/**
  *	Load Language Files
  *
  *	@param	string|array	File(s)
  *	@param	boolean			Force Reload
  *	@return	void
  */
 public function loadLanguageFile($files, $app = CTM_BOARD_APP, $forceReload = FALSE)
 {
     $app = strtolower($app) == "core" && CTM_ROOT_AREA == "admin" ? "admin_core" : strtolower($app);
     if ($forceReload == true) {
         $this->words = array();
     }
     if (is_string($files)) {
         if (!in_array($app . "::" . $files, $this->loadedLangs)) {
             if (file_exists(CTM_CACHE_PATH . "lang_cache/" . $this->language . "/" . $app . "/" . CTM_ROOT_AREA . "_" . $files . ".php")) {
                 require_once CTM_CACHE_PATH . "lang_cache/" . $this->language . "/" . $app . "/" . CTM_ROOT_AREA . "_" . $files . ".php";
                 $this->words = array_merge($this->words, $CTM_LANG);
                 $this->loadedLangs[] = $app . "::" . $files;
             } else {
                 CTM_Controller::DebugLog("Can not to open the language cache {" . CTM_ROOT_AREA . "::" . $files . "}");
             }
         }
     } else {
         foreach ($files as $file) {
             if (!in_array($app . "::" . $file, $this->loadedLangs)) {
                 if (file_exists(CTM_CACHE_PATH . "lang_file/" . $this->language . "/" . $app . "/" . CTM_ROOT_AREA . "_" . $file . ".php")) {
                     require_once CTM_CACHE_PATH . "lang_file/" . $this->language . "/" . $app . "/" . CTM_ROOT_AREA . "_" . $file . ".php";
                     $this->words = array_merge($this->words, $CTM_LANG);
                     $this->loadedLangs[] = $app . "::" . $file;
                 } else {
                     CTM_Controller::DebugLog("Can not to open the language cache {" . CTM_ROOT_AREA . "::" . $file . "}");
                 }
             }
         }
     }
 }
 /**
  *	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;
 }
 /**
  *	Start Dashboard
  *
  *	@return	void
  */
 public static function init()
 {
     global $furlCache, $appsCache;
     if (!self::$inApplication) {
         if (CTM_ROOT_AREA == "admin") {
             $application = "Core";
             $section = "System";
             if ($_GET['app'] && array_key_exists($_GET['app'], $appsCache)) {
                 $cache = $appsCache[$_GET['app']];
                 $application = $cache['name'];
                 $section = $cache['module'];
                 define("CTM_BOARD_APP", $application);
                 define("ACP_LOAD_MODULE", $section);
             } elseif ($_GET['app']) {
                 return CTM_ACPBoard::output()->loadSkinCache("server")->application_failed();
             }
         } else {
             $application = CTM_Registry::$initdata['DEFAULT_APPLICATION'];
             $section = CTM_Registry::$initdata['DEFAULT_APP_SECTION'];
             if (CTM_URLEngine::$URLData[0] && array_key_exists(CTM_URLEngine::$URLData[0], $furlCache)) {
                 $furl = $furlCache[CTM_URLEngine::$URLData[0]];
                 $application = $appsCache[$furl['app']]['name'];
                 $section = $furl['module'];
                 $load = $furl['section'];
             } elseif ($_GET['app'] && array_key_exists($_GET['app'], $appsCache)) {
                 $cache = $appsCache[$_GET['app']];
                 $application = $cache['name'];
                 $section = $cache['module'];
             } elseif ($_GET['app'] && CTM_URLEngine::$URLData[0]) {
                 return CTM_Controller::instance()->output->loadSkinCache("server", "applicationFailed");
             }
         }
         CTM_Command::instance()->registry();
         CTM_Command::instance()->lang->loadLanguageFile("global", $application, false);
         if (CTM_ROOT_AREA == "admin") {
             if ($application == "Core") {
                 self::$application = "Core";
                 define("CTM_BOARD_APP", "Core");
                 define("ACP_LOAD_MODULE", $section);
                 return;
             }
         }
         if (CTM_ROOT_AREA == "public") {
             $load = $load ? $load : "app_section.php";
             self::LoadApplication($application, $section, $load);
         }
     }
 }
