db->beginTransaction(); $config = new DatabaseConfig($database); ctx_log_endok(); // load the theme parts ctx_log_start("Loading themelets"); foreach(_get_themelet_files(get_theme()) as $themelet) { require_once $themelet; } ctx_log_endok(); _load_extensions(); // start the page generation waterfall $page = class_exists("CustomPage") ? new CustomPage() : new Page(); $user = _get_user(); send_event(new InitExtEvent()); if(!is_cli()) { // web request send_event(new PageRequestEvent(@$_GET["q"])); $page->display(); } else { // command line request send_event(new CommandEvent($argv)); } $database->db->commit(); // saving cache data and profiling data to disk can happen later if(function_exists("fastcgi_finish_request")) fastcgi_finish_request(); ctx_log_endok(); } catch(Exception $e) { if($database && $database->db) $database->db->rollback(); _fatal_error($e); ctx_log_ender(); } ?>