/** * Decides what to do with the current url setup * * @version 1.0 * @since 1.0.0 * @author Dan Aldridge * * @return void */ public function invokeRoute() { // Get instanced $objRoute = Core_Classes_coreObj::getRoute(); $module = $this->module; $this->module = 'Admin_Modules_' . $this->module; // if defaults are being loaded for the core acp panel, then we want dashboard not index if ($this->action == 'index' && $module == 'core') { $this->action = 'dashboard'; } // if nothing is selected, index all the way if (is_empty($this->action)) { $this->action = 'index'; } $action = array($this->action); if (strpos($this->action, '/') !== false) { $action = explode('/', $this->action); } $panels = cmsROOT . 'modules/%s/panels/'; $panels = sprintf($panels, $module); // check if we are dealing with the sub panels or not if (file_exists($panels) && is_readable($panels) && count(glob($panels . 'panel.*.php'))) { // we are ! $method = array_shift($action); if (!isset($action[0]) || is_empty($action[0])) { $action[0] = $method; } $args = array('method' => $method, 'args' => $action); // check the panel to see if it exists, if so include it $path = sprintf($panels, $module) . 'panel.' . $args['method'] . '.php'; if (file_exists($path) && is_readable($path)) { require_once $path; DEBUG ? debugLog($path, 'invokeRoute(): Loaded sub panel... ') : ''; } else { trigger_error('Error: Could not load ACP Panel: ' . $path); } // then call to it like normal :D $method = reflectMethod($this->module . '_' . $args['method'], $args['args'][0], $args); } else { $method = reflectMethod($this->module, array_shift($action), $action); } if ($method === false) { $objRoute->throwHTTP(404); } }
/** * Registers Cache hooks * * @version 2.0 * @since 1.0.0 * @author Dan Aldridge * * @param string $file Alias for Cache Store */ public function doCache($file) { $return = false; switch ($file) { case 'config': $return = $this->generate_config_cache(); break; case 'routes': $return = Core_Classes_coreObj::getRoute()->generate_cache(); break; case 'blocks': $return = Core_Classes_coreObj::getBlocks()->generate_cache(); break; case 'statistics': $return = $this->generate_stats_cache(); break; case 'plugins': $query = Core_Classes_coreObj::getDBO()->queryBuilder()->select('*')->from('#__' . $file)->build(); $this->setup($file, $query); break; } // TODO: throw a hook in here, and modify this baby so the hook can add to this switch without modifying the core code... hrm ;x - xLink if ($return !== false) { $this->writeFile($file, $return); } }
<?php /*======================================================================*\ || Cybershade CMS - Your CMS, Your Way || \*======================================================================*/ define('INDEX_CHECK', true); define('cmsDEBUG', true); $GET = $_GET; require_once 'core/core.php'; $objRoute = Core_Classes_coreObj::getRoute(); $objPage = Core_Classes_coreObj::getPage(); $objTPL = Core_Classes_coreObj::getTPL(); $objAdmin = Core_Classes_coreObj::getAdminCP('', $GET); $objUser = Core_Classes_coreObj::getUser(); $objRoute->modifyGET($GET); if (!Core_Classes_User::$IS_ONLINE || !Core_Classes_User::$IS_ADMIN) { // Need to sort out login // $objRoute->throwHTTP(404); $objPage->redirect('/' . root() . 'login'); exit; } $objPage->setTheme('perfectum-mootools'); $objPage->addBreadcrumbs(array(array('url' => '/' . root() . $objAdmin->mode . '/', 'name' => ucwords($objAdmin->mode) . ' Control Panel'))); $objPage->setTitle('Cybershade CMS Administration Panel'); // grab the nav and throw the baSic tpl setups together $objAdmin->getNav(); $objPage->tplGlobals(); // sort the route out, see what we need to do $objAdmin->invokeRoute(); // and then output..something $objPage->showHeader();