Example #4
0
 /**
  *	Load Skin Cache
  *
  *	@param	string	Skin file
  *	@param	string	Skin name
  *	@param	boolean	Set Global Content
  *	@param	string	Set Content
  *	@return	string	Skin content
  */
 public function loadSkinCache($category, $cache, $setGlobalContent = FALSE, $setContent = "subContent")
 {
     if ($this->noSetTemp == false) {
         if (file_exists(CTM_CACHE_PATH . "skin_cache/templates/" . $this->template . "/skin_" . $category . ".php")) {
             if (!$this->loadedCaches[$category]) {
                 require_once CTM_CACHE_PATH . "skin_cache/templates/" . $this->template . "/skin_" . $category . ".php";
                 $this->cacheClass[$category] = $callSkinCache;
                 $this->loadedCaches[$category] = array();
             }
             if (method_exists($this->cacheClass[$category], $cache)) {
                 if (!in_array($cache, $this->loadedCaches[$category])) {
                     $this->loadedCaches[$category][$cache] = $this->cacheClass[$category]->{$cache}();
                 }
                 $return = $this->loadedCaches[$category][$cache];
                 return $this->content[$setGlobalContent == true ? 'global' : $setContent] = $return;
             }
         } else {
             CTM_Controller::DebugLog("Can not to open the skin cache {" . $category . "::" . $cache . "}");
         }
     }
 }
 /**
  *	Run Section
  *
  *	@return	void
  */
 public function run()
 {
     global $installation;
     if ($_GET['do'] == "install") {
         $this->session->StartSession($_POST['session']);
         $this->session->GetSession("db_settings", $sql_session);
         $this->DB->settings['mssql']['hostname'] = $sql_session['sql_host'];
         $this->DB->settings['mssql']['hostport'] = $sql_session['sql_port'];
         $this->DB->settings['mssql']['database'] = $sql_session['sql_db'];
         $this->DB->settings['mssql']['username'] = $sql_session['sql_user'];
         $this->DB->settings['mssql']['password'] = $sql_session['sql_pass'];
         $this->DB->settings['mssql']['persistent'] = FALSE;
         $this->DB->settings['mssql']['hideErrors'] = TRUE;
         $this->DB->settings['mssql']['debug'] = FALSE;
         $this->DB->Connect("mssql");
         if (!$this->DB->IsConnected()) {
             $GLOBALS['error_message'] = $this->showMessage($this->lang->words['Installation']['Messages']['ConnectError'], "error");
         } else {
             switch ($_GET['set']) {
                 case "sql":
                     require_once CTM_SETUP_PATH . "sources/extensions/setup_sql_objects.php";
                     require_once CTM_SETUP_PATH . "setup/install/sql/mssql_alters.php";
                     require_once CTM_SETUP_PATH . "setup/install/sql/mssql_tables.php";
                     require_once CTM_SETUP_PATH . "setup/install/sql/mssql_procedures.php";
                     require_once CTM_SETUP_PATH . "setup/install/sql/mssql_views.php";
                     require_once CTM_SETUP_PATH . "setup/install/sql/mssql_fulltext.php";
                     $all_ok = true;
                     $this->step = "SQL";
                     if (count($install_objects) > 0) {
                         $with_objects = false;
                         $delete_success = false;
                         foreach ($install_objects as $name => $type) {
                             switch ($type) {
                                 case "table":
                                     $_type = "U";
                                     $query = "TABLE";
                                     break;
                                 case "procedure":
                                     $_type = "P";
                                     $query = "PROCEDURE";
                                     break;
                                 case "view":
                                     $_type = "V";
                                     $query = "VIEW";
                                     break;
                             }
                             $this->DB->Arguments($name);
                             $this->DB->Query("SELECT id FROM dbo.sysobjects WHERE name = '%s' AND type = '{$_type}'", $check);
                             if ($this->DB->CountRows($check) > 0) {
                                 $with_objects = true;
                                 if ($sql_session['delete_install'] == true) {
                                     $this->DB->Arguments($name);
                                     $this->DB->Query("DROP {$query} dbo.%s", $test);
                                     $delete_success = $test == true;
                                 } else {
                                     $delete_success = false;
                                 }
                             }
                         }
                         if ($with_objects == true) {
                             if ($sql_session['delete_install'] == true) {
                                 if ($delete_success == false) {
                                     $GLOBALS['error_message'] = $this->showMessage($this->lang->words['Installation']['Messages']['DeleteInstallationFailed'], "error");
                                     $all_ok = false;
                                 }
                             } else {
                                 $GLOBALS['error_message'] = $this->showMessage($this->lang->words['Installation']['Messages']['ExistingInstallation'], "error");
                                 $all_ok = false;
                             }
                         }
                     }
                     if ($all_ok == true) {
                         $this->install_vars['querys']['mu_accounts:database'] = MUACC_CORE;
                         $this->install_vars['querys']['mu_general:database'] = MUGEN_CORE;
                         $this->install_vars['querys']['coin:database'] = COIN_CORE;
                         $this->install_vars['querys']['coin:table'] = COIN_TABLE;
                         $this->install_vars['querys']['coin:column_1'] = COIN_COLUMN_1;
                         $this->install_vars['querys']['coin:column_2'] = COIN_COLUMN_2;
                         $this->install_vars['querys']['coin:column_3'] = COIN_COLUMN_3;
                         $this->install_vars['querys']['coin:login'] = COIN_LOGIN;
                         $alters = 0;
                         $tables = 0;
                         $procedures = 0;
                         $views = 0;
                         $others = 0;
                         if (count($install_alters) > 0) {
                             foreach ($install_alters as $query) {
                                 $alters++;
                                 $this->DB->Query($this->loadCompileQuery($query));
                             }
                         }
                         if (count($install_tables) > 0) {
                             foreach ($install_tables as $query) {
                                 $tables++;
                                 $this->DB->Query($this->loadCompileQuery($query));
                             }
                         }
                         if (count($install_procedures) > 0) {
                             foreach ($install_procedures as $query) {
                                 $procedures++;
                                 $this->DB->Query($this->loadCompileQuery($query));
                             }
                         }
                         if (count($install_views) > 0) {
                             foreach ($install_views as $query) {
                                 $views++;
                                 $this->DB->Query($this->loadCompileQuery($query));
                             }
                         }
                         if (count($install_fulltext) > 0) {
                             foreach ($install_fulltext as $query) {
                                 $others++;
                                 $this->DB->Query($this->loadCompileQuery($query));
                             }
                         }
                         $GLOBALS['installed_alters'] = $alters;
                         $GLOBALS['installed_tables'] = $tables;
                         $GLOBALS['installed_procedures'] = $procedures;
                         $GLOBALS['installed_views'] = $views;
                         $GLOBALS['installed_others'] = $others;
                         $GLOBALS['go_next'] = "?app=install&section=" . $this->section . "&do=install&set=template";
                     }
                     return false;
                     break;
                 case "template":
                     $xml_content = file_get_contents(CTM_SETUP_PATH . "setup/install/xml/skin_harmony.xml");
                     $path = "server_cache/db_php/skin_sources/skin_sources.php";
                     CTM_Template::Lib('ImportExport')->ImportXML($xml_content, $skin_info);
                     CTM_Controller::UpdateWebCache("effectwebkernelhash", "hash_file:" . $path, "hash_file:" . md5_file(CTM_CACHE_PATH . $path));
                     $this->step = "Template";
                     $GLOBALS['installed_templates'] = array($skin_info['Name']);
                     $GLOBALS['go_next'] = "?app=install&section=" . $this->section . "&do=install&set=settings";
                     break;
                 case "settings":
                     $xml_settings = CTM_FileManage::Lib('XML')->ParseXML(CTM_SETUP_PATH . "setup/install/xml/control_settings.xml");
                     $lines = 0;
                     $this->step = "Settings";
                     if (count($xml_settings) > 0) {
                         $this->iSettings->OpenSettings(CTM_CONTROL_PATH . "Settings.php");
                         foreach ($xml_settings->line as $xml) {
                             $lines++;
                             $this->iSettings->SetLine($xml['syntax'], $this->loadCompileSettingsArgs($xml));
                         }
                         $this->iSettings->CloseSettings();
                     }
                     $GLOBALS['changed_lines'] = $lines;
                     $GLOBALS['go_next'] = "?app=install&section=" . $this->section . "&do=install&set=data";
                     break;
                 case "data":
                     require_once CTM_SETUP_PATH . "setup/install/sql/mssql_inserts.php";
                     $this->install_vars['querys']['team_groups:name'] = $this->lang->words['InstallTexts']['AdminGroup']['Name'];
                     $this->install_vars['querys']['team_groups:group_title'] = $this->lang->words['InstallTexts']['AdminGroup']['Title'];
                     $inserts = 0;
                     $this->step = "Data";
                     if (count($install_inserts) > 0) {
                         foreach ($install_inserts as $query) {
                             $inserts++;
                             $this->DB->Query($this->loadCompileQuery($query));
                         }
                     }
                     $GLOBALS['inserted_data'] = $inserts;
                     $GLOBALS['go_next'] = "?app=install&section=" . $this->section . "&do=install&set=end";
                     break;
                 case "end":
                     $this->session->StartSession($_POST['session']);
                     $this->session->SetSession("install", array("end" => true));
                     $this->session->EndSession($new_session);
                     $this->nextSection($new_session);
                     break;
                 default:
                     header("Location: ?app=install&section=" . $this->section);
                     break;
             }
         }
     }
 }
