projects
/
PHP-P10.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added saxdb & continued BotLoader
[PHP-P10.git]
/
BotLoader
/
BotLoader.class.php
diff --git
a/BotLoader/BotLoader.class.php
b/BotLoader/BotLoader.class.php
index 2b89cb392a6e60d975051c826587c523abb61125..df06eeaed4d1f137aeb63ff3b6cecf3f5f45c5c6 100644
(file)
--- a/
BotLoader/BotLoader.class.php
+++ b/
BotLoader/BotLoader.class.php
@@
-26,16
+26,37
@@
*
*/
require_once("Bot.class.php");
*
*/
require_once("Bot.class.php");
+require_once("saxdb.class.php");
class BotLoader {
private $uplink;
class BotLoader {
private $uplink;
+ private $saxdb;
+ private $botdb;
+ private $loadedBots = array();
public function __construct($uplink) {
$this->uplink = $uplink;
public function __construct($uplink) {
$this->uplink = $uplink;
+ $this->saxdb = new saxdb();
+ $this->saxdb->loadDB("php_p10.db");
+ $this->botdb = $this->saxdb->getSection("BotLoader");
}
public function loadBots() {
}
public function loadBots() {
+ if(array_key_exists("bots", $this->botdb) && is_array($this->botdb["bots"])) {
+ foreach($this->botdb["bots"] as $name => $botfile) {
+ $this->loadBot($name, $botfile);
+ }
+ } else {
+ $this->botdb["bots"] = array();
+ }
+ }
+ private function loadBot($name, $botfile) {
+ if(array_key_exists($name, $this->loadedBots)) return;
+ //load bot
+ if(!array_key_exists($name, $this->botdb["bots"])) {
+ $this->botdb["bots"][$name] = $botfile;
+ }
}
}
}
}