/** * Process everything the queue */ public static function processQueue() { if (!count(self::$queue)) { return false; } $next = FabriqStack::dequeue(); while ($next->controller == '') { if (!count(self::$queue)) { return false; } FabriqStack::processQueue(); } self::$processing = $next; switch ($next->type) { case 'module': $module =& FabriqModules::module($next->controller); call_user_func_array(array($module, $next->action), $next->extra); if (Fabriq::render() != 'none' && FabriqModules::has_permission() && !FabriqModules::stopMappedRender()) { FabriqTemplates::renderToBody($next); } break; case 'controller': default: PathMap::controller($next->controller); PathMap::action($next->action); $file = "app/controllers/{$next->controller}.controller.php"; if (file_exists('sites/' . FabriqStack::site() . "/{$file}")) { require_once 'sites/' . FabriqStack::site() . "/{$file}"; } else { require_once $file; } $c = "{$next->controller}_controller"; $controller = new $c(); $a = str_replace('.', '_', $next->action); if (!$controller->hasMethod($a)) { FabriqStack::error(404); } call_user_func(array($controller, $a)); FabriqTemplates::renderToBody($next); break; } if (count(self::$queue)) { FabriqStack::processQueue(); } }
$aPath = str_replace('index.php?q=', '', $aPath); $aPath = explode('/', $aPath); $i = 0; while ($aPath[$i] != 'fabriqinstall' && $i < count($aPath)) { $appPath .= $aPath[$i] . '/'; $i++; } $_FAPP['url'] = "http://{$_SERVER['HTTP_HOST']}"; $_FAPP['apppath'] = str_replace('//', '/', $appPath); } // require the core files FabriqStack::requireCore(); // check if user is logged in and if not give viewer // unathenticated role FabriqStack::checkUserStatus(); // determine the controller and action to render PathMap::map_path(); // determine which template to set initially FabriqTemplates::init(); // include the controller and action files if (file_exists('sites/' . FabriqStack::site() . '/app/controllers/application.controller.php')) { require_once 'sites/' . FabriqStack::site() . '/app/controllers/application.controller.php'; } else { require_once 'app/controllers/application.controller.php'; } FabriqStack::processQueue(); FabriqTemplates::render(); // close the database connection if ($installed) { $db->close(); }