public function render() { $smarty = new SmartySite(); global $config; if (isset($config['dev']) && $config['dev']) { $smarty->assign("description", $this->getMessage()); $smarty->assign('dev', true); $smarty->assign('exception', $this); $smarty->assign('server', print_r($_SERVER, true)); } else { $smarty->assign('description', 'There was an error displaying this page.'); } $content = $smarty->fetch("application/{$this->template}.tpl"); $layout = $this->selectLayout(); header("HTTP/1.0 {$this->code} {$this->string}"); RenderPage($this->title, $content, $layout, $this->nosql); }
<meta name="Generator" content="&Config.Version;"/> <link rel="stylesheet" type="text/css" title="ChuWiki" href="&Config.URI;&Config.ThemePath;/ChuWiki.css"/> </head> <body> <p id="Logo">&Config.Title;</p> <h1>&Lang.EditTitle; &Page.Name;</h1> <div id="Content" class="Preview"> &Page.Html; </div> <div id="Menu"> <?php echo RenderPage(GetLangVar('MenuPage')); ?> <p><a href="&Config.WikiURI;&Lang.MenuPage;">&Lang.MenuPage;</a></p> </div> <form method="post" action="#"> <div> <textarea id="Wiki" name="Wiki" cols="80" rows="30">&Page.Wiki;</textarea> </div> <p id="PPreviewSave"><input type="submit" id="Preview" name="Preview" value="&Lang.Preview;" accesskey="p"/><input type="submit" id="Save" name="Save" value="&Lang.Save;" accesskey="s"/></p> </form> <div id="Rules"> &Lang.Rules; </div>
protected function render($template = null, $direct = false) { if ($template) { $this->template = $template; } if ($this->tinymce) { Site::TinyMCE(); } $csrf = null; if (isset($_SESSION['csrf'])) { $csrf = $_SESSION['csrf']; } if ((!$this->xhr or !$csrf) and !isset($_GET['rss'])) { $csrf = self::GenerateCSRFHash(); } if ($this->navbar) { $this->assignLayout('navbar', $this->navbar); } $this->smarty->assign("csrf", $csrf); $this->smarty->assign("site", $this->site); // Base URI $protocol = "http"; if (isset($_SERVER['SERVER_PORT']) and $_SERVER['SERVER_PORT'] == 443) { $protocol = "https"; } $baseuri = "{$protocol}://{$_SERVER['HTTP_HOST']}"; $this->smarty->assign("protocol", $protocol); $this->smarty->assign("baseuri", $baseuri); $page = $this->smarty->fetch($this->template); if ($direct) { echo $page; } else { RenderPage($this->title, $page, $this->layout, false, $this->layoutVars); } }