Пример #1
0
 foreach ($functions_list as $function_name => $function_file) {
     print green . "LOAD FUNCTION: " . resetColor . $function_name . "\n";
     require_once $paths['folders']['functions'] . $function_file;
 }
 //*******************************************************************************************
 //*********************************** Multibot Controler ************************************
 //*******************************************************************************************
 foreach ($vars as $function_name => $vars_list) {
     unset($vars[$function_name]);
     $vars[mb_strtolower($function_name, "UTF-8")] = $vars_list;
 }
 $vars_list = array();
 $socket_timer = date('r', time() + 10);
 sleep(1);
 if (!($socket_info = socket_read($socket, 2048))) {
     $multibotObject->addError($lang['multibot_mode']['instance_read_error'], true);
 } else {
     $multibotObject->addInfo($lang['multibot_mode']['instance_read_success']);
 }
 if (!empty($socket_info)) {
     $socket_info = preg_replace('/\\s+/', '', $socket_info);
     $socket_info = mb_strtolower($socket_info, "UTF-8");
     $functions = explode(",", $socket_info);
     $multibotObject->setName($functions[0]);
     $multibot_config = $multibotObject->getConfig("multibot");
     unset($functions[0]);
     $user_info = $tsAdmin->whoAmi();
     $nick = $user_info['data']['client_nickname'];
     foreach ($functions as $function_name) {
         $functions_to_start[mb_strtolower($function_name . "UTF-8")] = mb_strtolower($function_name, "UTF-8");
     }
Пример #2
0
 *  Kontorler całego multibota (commands-core.php) uruchamia proces multibota
 *  (multibot-core.php) następnie przesyła nazwy funkcji które mają być w nim
 *  uruchomione. Kontroler pojedyńczego procesu (Ten plik) uruchamia dane funkcje
 *  i następnie wysyła poprzez socket do głownego kontrolera (commands-core.php)
 *  nazwy fukncji które miał uruchomić co jest równoznaczne z potwierdzeniem odebrania
 *  poprawnych danych.
 *
 */
date_default_timezone_set('Europe/Berlin');
require "Core/multibot-core.class.php";
$multibotCore = new multibotCore();
$lang = $multibotCore->getLang();
$vars = array('clock' => array(), 'pokeBot' => array('clientList', 'channelList'), 'adminStatus' => array('serverGroupNames'), 'afkAutoMove' => array('clientList'), 'welcomeMessage' => array('clientList', 'serverInfo'), 'adminChannelStatus' => array('clientList'), 'channelChecker' => array('clientList', 'serverInfo', 'channelList'));
//socket
if (!($socket = socket_create(AF_INET, SOCK_STREAM, 0))) {
    $multibotCore->addError($lang['internal_socket_create_error'], false, true);
} else {
    $multibotCore->addInfo($lang['internal_socket_create_success']);
}
sleep(5);
if (!socket_connect($socket, 'localhost', 12345)) {
    $multibotCore->addError($lang['internal_socket_connect_error'], false, true);
} else {
    $multibotCore->addInfo($lang['internal_socket_connect_success']);
}
if (!socket_set_nonblock($socket)) {
    $multibotCore->addError($lang['internal_socket_bind_error'], false, true);
} else {
    $multibotCore->addInfo($lang['internal_socket_bind_success']);
}
$timeSocket = date('r', time() + 10);