public function CompilePage($a_id, $a_mode = COMPILER_MODE_FRONTEND)
 {
     self::$Mode = $a_mode;
     $result = Database::Query("SELECT * FROM `" . DB_TBL_PAGES . "` WHERE `id` = '" . $a_id . "'");
     if (!$result->HasData()) {
         die("Page with id #" . $a_id . " not found!");
     }
     $this->m_pageid = $result->GetValue('id');
     $this->m_pagename = $result->GetValue('name');
     $compiled = $this->BuildTemplate($result->GetValue('template') . ".tmpl");
     if ($a_mode == COMPILER_MODE_FRONTEND) {
         Database::Query("UPDATE `" . DB_TBL_PAGES . "` SET `compiled` = '" . Database::Escape(serialize($compiled)) . "' WHERE `id` = '" . $a_id . "'");
         return $compiled;
     } else {
         return $compiled;
     }
     // Do not insert editor pages into db
 }
// Error reporting
error_reporting(E_ALL ^ E_NOTICE);
define("FAKE", 1);
include "_cms/includes/global.php";
StopWatch::Start();
ObjMgr::Initialize();
$pageid = isset($_GET['page']) ? $_GET['page'] : Content::GetDefaultPageId();
if (isset($_GET['logout']) && ObjMgr::GetAccount()->m_loggedin) {
    ObjMgr::GetAccount()->Logout();
}
if (isset($_GET['locale'])) {
    Locales::SetUserLocale($_GET['locale']);
}
if (ObjMgr::GetAccount()->m_loggedin) {
    if (isset($_POST['action'])) {
        Compiler::$Mode = COMPILER_MODE_EDITOR;
        // Plugin Hook
        $data_object = new stdClass();
        $data_object->post = $_POST;
        ObjMgr::GetPluginMgr()->ExecuteHook("On_PostAction_" . $_POST['action'], $data_object);
        switch ($_POST['action']) {
            // Saves module data
            case 'module_update':
                Editor::SaveModule($_POST['module_data']);
                exit;
                // Returns module html
            // Returns module html
            case 'module_query':
                print Editor::GetModule($_POST['module_id']);
                exit;
                // Creates module template