public function __toString() { $smarty = new SmartySite(); if (file_exists(SITE_ROOT . '/templates/local')) { $smarty->template_dir = SITE_ROOT . '/templates/local'; } $smarty->compile_dir = SITE_ROOT . '/templates_c'; $smarty->plugins_dir[] = SITE_ROOT . '/core/plugins'; $string = '<script type="text/javascript"> // <![CDATA[ if ( self.name == \'\' ) { var title = \'Console\'; } else { var title = \'Console_\' + self.name; } _smarty_console = window.open("",title.value,"width=780,height=600,resizable,scrollbars=yes");' . "\n"; $smarty->assign('messages', $this->messages); $c = $smarty->fetch('debug.tpl'); $c = str_replace("\n", '', $c); $string .= '_smarty_console.document.write(\'' . $c . '\'); _smarty_console.document.close(); // ]]> </script>\''; return $string; }
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); }
public function send() { if ($this->validate()) { $smarty = new SmartySite(); $smarty->assign("contact", $this); $content = $smarty->fetch("email/contact.email.tpl"); $response = Email::send("*****@*****.**", "epic.LAN", $this->subject, $content, "{$this->name} <{$this->emailaddress}>", "X-Remote-IP: {$this->ip}\r\n"); if ($response !== true) { $this->errors[] = "Unable to send email"; if ($response['message']) { $this->errors[] = $response['message']; } return $response['result']; } else { return true; } } else { return false; } }
public static function render($title = null, $headcontent = null) { self::init(); global $site; global $config; $smarty = new SmartySite(); $smarty->assign("title", $title); $smarty->assign("site", $site); $smarty->assign("content", "|--|CONTENT|--|"); $smarty->assign("headcontent", $headcontent); $smarty->assign("next_event", Event::next_event()); $all_events = Event::find_all("events.visible = true", "events.startdate DESC"); $events = array(); foreach ($all_events as $event) { if ($event->check_user(Site::CurrentUser())) { $events[] = $event; } } $smarty->assign("all_events", $events); $output = $smarty->fetch("application/layout.tpl"); $output = explode("|--|CONTENT|--|", $output); return array("header" => $output[0], "footer" => $output[1]); }