示例#1
0
 public static function restart_command($nick, $ircdata = array())
 {
     // we don't even need to listen for any
     // parameters, because its just a straight command
     if (services::is_root($nick)) {
         if (isset(core::$config->settings->shutdown_message) || core::$config->settings->shutdown_message != null) {
             ircd::global_notice(core::$config->global->nick, '*!*@*', core::$config->settings->shutdown_message);
         }
         // is there a shutdown message?
         core::save_logs();
         // save logs.
         ircd::shutdown('shutdown command from ' . $nick, false);
         // exit the server
         fclose(core::$socket);
         // close the socket first.
         if (substr(php_uname(), 0, 7) != 'Windows') {
             if (core::$debug) {
                 system('php ' . BASEPATH . '/services.php debug');
             } else {
                 exec('php ' . BASEPATH . '/services.php > /dev/null &');
             }
             // reboot if we're running anything but windows
             // if debug we send the output back to the screen, else we send it to /dev/null
         } else {
             if (!isset(core::$config->settings->php_dir) || core::$config->settings->php_dir == '') {
                 define('PHPDIR', 'C:\\php\\php.exe');
             } else {
                 define('PHPDIR', core::$config->settings->php_dir);
             }
             // define where the php binary is located.
             exec('@cd ' . BASEPATH);
             // cd to the basedir
             if (core::$debug) {
                 system('@' . PHPDIR . ' services.php debug');
             } else {
                 exec('@' . PHPDIR . ' services.php');
             }
             // if we run windows we do a different method of reboot
             // again if we debug we send it to the screen, if not.. we don't
         }
         exit;
         // exit the program
     } else {
         services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_ACCESS_DENIED);
     }
 }
示例#2
0
 public static function global_command($nick, $ircdata = array())
 {
     $mask = $ircdata[0];
     $message = core::get_data_after(&$ircdata, 1);
     if (trim($mask) == '' || trim($message) == '') {
         services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_INVALID_SYNTAX);
         return false;
     }
     // are they sending a message?
     if (strpos($mask, '@') === false) {
         services::communicate(core::$config->operserv->nick, $nick, &operserv::$help->OS_GLOBAL_INVALID);
         return false;
     } else {
         if (strpos($mask, '!') === false) {
             $mask = '*!' . $mask;
         }
         // prepend the *! to the mask
     }
     // is the mask valid?
     if (core::$config->global->nick_on_global) {
         ircd::global_notice(core::$config->global->nick, $mask, '[' . $nick . '] ' . $message);
     } else {
         ircd::global_notice(core::$config->global->nick, $mask, $message);
     }
     // send the message!!
     ircd::globops(core::$config->operserv->nick, $nick . ' just used GLOBAL command.');
     // we globop the command being used.
 }