Ejemplo n.º 1
0
 public function checkSyntax($filename)
 {
     if (\budabot\core\isWindows()) {
         $command = ".\\win32\\php.exe -l {$filename} 2>&1";
     } else {
         $command = "php -l {$filename} 2>&1";
     }
     $output = array();
     $return_var = '';
     exec($command, $output, $return_var);
     return implode("\n", $output);
 }
Ejemplo n.º 2
0
 public function getUsageInfo($lastSubmittedStats, $now, $debug = false)
 {
     global $version;
     $botid = $this->settingManager->get('botid');
     if ($botid == '') {
         $botid = $this->util->genRandomString(20);
         $this->settingManager->save('botid', $botid);
     }
     $sql = "SELECT type, command FROM usage_<myname> WHERE dt >= ? AND dt < ?";
     $data = $this->db->query($sql, $lastSubmittedStats, $now);
     $settings = array();
     $settings['dimension'] = $this->chatBot->vars['dimension'];
     $settings['is_guild_bot'] = $this->chatBot->vars['my_guild'] == '' ? '0' : '1';
     $settings['guildsize'] = $this->getGuildSizeClass(count($this->chatBot->guildmembers));
     $settings['using_chat_proxy'] = $this->chatBot->vars['use_proxy'];
     $settings['db_type'] = $this->db->get_type();
     $settings['bot_version'] = $version;
     $settings['using_git'] = file_exists("./modules/GIT_MODULE/GitController.class.php") === true ? '1' : '0';
     $settings['os'] = \budabot\core\isWindows() === true ? 'Windows' : 'Other';
     $settings['symbol'] = $this->settingManager->get('symbol');
     $settings['spam_protection'] = $this->settingManager->get('spam_protection');
     $settings['relay_enabled'] = $this->settingManager->get('relaybot') == 'Off' ? '0' : '1';
     $settings['relay_type'] = $this->settingManager->get('relaytype');
     $settings['alts_inherit_admin'] = $this->settingManager->get('alts_inherit_admin');
     $settings['irc_status'] = $this->settingManager->get('irc_status');
     $settings['first_and_last_alt_only'] = $this->settingManager->get('first_and_last_alt_only');
     $settings['aodb_db_version'] = $this->settingManager->get('aodb_db_version');
     $settings['guild_admin_access_level'] = $this->settingManager->get('guild_admin_access_level');
     $settings['guild_admin_rank'] = $this->settingManager->get('guild_admin_rank');
     $settings['max_blob_size'] = $this->settingManager->get('max_blob_size');
     $settings['logon_delay'] = $this->settingManager->get('logon_delay');
     $settings['fancy_online'] = $this->settingManager->get('fancy_online');
     $settings['online_show_org_guild'] = $this->settingManager->get('online_show_org_guild');
     $settings['online_show_org_priv'] = $this->settingManager->get('online_show_org_priv');
     $settings['online_admin'] = $this->settingManager->get('online_admin');
     $settings['items_database'] = $this->settingManager->get('items_database');
     $settings['relaysymbolmethod'] = $this->settingManager->get('relaysymbolmethod');
     $obj = new stdClass();
     $obj->id = sha1($botid . $this->chatBot->vars['name'] . $this->chatBot->vars['dimension']);
     $obj->version = "1.3";
     $obj->debug = $debug == true ? '1' : '0';
     $obj->commands = $data;
     $obj->settings = $settings;
     return $obj;
 }