public function __construct($argc, $argv) { $this->xbot = new xbot(); // new xbot if ($argc > 1 && $argv[1] == 'debug') { self::$debug = true; } // argc $conf = file_get_contents('github.conf'); self::$config = json_decode($conf, true); if (self::$config == null) { self::debug('failed config parse, you may have comments in it, remove them :)'); die; } // config can't be parsed. self::debug('connecting to mysql (' . self::$config['mysql']['host'] . ':' . self::$config['mysql']['db'] . ')'); self::$db = mysql_connect(self::$config['mysql']['host'], self::$config['mysql']['user'], self::$config['mysql']['pass']); mysql_select_db(self::$config['mysql']['db'], self::$db); // connect to mysql foreach (self::$config['networks'] as $network => $net_data) { self::debug('connecting to (' . $network . ':' . $net_data['port'] . ') as ' . $net_data['nick']); } $this->xbot->connect(self::$config); self::debug('connected to networks'); // connect the bot $this->xbot->timer->add(array('bot', 'listen_data', array($this->xbot)), 5, 0); $this->xbot->timer->add(array('bot', 'get_new_data', array($this->xbot)), self::$config['options']['new_data_interval'], 0); // set up some timers, we only actually go hunting for new data every 30 seconds, then if new data is found its stored // the stored data is checked by listen_data every 5 seconds. We only check every 30 seconds because for huge repos like // rails/rails, which I developed this on it can be quite intensive, and plus the more often we check the quicker // we can run out of api calls (unless you get on the whitelist) $this->xbot->main('bot', 'main'); // boot the main loop w/ a callback*/ }
public function main($xbot, $ircdata) { if ($xbot->events->on_ping($xbot->ircdata)) { if (!mysql_ping(self::$db)) { mysql_close(self::$db); self::$db = mysql_connect(self::$config['mysql']['host'], self::$config['mysql']['user'], self::$config['mysql']['pass']); mysql_select_db(self::$config['mysql']['db'], self::$db); // connect to mysql } } // ping self::log_chans($ircdata); if ($ircdata->type == 'privmsg' && $ircdata->target[0] == '#') { $message = explode(' ', $ircdata->message); $nmessage = $message; if (in_array(strtolower($message[0]), self::$config['bot_triggers'])) { unset($nmessage[0]); $rmessage = implode(' ', $nmessage); if (strtolower($message[1]) == 'quote') { if (isset($message[2]) && isset($message[3]) && is_numeric($message[2]) && is_numeric($message[3]) && $message[2] >= 0 && $message[3] <= 30 && $message[3] > $message[2]) { $from = $message[2]; $to = $message[3]; $chan = $ircdata->target; // set some variables $mybuffer = self::$buffer[$chan]; $pop = array_pop($mybuffer); $mybuffer = array_reverse($mybuffer); // do some SHUFFLING!! $mybuffer = array_slice($mybuffer, $from, $to); $mybuffer = implode("\r\n", $mybuffer); // get what we need. mysql_query("INSERT INTO `" . self::$config['mysql']['table'] . "` (`quote`,`by`,`date`) VALUES('" . $mybuffer . "','" . $from . "','" . time() . "')"); // INSERT into the database return false; } else { return false; } // it isnt. // check if the format is right.. } // sam, quote. if (strtolower($message[1]) == 'info') { $num_of_items = mysql_query("SELECT `id` FROM `" . self::$config['mysql']['table'] . "`"); $num_of_items = mysql_num_rows($num_of_items); $uptime = self::format_time(timer::$uptime); $reply = self::$config['info_info']; $reply = str_replace('{items}', $num_of_items, $reply); $reply = str_replace('{uptime}', $uptime, $reply); $reply = str_replace('{queries}', self::$queries, $reply); self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // sam, info. if (strtolower($message[1]) == 'join') { if (!in_array($ircdata->host, self::$config['admin_hosts'])) { $reply = array_rand(self::$config['info_locked']); $reply = self::$config['info_locked'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is a non admin trying to f**k around with our shit? :/ $chan = $message[2]; $key = $message[3]; // chan, and key, if a key is needed if ($chan == null) { return false; } // error $xbot->join($ircdata->from, $chan, $key); // join the channel :) return false; } // Samantha, join if (strtolower($message[1]) == 'part') { if (!in_array($ircdata->host, self::$config['admin_hosts'])) { $reply = array_rand(self::$config['info_locked']); $reply = self::$config['info_locked'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is a non admin trying to f**k around with our shit? :/ $chan = $message[2]; $message = $xbot->get_data_after($message, 3); // chan, and message if ($chan == null) { return false; } // error $xbot->part($ircdata->from, $chan, $message); // part the channel :) return false; } // Samantha, part if (strtolower($message[1]) == 'nick') { if (!in_array($ircdata->host, self::$config['admin_hosts'])) { $reply = array_rand(self::$config['info_locked']); $reply = self::$config['info_locked'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is a non admin trying to f**k around with our shit? :/ $new_nick = $message[2]; // chan, and message if ($new_nick == null) { return false; } // error self::$config['networks'][$from]['nick'] = $new_nick; $xbot->nick($ircdata->from, $new_nick); // change nick return false; } // Samantha, nick if (strtolower($message[1]) == 'quiet') { if (self::$quiet) { return false; } // is samantha in quiet mode?! if (!in_array($ircdata->host, self::$config['admin_hosts'])) { $reply = array_rand(self::$config['info_locked']); $reply = self::$config['info_locked'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is a non admin trying to f**k around with our shit? :/ self::$quiet = true; $reply = array_rand(self::$config['quiet_replies']); $reply = self::$config['quiet_replies'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // Samantha, quiet if (strtolower($message[1]) == 'wakeup') { if (!self::$quiet) { return false; } // is samantha in quiet mode?! if (!in_array($ircdata->host, self::$config['admin_hosts'])) { $reply = array_rand(self::$config['info_locked']); $reply = self::$config['info_locked'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is a non admin trying to f**k around with our shit? :/ self::$quiet = false; $reply = array_rand(self::$config['wakeup_replies']); $reply = self::$config['wakeup_replies'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // Samantha, wakeup if (self::$quiet) { return false; } // is samantha in quiet mode?! if (strtolower($message[1]) == 'who' && strtolower($message[2]) == 'told' && strtolower($message[3]) == 'you' && strtolower($message[4]) == 'about' && isset($message[5])) { $key = $xbot->get_data_after($message, 5); // could be a "shauns feet smell of cheese" < eg, multiple keys if (substr($key, -1, 1) == '?' || substr($key, -1, 1) == '.' || substr($key, -1, 1) == '!') { $key = substr($key, 0, -1); } // replace the value shit $key = mysql_real_escape_string($key); // escape the string, so theres no crap in it. $info_query = mysql_query("SELECT `key`,`value`,`date`,`setby`,`locked` FROM `" . self::$config['mysql']['table'] . "` WHERE `key` = '" . $key . "'"); // have we found a reply? if (mysql_num_rows($info_query) == 0) { $reply = array_rand(self::$config['dont_know_replies']); $reply = self::$config['dont_know_replies'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); $reply = str_replace('{key}', $key, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } else { $info_row = mysql_fetch_array($info_query); // grab the row self::msg($xbot, $ircdata->from, $ircdata->target, $info_row['setby'] . ' told me about ' . $key . ' on ' . date('F j, Y, g:i a', $info_row['date'])); return false; } } // Samantha, who told you about * if (strtolower($message[1]) == 'forget' && isset($message[2])) { $key = mysql_real_escape_string($xbot->get_data_after($message, 2)); // escape the string, so theres no crap in it. $info_query = mysql_query("SELECT `key`,`locked` FROM `" . self::$config['mysql']['table'] . "` WHERE `key` = '" . $key . "'"); // have we found a reply? if (mysql_num_rows($info_query) == 0) { $reply = array_rand(self::$config['dont_know_replies']); $reply = self::$config['dont_know_replies'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); $reply = str_replace('{key}', $key, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } else { $info_row = mysql_fetch_array($info_query); // grab the row if ($info_row['locked'] == 1 && !in_array($ircdata->host, self::$config['admin_hosts'])) { $reply = array_rand(self::$config['info_locked']); $reply = self::$config['info_locked'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is it locked? :/ mysql_query("DELETE FROM `" . self::$config['mysql']['table'] . "` WHERE `key` = '" . $key . "'"); // delete the record $reply = array_rand(self::$config['info_forgot']); $reply = self::$config['info_forgot'][$reply]; $reply = str_replace('{key}', $key, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // yes we have } // Samantha, forget if (strtolower($message[1]) == 'lock' || strtolower($message[1]) == 'unlock' && isset($message[2])) { if (!in_array($ircdata->host, self::$config['admin_hosts'])) { $reply = array_rand(self::$config['info_locked']); $reply = self::$config['info_locked'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is a non admin trying to f**k around with our shit? :/ $key = mysql_real_escape_string($xbot->get_data_after($message, 2)); // escape the string, so theres no crap in it. $info_query = mysql_query("SELECT `key`,`locked` FROM `" . self::$config['mysql']['table'] . "` WHERE `key` = '" . $key . "'"); // have we found a reply? if (mysql_num_rows($info_query) == 0) { $reply = array_rand(self::$config['dont_know_replies']); $reply = self::$config['dont_know_replies'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); $reply = str_replace('{key}', $key, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } else { $tinyint = $message[1] == 'lock' ? 1 : 0; mysql_query("UPDATE `" . self::$config['mysql']['table'] . "` SET `locked` = '" . $tinyint . "' WHERE `key` = '" . $key . "'"); // update $reply = array_rand(self::$config['info_confirm']); $reply = self::$config['info_confirm'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // yes we have } // Samantha, lock * && Samantha, unlock * if (preg_match('/(.*): (.*)/is', $rmessage)) { $keys = explode(':', $rmessage, 2); $key = mysql_real_escape_string(trim($keys[0])); $key = str_replace('\\', '', $key); // replace \ with '' because \ is our reply delimeter. $value = mysql_real_escape_string(trim($keys[1])); // escape the string, so theres no crap in it. if (in_array($key, self::$config['system_phrases'])) { $reply = array_rand(self::$config['info_reserved']); $reply = self::$config['info_reserved'][$reply]; // find a random reply self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is this a reserved word? $info_query = mysql_query("SELECT `key`,`value`,`locked` FROM `" . self::$config['mysql']['table'] . "` WHERE `key` = '" . $key . "'"); // have we found a reply? if (mysql_num_rows($info_query) == 0) { $setby = mysql_real_escape_string($ircdata->nick); $date = time(); mysql_query("INSERT INTO `" . self::$config['mysql']['table'] . "` (`key`,`value`,`setby`,`date`) VALUES('" . $key . "','" . $value . "','" . $setby . "','" . $date . "')"); // update $reply = array_rand(self::$config['info_confirm']); $reply = self::$config['info_confirm'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } else { $info_row = mysql_fetch_array($info_query); // fetch the row if (strtolower(trim($info_row['value'])) == strtolower(trim($value))) { self::msg($xbot, $ircdata->from, $ircdata->target, 'I know :D'); // msg to the channel. return false; } // we know -.- $reply = array_rand(self::$config['info_notnew']); $reply = self::$config['info_notnew'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); $reply = str_replace('{key}', stripslashes($info_row['key']), $reply); $reply = str_replace('{value}', stripslashes($info_row['value']), $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // yes we have*/ } // Samantha, *: * (assignment) (changed this, easier i guess) if (isset($message[1]) && strpos($rmessage, ':') === false) { $keys = preg_split('/\\\\/si', $xbot->get_data_after($message, 1), -1, PREG_SPLIT_NO_EMPTY); $key = trim($keys[0]); // could be a "shauns feet smell of cheese" < eg, multiple keys ++self::$queries; if (substr($key, -1, 1) == '?' || substr($key, -1, 1) == '.' || substr($key, -1, 1) == '!') { $key = substr($key, 0, -1); } // replace the value shit $key = mysql_real_escape_string($key); // escape the string, so theres no crap in it. $info_query = mysql_query("SELECT `key`,`value`,`locked`,`setby` FROM `" . self::$config['mysql']['table'] . "` WHERE `key` = '" . $key . "'"); // have we found a reply? if (mysql_num_rows($info_query) == 0) { $reply = array_rand(self::$config['dont_know_replies']); $reply = self::$config['dont_know_replies'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); $reply = str_replace('{key}', $key, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } else { $info_row = mysql_fetch_array($info_query); // fetch the row $reply = array_rand(self::$config['info_replies']); $reply = self::$config['info_replies'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); $reply = str_replace('{key}', stripslashes($info_row['key']), $reply); // find a random reply, and replace {shit} with shit, etc. lol $value = stripslashes($info_row['value']); $value = str_replace('<reply>', trim($keys[1]), $value); $value = str_replace('<encode_reply>', str_replace(' ', '+', trim($keys[1])), $value); $value = str_replace('<wiki_encode>', str_replace(' ', '_', trim($keys[1])), $value); $value = str_replace('<nick>', $info_row['setby'], $value); $value = str_replace('<me>', bot::$config['networks']['irc.gamergrid.net']['nick'], $value); $value = str_replace('<who>', $ircdata->nick, $value); // replace <reply> and stuff $reply = str_replace('{value}', $value, $reply); // replace {value} last, because we've modified it with expansions :D if (trim(substr($value, 0, 8)) == '<action>') { $xbot->action($ircdata->from, $ircdata->target, substr($value, 8)); } else { self::msg($xbot, $ircdata->from, $ircdata->target, $reply); } // msg to the channel. return false; } // yes we have } // Samantha, * (phrase) } // Samantha, message here if (self::$quiet) { return false; } // is samantha in quiet mode?! unset($nmessage[0], $nmessage[1]); $nrmessage = implode(' ', $nmessage); if (strtolower($message[0]) == 'no' && in_array(strtolower($message[1]), self::$config['bot_triggers']) && preg_match('/(.*) \\b(' . self::$config['assignment_regex'] . ')\\b/is', $nrmessage)) { $keys = preg_split('/\\b(' . self::$config['assignment_regex'] . ')\\b/i', $nrmessage, -1, PREG_SPLIT_DELIM_CAPTURE); $key = mysql_real_escape_string(trim($keys[0])); $key = str_replace('\\', '', $key); // replace \ with '' because \ is our reply delimeter. // escape the string, so theres no crap in it. if (in_array($key, self::$config['system_phrases'])) { $reply = array_rand(self::$config['info_reserved']); $reply = self::$config['info_reserved'][$reply]; // find a random reply self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is this a reserved word? $info_query = mysql_query("SELECT `key`,`value`,`locked` FROM `" . self::$config['mysql']['table'] . "` WHERE `key` = '" . $key . "'"); // have we found a reply? if (mysql_num_rows($info_query) == 0) { $reply = array_rand(self::$config['dont_know_replies']); $reply = self::$config['dont_know_replies'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); $reply = str_replace('{key}', $key, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } else { $info_row = mysql_fetch_array($info_query); if ($info_row['locked'] == 1 && !in_array($ircdata->host, self::$config['admin_hosts'])) { $reply = array_rand(self::$config['info_locked']); $reply = self::$config['info_locked'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // is it locked? :/ $value = mysql_real_escape_string(trim($xbot->get_data_after($keys, 2))); $setby = mysql_real_escape_string($ircdata->nick); $date = time(); // bleh.. escape all the stuff we're about to insert into the database. mysql_query("DELETE FROM `" . self::$config['mysql']['table'] . "` WHERE `key` = '" . $key . "'"); mysql_query("INSERT INTO `" . self::$config['mysql']['table'] . "` (`key`,`value`,`setby`,`date`) VALUES('" . $key . "','" . $value . "','" . $setby . "','" . $date . "')"); // update $reply = array_rand(self::$config['info_confirm']); $reply = self::$config['info_confirm'][$reply]; $reply = str_replace('{nick}', $ircdata->nick, $reply); // find a random reply, and replace {shit} with shit, etc. lol self::msg($xbot, $ircdata->from, $ircdata->target, $reply); // msg to the channel. return false; } // yes we have } // no Samantha, * is * (reassignment) } // only trigger on channel privmsgs }
private function readConfig() { global $argc, $argv; if ($argc < 2) { $args = array(config::$main['scriptdir'] . "/../ircbot/bot.conf"); } else { $args = $argv; array_shift($args); } $isPasswordEncrypt = false; foreach ($args as $filename) { if ($filename == "") { continue; } if ($isPasswordEncrypt == true) { die("Encrypted Password: "******"\nReplace this as 'dccadminpass' in bot.conf!"); } if ($filename == "-c") { $isPasswordEncrypt = true; continue; } if ($filename == "-b" && $this->background != 1) { $this->background = 1; $this->doBackground(); continue; } $config = bot::parseConfig($filename); if ($config == false) { echo "Could not spawn bot {$filename}"; die; } $bot = new botClass(); $bot->config = $config; $bot->configFilename = $filename; $this->bots[] = $bot; } if ($isPasswordEncrypt == true) { die("No password submitted on command line! Syntax: bot.php -c <new admin password>\n"); } if (!$this->background && PID != '') { $file = fopen(PID, "w+"); fwrite($file, getmypid()); fclose($file); } }
public function HTML($tmp) { try { if (bot::$count == 0) { bot::$count = 1; bot::$table = str_replace(".", "_", $this->domain); bot::$maindomain = $this->domain; } foreach ($tmp as $tag) { foreach ($this->dom->getElementsByTagName($tag) as $node) { foreach ($node->attributes as $attrName => $attrNode) { $this->node[trim($node->nodeName)][trim($attrName)][trim($attrNode->nodeValue)] = ""; if ($attrName == 'href' || $attrName == 'src') { /*$this->VERIFYURL($attrNode->nodeValue);*/ } } } } } catch (Exception $e) { echo $e->getMesage(); } }
<?php /** * Author : ChelseaStats * Date : 2015-05-22 * Url : https://twitter.com/19thMayBot * * A twitter bot for 'live' tweeting that night in Munich (19th May 2012) * * Match : 60 seconds * 165 minutes ( 45 [1H] + 15 + 45 [2H] + 5 + 15 [1H ET] + 5 + 15 [2H ET] + 5 + 15 [pens]) * - the rest of the time slots are HT, FT, HT ET and pre-pens. comfort breaks. * * Pull requests to this file will be ignored. * */ $match = 60 * 165; ini_set('max_execution_time', $match); require_once '../config.php'; require_once 'twitteroauth.php'; require_once 'class.bot.php'; $bot = new bot(); $bot->Process('commentary-log.csv');
function __construct() { parent::__construct(); }
public function dcc_spawn($chat, $args) { $chat->dccSend("Spawning " . $args['query'] . "..."); $result = bot::addBot($args['query']); if ($result === true) { $chat->dccSend($args['query'] . " successfully spawned"); } else { $chat->dccSend($args['query'] . " was not spawned"); } }
public function reply($chat, $message, $id) { global $n; /* Ответы на специальные команды, начинающиеся с восклицательного знака ! Пока оставляю для примера. В дальнейшем можно удалить */ self::$last_id = $message; if (self::$last_id <= $message) { $command = explode(' ', $message); switch ($command[0]) { case '!test': $reply = 'It\'s work!'; break; case '!help': $comm = explode('!help ', $message); $reply = '<здесь можно вывести какую-нибудь справку>'; break; default: $reply = 'Используйте !help'; break; } //Посылаем сообщение if ($reply != '') { $n->Invoke('CHATMESSAGE ' . $chat . ' ' . $reply); } } else { echo 'Уже отвечал!' . "\n"; } }
private function readConfig() { global $argc, $argv; if ($argc < 2) { echo "You must specify a config file.\n"; die; } $isPasswordEncrypt = false; array_shift($argv); foreach ($argv as $filename) { if ($filename == "") { continue; } if ($isPasswordEncrypt == true) { die("Encrypted Password: "******"\nReplace this as 'dccadminpass' in bot.conf!"); } if ($filename == "-c") { $isPasswordEncrypt = true; continue; } if ($filename == "-b" && $this->background != 1) { $this->background == 1; $this->doBackground(); continue; } $config = bot::parseConfig($filename); if ($config == false) { echo "Could not spawn bot {$filename}"; die; } $bot = new botClass(); $bot->config = $config; $bot->configFilename = $filename; $this->bots[] = $bot; } if ($isPasswordEncrypt == true) { die("No password submitted on command line! Syntax: bot.php -c <new admin password>\n"); } }
$tag = array(); $o = file_get_contents("php://input"); $r = explode("+^+", $o); $u = $r[1]; if (isset($r[0]) && trim($r[0]) !== "") { $url = $r[0]; } if (isset($u) && trim($u) !== "") { $u = (string) trim($u); $s = explode(",", $u); for ($i = 0; $i < count($s); $i++) { /*echo $s[$i];*/ $tmp = explode("-->", $s[$i]); $tag[$tmp[0]][$tmp[1]][$tmp[2]] = ""; } $site = new bot($url); foreach ($tag as $key => $value) { /*echo "Key: $key; \n";*/ foreach ($value as $k => $v) { /*echo "attribute: $k; \n";*/ foreach ($v as $n => $op) { /*echo "name $n;\n";*/ echo "\nis avail:: " . $site->node[$key][$k][$n]; /*echo count($site->node[$key][$k][$n])."\n";*/ print_r($site->ADV($key, $k, $n)); } } } } ?>
<?php set_time_limit(90); require_once 'include/config.inc.php'; require_once 'class/bot.class.php'; require_once 'include/database_connection.inc.php'; $buffer_file = 'local.html'; $bot = new bot($fcp_host, $fcp_port, $buffer_file); $splitedURL['key_type'] = 'SSK'; $splitedURL['key_value'] = 'PFeLTa1si2Ml5sDeUy7eDhPso6TPdmw-2gWfQ4Jg02w,3ocfrqgUMVWA2PeorZx40TW0c-FiIOL-TWKQHoDbVdE,AQABAAE'; $splitedURL['site_name'] = 'Index'; $splitedURL['edition'] = '34'; $splitedURL['path'] = 'all.html'; $path = $bot->constructURL($splitedURL); $bot->getDistantFile($path); $title = $bot->extractTitle(); $metas = $bot->extractMetas(); $urls = $bot->extractURLs(); $bot->cleanURLs($urls, $splitedURL['key_type'], $splitedURL['key_value'], $splitedURL['site_name'], $splitedURL['edition']); foreach ($urls as $value) { if (!empty($value)) { $splitedURL = $bot->splitURL($value); echo $value; print_r($splitedURL); $id_freesite = $bot->dbGetFreesiteId($splitedURL); if ($id_freesite === false) { $id_freesite = $bot->dbAddFreesite($splitedURL); } $bot->dbAddFreesiteURL($id_freesite, $splitedURL['path']); } }
<?php require_once "config.php"; function __autoload($class_name) { include 'core/' . $class_name . '.php'; } $core = new core($config); $command = new command($config); $user = new user($config); $bot = new bot($config, $user); //start bot and use defaults. $bot->plugin_register(new core($config)); $bot->plugin_register(new command($config)); $bot->plugin_register(new user($config)); $bot->start();