Пример #1
0
 public static function factory($driver)
 {
     if (require BASEPATH . '/core/drivers/' . $driver . '.php') {
         core::alog('factory(): using ' . $driver . ' database driver', 'BASIC');
         self::$driver = new $driver();
         // store the instance here
     } else {
         core::alog('factory(): failed to open ' . $driver . ' database driver', 'BASIC');
         core::save_logs();
         // force a log save
     }
     // see if we can require the file
     // if so initiate the class
     // if not, bail.
 }
Пример #2
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);
     }
 }
Пример #3
0
 public function __construct()
 {
     modules::init_module('mysql_driver', self::MOD_VERSION, self::MOD_AUTHOR, 'driver', 'static');
     // these are standard in module constructors
     if (!(self::$link = @mysql_connect(core::$config->database->server, core::$config->database->user, core::$config->database->pass))) {
         core::alog('database(): failed to connect to ' . core::$config->database->server . ' ' . core::$config->database->user . ':' . core::$config->database->pass, 'BASIC');
         core::save_logs();
         // force a log save
     }
     // can we connect to sql?
     if (!@mysql_select_db(core::$config->database->name, self::$link)) {
         core::alog('database(): failed to select database ' . core::$config->database->name, 'BASIC');
         core::save_logs();
         // force a log save
     }
     // can we select the database?
     core::alog('database(): connection to database sucessful', 'BASIC');
     // log the sucessful connection
     if (core::$config->database->optimize) {
         timer::add(array('database', 'optimize', array()), 86399, 0);
     }
     // add a timer to optimize the db every day.
 }
Пример #4
0
 public static function check()
 {
     foreach (self::$required as $var => $value) {
         if (!isset(self::$config[$value])) {
             core::alog('ERROR: ' . $value . ' is REQUIRED, startup halted', 'BASIC');
             core::save_logs();
             // force a log save.
         }
     }
     // check for required vars
     if (is_array(self::$config['chanserv_exception_modules']) && !in_array('cs_fantasy', self::$config['chanserv_exception_modules'])) {
         if (!isset(self::$config['fantasy_prefix'])) {
             self::$config['fantasy_prefix'] = '!';
         }
     }
     // check for undefined vars.
     foreach (self::$config as $var => $value) {
         if ($value == 'yes' || $value == 'true' || $value == '1') {
             self::$config[$var] = true;
         }
         if ($value == 'no' || $value == 'false' || $value == '0') {
             self::$config[$var] = false;
         }
     }
     // convert 'yes', 'true', '1' and their opposites to booleans
 }