Ejemplo n.º 1
0
 /**
  *	Init Now
  *
  *	@return	void
  */
 public static function initNow()
 {
     require_once CTM_ROOT_PATH . "cache/server_cache/db_php/core_sources/installation_info.php";
     $_SERVER['REQUEST_URI'] = str_replace("&ajaxLoadSet", "/&ajaxLoadSet", CTM_URLEngine::URIString());
     CTM_Controller::PHPErrors();
     CTM_LoadTime::startTime();
     date_default_timezone_set("America/Sao_Paulo");
     if ($installation['is_installed'] == false) {
         if (CTM_ROOT_AREA == "admin") {
             header("Location: " . CTM_URLEngine::URLBase() . "installer/?app=install");
             exit;
         } else {
             CTM_Error::kernelError("The board is not installed");
         }
     } elseif (EW_THIS_VERSION > str_pad($installation['current_version'], 5, 0, STR_PAD_RIGHT)) {
         if (CTM_ROOT_AREA == "admin") {
             header("Location: " . CTM_URLEngine::URLBase() . "installer/?app=upgrade");
             exit;
         } else {
             CTM_Error::kernelError("The board is in update process");
         }
     }
     CTM_Cookies::$cookiePath = COOKIE_PATH;
     CTM_Cookies::$cookieDomain = COOKIE_DOMAIN;
     CTM_Registry::init();
     CTM_Command::instance()->registry();
     CTM_Registry::fetchDriver()->settings['mssql']['hostname'] = MSSQL_HOSTNAME;
     CTM_Registry::fetchDriver()->settings['mssql']['hostport'] = MSSQL_HOSTPORT;
     CTM_Registry::fetchDriver()->settings['mssql']['username'] = MSSQL_USERNAME;
     CTM_Registry::fetchDriver()->settings['mssql']['password'] = MSSQL_PASSWORD;
     CTM_Registry::fetchDriver()->settings['mssql']['database'] = CTMEW_CORE;
     CTM_Registry::fetchDriver()->settings['mssql']['persistent'] = MSSQL_PERSISTENT;
     CTM_Registry::fetchDriver()->settings['mssql']['debug'] = in_array("mssql", explode(",", CTM_SQL_DEBUG_MODE));
     CTM_Registry::fetchDriver()->settings['mssql']['log_folder'] = "MSSQL";
     CTM_Registry::fetchDriver()->Connect("mssql");
     if (CTM_Command::instance()->settings['CRONJOB']['ENABLE'] == TRUE) {
         $CronJob = new CronJob();
         $CronJob->Start(CTM_Command::instance()->settings['CRONJOB']['DEBUG']);
         $CronJob->RunAllTasks();
         $CronJob->Finish();
     }
     Authentication::init();
     CTM_Controller::Setup();
     CTM_Dashboard::init();
     CTM_Registry::setSetup("application", CTM_Dashboard::$application);
     if (CTM_ROOT_AREA == "public") {
         print self::GetContent();
         print "\r\n<!-- Effect Web " . EW_PUBLIC_VERSION . " / Powered by Erick-Master & Litlle / (c) 2012 -->";
     } else {
         CTM_ACPBoard::init(ACP_LOAD_MODULE);
     }
     exit;
 }
Ejemplo n.º 2
0
 /**
  *	Init ACP Board
  *
  *	@return	void
  */
 public static function init($core_module = NULL)
 {
     self::acp_instance()->registry();
     self::start($core_module);
     self::setup($core_module);
     $skin_global = self::output()->loadSkinCache("core_global", false);
     if (ACP_SESSION_LOGGED == TRUE) {
         self::instance()->lang->loadLanguageFile("header", "Core");
         self::instance()->lang->setArguments("Header,Footer,LoadTime", CTM_LoadTime::resultTime());
         if (!self::$output_content) {
             self::$output_content = $skin_global;
         }
         $skin_global->registry();
         self::$output_content->registry();
         if (ACP_PERMISSION_ACCESS_ERROR == 1) {
             $output_content = $skin_global->permission_error();
         } elseif (ACP_PERMISSION_LICENSE_ERROR == 1) {
             $output_content = $skin_global->module_unavailable();
         } elseif (method_exists(self::$output_content, self::$output_method)) {
             $output_content = self::$output_content->{self::$output_method}();
         }
         if (method_exists(self::$output_content, "core_global_sidebar")) {
             $output_sidebar = self::$output_content->core_global_sidebar();
         } else {
             $output_sidebar = NULL;
         }
         if (loadIsAjax() == true) {
             print $output_content;
         } else {
             print $skin_global->global_header($output_content, $output_sidebar);
         }
     } else {
         self::instance()->lang->loadLanguageFile("auth", "Core");
         $skin_global->registry();
         print $skin_global->auth_login($GLOBALS['auth_login']['message']);
     }
     print "\r\n<!-- Effect Web 2 :: Admin Control Panel " . ACP_PUBLIC_VERSION . " / Powered by Erick-Master & Litlle / (c) 2012 - www.cetemaster.com.br [Licensed to: " . SERVER_NAME . "] -->";
 }