Example #6
0
<?php

/**
 * Cetemaster Services
 * Effect Web 2 - MuOnline Suite Software
 *
 * Gateway index.php file
 * Last Update: 19/08/2012 - 14:56h
 * Author: $CTM['Erick-Master']
 *
 * Cetemaster Services, Limited
 * Copyright (c) 2010-2013. All Rights Reserved, 
 * www.cetemaster.com.br / www.cetemaster.com
*/
define("IN_CTM_MODULE", TRUE);
define("CTM_MODULE_KEY", "bf6654d3");
define("CTM_SYSTEM_NAME", "EffectWeb");
define("CTM_ROOT_AREA", "public");
require_once "initdata.php";
require_once CTM_ROOT_PATH . "modules/showLoad.php";
require_once CTM_ROOT_PATH . "modules/sources/ctmCommand.php";
require_once CTM_ROOT_PATH . "modules/sources/ctmRegistry.php";
require_once CTM_ROOT_PATH . "modules/sources/ctmController.php";
require_once CTM_ROOT_PATH . "modules/sources/ctmExtensions.php";
CTM_Controller::initNow();
exit;
 /**
  *	Run Section
  *
  *	@return	void
  */
 public function run()
 {
     global $versionHistory, $installation;
     $this->session->StartSession($_SESSION['SETUP_SESSION']);
     $this->session->GetSession("options", $options);
     $this->session->GetSession("repair_db", $repair_db);
     if ($_GET['do'] == "run") {
         switch ($_GET['set']) {
             case "sql":
                 require_once CTM_SETUP_PATH . "sources/extensions/setup_sql_objects.php";
                 require_once CTM_SETUP_PATH . "setup/install/sql/mssql_alters.php";
                 require_once CTM_SETUP_PATH . "setup/install/sql/mssql_tables.php";
                 require_once CTM_SETUP_PATH . "setup/install/sql/mssql_procedures.php";
                 require_once CTM_SETUP_PATH . "setup/install/sql/mssql_views.php";
                 require_once CTM_SETUP_PATH . "setup/install/sql/mssql_fulltext.php";
                 $all_ok = true;
                 $vault_ready = false;
                 $reset_data = 0;
                 $this->step = "SQL";
                 /*if(count($install_objects) > 0 && $options['repair_db_web'] == true)
                 					{
                 						$delete_success = false;
                 
                 						foreach($install_objects as $name => $type)
                 						{
                 							switch($type)
                 							{
                 								case "table" :
                 									$_type = "U";
                 									$query = "TABLE";
                 								break;
                 								case "procedure" :
                 									$_type = "P";
                 									$query = "PROCEDURE";
                 								break;
                 								case "view" :
                 									$_type = "V";
                 									$query = "VIEW";
                 								break;
                 							}
                 
                 							if($repair_db['db_web']['reset_all_tables'] == true && $query == "TABLE")
                 							{
                 								$this->DB->Arguments($name);
                 								$this->DB->Query("SELECT id FROM dbo.sysobjects WHERE name = '%s' AND type = '{$_type}'", $check);
                 
                 								if($this->DB->CountRows($check) > 0)
                 								{
                 									$this->DB->Arguments($name);
                 									$this->DB->Query("DROP {$query} dbo.%s", $test);
                 
                 									$delete_success = $test == true;
                 								}
                 							}
                 						}
                 
                 						if($repair_db['db_web']['reset_all_tables'] == true && $query == "TABLE")
                 						{
                 							if($delete_success == false)
                 							{
                 								$GLOBALS['error_message'] = $this->showMessage($this->lang->words['Installation']['Messages']['DeleteTablesFailed'], "error");
                 								$all_ok = false;
                 							}
                 						}
                 					}*/
                 if (count($repair_objects['Server']) > 0 && $options['repair_db_server'] == true) {
                     foreach ($repair_objects['Server'] as $name => $type) {
                         if ($name == "MEMB_INFO" && $repair_db['db_server']['reset_member_data'] == true) {
                             $reset_data += $this->loadResetDBData(MUACC_CORE . ".dbo.MEMB_INFO", $type);
                         } elseif ($name == "Character" && $repair_db['db_server']['reset_character_data'] == true) {
                             $reset_data += $this->loadResetDBData(MUACC_CORE . ".dbo.Character", $type);
                         } else {
                             switch ($type) {
                                 case "table":
                                     $_type = "U";
                                     $query = "TABLE";
                                     break;
                                 case "procedure":
                                     $_type = "P";
                                     $query = "PROCEDURE";
                                     break;
                                 case "view":
                                     $_type = "V";
                                     $query = "VIEW";
                                     break;
                             }
                             if ($repair_db['db_server']['reset_all_tables'] == true && $query == "TABLE" && $name != "EffectWebVirtualVault") {
                                 $this->DB->Arguments($name);
                                 $this->DB->Query("SELECT id FROM " . MUGEN_CORE . ".dbo.sysobjects WHERE name = '%s' AND type = '{$_type}'", $check);
                                 if ($this->DB->CountRows($check) > 0) {
                                     $this->DB->Arguments($name);
                                     $this->DB->Query("DROP {$query} " . MUGEN_CORE . ".dbo.%s", $test);
                                     $delete_success = $test == true;
                                 }
                             }
                         }
                         if ($repair_db['db_server']['reset_virtual_vault_items'] == true && $name == "EffectWebVirtualVault" && $vault_ready == false) {
                             $this->DB->Query("SELECT id FROM " . MUGEN_CORE . ".dbo.sysobjects WHERE name = 'EffectWebVirtualVault' AND type = '{$_type}'", $check);
                             if ($this->DB->CountRows($check) > 0) {
                                 $this->DB->Arguments($name);
                                 $this->DB->Query("DROP TABLE " . MUGEN_CORE . ".dbo.EffectWebVirtualVault", $test);
                                 $vault_ready = true;
                                 $delete_success = $test == true;
                             }
                         }
                         if ($repair_db['db_server']['reset_all_tables'] == true && $query == "TABLE") {
                             if ($delete_success == false) {
                                 $GLOBALS['error_message'] = $this->showMessage($this->lang->words['Installation']['Messages']['DeleteTablesFailed'], "error");
                                 $all_ok = false;
                             }
                         }
                     }
                 }
                 if ($all_ok == true) {
                     $this->install_vars['querys']['mu_accounts:database'] = MUACC_CORE;
                     $this->install_vars['querys']['mu_general:database'] = MUGEN_CORE;
                     $this->install_vars['querys']['coin:database'] = COIN_CORE;
                     $this->install_vars['querys']['coin:table'] = COIN_TABLE;
                     $this->install_vars['querys']['coin:column_1'] = COIN_COLUMN_1;
                     $this->install_vars['querys']['coin:column_2'] = COIN_COLUMN_2;
                     $this->install_vars['querys']['coin:column_3'] = COIN_COLUMN_3;
                     $this->install_vars['querys']['coin:login'] = COIN_LOGIN;
                     $alters = 0;
                     $tables = 0;
                     $procedures = 0;
                     $views = 0;
                     $others = 0;
                     $_install_alters = array();
                     $_install_tables = array();
                     $_install_procedures = array();
                     $_install_views = array();
                     $_install_fulltext = array();
                     if (count($install_alters) > 0) {
                         foreach ($install_alters as $_query) {
                             /*if($_query['db'] == "system" && $options['repair_db_web'] == true)
                             		{
                             			$_install_tables[] = $_query;
                             		}*/
                             if ($_query['db'] == "server" && $options['repair_db_server'] == true) {
                                 $_install_alters[] = $_query;
                             }
                         }
                     }
                     if (count($install_tables) > 0) {
                         foreach ($install_tables as $_query) {
                             /*if($_query['db'] == "system" && $options['repair_db_web'] == true)
                             		{
                             			$_install_tables[] = $_query;
                             		}*/
                             if ($_query['db'] == "server" && $options['repair_db_server'] == true) {
                                 $_install_tables[] = $_query;
                             }
                         }
                     }
                     if (count($install_procedures) > 0) {
                         foreach ($install_procedures as $_query) {
                             /*if($_query['db'] == "system" && $options['repair_db_web'] == true)
                             		{
                             			$_install_procedures[] = $_query;
                             		}*/
                             if ($_query['db'] == "server" && $options['repair_db_server'] == true) {
                                 $_install_procedures[] = $_query;
                             }
                         }
                     }
                     if (count($install_views) > 0) {
                         foreach ($install_views as $_query) {
                             /*if($_query['db'] == "system" && $options['repair_db_web'] == true)
                             		{
                             			$_install_views[] = $_query;
                             		}*/
                             if ($_query['db'] == "server" && $options['repair_db_server'] == true) {
                                 $_install_views[] = $_query;
                             }
                         }
                     }
                     if (count($install_fulltext) > 0) {
                         foreach ($install_fulltext as $_query) {
                             /*if($_query['db'] == "system" && $options['repair_db_web'] == true)
                             		{
                             			$_install_fulltext[] = $_query;
                             		}*/
                             if ($_query['db'] == "server" && $options['repair_db_server'] == true) {
                                 $_install_fulltext[] = $_query;
                             }
                         }
                     }
                     if (count($_install_alters) > 0) {
                         foreach ($_install_alters as $query) {
                             $this->DB->Query($this->loadCompileQuery($query), $test);
                             if ($test == true) {
                                 $alters++;
                             }
                         }
                     }
                     if (count($_install_tables) > 0) {
                         foreach ($_install_tables as $query) {
                             $this->DB->Query($this->loadCompileQuery($query), $test);
                             if ($test == true) {
                                 $tables++;
                             }
                         }
                     }
                     if (count($_install_procedures) > 0) {
                         foreach ($_install_procedures as $query) {
                             $this->DB->Query($this->loadCompileQuery($query), $test);
                             if ($test == true) {
                                 $procedures++;
                             }
                         }
                     }
                     if (count($_install_views) > 0) {
                         foreach ($_install_views as $query) {
                             $this->DB->Query($this->loadCompileQuery($query), $test);
                             if ($test == true) {
                                 $views++;
                             }
                         }
                     }
                     if (count($_install_fulltext) > 0) {
                         foreach ($_install_fulltext as $query) {
                             $this->DB->Query($this->loadCompileQuery($query), $test);
                             if ($test == true) {
                                 $others++;
                             }
                         }
                     }
                 }
                 $GLOBALS['repaired_alters'] = $alters;
                 $GLOBALS['repaired_tables'] = $tables;
                 $GLOBALS['repaired_procedures'] = $procedures;
                 $GLOBALS['repaired_views'] = $views;
                 $GLOBALS['repaired_others'] = $others;
                 $GLOBALS['reseted_data'] = $reset_data;
                 $GLOBALS['go_next'] = "?app=repair&section=" . $this->section . "&do=run&set=template";
                 return false;
                 break;
             case "template":
                 if ($options['restore_factory_template'] == true) {
                     $xml_content = file_get_contents(CTM_SETUP_PATH . "setup/install/xml/skin_harmony.xml");
                     $path = "server_cache/db_php/skin_sources/skin_sources.php";
                     CTM_Template::Lib('ImportExport')->ImportXML($xml_content, $skin_info);
                     CTM_Controller::UpdateWebCache("effectwebkernelhash", "hash_file:" . $path, "hash_file:" . md5_file(CTM_CACHE_PATH . $path));
                     $this->step = "Template";
                     $GLOBALS['restored_templates'] = array($skin_info['Name']);
                     $GLOBALS['go_next'] = "?app=repair&section=" . $this->section . "&do=run&set=data";
                 } else {
                     header("Location: ?app=repair&section=" . $this->section . "&do=install&set=data");
                 }
                 break;
             case "data":
                 require_once CTM_SETUP_PATH . "sources/extensions/setup_sql_data.php";
                 require_once CTM_SETUP_PATH . "setup/install/sql/mssql_inserts.php";
                 $this->install_vars['querys']['team_groups:name'] = $this->lang->words['InstallTexts']['AdminGroup']['Name'];
                 $this->install_vars['querys']['team_groups:group_title'] = $this->lang->words['InstallTexts']['AdminGroup']['Title'];
                 $inserts = 0;
                 $this->step = "Data";
                 if ($options['create_admin_account'] == true) {
                     $test = array(false, false);
                     //$this->DB->Query($this->loadCompileQuery($install_inserts['General']['AdminAccount']['Group']), $test[0]);
                     $this->install_vars['querys']['team_members:group_id'] = 1;
                     //$this->DB->GetLastedId();
                     $this->DB->Query($this->loadCompileQuery($install_inserts['AdminAccount:Account']), $test[1]);
                     //if($test[0] == true)
                     //$inserts++;
                     if ($test[1] == true) {
                         $inserts++;
                     }
                 }
                 if ($options['restore_factory_tasks'] == true) {
                     $test = false;
                     if (count($sql_data) > 0) {
                         foreach ($sql_data as $index => $query) {
                             if (substr($index, 0, 9) == "CronTask:") {
                                 $this->DB->Query($query['Select'], $test);
                                 if ($this->DB->CountRows($test) > 0) {
                                     $this->DB->Query($query['Delete']);
                                 }
                                 $this->DB->Query($this->loadCompileQuery($install_inserts[$index]), $test);
                                 if ($test == true) {
                                     $inserts++;
                                 }
                             }
                         }
                     }
                 }
                 $GLOBALS['inserted_data'] = $inserts;
                 $GLOBALS['go_next'] = "?app=repair&section=" . $this->section . "&do=run&set=end";
                 break;
             case "end":
                 $this->session->StartSession($_POST['session']);
                 $this->session->SetSession("repair", array("end" => true));
                 $this->session->EndSession($new_session);
                 $this->nextSection($new_session);
                 break;
             default:
                 header("Location: ?app=repair&section=" . $this->section);
                 break;
         }
     }
 }
 /**
  *	Run Section
  *
  *	@return	void
  */
 public function run()
 {
     global $versionHistory, $installation;
     if ($_GET['do'] == "install") {
         require_once CTM_SETUP_PATH . "sources/extensions/setup_versions_update.php";
         $end = 0;
         foreach ($versionHistory as $version => $info) {
             if ($version > $installation['current_version']) {
                 $versions_to_update[$end++] = $version;
             }
         }
         $end -= 1;
         $current_step = !$_GET['step'] ? 0 : ($_GET['step'] > $end ? $end : $_GET['step']);
         $current_version = $versions_to_update[$current_step];
         switch ($_GET['set']) {
             case "sql":
                 if ($update_versions[$current_version]['sql_site'] == true || $update_versions[$current_version]['sql_server'] == true) {
                     require_once CTM_SETUP_PATH . "setup/updates/" . $current_version . "/sql/mssql_drops.php";
                     require_once CTM_SETUP_PATH . "setup/updates/" . $current_version . "/sql/mssql_alters.php";
                     require_once CTM_SETUP_PATH . "setup/updates/" . $current_version . "/sql/mssql_tables.php";
                     require_once CTM_SETUP_PATH . "setup/updates/" . $current_version . "/sql/mssql_procedures.php";
                     require_once CTM_SETUP_PATH . "setup/updates/" . $current_version . "/sql/mssql_views.php";
                     require_once CTM_SETUP_PATH . "setup/updates/" . $current_version . "/sql/mssql_fulltext.php";
                     $this->step = "SQL";
                     $this->install_vars['querys']['mu_accounts:database'] = MUACC_CORE;
                     $this->install_vars['querys']['mu_general:database'] = MUGEN_CORE;
                     $this->install_vars['querys']['coin:database'] = COIN_CORE;
                     $this->install_vars['querys']['coin:table'] = COIN_TABLE;
                     $this->install_vars['querys']['coin:column_1'] = COIN_COLUMN_1;
                     $this->install_vars['querys']['coin:column_2'] = COIN_COLUMN_2;
                     $this->install_vars['querys']['coin:column_3'] = COIN_COLUMN_3;
                     $this->install_vars['querys']['coin:login'] = COIN_LOGIN;
                     $drops = 0;
                     $alters = 0;
                     $tables = 0;
                     $procedures = 0;
                     $views = 0;
                     $others = 0;
                     if (count($update_drops) > 0) {
                         foreach ($update_drops as $query) {
                             $drops++;
                             $this->DB->Query($this->loadCompileQuery($query, $current_version));
                         }
                     }
                     if (count($update_alters) > 0) {
                         foreach ($update_alters as $query) {
                             $alters++;
                             $this->DB->Query($this->loadCompileQuery($query, $current_version));
                         }
                     }
                     if (count($update_tables) > 0) {
                         foreach ($update_tables as $query) {
                             $tables++;
                             $this->DB->Query($this->loadCompileQuery($query, $current_version));
                         }
                     }
                     if (count($update_procedures) > 0) {
                         foreach ($update_procedures as $query) {
                             $procedures++;
                             $this->DB->Query($this->loadCompileQuery($query, $current_version));
                         }
                     }
                     if (count($update_views) > 0) {
                         foreach ($update_views as $query) {
                             $views++;
                             $this->DB->Query($this->loadCompileQuery($query, $current_version));
                         }
                     }
                     if (count($update_fulltext) > 0) {
                         foreach ($update_fulltext as $query) {
                             $others++;
                             $this->DB->Query($this->loadCompileQuery($query, $current_version));
                         }
                     }
                     $GLOBALS['droped_objects'] = $drops;
                     $GLOBALS['installed_alters'] = $alters;
                     $GLOBALS['installed_tables'] = $tables;
                     $GLOBALS['installed_procedures'] = $procedures;
                     $GLOBALS['installed_views'] = $views;
                     $GLOBALS['installed_others'] = $others;
                     $GLOBALS['go_next'] = "?app=upgrade&section=" . $this->section . "&do=install&set=template&step=" . $current_step;
                 } else {
                     header("Location: ?app=upgrade&section=" . $this->section . "&do=install&set=template&step=" . $current_step);
                 }
                 break;
             case "template":
                 if ($update_versions[$current_version]['templates'] == true) {
                     $xml_content = file_get_contents(CTM_SETUP_PATH . "setup/install/xml/skin_harmony.xml");
                     $path = "server_cache/db_php/skin_sources/skin_sources.php";
                     CTM_Template::Lib('ImportExport')->ImportXML($xml_content, $skin_info);
                     CTM_Controller::UpdateWebCache("effectwebkernelhash", "hash_file:" . $path, "hash_file:" . md5_file(CTM_CACHE_PATH . $path));
                     $this->step = "Template";
                     $GLOBALS['updated_templates'] = array($skin_info['Name']);
                     $GLOBALS['go_next'] = "?app=upgrade&section=" . $this->section . "&do=install&set=data&step=" . $current_step;
                 } else {
                     header("Location: ?app=upgrade&section=" . $this->section . "&do=install&set=data&step=" . $current_step);
                 }
                 break;
             case "data":
                 if ($update_versions[$current_version]['sql_site'] == true || $update_versions[$current_version]['sql_server'] == true) {
                     require_once CTM_SETUP_PATH . "setup/updates/" . $current_version . "/sql/mssql_inserts.php";
                     $this->install_vars['querys']['team_groups:name'] = $this->lang->words['InstallTexts']['AdminGroup']['Name'];
                     $this->install_vars['querys']['team_groups:group_title'] = $this->lang->words['InstallTexts']['AdminGroup']['Title'];
                     $inserts = 0;
                     $this->step = "Data";
                     if (count($update_inserts) > 0) {
                         foreach ($update_inserts as $query) {
                             $inserts++;
                             $this->DB->Query($this->loadCompileQuery($query));
                         }
                     }
                     $GLOBALS['inserted_data'] = $inserts;
                     $GLOBALS['go_next'] = "?app=upgrade&section=" . $this->section . "&do=install&set=end&step=" . $current_step;
                 } else {
                     header("Location: ?app=upgrade&section=" . $this->section . "&do=install&set=end&step=" . $current_step);
                 }
                 break;
             case "end":
                 if ($current_step == $end) {
                     $this->session->StartSession($_POST['session']);
                     $this->session->SetSession("install", array("end" => true));
                     $this->session->EndSession($new_session);
                     $this->nextSection($new_session);
                 } else {
                     header("Location: ?app=upgrade&section=" . $this->section . "&do=install&set=sql&step=" . ($current_step + 1));
                 }
                 break;
             default:
                 header("Location: ?app=upgrade&section=" . $this->section);
                 break;
         }
         $GLOBALS['current_version']['string'] = $versionHistory[$current_version]['show'];
         $GLOBALS['current_version']['key'] = $current_version;
     }
 }
 /**
  *	Init intaller now
  *
  *	@return	void
  */
 public static function initNow()
 {
     global $install_sections, $upgrade_sections, $repair_sections, $installation;
     CTM_Controller::PHPErrors();
     CTM_Command::instance()->loadLibrary(CTM_SETUP_MODE == "install" ? "Install" : (CTM_SETUP_MODE == "repair" ? "Repair" : "Upgrade"), "setup");
     CTM_Registry::init();
     CTM_Registry::setVars("section", $_GET['section']);
     CTM_Registry::setVars("max_sections", CTM_Command::instance()->setup->max_sections);
     CTM_Command::instance()->registry();
     CTM_Command::instance()->lang->loadLanguageFile("core:global");
     CTM_Command::instance()->output->registry();
     $continue = true;
     if (CTM_SETUP_MODE == "install") {
         $setup_sections = $install_sections;
         $sections_folder = "install";
         if ($installation['is_installed'] == true) {
             require_once CTM_SETUP_PATH . "sources/sections/install/block.php";
             $section->run();
             $section->content($content);
             $continue = false;
         }
     } elseif (CTM_SETUP_MODE == "default") {
         self::instance()->output->setTitles(self::instance()->lang->words['Default']['HTML'], self::instance()->lang->words['Default']['Step']);
         $content = array("type" => "core", "section" => "default_page");
         $continue = false;
         $GLOBALS['hide_button'] = true;
         $GLOBALS['hide_sidebar'] = true;
     } elseif (CTM_SETUP_MODE == "upgrade") {
         $setup_sections = $upgrade_sections;
         $sections_folder = "upgrade";
         if ($installation['current_version'] == EW_THIS_VERSION) {
             require_once CTM_SETUP_PATH . "sources/sections/upgrade/block.php";
             $section->run();
             $section->content($content);
             $continue = false;
         }
     } elseif (CTM_SETUP_MODE == "repair") {
         $setup_sections = $repair_sections;
         $sections_folder = "repair";
         if ($installation['is_installed'] == false) {
             header("Location: ?app=install");
             exit;
         } elseif ($installation['current_version'] < EW_THIS_VERSION) {
             header("Location: ?app=upgrade");
             exit;
         }
     }
     if ($continue == true && (CTM_SETUP_MODE == "upgrade" || CTM_SETUP_MODE == "repair")) {
         self::instance()->DB->settings['mssql']['hostname'] = MSSQL_HOSTNAME;
         self::instance()->DB->settings['mssql']['hostport'] = MSSQL_HOSTPORT;
         self::instance()->DB->settings['mssql']['database'] = CTMEW_CORE;
         self::instance()->DB->settings['mssql']['username'] = MSSQL_USERNAME;
         self::instance()->DB->settings['mssql']['password'] = MSSQL_PASSWORD;
         self::instance()->DB->settings['mssql']['persistent'] = FALSE;
         self::instance()->DB->settings['mssql']['hideErrors'] = TRUE;
         self::instance()->DB->settings['mssql']['debug'] = FALSE;
         self::instance()->DB->Connect("mssql");
         if (!self::instance()->DB->IsConnected()) {
             self::instance()->output->setTitles(self::instance()->lang->words['Default']['HTML'], self::instance()->lang->words['Default']['Step']);
             $content = array("type" => "core", "section" => "show_error");
             $continue = false;
             $GLOBALS['show_error'] = self::instance()->lang->words['DBConnectError'];
             $GLOBALS['hide_button'] = true;
             $GLOBALS['hide_sidebar'] = true;
         }
     }
     if ($continue == true) {
         if ($_GET['section']) {
             if (file_exists(CTM_SETUP_PATH . "sources/sections/" . $sections_folder . "/" . $setup_sections[$_GET['section']] . ".php") && CTM_Command::instance()->setup->CheckSection()) {
                 require_once CTM_SETUP_PATH . "sources/sections/" . $sections_folder . "/" . $setup_sections[$_GET['section']] . ".php";
                 $section->run();
                 $section->content($content);
             } else {
                 require_once CTM_SETUP_PATH . "sources/sections/" . $sections_folder . "/" . $setup_sections[1] . ".php";
                 $section->run();
                 $section->content($content);
             }
         } else {
             require_once CTM_SETUP_PATH . "sources/sections/" . $sections_folder . "/" . $setup_sections[1] . ".php";
             $section->run();
             $section->content($content);
         }
     }
     $GLOBALS['section'] = $_GET['section'] ? $_GET['section'] : 1;
     $GLOBALS['__session'] = $_POST['session'] ? $_POST['session'] : $_SESSION['SETUP_SESSION'];
     echo CTM_Command::instance()->output->returnFullContent($content);
     exit("\r\n<!-- Cetemaster PHP Installer v1.1 - Copyright 2013 (c) Cetemaster Services (www.cetemaster.com.br) -->");
 }
