public static function index() { return function ($request, $response) { $tpl = Template::load('register.html'); echo $tpl->render(array()); }; }
public function displayError() { if (!ini_get('display_errors')) { return; } $messages = explode("\n", $this->message); $messages = array_map('trim', $messages); $messages = array_filter($messages, 'strlen'); $messages = array_values($messages); $param = array("code" => $this->code, "messages" => $messages, "file" => $this->file, "line" => $this->line, "trace" => debug_backtrace()); $template = new Template(); // set template $template->assign_vars($param); // load template if (!self::$template_filename) { self::$template_filename = dirname(__FILE__) . '/../../component/view/Exception.tpl'; } if ($template->load(self::$template_filename)) { $html = $template->get_display_template(true); } else { throw new PMPException('Sysmtem Error ' . __CLASS__ . ' ' . __LINE__); } print $html; exit; }
static function Related_Terms($attributes = Null) { $attributes = Is_Array($attributes) ? $attributes : array(); $attributes = Array_Merge(array('number' => 5), $attributes); $related_terms = Core::getTagRelatedTerms($attributes); return Template::load('glossary-related-terms.php', array('attributes' => $attributes, 'related_terms' => $related_terms)); }
public function display() { $rolelist = new Template(); $rolelist->load("role_list"); $actions = ActionList::get("rolelist"); if (isset($_POST['insert'])) { $role = new Role(); $role->name = $_POST['insert']; $role->insert(); } if (isset($_GET['delete'])) { $role = new Role(); $role->ID = $_GET['delete']; $role->delete(); } $table = new Table(); $id = new TableColumn("id", Language::DirectTranslate("ID")); $id->autoWidth = true; $name = new TableColumn("name", Language::DirectTranslate("NAME")); $table->columns->add($id); $table->columns->add($name); $table->name = "{'dbprefix'}roles"; $table->actions = "rolelist"; $table->orderBy = "name"; $table->cacheName = "rolelist"; $rolelist->assign_var("TABLE", $table->getCode()); $rolelist->output(); }
public function view($name) { $template = new Template(); $template->load($name); $this->template = $template; return $this; }
public function display() { $template = new Template(); $template->load("plugin_contactform_contactform"); $template->show_if('SHOWFORM', true); $template->show_if('SHOWMESSAGE', false); if (isset($_POST["contactformsubmit"]) && $_POST["url"] == "" && $_POST["inputspamcontrol"] == $_SESSION["plugin_contactform_result"]) { $settings = Settings::getRootInstance()->specify("plugin", "contactform"); $plugin_contactform_receiver = $settings->get("contactform_mail"); $plugin_contactform_sendername = $_POST['inputname']; $plugin_contactform_sendermail = $_POST['inputmail']; $plugin_contactform_text = $_POST['inputtext']; $plugin_contactform_subject = Language::DirectTranslate("plugin_contactform_pagetypetitle") . " " . Settings::getInstance()->get("title"); mail($plugin_contactform_receiver, $plugin_contactform_subject, $plugin_contactform_text, "From: {$plugin_contactform_sendername} <{$plugin_contactform_sendermail}>"); $_SESSION['plugin_contactform_result'] = ""; $template->show_if('SHOWFORM', false); $template->show_if('SHOWMESSAGE', true); $template->assign_var("SUCCESSMESSAGE", $settings->get("contactform_successmessage")); } $plugin_contactform_numberone = rand(1, 10); $plugin_contactform_numbertwo = rand(1, 10); $_SESSION['plugin_contactform_result'] = $plugin_contactform_numberone + $plugin_contactform_numbertwo; $template->assign_var('FORMURL', UrlRewriting::GetUrlByAlias($this->page->alias)); $template->assign_var('NUMBER1', $plugin_contactform_numberone); $template->assign_var('NUMBER2', $plugin_contactform_numbertwo); Cache::clear(); echo $template->getCode(); }
public function display() { $template = new Template(); $template->load("plugins"); $plugins = new PluginList(); $plugins->loadAll(); foreach ($plugins->plugins as $plugin) { $index = $template->add_loop_item("PLUGINS"); if (isset($_GET['activate']) && $_GET['activate'] == $plugin->path) { $plugin->activate(); } elseif (isset($_GET['deactivate']) && $_GET['deactivate'] == $plugin->path) { $plugin->deactivate(); } $template->assign_loop_var("PLUGINS", $index, "NAME", htmlentities($plugin->name)); $template->assign_loop_var("PLUGINS", $index, "PATH", htmlentities($plugin->path)); $template->assign_loop_var("PLUGINS", $index, "DESCRIPTION", htmlentities($plugin->getDescription())); $template->assign_loop_var("PLUGINS", $index, "VERSION", $plugin->version); $template->assign_loop_var("PLUGINS", $index, "AUTHORLINK", $plugin->authorLink); $template->assign_loop_var("PLUGINS", $index, "AUTHORNAME", htmlentities($plugin->authorName)); $template->assign_loop_var("PLUGINS", $index, "LICENSE", htmlentities($plugin->license)); $template->assign_loop_var("PLUGINS", $index, "LICENSEURL", htmlentities($plugin->licenseUrl)); if ($plugin->isActivated()) { $myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "deactivate=" . urlencode($plugin->path)); $disable = Language::DirectTranslateHtml("DISABLE"); $template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $disable . "</a>"); } else { $myurl = UrlRewriting::GetUrlByAlias($this->page->alias, "activate=" . urlencode($plugin->path)); $enable = Language::DirectTranslateHtml("ENABLE"); $template->assign_loop_var("PLUGINS", $index, "ACTIVATIONLINK", "<a href=\"" . $myurl . "\">" . $enable . "</a>"); } } $template->assign_var("HOST", Settings::getValue("host")); $template->assign_var("APIKEY", Settings::getValue("apikey")); $template->output(); }
protected function upload() { $template = new Template(); $template->load("upload"); $template->assign_var("REFERRER", $_POST['referrer']); $template->show_if("SHOW_MEDIALIBARY", false); if (!file_exists(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'])) { mkdir(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir']); } if (FileServer::upload(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'], $_FILES['file'])) { $name = $_FILES['file']['name']; $template->assign_var("MESSAGE", str_replace("{FILENAME}", $name, Language::DirectTranslate("FILE_UPLOADED"))); $path_info = pathinfo(Settings::getInstance()->get("root") . "content/uploads" . $_SESSION['dir'] . "/" . $name); if (strtolower($path_info['extension'] == 'jpg') or strtolower($path_info['extension'] == 'jpeg') or strtolower($path_info['extension'] == 'gif') or strtolower($path_info['extension'] == 'png') or strtolower($path_info['extension'] == 'bmp')) { $template->show_if("SHOW_MEDIALIBARY", true); $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/media/addimage")); $template->assign_var("FILE_PATH", Settings::getInstance()->get("host") . "content/uploads" . $_SESSION['dir'] . "/" . $name); } } else { if (FileServer::$uploadFailure != "") { $template->assign_var("MESSAGE", FileServer::$uploadFailure); } else { $template->assign_var("MESSAGE", Language::DirectTranslate("FILE_NOT_UPLOADED")); } } $template->output(); }
public function load() { $this->headline = Language::DirectTranslate("plugin_menulistwidget_menus"); if (Cache::contains("menu", "widget_" . $_GET['dir'])) { $this->content = Cache::getData("menu", "widget_" . $_GET['dir']); } else { if (!isset($_GET['dir']) || substr($_GET['dir'], 0, 1) == '.') { $_GET['dir'] = ""; } $template = new Template(); $template->load("plugin_menulistwidget_menulist"); $newmenuurl = UrlRewriting::GetUrlByAlias("admin/newmenu"); $template->assign_var("NEWMENUURL", $newmenuurl); $menus = sys::getMenues($_GET['dir']); foreach ($menus as $menu) { $index = $template->add_loop_item("MENUS"); $template->assign_loop_var("MENUS", $index, "ID", $menu->id); $template->assign_loop_var("MENUS", $index, "TITLE", $menu->name); $template->assign_loop_var("MENUS", $index, "PAGES", $menu->count); $editurl = UrlRewriting::GetUrlByAlias("admin/editmenu", "menu=" . $menu->id); $template->assign_loop_var("MENUS", $index, "EDITURL", $editurl); $deleteurl = UrlRewriting::GetUrlByAlias("admin/deletemenu", "menu=" . $menu->id); $template->assign_loop_var("MENUS", $index, "DELETEURL", $deleteurl); } if (!$menus) { $template->assign_var("NOMENUS", Language::DirectTranslate("plugin_menulistwidget_no_menus")); } else { $template->assign_var("NOMENUS", ""); } $this->content = $template->getCode(); Cache::setData("menu", "widget_" . $_GET['dir'], $this->content); } }
public function display() { $template = new Template(); $template->load("plugin_changepassword_changepassword"); $template->show_if('PASSWORD_WRONG', false); $template->show_if('SUCCESSFUL', false); $template->show_if('OLD_PASSWORD_WRONG', false); if (isset($_REQUEST['old_password']) && !empty($_REQUEST['old_password']) && is_string($_REQUEST['old_password']) && isset($_REQUEST['new_password']) && !empty($_REQUEST['new_password']) && is_string($_REQUEST['new_password']) && isset($_REQUEST['confirm_password']) && !empty($_REQUEST['confirm_password']) && is_string($_REQUEST['confirm_password'])) { $old_password = DataBase::Current()->EscapeString($_REQUEST['old_password']); $new_password = DataBase::Current()->EscapeString($_REQUEST['new_password']); $confirm_password = DataBase::Current()->EscapeString($_REQUEST['confirm_password']); if ($new_password != $confirm_password) { $template->show_if('PASSWORD_WRONG', true); } else { $password = DataBase::Current()->EscapeString(md5($new_password . Settings::getInstance()->get("salt"))); $old_password = DataBase::Current()->EscapeString(md5($old_password . Settings::getInstance()->get("salt"))); $db_password = DataBase::Current()->ReadField("SELECT `password` FROM `{'dbprefix'}user` WHERE `id` = '" . User::Current()->id . "'; "); if ($db_password && $db_password != null) { if ($db_password != $old_password) { $template->show_if('OLD_PASSWORD_WRONG', true); } else { DataBase::Current()->Execute("UPDATE `{'dbprefix'}user` SET `password` = '" . $password . "' WHERE `id` = '" . User::Current()->id . "'; "); $template->show_if('SUCCESSFUL', true); EventManager::raiseEvent("plugin_changepassword_change", array('old_password' => $old_password, 'new_password' => $password, 'userid' => User::Current()->id)); Cache::clear("tables", "userlist"); } } else { //Der User ist nicht in der Datenbank aufgeführt. } } } $template->assign_var('ACTION', UrlRewriting::GetUrlByAlias($this->page->alias)); echo $template->getCode(); }
function __construct($contents) { $this->reg = Registry::getInstance(); //access to app_data $array_app = (array) $this->reg->app_data; Template::load($contents, $array_app); }
/** * * @return string */ public function getCode() { if (isset($_POST['save'])) { foreach ($_POST as $property => $value) { if ($property != "save" && $property != "roles") { $settings = Settings::getRootInstance()->specify($this->areaType, $this->area); if ($this->dir != "" && $this->dir != "/") { $settings = $settings->dir($this->dir); } $settings->set($property, $value, $this->role); } } Settings::forceReload(); Cache::clear(); Language::GetGlobal()->ClearCache(); if (@header("Location:" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']))) { exit; } else { die("<script>window.location.href = '" . str_replace("&save_settings=1", "", $_SERVER['REQUEST_URI']) . "';</script>"); } $changed = true; } $template = new Template(); $template->load($this->template); if ($this->area != "global" || $this->areaType != "global") { $roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">"; } else { $roleselector = "<select name=\"roles\" onchange=\"document.location.href='" . $this->url . $this->getQuerySeperator() . "role=' + this.options[this.selectedIndex].value + '&save_settings=1';\">"; } $roles = DataBase::Current()->ReadRows("SELECT * FROM {'dbprefix'}roles ORDER BY name"); if ($roles) { foreach ($roles as $role) { if ($this->role == $role->id) { $roleselector .= "<option value=\"" . $role->id . "\" selected=\"selected\">" . htmlentities($role->name) . "</option>"; } else { $roleselector .= "<option value=\"" . $role->id . "\">" . $role->name . "</option>"; } } } $roleselector .= "</select>"; $template->assign_var("ROLES", $roleselector); if ($this->area != "global" || $this->areaType != "global") { $template->assign_var("URL", $this->url . $this->getQuerySeperator() . "areatype=" . urlencode($this->areaType) . "&area=" . urlencode($this->area) . "&role=" . $this->role . "&save_settings=1"); } else { $template->assign_var("URL", $this->url . $this->getQuerySeperator() . "role=" . $this->role . "&save_settings=1"); } $rows = Settings::getRootInstance()->specify($this->areaType, $this->area)->dir($this->dir)->getRows($this->role); if ($rows) { foreach ($rows as $row) { $index = $template->add_loop_item("SETTINGS"); $template->assign_loop_var("SETTINGS", $index, "PROPERTY", $row['name']); $template->assign_loop_var("SETTINGS", $index, "DESCRIPTION", htmlentities($row['description'])); $control = new $row['type'](); $control->name = $row['name']; $control->value = $row['value']; $template->assign_loop_var("SETTINGS", $index, "CONTROL", $control->getCode()); } } return $template->getCode(); }
public function display() { $template = new Template(); if (!isset($_GET['delete'])) { $template->load("menu_delete"); $template->assign_var("CANCELURL", "javascript:history.back()"); $template->assign_var("DELETEURL", $this->page->GetUrl("menu=" . urlencode($_GET['menu']) . "&delete=true")); } else { $template->load("message"); if (Menu::delete(DataBase::Current()->EscapeString($_GET['menu']))) { $template->assign_var("MESSAGE", Language::DirectTranslate("MENU_DELETED")); } else { $template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_DELETED")); } } $template->output(); }
static function printFilter($filter_depth = False) { $prefix_filter = self::generate($filter_depth); if (!empty($prefix_filter)) { echo Template::load('glossary-prefix-filter.php', array('filter' => $prefix_filter)); } else { return False; } }
/** * inint index */ public function index() { // ถ้าไม่มีโมดูลเลือกหน้า home $module = empty($_GET['module']) ? 'home' : $_GET['module']; // สร้าง View $view = $this->createView('Index\\Index\\View'); // template default $view->add(array('MENU' => createClass('Index\\Menu\\Controller')->render($module), 'TITLE' => 'Welcome to GCMS++', 'CONTENT' => \Template::load('', '', $module), 'TIME' => \Date::format())); // output เป็น HTML $view->renderHTML(); }
function def($request, $response) { if (!$request->session('id')) { $tpl = Template::load('login.html'); echo $tpl->render(array('title' => 'Login', 'message' => $request->session('id'))); } else { $tpl = Template::load('index.html'); $data = array("title" => "WebApp Boilerplate", "message" => "I'm using Twig with erb syntax, id:" . $request->session('id')); echo $tpl->render($data); } }
/** * * @return string */ public function getEditableCode() { $template = new Template(); $template->load("control_wysiwyg"); $template->assign_var("CONTENT", $this->page->getEditorContent($this)); $template->assign_var("HOST", Settings::getInstance()->get("host")); $template->assign_var("ALIAS", $this->page->alias); $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $this->page->alias)); $template->assign_var("LANG", strtolower(Settings::getInstance()->get("language"))); $template->assign_var("PREVIEWURL", $this->page->GetUrl()); return $template->getCode(); }
public static function handleUncaughtException(\Exception $instance) { @ob_end_clean(); if (Database::inTransaction()) { Database::rollBack(); } if (!$instance instanceof Error) { $instance = new self($instance->getMessage(), intval($instance->getCode()), $instance, $instance->getTrace()); } include Template::load('Misc/Error'); exit; }
public function display() { $template = new Template(); $template->load("menu_new"); $template->show_if("NOTSUCCEEDED", isset($_POST['name']) == false); $template->show_if("SUCCEEDED", false); if ($_GET['blank'] == true) { $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu", "blank=true")); } else { $template->assign_var("URL", UrlRewriting::GetUrlByAlias("admin/newmenu")); } if (isset($_POST['name'])) { $template->show_if("SUCCEEDED", true); $id = Menu::create($_POST['name'], $_SESSION['dir']); if (!$id) { $template->load("message"); $template->assign_var("MESSAGE", Language::DirectTranslate("MENU_NOT_CREATED")); } } $template->output(); }
public function display() { $language = new Language($_GET['language']); if (isset($_POST['translation'])) { $language->updateTranslation($_GET['token'], $_POST['translation']); Cache::clear("language"); } $template = new Template(); $template->load("translationtokeneditor"); $template->assign_var("ORIGINAL", Language::DirectTranslate($_GET['token'])); $template->assign_var("TRANSLATION", $language->getString($_GET['token'])); $template->output(); }
public function display() { $template = new Template(); $template->load("new_form"); $template->show_if("SUCCEEDED", false); $template->show_if("NOTSUCCEEDED", isset($_POST['name']) == false); if ($_GET['blank'] == true) { $url = UrlRewriting::GetUrlByAlias("admin/newform", "blank=true"); } else { $url = UrlRewriting::GetUrlByAlias("admin/newform"); } $template->assign_var("URL", $url); if (isset($_POST['name'])) { $template->show_if("SUCCEEDED"); $id = Form::create($_POST['name'], $_SESSION['dir']); if (!$id) { $template->load("message"); $template->assign_var("MESSAGE", $language->getString("FORM_NOT_CREATED")); } } $template->output(); }
/** * อ่านอีเมล์ที่แก้ไข * id = 0 สร้างอีเมล์ใหม่ * * @param int $id * @return object|bool คืนค่าข้อมูล object ไม่พบคืนค่า false */ public static function getIndex($id) { if (is_int($id)) { if (empty($id)) { $index = (object) array('id' => 0, 'from_email' => '', 'copy_to' => '', 'subject' => '', 'language' => Language::name(), 'detail' => Template::load('', '', 'mailtemplate'), 'name' => ''); } else { $model = new static(); $index = $model->db()->first($model->getFullTableName('emailtemplate'), array('id', $id)); } return $index; } return false; }
public function display() { $userlist = new Template(); $userlist->load("user_list"); $userlist->assign_var("URL", $this->page->GetUrl()); if (isset($_POST['insert'])) { $user = new User(); $user->name = $_POST['name']; $user->role = $_POST['new_user_role']; $user->email = $_POST['email']; if (!$user->insert($_POST['password'])) { $userlist->assign_var("MSG", Language::DirectTranslateHtml("USER_NOT_CREATED")); } } if (isset($_GET['delete'])) { $user = new User(); $user->id = $_GET['delete']; if (!$user->delete()) { $userlist->assign_var("MSG", Language::DirectTranslateHtml("USER_NOT_DELETED")); } } $userlist->assign_var("MSG", ""); Cache::clear("tables", "userlist"); $table = new Table(); $id = new TableColumn("id", Language::DirectTranslate("ID")); $id->autoWidth = true; $name = new TableColumn("name", Language::DirectTranslate("NAME")); $role = new TableColumn("role", Language::DirectTranslate("ROLE"), "IFNULL((SELECT name FROM {'dbprefix'}roles WHERE id = {'dbprefix'}user.role),'')"); $email = new TableColumn("email", Language::DirectTranslate("EMAIL")); $created = new TableColumn("create_timestamp", Language::DirectTranslate("CREATED_ON")); $created->autoWidth = true; $access = new TableColumn("last_access_timestamp", Language::DirectTranslate("LAST_ACCESS")); $access->autoWidth = true; $table->columns->add($id); $table->columns->add($name); $table->columns->add($role); $table->columns->add($email); $table->columns->add($created); $table->columns->add($access); $table->name = "{'dbprefix'}user"; $table->actions = "userlist"; $table->orderBy = "name"; $table->cacheName = "userlist"; $userlist->assign_var("TABLE", $table->getCode()); $roles = new RoleSelector(); $roles->hideSpecialRoles = true; $roles->name = "new_user_role"; $userlist->assign_var("ROLES", $roles->getCode()); $userlist->output(); }
public function load() { $dir = ''; if (isset($_GET['dir']) && substr($_GET['dir'], 0, 1) != '.') { $dir = $_GET['dir']; } $this->headline = Language::DirectTranslate("plugin_pagelistwidget_pages"); if (Cache::contains("page", "widget_" . $dir)) { $this->content = Cache::getData("page", "widget_" . $dir); } else { $template = new Template(); $template->load("plugin_pagelistwidget_pagelist"); $pages = Page::getPagesByDir($dir); if (substr($dir, 0, 1) == "/") { $shortdir = substr($dir, 1); } else { $shortdir = $dir; } if ($pages) { foreach ($pages as $page) { $shortalias = substr($page->alias, strlen($shortdir)); if (substr($shortalias, 0, 1) == "/") { $shortalias = substr($shortalias, 1); } else { $shortalias = $shortalias; } if (!strpos($shortalias, "/")) { $host = Settings::getInstance()->get("host"); $index = $template->add_loop_item("PAGES"); $template->assign_loop_var("PAGES", $index, "TITLE", $page->title); $template->assign_loop_var("PAGES", $index, "ALIAS", $shortalias); $editurl = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $page->alias); $template->assign_loop_var("PAGES", $index, "EDITURL", $editurl); $deleteurl = UrlRewriting::GetUrlByAlias("admin/pagedelete", "site=" . $page->alias); $template->assign_loop_var("PAGES", $index, "DELETEURL", $deleteurl); $showurl = UrlRewriting::GetUrlByAlias($page->alias); $template->assign_loop_var("PAGES", $index, "SHOWURL", $showurl); } } $template->assign_var("NOPAGES", ""); } else { $template->assign_var("NOPAGES", Language::DirectTranslate("plugin_pagelistwidget_no_pages")); } $this->content = $template->getCode(); if (isset($_GET['dir'])) { Cache::setData("page", "widget_" . $_GET['dir'], $this->content); } } }
/** * * Report the error * * @param [string] The message to be displayed * @param [boolean] Whether or not to display PHP backtrace */ function report($msg, $backtrace = true) { // Check for error reporting flag if ($this->config['error_reporting']) { Template::load('error_reporting.html', array("msg" => $msg, "backtrace" => print_r(debug_backtrace(), true))); exit; } else { // Prepare 404 response $Response = new Response(); $Response->setCode(404); $Response->send(); Template::load('404.html'); } exit; }
/** * * @return string */ public function getCode() { $template = new Template(); $template->load("widget_" . $this->displayType); $template->assign_var("HEADLINE", $this->headline); $template->assign_var("CONTENT", $this->content); $template->assign_var("MINWIDTH", $this->minwidth); $template->show_if("HASMINWIDTH", $this->minwidth != -1); $template->assign_var("MAXWIDTH", $this->maxwidth); $template->show_if("HASMAXWIDTH", $this->maxwidth != -1); $template->assign_var("MINHEIGHT", $this->minheight); $template->show_if("HASMINHEIGHT", $this->minheight != -1); $template->assign_var("MAXHEIGHT", $this->maxheight); $template->show_if("HASMAXHEIGHT", $this->maxheight != -1); return $template->getCode(); }
public function display() { $template = new Template(); $template->load("message"); if (ImageServer::insert($_POST['path'], $_POST['name'], $_POST['description'])) { $template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_ADDED")); $redirect = UrlRewriting::GetUrlByAlias("admin/home", "dir=" . urlencode($_SESSION['dir'])); if (isset($_POST['referrer'])) { $redirect = $_POST['referrer']; } echo "<script type='text/javascript'>setTimeout('window.location.href= \\'" . $redirect . "\\'', 1000)</script>"; } else { $template->assign_var("MESSAGE", Language::DirectTranslateHtml("IMAGE_NOT_ADDED")); } $template->output(); }
function loadPage($page = "index") { switch (mb_strtolower($page)) { case "index": Template::load("Index"); break; case "about": Template::load("About"); break; case "contacts": Template::load("Contacts"); break; default: Template::load404error(); break; } }
function def($request, $response) { if (!$request->session('id')) { $tpl = Template::load('index.html'); echo $tpl->render(array('title' => 'Login')); } elseif ($request->session('admin')) { try { $tpl = Template::load('admin_index.html'); echo $tpl->render(array('title' => 'Admin', 'username' => $request->session('username'))); } catch (Exception $e) { echo $e->getMessage(); } } else { $tpl = Template::load('user_index.html'); $data = array("title" => "Adsell", "username" => $request->session('username')); echo $tpl->render($data); } }
/** * * @return string */ public function getEditableCode() { $template = new Template(); $template->load("listpage"); if ($list = unserialize($this->page->getEditorContent($this))) { $template->assign_var("SELECT", str_replace('\\\'', '\'', $list->fillSelect)); $template->assign_var("TEMPLATE", $list->template); } else { $template->assign_var("SELECT", ""); $template->assign_var("TEMPLATE", ""); } $template->assign_var("HOST", Settings::getInstance()->get("host")); $template->assign_var("ALIAS", $this->page->alias); $url = UrlRewriting::GetUrlByAlias("admin/pageedit", "site=" . $this->page->alias); $template->assign_var("URL", $url); $template->assign_var("LANG", Settings::getInstance()->get("language")); return $template->getCode(); }