/** * @param $view * @param bool $force * @return \adminpage */ public function getTemplate($view, $force = false) { if (!isset($this->template[$view]) || $force) { // lang $lang = new Lang($this->config->config('language_text'), 'admin/' . $view); $common = new Lang($this->config->config('language_text'), 'admin'); $this->template[$view] = new \adminpage($view, $lang, $common); } return $this->template[$view]; }
/** * @param ServerRequestInterface $request * @param ResponseInterface $response * @param callable $next * @return ResponseInterface */ public function __invoke(ServerRequestInterface $request, ResponseInterface $response, callable $next) { // get response $response = $next($request, $response); // Save statistics after all manipulations //count_all($this->config->cfg('goto')); save_visitors(); if (!$this->config->configExists('main', 'count_referers') || $this->config->cfg('main', 'count_referers') == 1) { save_referer(); } return $response; }
/** * @return mixed * @throws \ErrorException */ protected function detectPage() { // security functions if (!isset($_REQUEST['go'])) { $_REQUEST['go'] = null; } $go = $_REQUEST['go']; // get page-data from database $acp_arr = $this->db->conn()->prepare(<<<SQL SELECT `page_id`, `page_file`, P.`group_id` AS `group_id`, `menu_id` FROM `{$this->db->getPrefix()}admin_cp` P, `{$this->db->getPrefix()}admin_groups` G WHERE P.`group_id` = G.`group_id` AND P.`page_id` = ? AND P.`page_int_sub_perm` != 1 SQL ); $acp_arr->execute(array($go)); $acp_arr = $acp_arr->fetch(\PDO::FETCH_ASSOC); // if page exists if (!empty($acp_arr)) { // if page is start page if ($acp_arr['group_id'] == -1) { $acp_arr['menu_id'] = $acp_arr['page_file']; $acp_arr['page_file'] = $acp_arr['page_id'] . '.php'; } //if popup if ($acp_arr['group_id'] == 'popup') { define('POPUP', true); $title = $this->text['menu']->get('page_title_' . $acp_arr['page_id']); } else { define('POPUP', false); $title = $this->text['menu']->get('group_' . $acp_arr['group_id']) . ' » ' . $this->text['menu']->get('page_title_' . $acp_arr['page_id']); } // get the page-data $PAGE_DATA_ARR = createpage($title, has_perm($acp_arr['page_id']), $acp_arr['page_file'], $acp_arr['menu_id']); } else { $PAGE_DATA_ARR['created'] = false; define('POPUP', false); } // logout if ($PAGE_DATA_ARR['created'] === false && $go == 'logout') { setcookie('login', '', time() - 3600, '/'); $_SESSION = array(); $PAGE_DATA_ARR = createpage($this->text['menu']->get("admin_logout_text"), true, 'admin_logout.php', 'dash'); } elseif ($PAGE_DATA_ARR['created'] === false && ($go == 'login' || empty($go))) { $go = 'login'; $PAGE_DATA_ARR = createpage($this->text['menu']->get("admin_login_text"), true, 'admin_login.php', 'dash'); } elseif ($PAGE_DATA_ARR['created'] === false) { $go = '404'; $PAGE_DATA_ARR = createpage($this->text['menu']->get("admin_error_page_title"), true, 'admin_404.php', 'error'); } // Get Special Page Lang-Text-Files $page_lang = new Lang($this->config->config('language_text'), 'admin/' . substr($PAGE_DATA_ARR['file'], 0, -4)); $common_lang = $this->text['admin']; // initialise template system $PAGE_DATA_ARR['template'] = new \adminpage($PAGE_DATA_ARR['file'], $page_lang, $common_lang); // Define Constant define('ACP_GO', $go); return $PAGE_DATA_ARR; }
/** * @param $string * @return mixed */ function applyFunctions($string) { global $NAV, $SNP, $APP; // init globals $NAV = array(); $SNP = array(); $APP = $this->applets; return tpl_functions($string, $this->config->cfg('system', 'var_loop'), array(), true); }