Ejemplo n.º 3
0
 /**
  *	Header Querys [Server Informations]
  *
  *	@return	void
  */
 public function loadHeaderQuerys()
 {
     switch (strval(SERVER_BUGBLESS)) {
         case "0":
             $this->updateVars("sidebar,infos,bug_bless", "<font color=\"red\">Offline</font>");
             break;
         case "1":
             $this->updateVars("sidebar,infos,bug_bless", "<font color=\"green\">Online</font>");
             break;
         default:
             $this->updateVars("sidebar,infos,bug_bless", "<font color=\"blue\">" . SERVER_BUGBLESS . "</font>");
             break;
     }
     if (!function_exists("numberFormat")) {
         $numberFormat = create_function("\$integer", "return number_format(\$integer, 0, false, '.');");
     }
     $vip_lang = "sidebar,infos,count,totalVIPAccounts,";
     $this->updateVars("sidebar,infos,count,totalAccounts", $numberFormat($this->ServerInfo(MUACC_CORE, "MEMB_INFO", "memb___id")));
     $this->updateVars("sidebar,infos,count,totalCharacters", $numberFormat($this->ServerInfo(MUACC_CORE, "Character", "Name")));
     $this->updateVars("sidebar,infos,count,totalGuilds", $numberFormat($this->ServerInfo(MUACC_CORE, "Guild", "G_Name")));
     $this->updateVars($vip_lang . "1", $numberFormat($this->ServerInfo(VIP_CORE, VIP_TABLE, VIP_LOGIN, VIP_COLUMN . " = 1")));
     if (VIP_NUMBER >= 2) {
         $this->updateVars($vip_lang . "2", $numberFormat($this->ServerInfo(VIP_CORE, VIP_TABLE, VIP_LOGIN, VIP_COLUMN . " = 2")));
     }
     if (VIP_NUMBER >= 3) {
         $this->updateVars($vip_lang . "3", $numberFormat($this->ServerInfo(VIP_CORE, VIP_TABLE, VIP_LOGIN, VIP_COLUMN . " = 3")));
     }
     if (VIP_NUMBER >= 4) {
         $this->updateVars($vip_lang . "4", $numberFormat($this->ServerInfo(VIP_CORE, VIP_TABLE, VIP_LOGIN, VIP_COLUMN . " = 4")));
     }
     if (VIP_NUMBER == 5) {
         $this->updateVars($vip_lang . "5", $numberFormat($this->ServerInfo(VIP_CORE, VIP_TABLE, VIP_LOGIN, VIP_COLUMN . " = 5")));
     }
     $this->updateVars("sidebar,infos,count,totalBanned,accounts", $numberFormat($this->ServerInfo(MUACC_CORE, "MEMB_INFO", "memb___id", "bloc_code = 1 AND MemberStatus = 0")));
     $this->updateVars("sidebar,infos,count,totalBanned,characters", $numberFormat($this->ServerInfo(MUACC_CORE, "Character", "Name", "CtlCode = 1")));
     $this->updateVars("sidebar,infos,reset_type", $this->functions->getResetInfo(0, 'TYPE'));
     $this->lang->setArguments("Footer,LoadTime", CTM_LoadTime::resultTime());
 }
 public function runTask()
 {
     //------------------------------------------
     // Well... gerate the rankings, right?
     //------------------------------------------
     $time = CTM_LoadTime::startTime();
     $this->time = time();
     $this->loadWrite("Starting the procedure...");
     //------------------------------------------
     // Resets General
     //------------------------------------------
     $this->loadWrite("Updating: Resets General");
     $this->loadSetCharRanking("RESETS", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_RESET);
     //------------------------------------------
     // Resets Daily
     //------------------------------------------
     $this->loadWrite("Updating: Resets Daily");
     $this->loadSetCharRanking("RDAILY", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_RDAILY);
     //------------------------------------------
     // Resets Week
     //------------------------------------------
     $this->loadWrite("Updating: Resets Weekly");
     $this->loadSetCharRanking("RWEEKLY", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_RWEEKLY);
     //------------------------------------------
     // Resets Month
     //------------------------------------------
     $this->loadWrite("Updating: Resets Monthly");
     $this->loadSetCharRanking("RMONTHLY", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_RMONTHLY);
     //------------------------------------------
     // Master Resets
     //------------------------------------------
     $this->loadWrite("Updating: Master Resets");
     $this->loadSetCharRanking("MRESETS", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_MRESET);
     //------------------------------------------
     // Master Resets Daily
     //------------------------------------------
     $this->loadWrite("Updating: Master Resets Daily");
     $this->loadSetCharRanking("MRDAILY", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_MRDAILY);
     //------------------------------------------
     // Master Resets Week
     //------------------------------------------
     $this->loadWrite("Updating: Master Resets Weekly");
     $this->loadSetCharRanking("MRWEEKLY", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_MRWEEKLY);
     //------------------------------------------
     // Master Resets Month
     //------------------------------------------
     $this->loadWrite("Updating: Master Resets Monthly");
     $this->loadSetCharRanking("MRMONTHLY", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_MRMONTHLY);
     //------------------------------------------
     // Level
     //------------------------------------------
     $this->loadWrite("Updating: Level");
     $this->loadSetCharRanking("LEVEL", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], "cLevel");
     //------------------------------------------
     // Master Level
     // If MUSERVER_VERSION >= 4 (xD)
     //------------------------------------------
     if (MUSERVER_VERSION >= 4) {
         $ML = $this->functions->GetMasterLevelData();
         $db['TABLE'] = $ML['DATA']['TABLE'];
         $db['COLUMN_NAME'] = $ML['DATA']['NAME'];
         $this->loadWrite("Updating: Master Level");
         $this->loadSetCharRanking("MASTER_LEVEL", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], $ML['DATA']['LEVEL'], $db);
     }
     //------------------------------------------
     // Pk Kills
     //------------------------------------------
     $this->loadWrite("Updating: Pk Kills");
     $this->loadSetCharRanking("PK_KILLS", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_PKCOUNT);
     //------------------------------------------
     // Hero Kills
     //------------------------------------------
     $this->loadWrite("Updating: Hero Kills");
     $this->loadSetCharRanking("HERO_KILLS", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], COLUMN_HEROCOUNT);
     //------------------------------------------
     // Guild Score
     //------------------------------------------
     $this->loadWrite("Updating: Guild Score");
     $this->loadSetGuildRanking("GUILD_SCORE", $this->settings['WEBCACHE']['RANKINGS']['LIMIT'], "G_Score");
     //------------------------------------------
     // That's it
     //------------------------------------------
     $this->loadWrite("Updating XML Cache");
     if ($fp = fopen(CTM_CACHE_PATH . "server_cache/db_xml/mu_rankings.xml", "wb")) {
         fwrite($fp, $this->loadCacheXML());
         fclose($fp);
         $this->loadWrite("Finished! Updated " . $this->count . " results in " . CTM_LoadTime::resultTime($time) . " seconds");
         $this->loadWrite("Next Update: " . date("d/m/Y - H:i:s", strtotime("+ " . $this->settings['WEBCACHE']['RANKINGS']['MINUTES'] . " minutes")));
     } else {
         //------------------------------------------
         // Failed?
         //------------------------------------------
         $this->loadWrite("Failure to update the XML Cache");
         return $this->setTaskResult($this->taskKey, "ERROR");
     }
     //------------------------------------------
     // End?
     //------------------------------------------
     $this->setTaskOptions($this->taskKey, array(0, 0, 0, 0, $this->settings['WEBCACHE']['RANKINGS']['MINUTES']));
     #this->setTaskOptions($this->taskKey, array(Days, Weeks, Months, Hours, Minutes));
     return NULL;
 }
Ejemplo n.º 5
0
 /**
  *	Private: Close
  *	Save debug log (if self::$debug == true) and close CronJob
  *
  *	@return	void
  */
 private function loadClose()
 {
     if (self::$running == true) {
         $this->loadWrite("Close Operation");
         $this->loadWrite("Operation executed in " . CTM_LoadTime::resultTime(self::$timeId) . " seconds");
         if (self::$debug == true) {
             if (!file_exists(EW_LOG_PATH . "CronJob/")) {
                 mkdir(EW_LOG_PATH . "CronJob/");
             }
             $fp = fopen(EW_LOG_PATH . "CronJob/" . date("d-m-Y") . EW_LOG_EXT, "a+");
             fwrite($fp, self::$execResult . (substr(self::$execResult, strlen(self::$execResult) - 2) != "\r\n" ? "\r\n" : NULL) . str_repeat("=", 90) . "\r\n");
             fclose($fp);
         }
         self::$running = FALSE;
     }
 }