Пример #1
0
 public function __construct($filename = "n/a")
 {
     if ($filename == "n/a") {
         $filename = 'commands.php';
     }
     parent::__construct($filename);
     $this->Load();
 }
Пример #2
0
 public function __construct($filename = 'n/a')
 {
     if ($filename == 'n/a') {
         $filename = 'cron.php';
     }
     parent::__construct($filename);
     $this->Load();
     $this->CronTabCreate();
 }
Пример #3
0
 public function __construct($filename = "n/a")
 {
     parent::__construct($filename);
 }
Пример #4
0
 public function LoadConfig()
 {
     $this->Config = array();
     $cf = new ConfFile();
     if ($cf->Open(IRCBot_ConfigFile) != False) {
         // file loaded
         $tmp = $cf->Load();
         unset($cf);
         if (isset($tmp['user-defined'])) {
             $this->Config['user-defined'] = $tmp['user-defined'];
         }
         $i = 0;
         foreach ($tmp['connect']['server'] as $val) {
             list($this->Config['server'][$i]['url'], $this->Config['server'][$i]['port']) = explode(':', $val);
             $i++;
         }
         $this->Config['nick'] = $tmp['connect']['nick'];
         $this->Config['channel'] = $tmp['connect']['channel'];
         $this->Config['user_message'] = $tmp['connect']['user_message'];
         $this->Config['user_message']['default'] = $this->Config['nick'][0] . ' BLPSBot v1.01 :' . IRCBot_Version;
         if (isset($tmp['connect']['user_message_timeout'][0]) and $tmp['connect']['user_message_timeout'][0] > 0) {
             $this->Config['timeout']['user_message'] = $tmp['connect']['user_message_timeout'][0];
         } else {
             $this->Config['timeout']['user_message'][0] = 5;
         }
         if (isset($tmp['connect']['nick_message_timeout'][0]) and $tmp['connect']['nick_message_timeout'][0] > 0) {
             $this->Config['timeout']['nick_message'] = $tmp['connect']['nick_message_timeout'][0];
         } else {
             $this->Config['timeout']['nick_message'] = 5;
         }
         if (isset($tmp['connect']['connect_timeout'][0]) and $tmp['connect']['connect_timeout'][0] > 0) {
             $this->Config['timeout']['connect'] = $tmp['connect']['connect_timeout'][0];
         } else {
             $this->Config['timeout']['connect'] = 10;
         }
         $this->Config['Events']['cache_file'] = isset($tmp['events']['cache_file'][0]) ? str_replace(array('\\', '/'), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $tmp['events']['cache_file'][0]) : 'events.php';
         $this->Config['Events']['events_dir'] = isset($tmp['events']['events_dir'][0]) ? str_replace(array('\\', '/'), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $tmp['events']['events_dir'][0]) : 'events' . DIRECTORY_SEPARATOR;
         $this->Config['Events']['default_timeout'] = isset($tmp['events']['default_timeout'][0]) ? $tmp['events']['default_timeout'][0] : 180;
         $this->Config['Users']['user_file'] = str_replace(array('\\', '/'), array(DIRECTORY_SEPARATOR, DIRECTORY_SEPARATOR), $tmp['users']['user_file'][0]);
         // try load user file
         if (file_exists($this->Config['Users']['user_file'])) {
             if ($GLOBALS['Users']->Open($this->Config['Users']['user_file'])) {
                 $GLOBALS['Users']->Load();
                 $GLOBALS['Log']->Sys('User cache (' . $this->Config['Users']['user_file'] . ') sucefull loaded..');
             } else {
                 $GLOBALS['Log']->Sys('User cache (' . $this->Config['Users']['user_file'] . ') loadeding error..');
             }
         } else {
             $GLOBALS['Log']->Sys('Can\'t load user cache in ' . $this->Config['Users']['user_file'] . ' - file not exists !');
         }
         return true;
     } else {
         return false;
     }
 }