Esempio n. 1
0
<?php

define('SMARTY_DIR', 'extlibs/smarty/');
define('TEMPLATES_DIR', 'templates');
require_once SMARTY_DIR . 'SmartyBC.class.php';
$smarty = new SmartyBC();
$smarty->setTemplateDir(array(TEMPLATES_DIR, TEMPLATES_DIR . '/partials', TEMPLATES_DIR . '/layouts'));
$smarty->setCompileDir(SMARTY_DIR . 'templates_c/')->setConfigDir(SMARTY_DIR . 'configs/')->setCacheDir(SMARTY_DIR . 'cache/');
$smarty->caching = false;
$smarty->cache_lifetime = 120;
//$smarty->force_compile = true;
//$smarty->debugging = true;
$smarty->assign('site', array('author' => 'Julia Kurnia', 'url' => 'http://zidisha.org', 'email_contact' => '*****@*****.**'));
$smarty->assign('twitter', array('screenname' => 'bestpsdfreebies', 'key' => 'BOmazbuKUiXqpvcdBtuXbw', 'secret' => 'mCt9uC3hi8W7QhzNHRBisg6cEqLKa5bKtmSzQ3Jwc', 'token' => '478633957-N08fggOglJNe5GUMTYeng4xcpc1gvLOe4U4W0u1g', 'token_secret' => 'eb7vaneoNRizPwIDOQktv8wgmNeSKBMdxUXzmHuRQ', 'cache_expire' => 3600, 'tweets' => 3));
// Need to make template_c and cache folders writeable.
// Navigate to libs folder and run these commands in terminal:
// sudo chown nobody:nobody templates_c
// sudo chmod 775 templates_c
// sudo chown nobody:nobody cache
// sudo chmod 775 cache
function smarty_modifier_url($url, $code = null)
{
    return language_url($url, $code);
}
function smarty_function_mixpanel($params, Smarty_Internal_Template $template)
{
    $params += array('script' => 'head');
    if ($params['script'] == 'head') {
        return Mixpanel::head_script();
    }
    return Mixpanel::body_script();
Esempio n. 2
0
 /**
  * @param $index
  * @param $value
  */
 public function __set($index, $value)
 {
     $this->_instance->assign($index, $value);
 }
Esempio n. 3
0
require_once MODULES_PATH . '/Log.lib.php';
require_once MODULES_PATH . '/Cleaner.lib.php';
require_once MODULES_PATH . '/Scout.lib.php';
#require_once(MODULES_PATH . '/HTTP.lib.php');
#require_once(MODULES_PATH . '/Cookie.lib.php');
#require_once(MODULES_PATH . '/CookieStore.lib.php');
#require_once(MODULES_PATH . '/JSON.lib.php');
# Abstract Controller
require_once CONTROLLERS_PATH . '/Controller.lib.php';
require_once SMARTY_CLASS_PATH . '/SmartyBC.class.php';
$smarty = new SmartyBC();
$smarty->template_dir = TEMPLATE_PATH;
$smarty->compile_dir = SMARTY_TEMPLATE_C_PATH;
$smarty->config_dir = SMARTY_CONFIGS_PATH;
$smarty->cache_dir = SMARTY_CACHE_PATH;
$smarty->assign('site_url', SITE_URL);
$smarty->assign('template_url', TEMPLATE_URL);
if (MODE == 'staging') {
    $smarty->caching = 0;
    $smarty->cache_lifetime = 0;
}
Gbl::store('template_engine', $smarty);
# create the system log, used for most logging
$system_log = new Log(SYSTEM_LOG_PATH, LOG_LEVEL_ALL);
Gbl::store('system_log', $system_log);
# authentication types -- auth module
define('AUTH_SITE', 0);
# cleaner types -- used by the Cleaner module.
define('CTYPE_ARRAY', 0);
define('CTYPE_REGEX', 1);
define('CTYPE_INT', 2);
<?php

require_once $basedir . "/vendor/autoload.php";
$smarty = new SmartyBC();
$smarty->setTemplateDir($basedir . '/templates');
$smarty->setCompileDir($basedir . '/templates_c');
$smarty->setCacheDir($basedir . '/cache');
$smarty->setConfigDir($basedir . '/configs');
$smarty->security = false;
$smarty->setCaching(Smarty::CACHING_LIFETIME_SAVED);
$smarty->assign('baseurl', $baseurl);
Esempio n. 5
0
/* Copyright 2008 Timothy White */
// Page loading time
$mtime = microtime();
$mtime = explode(" ", $mtime);
$mtime = $mtime[1] + $mtime[0];
$pagestarttime = $mtime;
// Settings
require_once "MDB2.php";
require_once __DIR__ . '/../../../vendor/autoload.php';
require_once '../radmin/includes/site_settings.inc.php';
require_once '../radmin/includes/misc_functions.inc.php';
$smarty = new SmartyBC();
// TODO Detect browser settings and allow override of language?
\Grase\Locale::applyLocale($Settings->getSetting('locale'));
#$smarty->register_block('t', 'smarty_block_t');
$smarty->assign("Location", $Settings->getSetting('locationName'));
$smarty->assign("Support", array("link" => $Settings->getSetting('supportContactLink'), "name" => $Settings->getSetting('supportContactName')));
$smarty->assign("website_name", $Settings->getSetting('websiteName'));
$smarty->assign("website_link", $Settings->getSetting('websiteLink'));
$networkoptions = unserialize($Settings->getSetting("networkoptions"));
$lanIP = $networkoptions['lanipaddress'];
$smarty->assign("serverip", $lanIP);
custom_settings(array('hidefooter', 'hideheader', 'hidemenu', 'disableallcss', 'hidehelplink', 'hidenormallogin'));
$logintitle = $Settings->getSetting('logintitle');
if ($logintitle == '') {
    $logintitle = $Settings->getSetting('locationName') . " Hotspot";
}
$smarty->assign("logintitle", $logintitle);
$freeloginbuttontext = $Settings->getSetting('freeloginbuttontext');
if ($freeloginbuttontext == '') {
    $freeloginbuttontext = T_('Free Access');
 public static function fatalNoDatabaseError($error)
 {
     global $NONINTERACTIVE_SCRIPT;
     if (isset($NONINTERACTIVE_SCRIPT) && $NONINTERACTIVE_SCRIPT) {
         // Non-interactive script running, return error message as comments
         echo "#error_occured\n";
         echo "# An error has occured in the application\n";
         echo "# ::{$error}::\n";
         echo "# Memory used: " . memory_get_usage() . "\n";
         die;
     }
     $smarty = new \SmartyBC();
     $smarty->compile_check = true;
     $smarty->register_block('t', 'smarty_block_t');
     // Needed even though message will be in English
     $smarty->assign("Application", APPLICATION_NAME);
     $smarty->assign("error", $error);
     $smarty->assign("memory_used", memory_get_usage());
     $smarty->display("error.tpl");
     die;
 }
Esempio n. 7
0
define("LITO_MAIN_CSS", LITO_ROOT_PATH_URL . 'css/' . LITO_THEMES);
define("LITO_JS_URL", LITO_ROOT_PATH_URL . 'js/');
define("LITO_GLOBAL_IMAGE_URL", LITO_ROOT_PATH_URL . 'images/');
$lang_suffix = "de";
require LITO_ROOT_PATH . 'options/options.php';
require LITO_INCLUDES_PATH . 'functions.php';
require LITO_INCLUDES_PATH . 'smarty/SmartyBC.class.php';
// Smarty class laden und pr�fen
$time_start = explode(' ', substr(microtime(), 1));
$time_start = $time_start[1] + $time_start[0];
$tpl = new SmartyBC();
$tpl->template_dir = LITO_THEMES_PATH;
$tpl->compile_dir = LITO_CACHE_PATH . 'Smarty/templates_c/' . LITO_THEMES . '/';
$tpl->cache_dir = LITO_CACHE_PATH . 'Smarty/cache/ ' . LITO_THEMES . '/';
$tpl->config_load(LITO_LANG_PATH . 'core/lang_' . $lang_suffix . '.php');
$tpl->assign('GAME_TITLE_TEXT', $op_set_gamename);
$is_loged_in = 0;
if (isset($_SESSION['userid'])) {
    $is_loged_in = 1;
    // if Game Online or Offline
    if ($op_set_offline == 1 && $modul_name != "logout") {
        show_error($op_set_offline_message, "core", 0);
        exit;
    }
    // load Userdata array
    $result = $db->query("SELECT u.*,c.* FROM cc" . $n . "_users AS u, cc" . $n . "_countries AS c WHERE u.userid='" . $_SESSION['userid'] . "' AND u.activeid=c.islandid");
    $userdata = $db->fetch_array($result);
    $db->unbuffered_query("UPDATE cc" . $n . "_users SET lastactive='" . time() . "' WHERE userid='" . $userdata['userid'] . "'");
    //disabled Admingame login
    if (intval($db->num_rows($result)) == 0 && $modul_name != "logout") {
        show_error('ADMIN_LOGIN', "core");
Esempio n. 8
0
 /**
  * Get smarty template
  * @return Smarty smarty object
  */
 public static function getSmartyTemplate()
 {
     $smarty = new \SmartyBC();
     $useTheme = !defined('OPENBIZ_USE_THEME') ? 0 : OPENBIZ_USE_THEME;
     if ($useTheme) {
         $theme = Openbizx::$app->getCurrentTheme();
         $themePath = $theme;
         // Openbizx::$app->getConfiguration()->GetThemePath($theme);
         if (is_dir(OPENBIZ_THEME_PATH . "/" . $themePath . "/template")) {
             $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/template";
         } else {
             $templateRoot = OPENBIZ_THEME_PATH . "/" . $themePath . "/templates";
         }
         $smarty->setTemplateDir($templateRoot);
         $compileDir = defined('OPENBIZ_SMARTY_CPL_PATH') ? OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath : $templateRoot . "/cpl";
         $smarty->setCompileDir($compileDir);
         $smarty->setConfigDir($templateRoot . "/cfg");
         $smarty->config_load('tpl.conf');
     } else {
         if (defined('SMARTY_TPL_PATH')) {
             $smarty->setTemplateDir(SMARTY_TPL_PATH);
         }
         if (defined('OPENBIZ_SMARTY_CPL_PATH')) {
             $smarty->setCompileDir(OPENBIZ_SMARTY_CPL_PATH . "/" . $themePath);
         }
         if (defined('SMARTY_CFG_PATH')) {
             $smarty->setConfigDir(SMARTY_CFG_PATH);
         }
     }
     if (!is_dir($smarty->compile_dir)) {
         mkdir($smarty->compile_dir, 0777);
     }
     // load the config file which has the images and css url defined
     $smarty->assign('app_url', OPENBIZ_APP_URL);
     $smarty->assign('app_index', OPENBIZ_APP_INDEX_URL);
     $smarty->assign('js_url', OPENBIZ_JS_URL);
     $smarty->assign('css_url', OPENBIZ_THEME_URL . "/" . $theme . "/css");
     $smarty->assign('resource_url', OPENBIZ_RESOURCE_URL);
     $smarty->assign('resource_php', OPENBIZ_RESOURCE_PHP);
     $smarty->assign('theme_js_url', OPENBIZ_THEME_URL . "/" . $theme . "/js");
     $smarty->assign('theme_url', OPENBIZ_THEME_URL . "/" . $theme);
     $smarty->assign('image_url', OPENBIZ_THEME_URL . "/" . $theme . "/images");
     $smarty->assign('lang', strtolower(I18n::getCurrentLangCode()));
     $smarty->assign('lang_name', I18n::getCurrentLangCode());
     return $smarty;
 }
Esempio n. 9
0
 public function smart_view($view, $vars = array(), $return = FALSE)
 {
     $orgin_view = $view;
     if (!strpos($view, ".php") && !strpos($view, ".tpl")) {
         $view .= ".tpl";
     }
     PC::preparing_view($view);
     $view_name = $view;
     $smarty = new SmartyBC();
     $config =& get_config();
     $this->caching = 1;
     $smarty->setCompileDir(APPPATH . '/third_party/Smarty-3.1.8/templates_c');
     $smarty->setConfigDir(APPPATH . '/third_party/Smarty-3.1.8/configs');
     $smarty->setCacheDir(APPPATH . '/cache');
     if (strpos($this->_module, '_child') !== false) {
         list($path, $_view) = Modules::find($view, $this->_module, 'views/');
         if ($path == FALSE) {
             list($path, $_view) = Modules::find($view, str_replace("_child", "", $this->_module), 'views/');
         }
     } else {
         list($path, $_view) = Modules::find($view, $this->_module . "_child", 'views/');
         if ($path == FALSE) {
             list($path, $_view) = Modules::find($view, $this->_module, 'views/');
         }
     }
     if ($path == FALSE) {
         list($path, $_view) = Modules::find($orgin_view . ".php", $this->_module, 'views/');
         if ($path != FALSE) {
             $view = $orgin_view . ".php";
             $view_name = $view;
         }
     }
     if ($path == FALSE && strpos($this->_module, '_child') !== false) {
         list($path, $_view) = Modules::find($view, str_replace("_child", "", $this->_module), 'views/');
     }
     if ($path != FALSE) {
         $this->_ci_view_paths = array($path => TRUE) + $this->_ci_view_paths;
         $view = $_view;
     }
     $path_fragment = explode("/", $path);
     if ($path_fragment[0] == "modules") {
         global $active_show;
         $controller =& $active_show->controller;
         $theme_path = "themes/" . $controller->BuilderEngine->get_option('active_frontend_theme') . "/modules/" . $this->_module;
         $theme_file = $theme_path . "/" . $_view . ".php";
         if (file_exists($theme_file)) {
             $path = "../../" . $theme_path;
             $this->_ci_view_paths = array($path => TRUE) + $this->_ci_view_paths;
             $view = $path . "/" . $_view;
         }
         // To be updated
         $view_name = basename($view_name);
     }
     global $active_show;
     global $BuilderEngine;
     $vars['BuilderEngine'] =& $BuilderEngine;
     $vars['versions'] =& $active_show->controller->versions;
     $vars['user'] =& $active_show->controller->user;
     $vars['this'] =& $this;
     $smarty->setTemplateDir($path);
     foreach ($vars as $key => $value) {
         $smarty->assign($key, $value);
     }
     $smarty->assign("test_var", "qweqweqwe");
     if ($return) {
         ob_start();
         $smarty->display($view_name);
         $output = ob_get_contents();
         ob_end_clean();
         return $output;
     } else {
         $smarty->display($view_name);
     }
     /*
     global $active_show;
     global $BuilderEngine;
     $vars['BuilderEngine'] = &$BuilderEngine;
     
     
     
     $vars['versions'] = &$active_show->controller->versions;
     
     $vars['user'] = &$active_show->controller->user;
     
     return $this->_ci_load(array('_ci_view' => $view, '_ci_vars' => $this->_ci_object_to_array($vars), '_ci_return' => $return));
     */
 }
Esempio n. 10
0
**/
// use Factory\SmartyFactory;
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
define('FULL_PATH', dirname(__FILE__) . '/');
define('SMARTY_DIR', FULL_PATH . '../../vendor/smarty/smarty/libs/');
define('TEMPLATE_DIR', './templates/');
define('TEMPLATE_C_DIR', './templates_c/');
// $smarty = SmartyFactory::getInstance();
#Remove the factory, for some reasons it doesnt work on PHP 5.3 / CentOs 6
require_once SMARTY_DIR . 'SmartyBC.class.php';
$smarty = new SmartyBC();
$skin_name = $_SESSION["stylefile"];
$smarty->template_dir = TEMPLATE_DIR . $skin_name . '/';
$smarty->compile_dir = TEMPLATE_C_DIR;
$smarty->plugins_dir = "./plugins/";
$smarty->assign("TEXTCONTACT", TEXTCONTACT);
$smarty->assign("EMAILCONTACT", EMAILCONTACT);
$smarty->assign("COPYRIGHT", COPYRIGHT);
$smarty->assign("CCMAINTITLE", CCMAINTITLE);
$smarty->assign("SIGNUPLINK", SIGNUP_LINK);
$smarty->assign("ACXPASSWORD", $ACXPASSWORD);
$smarty->assign("ACXSIP_IAX", $ACXSIP_IAX);
$smarty->assign("ACXCALL_HISTORY", $ACXCALL_HISTORY);
$smarty->assign("ACXPAYMENT_HISTORY", $ACXPAYMENT_HISTORY);
$smarty->assign("ACXVOUCHER", $ACXVOUCHER);
$smarty->assign("ACXINVOICES", $ACXINVOICES);
$smarty->assign("ACXDID", $ACXDID);
$smarty->assign("ACXSPEED_DIAL", $ACXSPEED_DIAL);
$smarty->assign("ACXRATECARD", $ACXRATECARD);
$smarty->assign("ACXSIMULATOR", $ACXSIMULATOR);
$smarty->assign("ACXWEB_PHONE", $ACXWEB_PHONE);
Esempio n. 11
0
**/
// use Factory\SmartyFactory;
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
define('FULL_PATH', dirname(__FILE__) . '/');
define('SMARTY_DIR', FULL_PATH . '../../vendor/smarty/smarty/libs/');
define('TEMPLATE_DIR', '../Public/templates/');
define('TEMPLATE_C_DIR', '../templates_c/');
// $smarty = SmartyFactory::getInstance();
#Remove the factory, for some reasons it doesnt work on PHP 5.3 / CentOs 6
require_once SMARTY_DIR . 'SmartyBC.class.php';
$smarty = new SmartyBC();
$skin_name = $_SESSION["stylefile"];
$smarty->template_dir = TEMPLATE_DIR . $skin_name . '/';
$smarty->compile_dir = TEMPLATE_C_DIR;
$smarty->plugins_dir = "./plugins/";
$smarty->assign("TEXTCONTACT", TEXTCONTACT);
$smarty->assign("EMAILCONTACT", EMAILCONTACT);
$smarty->assign("COPYRIGHT", COPYRIGHT);
$smarty->assign("CCMAINTITLE", CCMAINTITLE);
$smarty->assign("SKIN_NAME", $skin_name);
// if it is a pop window
if (!is_numeric($popup_select)) {
    $popup_select = 0;
}
$smarty->assign("popupwindow", $popup_select);
if (!empty($msg)) {
    switch ($msg) {
        case "nodemo":
            $smarty->assign("MAIN_MSG", '<center><b><font color="red">' . gettext("This option is not available on the Demo!") . '</font></b></center><br>');
    }
}
Esempio n. 12
0
<?php

ini_set("display_errors", 1);
error_reporting(E_ALL);
require "setup.php";
define("PROJECT_DIR", $local_project_dir);
define("SMARTY_DIR", "smarty-3.1.27/libs/");
require SMARTY_DIR . "Smarty.class.php";
$smarty = new SmartyBC();
$smarty->setTemplateDir(PROJECT_DIR . "smarty/templates");
$smarty->setCompileDir(PROJECT_DIR . "smarty/templates_c");
$smarty->setCacheDir(PROJECT_DIR . "smarty/cache");
$smarty->setConfigDir(PROJECT_DIR . "smarty/config");
$smarty->assign('lbr', '{');
$smarty->assign('rbr', '}');
Esempio n. 13
0
if (!defined('INCLUDEPATH')) {
    exit("Request Error!");
}
include_once INCLUDEPATH . "/Smarty/SmartyBC.class.php";
//包含smarty类文件
$smarty = new SmartyBC();
//建立smarty实例对象$smarty
$smarty->caching = FALSE;
//是否使用缓存,项目在调试期间,不建议启用缓存
$smarty->template_dir = TEMPLATESPATH;
//设置模板目录
$smarty->compile_dir = TEMPLATESPATH . "/templets_cache";
//设置编译目录
$smarty->cache_dir = TEMPLATESPATH . "/smarty_cache";
//缓存文件夹
//左右边界符,默认为{},但实际应用当中容易与JavaScript相冲突
$smarty->left_delimiter = "{4yuebook:";
$smarty->right_delimiter = "}";
/*申明的公共变量*/
$smarty->assign('header', TEMPLATESPATH . '/default/header.html');
$smarty->assign('ebookclassify', TEMPLATESPATH . '/default/ebookclassify.html');
//首页分类显示列表
$smarty->assign('thiswriter', TEMPLATESPATH . '/default/thiswriter.html');
//本期作家
$smarty->assign('footer', TEMPLATESPATH . '/default/footer.html');
$smarty->assign('useroperationleft', TEMPLATESPATH . '/system/useroperationleft.html');
//用户个人中心左侧操作列表
$smarty->assign('useroperationright', TEMPLATESPATH . '/system/useroperationright.html');
//用户个人中心右侧操作列表
$smarty->assign('manageoperation', TEMPLATESPATH . '/system/manageoperation.html');
//网站后台左侧操作列表
Esempio n. 14
0
 function showMessage()
 {
     $retval = '';
     if (!empty($_SESSION['message']['title']) && !empty($_SESSION['message']['text'])) {
         switch ($_SESSION['message']['type']) {
             case MSGTYPE_ERROR:
                 $this->smarty->assign('error', $_SESSION['message']['text']);
                 $retval = $this->smarty->fetch($this->template . '/error.tpl');
                 break;
             default:
                 $this->smarty->assign('message', $_SESSION['message']);
                 $retval = $this->smarty->fetch($this->template . '/message.tpl');
                 break;
         }
         unset($_SESSION['message']);
     }
     return $retval;
 }
Esempio n. 15
0
        }
        return '[' . $content . ']';
    }
}
$smarty->registerPlugin('block', 'testRepeat', 'testRepeat');
function insert_testInsert($params, $smarty)
{
    $s = '';
    foreach ($params as $nm => $v) {
        $s .= "[{$nm}: {$v}] ";
    }
    $smarty->assign('insertResult', $s);
    return $s;
}
$smarty2 = new SmartyBC();
$smarty2->assign('testPath', $_SERVER['DOCUMENT_ROOT'] . '/test/templates');
$smarty->assign('includePHP', $smarty2->fetch('include_php.tpl'));
$smarty->assign('php', $smarty2->fetch('php.tpl'));
$smarty3 = new Smarty();
$smarty3->left_delimiter = '<!--{';
$smarty3->right_delimiter = '}-->';
$smarty3->auto_literal = false;
$smarty3->assign('foo', 'bar');
$smarty3->assign('a', array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'));
$smarty->assign('escapeParse', $smarty3->fetch('escape_parsing.tpl'));
function preFilterTest($tpl_source, Smarty_Internal_Template $template)
{
    return preg_replace("/<!--.*-->/U", 'changed in PRE filter', $tpl_source);
}
function preFilterTest2($tpl_source, Smarty_Internal_Template $template)
{
Esempio n. 16
0
 function assign($index = null, $val = null)
 {
     if ($index) {
         $this->tpl_vars[$index] = $val;
         parent::assign($index, $val);
     }
 }
Esempio n. 17
0
**/
// use Factory\SmartyFactory;
error_reporting(E_ALL ^ (E_NOTICE | E_WARNING));
define('FULL_PATH', dirname(__FILE__) . '/');
define('SMARTY_DIR', FULL_PATH . '../../vendor/smarty/smarty/libs/');
define('TEMPLATE_DIR', '../Public/templates/');
define('TEMPLATE_C_DIR', '../templates_c/');
// $smarty = SmartyFactory::getInstance();
#Remove the factory, for some reasons it doesnt work on PHP 5.3 / CentOs 6
require_once SMARTY_DIR . 'SmartyBC.class.php';
$smarty = new SmartyBC();
$skin_name = $_SESSION["stylefile"];
$smarty->template_dir = TEMPLATE_DIR . $skin_name . '/';
$smarty->compile_dir = TEMPLATE_C_DIR;
$smarty->plugins_dir = "./plugins/";
$smarty->assign("TEXTCONTACT", TEXTCONTACT);
$smarty->assign("EMAILCONTACT", EMAILCONTACT);
$smarty->assign("COPYRIGHT", COPYRIGHT);
$smarty->assign("CCMAINTITLE", CCMAINTITLE);
$smarty->assign("SKIN_NAME", $skin_name);
// if it is a pop window
if (!is_numeric($popup_select)) {
    $popup_select = 0;
}
$smarty->assign("popupwindow", $popup_select);
if (!empty($msg)) {
    switch ($msg) {
        case "nodemo":
            $smarty->assign("MAIN_MSG", '<center><b><font color="red">' . gettext("This option is not available on the Demo!") . '</font></b></center><br>');
    }
}