/**
  *	Public Modules
  *
  *	@return	void
  */
 public function loadPublicModules()
 {
     $this->registry();
     $templateId = FALSE;
     $languageId = FALSE;
     $template = FALSE;
     $language = FALSE;
     if (isset($_REQUEST['tpl']) && $this->settings['WEBPUBLIC']['SELECTOR']['TEMPLATES'] == true) {
         if (array_key_exists($_REQUEST['tpl'], $this->settings['WEBPUBLIC']['TEMPLATES'])) {
             if (file_exists(CTM_CACHE_PATH . "skin_cache/templates/" . $this->settings['WEBPUBLIC']['TEMPLATES'][$_REQUEST['tpl']][0] . "/")) {
                 CTM_Cookies::setCookie("UserTemplate", $_REQUEST['tpl'], -1);
                 $templateId = $_REQUEST['tpl'];
                 $template = $this->settings['WEBPUBLIC']['TEMPLATES'][$_REQUEST['tpl']][0];
             }
         }
     } elseif (CTM_Cookies::GetCookie("UserTemplate")) {
         $loadTemplate = CTM_Cookies::GetCookie("UserTemplate");
         if (array_key_exists($loadTemplate, $this->settings['WEBPUBLIC']['TEMPLATES'])) {
             if (file_exists(CTM_CACHE_PATH . "skin_cache/templates/" . $this->settings['WEBPUBLIC']['TEMPLATES'][$loadTemplate][0] . "/")) {
                 $templateId = $loadTemplate;
                 $template = $this->settings['WEBPUBLIC']['TEMPLATES'][$loadTemplate][0];
             }
         }
     }
     if (isset($_REQUEST['lang']) && $this->settings['WEBPUBLIC']['SELECTOR']['LANGUAGES'] == true) {
         if (array_key_exists($_REQUEST['lang'], $this->settings['WEBPUBLIC']['LANGUAGES'])) {
             if (file_exists(CTM_CACHE_PATH . "skin_cache/" . $this->settings['WEBPUBLIC']['LANGUAGES'][$_REQUEST['lang']][0] . "/")) {
                 CTM_Cookies::setCookie("UserLanguage", $_REQUEST['lang'], -1);
                 $languageId = $_REQUEST['lang'];
                 $language = $this->settings['WEBPUBLIC']['LANGUAGES'][$_REQUEST['lang']][0];
             }
         }
     } elseif (CTM_Cookies::GetCookie("UserLanguage")) {
         $loadLanguage = CTM_Cookies::GetCookie("UserLanguage");
         if (array_key_exists($loadTemplate, $this->settings['WEBPUBLIC']['LANGUAGES'])) {
             if (file_exists(CTM_CACHE_PATH . "lang_cache/" . $this->settings['WEBPUBLIC']['LANGUAGES'][$loadLanguage][0] . "/")) {
                 $languageId = $loadLanguage;
                 $language = $this->settings['WEBPUBLIC']['LANGUAGES'][$loadLanguage][0];
             }
         }
     }
     if (!(bool) $template || !(bool) $templateId) {
         CTM_Cookies::setCookie("UserTemplate", NULL);
         $templateId = $this->settings['WEBPUBLIC']['DEFAULT']['TEMPLATE'];
         $template = $this->settings['WEBPUBLIC']['TEMPLATES'][$templateId][0];
     }
     if (!(bool) $language || !(bool) $languageId) {
         CTM_Cookies::setCookie("UserLanguage", NULL);
         $languageId = $this->settings['WEBPUBLIC']['DEFAULT']['LANGUAGE'];
         $language = $this->settings['WEBPUBLIC']['LANGUAGES'][$languageId][0];
     }
     CTM_Command::instance()->output->setTemplate($template);
     CTM_Command::instance()->lang->setLanguage($language);
     define("CTM_TEMPLATE_SELECTED", $templateId);
     define("CTM_LANGUAGE_SELECTED", $languageId);
 }
示例#2
0
 /**
  *	Registry instance
  *
  *	@return	void
  */
 public function registry()
 {
     parent::instance()->registry();
     $this->settings = CTM_Registry::fetchSettings();
     $this->acp_vars = CTM_ACPRegistry::fetchVariables();
     $this->output = CTM_ACPBoard::output();
     $this->lang = CTM_Command::instance()->lang;
     $this->email = CTM_Command::instance()->email;
     $this->functions = CTM_Command::instance()->functions;
     $this->mailer = $GLOBALS['CTM_Mailer'];
     $this->DB = CTM_Registry::fetchDriver();
     $this->member = CTM_ACPRegistry::fetchMember();
 }
示例#3
0
 /**
  *	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);
         }
     }
 }
 /**
  *	Get self instance
  *
  *	@return	object
  */
 protected function instance()
 {
     if (!self::$instance) {
         self::$instance = new self();
     }
     return self::$instance;
 }
 /**
  *	Private: Setup Variables
  *
  *	@return	void
  */
 private static function Setup()
 {
     if (CTM_ROOT_AREA == "public") {
         $template = CTM_Command::instance()->output->template;
         $publicDir = PUBLIC_DIRECTORY . "/%s/" . $template . "/";
         CTM_Command::instance()->updateVars("public_directory", PUBLIC_DIRECTORY . "/");
         CTM_Command::instance()->updateVars("admincp_directory", ADMINCP_DIRECTORY . "/");
         CTM_Command::instance()->updateVars("style_dirs,skin_styles", sprintf($publicDir, "style_css"));
         CTM_Command::instance()->updateVars("style_dirs,skin_images", sprintf($publicDir, "style_images"));
         CTM_Command::instance()->updateVars("style_dirs,skin_res", sprintf($publicDir, "style_resources"));
         CTM_Command::instance()->updateVars("style_dirs,styles", PUBLIC_DIRECTORY . "/style_css/");
         CTM_Command::instance()->updateVars("style_dirs,images", PUBLIC_DIRECTORY . "/images/");
         CTM_Command::instance()->updateVars("style_dirs,js", PUBLIC_DIRECTORY . "/javascripts/");
         CTM_Command::instance()->updateVars("board_host", CTM_URLEngine::URLHost());
         CTM_Command::instance()->updateVars("board_url", CTM_URLEngine::URLBase());
         CTM_Command::instance()->updateVars("path_url", CTM_URLEngine::URIString());
         CTM_Command::instance()->updateVars("language_js", EffectWebData::LANGUAGE_JS . CTM_Command::instance()->lang->language);
         define("SESSION_USER_LOGGED", Authentication::Check());
     }
 }
 /**
  *	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) -->");
 }