public function __construct($search_paths = array()) { $this->paths = $search_paths; $this->modules = $this->getModules(); if (FileCache::is_cached('modules_info', 180)) { // cache expire after 3 mins $this->modules_info = FileCache::fetch('modules_info', null, 180); } else { $this->modules_info = array(); $this->getCNModulesInfo(); FileCache::store('modules_info', $this->modules_info, 180); } }
} global $use_theme; // Theme name defined in page XML config file try { $save_page = $app->getRequestParam('save'); $new_page_settings = $app->getRequestParam('page_settings') ? unserialize(urldecode($app->getRequestParam('page_settings'))) : null; $cache_id = "dyn_page_{$req_page}"; if (FileCache::is_cached($cache_id)) { $dynamic_page = FileCache::fetch($cache_id); $page_settings = $dynamic_page->buildPageSettings($new_page_settings); } else { $dynamic_page = new CNDynamicPage($req_page); $dynamic_page->initialize(); $dynamic_page->save_page = $save_page; $page_settings = $dynamic_page->buildPageSettings($new_page_settings); FileCache::store($cache_id, $dynamic_page, 1200); } // Force login if we're on a private network, unless we're on login.php, register.php or cnuser_login_index.php $login_required = $page_settings['page_mode'] != 'public' ? true : false; if (!$login_required && PA::$network_info->is_private() && !$login_never_required) { $login_required = TRUE; } // Check user session / login status, and redirect to login page (or // request page, for private networks) if required. if (!check_session($login_required, $page_redirect_function)) { if ($login_required) { exit; } } $use_theme = $page_settings['page_theme']; $page = new PageRenderer('setup_module', $page_settings['page_id'], sprintf(__('%s - %s'), __($page_settings['page_name']), PA::$network_info->name), $page_settings['page_template'], $page_settings['header_template'], $page_settings['page_mode'], $page_settings['block_type'], PA::$network_info, NULL, NULL);
/** * Generic Function to get record from page settings table * Function will take the field_name and value in the form of key => value pair */ public static function get_pages_default_setting($page_type, $only_configurable = true, $from_XML = false) { global $app; Logger::log('Enter: function ModuleSetting::get_pages_default_setting'); if (FileCache::is_cached($page_type . '_module_default_setting')) { $settings = FileCache::fetch($page_type . '_module_default_setting'); return $settings; } else { $return = array(); $results = $app->configObj->query("//*[@section='pages' and contains(@page_type, '{$page_type}')]"); //echo "Results:<pre>" . print_r($results, 1). "</pre>"; die(); // $pages = array_flip(getConstantsByPrefix('PAGE_')); // function defined in helper_functions.php // foreach($pages as $key => $const_name) { foreach ($results as $const_name => $key) { if (is_numeric($key)) { $page_settings = self::load_setting($key, PA::$network_info->network_id, $page_type, null, $only_configurable); if ($page_settings) { $cache_id = "dyn_page_{$key}"; if (FileCache::is_cached($cache_id)) { $dynamic_page = FileCache::fetch($cache_id); } else { $dynamic_page = new DynamicPage($key); FileCache::store($cache_id, $dynamic_page, 1200); } if (!is_object($dynamic_page) or !$dynamic_page->docLoaded) { throw new Exception("Page XML config file for page ID: {$page_id} - not found!"); } $dynamic_page->initialize(); if (!$from_XML) { foreach ($page_settings as $section => $value) { $dynamic_page->{$section} = $value; } } // also return the api_id $dynamic_page->api_id = strtolower(preg_replace("/^PAGE_/", '', $const_name)); $return[] = $dynamic_page; } } } FileCache::store($page_type . '_module_default_setting', $return, 1200); } Logger::log('Exit: function ModuleSetting::get_pages_default_setting'); return $return; }