/** * generate the modid (combination of current module and page) and store it in a static var * isStart is only needed for this class (used in function retrieveBlocks()). * * @global array $icmsConfig ImpressCMS configuration array * @global icms_module_Object $icmsModule current module * @return void */ public static function getPage() { global $icmsConfig, $icmsModule; if (is_array(self::$modid)) { return self::$modid; } // getting the start module and page configured in the admin panel if (is_array($icmsConfig['startpage'])) { $member_handler = icms::handler('icms_member'); $group = $member_handler->getUserBestGroup(is_object(icms::$user) ? icms::$user->getVar('uid') : 0); $icmsConfig['startpage'] = $icmsConfig['startpage'][$group]; } $startMod = $icmsConfig['startpage'] == '--' ? 'system' : $icmsConfig['startpage']; // setting the full and relative url of the actual page $clean_request = filter_var($_SERVER['REQUEST_URI'], FILTER_SANITIZE_URL); $fullurl = icms::$urls['http'] . icms::$urls['httphost'] . $clean_request; $url = substr(str_replace(ICMS_URL, '', $fullurl), 1); $icms_page_handler = icms::handler('icms_data_page'); $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_url', $fullurl)); if (!empty($url)) { $criteria->add(new icms_db_criteria_Item('page_url', $url), 'OR'); } $pages = $icms_page_handler->getCount($criteria); if ($pages > 0) { // we have a sym-link defined for this page $pages = $icms_page_handler->getObjects($criteria); $page = $pages[0]; $purl = filter_var($page->getVar('page_url'), FILTER_SANITIZE_URL); $mid = (int) $page->getVar('page_moduleid'); $pid = $page->getVar('page_id'); $module_handler = icms::handler('icms_module'); $module = $module_handler->get($mid); $dirname = $module->getVar('dirname'); $isStart = $startMod == $mid . '-' . $pid; } else { // we don't have a sym-link for this page if (is_object($icmsModule)) { $mid = (int) $icmsModule->getVar('mid'); $dirname = $icmsModule->getVar('dirname'); $isStart = substr($_SERVER['PHP_SELF'], -9) == 'index.php' && $startMod == $dirname; } else { $mid = 1; $dirname = 'system'; $isStart = !empty($GLOBALS['xoopsOption']['show_cblock']); } $pid = 0; } /* determine the visitor's start page and update the request based on that? */ if ($isStart) { self::$modid = array('module' => 0, 'page' => 1, 'isStart' => $isStart); } else { $criteria = new icms_db_criteria_Compo(new icms_db_criteria_Item('page_status', 1)); $pages = $icms_page_handler->getObjects($criteria); $pid = 0; foreach ($pages as $page) { $purl = filter_var($page->getVar('page_url'), FILTER_SANITIZE_URL); if (substr($purl, -1) == '*') { $purl = substr($purl, 0, -1); if (substr($url, 0, strlen($purl)) == $purl || substr($fullurl, 0, strlen($purl)) == $purl) { $pid = $page->getVar('page_id'); break; } } else { if ($purl == $url || $purl == $fullurl) { $pid = $page->getVar('page_id'); break; } } } self::$modid = array('module' => $mid, 'page' => $pid, 'isStart' => $isStart); } return self::$modid; }
public function xoInit($options = array()) { parent::xoInit($options); $this->_deprecated = icms_core_Debug::setDeprecated('icms_view_PageBuilder', sprintf(_CORE_REMOVE_IN_VERSION, '1.4')); }