Example #10
0
 /**
  *	Private: Import/Export Templates
  *	Import/Export templates by XML
  *
  *	@return	void
  */
 private function loadImportExportTemplates()
 {
     if ($_GET['process']) {
         switch ($_GET['process']) {
             case "import":
                 if (empty($_FILES['FileUpload']['name']) && empty($_POST['FilePath'])) {
                     $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['SelectFile'];
                     $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                 } else {
                     $break = FALSE;
                     $uploaded = FALSE;
                     $is_zip = FALSE;
                     if (!empty($_FILES['FileUpload']['name'])) {
                         $type = $_FILES['FileUpload']['type'];
                         $is_zip = $type == "application/x-gzip" || $type == "application/gzip" ? "gzip" : ($type == "application/zip" ? "zip" : "none");
                         if ($type != "text/xml" && $type != "application/x-gzip" && $type != "application/gzip" && $type != "application/zip") {
                             $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['InvalidFile'];
                             $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                             $break = TRUE;
                         } else {
                             $filepath = CTM_CACHE_PATH . "temp_cache/" . md5(time() . "&ew_template_temp_file&" . mt_rand()) . ".tmp";
                             if (!copy($_FILES['FileUpload']['tmp_name'], $filepath)) {
                                 $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['UploadError'];
                                 $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                                 $break = TRUE;
                             } else {
                                 $uploaded = TRUE;
                             }
                         }
                     } else {
                         $filepath = CTM_ROOT_PATH . $_POST['FilePath'];
                         $find_end = strrpos($filepath, ".");
                         $file_end = substr($filepath, $find_end + 1);
                         if (!file_exists($filepath)) {
                             $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['FileNoExists'];
                             $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                             $break = TRUE;
                         } elseif ($file_end != "xml" && $file_end != "gz" && $file_end != "zip") {
                             $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['InvalidFile'];
                             $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                             $break = TRUE;
                         } else {
                             $is_zip = $file_end == "gz" ? "gzip" : ($file_end == "zip" ? "zip" : NULL);
                         }
                     }
                     if ($is_zip == "gzip" && $break == false) {
                         if (!function_exists("gzopen") || !function_exists("gzread") || !function_exists("gzclose")) {
                             $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['UnZipError'];
                             $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                             $break = TRUE;
                         } else {
                             if ($gzip = gzopen($filepath, "r")) {
                                 $tmp_path = CTM_CACHE_PATH . "temp_cache/" . md5(time() . "&" . EffectWebFiles::TEMPLATE_XML_FILENAME . "&" . mt_rand()) . ".tmp";
                                 $gz_content = gzread($gzip, filesize($filepath) * 2);
                                 gzclose($gzip);
                                 if ($uploaded == true) {
                                     unlink($filepath);
                                 }
                                 $fp = fopen($tmp_path, "w");
                                 fwrite($fp, $gz_content);
                                 fclose($fp);
                             } else {
                                 $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['UnZipError'];
                                 $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                                 $break = TRUE;
                             }
                         }
                     } elseif ($is_zip == "zip" && $break == false) {
                         if (!class_exists("ZipArchive")) {
                             $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['UnZipError'];
                             $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                             $break = TRUE;
                         } else {
                             $zip = new ZipArchive();
                             if ($zip->open($filepath)) {
                                 $filename = md5(time() . "&" . EffectWebFiles::TEMPLATE_XML_FILENAME . "&" . mt_rand()) . ".tmp";
                                 $tmp_path = CTM_CACHE_PATH . "temp_cache/" . $filename;
                                 $zip->renameName(EffectWebFiles::TEMPLATE_XML_FILENAME, $filename);
                                 $zip->extractTo(CTM_CACHE_PATH . "temp_cache/", array($filename));
                                 $zip->renameName($filename, EffectWebFiles::TEMPLATE_XML_FILENAME);
                                 $zip->close();
                                 if ($uploaded == true) {
                                     unlink($filepath);
                                 }
                             } else {
                                 $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['UnZipError'];
                                 $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                                 $break = TRUE;
                             }
                         }
                     } else {
                         $tmp_path = $filepath;
                     }
                     if ($break == false) {
                         $xml_content = file_get_contents($tmp_path);
                         if (file_exists($tmp_path) && $tmp_path != $filepath && ($is_zip == "gzip" || $is_zip == "zip")) {
                             unlink($tmp_path);
                         }
                         if ($uploaded == true && $is_zip == "none") {
                             unlink($filepath);
                         }
                         if (!CTM_FileManage::Lib('XML')->IsXML($xml_content) || !strstr($xml_content, "<skin_xml") || !strstr($xml_content, "<skin_info>")) {
                             $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['FileCorrupted'];
                             $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                         } else {
                             CTM_Template::Lib('ImportExport')->ImportXML($xml_content, $skin_info);
                             if ($skin_info == "XML_CORRUPTED") {
                                 $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['FileCorrupted'];
                                 $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                             } elseif ($skin_info == "INVALID_CODEKEY") {
                                 $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['InvalidTemplate'];
                                 $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                             } elseif ($skin_info == "VAR_0_ERROR") {
                                 $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['LicenseError'];
                                 $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                             } else {
                                 $path = "server_cache/db_php/skin_sources/skin_sources.php";
                                 CTM_Controller::UpdateWebCache("effectwebkernelhash", "hash_file:" . $path, "hash_file:" . md5_file(CTM_CACHE_PATH . $path));
                                 $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Import']['Messages']['Success'];
                                 $GLOBALS['result_command'] = sprintf($GLOBALS['result_command'], $skin_info['Name'], $skin_info['SkinSet']);
                                 $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 3);
                             }
                         }
                     } else {
                         if ($uploaded == true) {
                             if (file_exists($filepath)) {
                                 unlink($filepath);
                             }
                             if (file_exists($tmp_path)) {
                                 unlink($tmp_path);
                             }
                         }
                     }
                 }
                 break;
             case "export":
                 CTM_Template::Lib('Sources')->OpenDatabase();
                 if (!CTM_Template::Lib('Sources')->CheckSkin($_POST['Template'])) {
                     CTM_Template::Lib('Sources')->CloseDatabase();
                     $GLOBALS['result_command'] = $this->lang->words['System']['Templates']['ImportExport']['Export']['Messages']['TemplateInvalid'];
                     $GLOBALS['result_command'] = adminShowMessage($GLOBALS['result_command'], 2);
                 } else {
                     CTM_Template::Lib('ImportExport')->ExportXML("ew_template", $_POST['Template'], $this->skin_cache_keys, true, CTM_ACP_USE_ZIP);
                 }
                 break;
         }
     }
     CTM_Template::Lib('Sources')->OpenDatabase();
     CTM_Template::Lib('Sources')->GetAllSkins($_templates);
     CTM_Template::Lib('Sources')->CloseDatabase();
     if (count($_templates) > 0) {
         foreach ($_templates as $key => $value) {
             $GLOBALS['templates'][$key] = $value['Name'];
         }
     }
     $GLOBALS['template_default_xml_file'] = EffectWebFiles::TEMPLATE_XML_FILENAME;
 }