/** * get singleton * * @access public * @return object **/ public static function getInstance() { if (!self::$instance) { self::$instance = new self(); CAT_Registry::register(array('USERS_PROFILE_ALLOWED' => 16), NULL, true); } return self::$instance; }
$root = "../"; $level = 1; while ($level < 10 && !file_exists($root . '/framework/class.secure.php')) { $root .= "../"; $level += 1; } if (file_exists($root . '/framework/class.secure.php')) { include $root . '/framework/class.secure.php'; } else { trigger_error(sprintf("[ <b>%s</b> ] Can't include class.secure.php!", $_SERVER['SCRIPT_NAME']), E_USER_ERROR); } } $val = CAT_Helper_Validate::getInstance(); $user = CAT_Users::getInstance(); $id = $user->get_user_id(); // this one is only used for the frontend! if (!FRONTEND_LOGIN || !FRONTEND_SIGNUP) { // no frontend login, no sign up if (INTRO_PAGE) { die(header('Location: ' . CAT_URL . PAGES_DIRECTORY . '/index.php')); } else { die(header('Location: ' . CAT_URL . '/index.php')); } } CAT_Helper_Page::getVirtualPage('Sign-up'); CAT_Helper_Page::addCSS(CAT_URL . '/account/css/preferences.css'); CAT_Registry::register('PAGE_CONTENT', CAT_PATH . '/account/signup_form.php', true); // Set auto authentication to false $auto_auth = false; // Include the index (wrapper) file require CAT_PATH . '/index.php';
/** * check if system is in maintenance mode * * @access public * @return boolean **/ public static function isMaintenance() { if (!CAT_Registry::exists('MAINTENANCE_MODE')) { $result = $this->db()->query('SELECT `value` FROM `:prefix:settings` WHERE `name`="maintenance_mode"'); if (is_resource($result) && $result->rowCount() == 1) { $row = $result->fetch(); CAT_Registry::register('MAINTENANCE_MODE', $row['maintenance_mode'], true); } } return CAT_Registry::get('MAINTENANCE_MODE') == 'on' ? true : false; }
//************************************************************************** // Disable magic_quotes_runtime //************************************************************************** if (version_compare(PHP_VERSION, '5.3.0', '<')) { set_magic_quotes_runtime(0); } //************************************************************************** // Set theme //************************************************************************** CAT_Registry::register('CAT_THEME_URL', CAT_URL . '/templates/' . DEFAULT_THEME, true); CAT_Registry::register('CAT_THEME_PATH', CAT_PATH . '/templates/' . DEFAULT_THEME, true); //************************************************************************** // set the search library //************************************************************************** if (!defined('CAT_INSTALL_PROCESS')) { if (false !== ($query = $database->query("SELECT value FROM `:prefix:search` WHERE name='cfg_search_library' LIMIT 1"))) { $query->rowCount() > 0 ? $res = $query->fetch() : ($res['value'] = 'lib_search'); CAT_Registry::register('SEARCH_LIBRARY', $res['value'], true); } else { CAT_Registry::register('SEARCH_LIBRARY', 'lib_search', true); } } else { CAT_Registry::register('SEARCH_LIBRARY', 'lib_search', true); } //************************************************************************** // get template engine //************************************************************************** global $parser; $parser = CAT_Helper_Template::getInstance('Dwoo'); CAT_Registry::register('CAT_INITIALIZED', true, true);
/** * Figure out which template to use * * @access public * @return void sets globals **/ public function setTemplate() { if (!defined('TEMPLATE')) { $prop = $this->getProperties(); // page has it's own template if (isset($prop['template']) && $prop['template'] != '') { if (file_exists(CAT_PATH . '/templates/' . $prop['template'] . '/index.php')) { CAT_Registry::register('TEMPLATE', $prop['template'], true); } else { CAT_Registry::register('TEMPLATE', DEFAULT_TEMPLATE, true); } // use global default } else { CAT_Registry::register('TEMPLATE', DEFAULT_TEMPLATE, true); } } $dir = '/templates/' . TEMPLATE; // Set the template dir (which is, in fact, the URL, but for backward // compatibility, we have to keep this irritating name) CAT_Registry::register('TEMPLATE_DIR', CAT_URL . $dir, true); // This is the REAL dir CAT_Registry::register('CAT_TEMPLATE_DIR', CAT_PATH . $dir, true); }