コード例 #1
0
ファイル: Debug.php プロジェクト: swat30/safeballot
    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;
    }
コード例 #2
0
ファイル: contact.php プロジェクト: ItsHaden/epicLanBootstrap
 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;
     }
 }
コード例 #3
0
 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);
 }
コード例 #4
0
 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]);
 }
コード例 #5
0
ファイル: Site.php プロジェクト: anas/feedstore
    {
        $this->metaTitle = $metaTitle;
    }
    function setMetaDescription($metaDescription)
    {
        $this->metaDescription = $metaDescription;
    }
    function setMetaKeywords($metaKeywords)
    {
        $this->metaKeywords = $metaKeywords;
    }
}
/* In order to use function chaining (object dereferencing) we need to redefine the compiler class */
class Smarty_Compiler_Norex extends Smarty_Compiler
{
    public $_obj_call_regexp = null;
    function __construct()
    {
        $this->Smarty_Compiler();
        $this->_obj_call_regexp = '(?:' . $this->_obj_start_regexp . '(?:' . $this->_obj_params_regexp . '' . '(?:' . $this->_obj_ext_regexp . '(?:' . $this->_obj_params_regexp . '|' . $this->_obj_single_param_regexp . '(?:\\s*,\\s*' . $this->_obj_single_param_regexp . ')*))*' . ')?(?:' . $this->_dvar_math_regexp . '(?:' . $this->_num_const_regexp . '|' . $this->_dvar_math_var_regexp . ')*)?)';
    }
}
//require_once(SITE_ROOT . '/core/plugins/resource.db.php');
$smarty = new SmartySite();
$config = Config::singleton();
$smarty->assign('config', $config);
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';
コード例 #6
0
ファイル: output.php プロジェクト: ItsHaden/epicLanBootstrap
function RenderPage($title, $content, $layout = "layout", $nosql = false, $vars = array())
{
    global $site;
    global $config;
    $smarty = new SmartySite();
    $smarty->assign("title", $title);
    $smarty->assign("content", $content);
    $smarty->assign("headcontent", "");
    $smarty->assign("site", $site);
    foreach ($vars as $name => $value) {
        $smarty->assign($name, $value);
    }
    if (isset($_SESSION['csrf'])) {
        $smarty->assign("csrf", $_SESSION['csrf']);
    }
    if (!$nosql) {
        $revert = false;
        if (isset($config['dev_sql']) && $config['dev_sql']) {
            $config['dev_sql'] = false;
            $revert = true;
        }
        $smarty->assign("next_event", Event::next_event());
        $events = array('future' => Event::find_all("(events.visible = true OR events.advertised = true) AND events.enddate > NOW()", "events.enddate ASC"), 'past' => Event::find_all("(events.visible = true OR events.advertised = true) AND events.enddate <= NOW()", "events.enddate DESC"));
        foreach ($events as $type => $collection) {
            ${$type} = array();
            foreach ($collection as $key => $event) {
                if ($event->check_user(Site::CurrentUser())) {
                    array_push(${$type}, $event);
                }
            }
            $smarty->assign("{$type}Events", ${$type});
        }
        $smallEvents = array();
        $largeEvents = array();
        foreach ($future as $event) {
            if ($event->capacity < 50) {
                $smallEvents[] = $event;
            } else {
                $largeEvents[] = $event;
            }
        }
        $smallEvents = array_slice($smallEvents, 0, 3);
        $largeEvents = array_slice($largeEvents, 1, 1);
        $smarty->assign('smallEvents', $smallEvents);
        $smarty->assign('largeEvents', $largeEvents);
        if ($revert) {
            $config['dev_sql'] = true;
        }
    }
    // Determine SSL or not
    $protocol = "http";
    if (isset($_SERVER['SERVER_PORT']) and $_SERVER['SERVER_PORT'] == 443) {
        $protocol = "https";
    }
    $baseuri = "{$protocol}://{$_SERVER['HTTP_HOST']}";
    $smarty->assign("protocol", $protocol);
    $smarty->assign("baseuri", $baseuri);
    $smarty->display("application/{$layout}.tpl");
    if (isset($config['dev_sql']) && $config['dev_sql']) {
        file_put_contents("logs/sql.log", "\r\n", FILE_APPEND);
    }
    die;
}