/** * @return \Smarty * @throws \SmartyException */ public static function getInstance() { $smarty = new \SmartyBC(); $securityPolicy = new Smarty_Security($smarty); $securityPolicy->php_handling = \Smarty::PHP_ALLOW; $smarty->enableSecurity($securityPolicy); return $smarty; }
public function __construct() { parent::__construct(); $this->compile_dir = APPPATH . "cache/Smarty/compile"; $this->template_dir = APPPATH . "/views/"; $this->setTemplateDir(APPPATH . "/views/"); $this->assign('APPPATH', APPPATH); $this->assign('BASEPATH', BASEPATH); // Assign CodeIgniter object by reference to CI if (method_exists($this, 'assignByRef')) { $ci =& get_instance(); $this->assignByRef("ci", $ci); } log_message('debug', "Smarty Class Initialized"); }
/** * Constructor - Sets the templateDir and compileDir for the Smarty files * @param <String> - $media Layout/Media name */ function __construct($media = '') { parent::__construct(); $THISDIR = dirname(__FILE__); $templatesDir = ''; $compileDir = ''; $templateDir = []; if (!empty($media)) { self::$currentLayout = $media; $customTemplatesDir = $THISDIR . '/../../custom/layouts/' . $media; $templateDir[] = $THISDIR . '/../../layouts/' . $media; $compileDir = $THISDIR . '/../../cache/templates_c/' . $media; } $defaultLayout = vglobal('defaultLayout'); if ($defaultLayout && is_file(vglobal('root_directory') . '/layouts/' . $defaultLayout)) { $templateDir[] = $THISDIR . '/../../layouts/' . $defaultLayout; } if (empty($templatesDir) || !file_exists($templatesDir)) { self::$currentLayout = self::getDefaultLayoutName(); $templateDir[] = $THISDIR . '/../../custom/layouts/' . self::getDefaultLayoutName(); $templateDir[] = $THISDIR . '/../../layouts/' . self::getDefaultLayoutName(); $compileDir = $THISDIR . '/../../cache/templates_c/' . self::getDefaultLayoutName(); } if (!file_exists($compileDir)) { mkdir($compileDir, 0777, true); } $this->setTemplateDir($templateDir); $this->setCompileDir($compileDir); self::$debugViewer = SysDebug::get('DEBUG_VIEWER'); // FOR SECURITY // Escape all {$variable} to overcome XSS // We need to use {$variable nofilter} to overcome double escaping // TODO: Until we review the use disabled. //$this->registerFilter('variable', array($this, 'safeHtmlFilter')); // FOR DEBUGGING: We need to have this only once. static $debugViewerURI = false; if (self::$debugViewer && $debugViewerURI === false) { $debugViewerURI = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH); if (!empty($_POST)) { $debugViewerURI .= '?' . http_build_query($_POST); } else { $debugViewerURI = $_SERVER['REQUEST_URI']; } $this->log("URI: {$debugViewerURI}, TYPE: " . $_SERVER['REQUEST_METHOD']); } }
/** */ public function __construct() { parent::__construct(); $config = CampSite::GetConfigInstance(); $this->debugging = $config->getSetting('smarty.debugging'); $this->force_compile = $config->getSetting('smarty.force_compile'); $this->compile_check = $config->getSetting('smarty.compile_check'); $this->use_sub_dirs = $config->getSetting('smarty.use_subdirs'); // cache settings $preferencesService = \Zend_Registry::get('container')->getService('system_preferences_service'); $this->useprotocol = $preferencesService->get('SmartyUseProtocol') === 'Y' ? 'true' : 'false'; $this->templateCacheHandler = $preferencesService->TemplateCacheHandler; if ($this->templateCacheHandler) { $this->caching = 1; $this->caching_type = 'newscoop'; CampTemplateCache::factory(); } else { $this->caching = 0; } if (defined('APPLICATION_ENV') && APPLICATION_ENV == 'development') { $this->force_compile = true; } // define dynamic uncached block require_once APPLICATION_PATH . self::PLUGINS . '/block.dynamic.php'; $this->registerPlugin('block', 'dynamic', 'smarty_block_dynamic', false); // define render function require_once APPLICATION_PATH . self::PLUGINS . '/function.render.php'; $this->registerPlugin('function', 'render', 'smarty_function_render', false); // define translate modifier require_once APPLICATION_PATH . self::PLUGINS . '/modifier.translate.php'; $this->registerPlugin('modifier', 'translate', 'smarty_modifier_translate', false); $this->left_delimiter = '{{'; $this->right_delimiter = '}}'; $this->auto_literal = false; $this->cache_dir = APPLICATION_PATH . '/../cache'; $this->compile_dir = APPLICATION_PATH . '/../cache'; $this->plugins_dir = array_merge((array) $this->plugins_dir, array(APPLICATION_PATH . self::PLUGINS), self::getPluginsPluginsDir()); $this->setTemplateDir(array(APPLICATION_PATH . '/../themes/', APPLICATION_PATH . '/../themes/system_templates/', APPLICATION_PATH . self::SCRIPTS)); $this->assign('view', \Zend_Registry::get('container')->get('view')); $this->assign('userindex', false); $this->assign('user', new MetaUser()); $this->assign('siteinfo', array('title' => $preferencesService->SiteTitle, 'keywords' => $preferencesService->SiteMetaKeywords, 'description' => $preferencesService->SiteMetaDescription)); $this->getTemplateTranslationsFiles(); }
/** * Class Constructor */ public function __construct() { parent::__construct(); // Store the Codeigniter super global instance... whatever $CI = get_instance(); // Load the Smarty config file $CI->load->config('smarty'); // Turn on/off debug $this->debugging = config_item('smarty_debug'); // Set some pretty standard Smarty directories $this->setCompileDir(config_item('compile_directory')); $this->setCacheDir(config_item('cache_directory')); $this->setConfigDir(config_item('config_directory')); $this->addPluginsDir(config_item('plugins_directory')); // Default template extension $this->template_ext = config_item('template_ext'); $this->force_compile = 1; // How long to cache templates for $this->cache_lifetime = config_item('cache_lifetime'); // Disable Smarty security policy $this->disableSecurity(); // If caching is enabled, then disable force compile and enable cache if (config_item('cache_status') === true) { $this->enable_caching(); } else { $this->disable_caching(); } // Set the error reporting level $this->error_reporting = config_item('template_error_reporting'); // This will fix various issues like filemtime errors that some people experience // The cause of this is most likely setting the error_reporting value above // This is a static function in the main Smarty class //Smarty::muteExpectedErrors(); // Should let us access Codeigniter stuff in views // This means we can go for example {$this->session->userdata('item')} // just like we normally would in standard CI views $this->assign("this", $CI); //My Vars $this->assign('APPPATH', APPPATH); $this->assign('BASEPATH', BASEPATH); $this->assign('systemurl', base_url()); $this->assign('template', 'default'); $this->assign("CI", $CI); }
function __construct($_name) { $this->name = $_name; parent::__construct(); $smartyDir = getenv("DOCUMENT_ROOT") . '/Smarty'; $this->setTemplateDir("."); $this->setCompileDir("{$smartyDir}/templates_c/"); $this->setConfigDir("{$smartyDir}/configs/"); $this->setCacheDir("{$smartyDir}/cache/"); //important $this->force_compile = true; $this->caching = Smarty::CACHING_LIFETIME_CURRENT; //?? $this->assign('app_name', ''); error_reporting(E_ALL & ~E_NOTICE); // error_reporting(E_ALL ^ E_DEPRECATED); // ini_set('display_errors', '1'); // $smarty->debugging = true; // $this->testInstall(); }
/** * @param modX $modx A reference to the modX object * @param array $params An array of configuration parameters */ function __construct(modX &$modx, $params = array()) { parent::__construct(); $this->modx =& $modx; /* set up configuration variables for Smarty. */ $this->template_dir = $modx->getOption('manager_path') . 'templates/'; $this->compile_dir = $modx->getOption(xPDO::OPT_CACHE_PATH) . 'mgr/smarty/'; $this->config_dir = $modx->getOption('core_path') . 'model/smarty/configs'; $this->plugins_dir = array($this->modx->getOption('core_path') . 'model/smarty/plugins'); $this->caching = false; foreach ($params as $paramKey => $paramValue) { $this->{$paramKey} = $paramValue; } if (!is_dir($this->compile_dir)) { $this->modx->getCacheManager(); $this->modx->cacheManager->writeTree($this->compile_dir); } $this->assign('app_name', 'MODX'); $this->_blocks = array(); $this->_derived = null; }
public function __construct(Request $peticion, ACL $_acl) { //Contruye las variables para la la vista parent::__construct(); $this->_request = $peticion; $this->_js = array(); $this->_acl = $_acl; $this->_rutas = array(); $this->_jsPlugin = array(); $this->_template = DEFAULT_LAYOUT; self::$_item = null; //Verifica el modulo y/o controlador para cargar los archivos de la vista y los archivos js $modulo = $this->_request->getModulo(); $controlador = $this->_request->getControlador(); if ($modulo) { $this->_rutas['view'] = ROOT . 'src' . DS . $this->_request->getFolder($modulo) . DS . '_modules' . DS . $modulo . DS . 'views' . DS . $controlador . DS; $this->_rutas['js'] = BASE_URL . 'src/' . $this->_request->getFolder($modulo) . '/_modules/' . $modulo . '/views/' . $controlador . '/js/'; } else { $this->_rutas['view'] = ROOT . 'src' . DS . $this->_request->getFolder($controlador) . DS . 'views' . DS . $controlador . DS; $this->_rutas['js'] = BASE_URL . 'src/' . $this->_request->getFolder($controlador) . '/views/' . $controlador . '/js/'; } //throw new Exception($this->_rutas['view'] . ' --- ' . $this->_rutas['js']); }
/** * @return string */ public function render() { return $this->_instance->fetch($this->_filename . '.tpl'); }
<?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();
<?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);
/** * displays the template results * * @param string $tpl_name * @param string $cache_id * @param string $compile_id * @return void */ public function display($tpl_name, $cache_id = null, $compile_id = null) { if (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] && preg_match('/MSIE (7|8)/', $this->_request->getAgent())) { // 检测是否为IE $content = $this->fetch($tpl_name); $content = str_replace(array('http://' . SP_STATIC_HOST . '/', SP_URL_STAT, SP_URL_USER), '/', $content); $content = str_replace('/wanlitong/', SP_URL_USER . 'wanlitong/', $content); echo $content; } else { //$g_view->assign("res_bundle", FALSE); parent::display(trim($tpl_name), $cache_id, $compile_id); } }
/** * A overridden method from the Smarty class used to hook into the Smarty * engine. See the Smarty documentation for more information */ function fetch($template = NULL, $cache_id = NULL, $compile_id = NULL, $parent = NULL, $display = false, $merge_tpl_vars = true, $no_output_filter = false) { if (!is_null($compile_id)) { $cid = $this->cur_language . $compile_id; } return parent::fetch($template, $cache_id, $cid, $parent, $display, $merge_tpl_vars, $no_output_filter); }
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)); */ }
function assign($index = null, $val = null) { if ($index) { $this->tpl_vars[$index] = $val; parent::assign($index, $val); } }
$i = 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)
public function __construct() { parent::__construct(); // enable security //$this->enableSecurity('My_Security_Policy'); $this->registerPlugin('block', 'l', 'smarty_block_l'); $this->php_handling = Smarty::PHP_ALLOW; }
define('LOG_LEVEL_ERROR', 1); define('LOG_LEVEL_NONE', 0); # Modules require_once MODULES_PATH . '/Gbl.lib.php'; require_once MODULES_PATH . "/Database.php"; 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
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false) { global $gBitSystem; if (strpos($template, ':')) { list($resource, $location) = explode(':', $template); if ($resource == 'bitpackage') { list($package, $tpl) = explode('/', $location); // exclude temp, as it contains nexus menus if (!$gBitSystem->isPackageActive($package) && $package != 'temp') { return ''; } } } if (defined('TEMPLATE_DEBUG') && TEMPLATE_DEBUG == TRUE) { echo "\n<!-- - - - {$template} - - - -->\n"; } return parent::fetch($template, $cache_id, $compile_id, $parent, $display, $merge_tpl_vars, $no_output_filter); }
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; }
<?php /* 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');
* * You should have received a copy of the GNU Affero General Public License * along with this program. If not, see <http://www.gnu.org/licenses/>. * * **/ // 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);
function showInvite($page, $hidden) { if (isset($_REQUEST['invite_code'])) { $data['message'] = 'Incorrect invitation code.'; $data['invite_code'] = $this->SfStr->getSafeString($_REQUEST['invite_code'], SAFE_STRING_TEXT); } $data['page'] = $page; if (is_array($hidden)) { foreach ($hidden as $key => $val) { $data['hiddenkey'][] = $key; $data['hiddenval'][] = $val; } } $this->smarty->assign_by_ref('data', $data); return $this->smarty->Fetch($this->template . '/invite_code.tpl'); }
function smarty_array_assign_by_reference($atts, $content = null, $code = "") { extract(shortcode_atts(array('tpl' => '#', 'name' => '', 'value' => ''), $atts)); $tpl = "{$tpl}"; $t1 = explode(",", $name); $t2 = explode(",", $value); global $s4w_smarty; if (get_option('s4w_smartybc', '0') == '1') { $s4w_smarty = new Smarty(); } else { $s4w_smarty = new SmartyBC(); } $theme_path = smarty_get_themes_path(); for ($i = 0; $i < count($t1); $i++) { /** * per ticket #79 - function call 'assign_by_ref' is unknown or deprecated * * $s4w_smarty->assign_by_ref($t1[$i],$t2[$i]); */ $s4w_smarty->assignByRef($t1[$i], $t2[$i]); } if (defined('WP_USE_THEMES') && WP_USE_THEMES == true) { $s4w_smarty->template_dir = $theme_path . "/templates"; $s4w_smarty->compile_dir = $theme_path . "/templates_c"; $s4w_smarty->config_dir = $theme_path . "/config"; $s4w_smarty->cache_dir = $theme_path . "/cache"; //$s4w_smarty->plugins_dir[] = $theme_path . "/plugins"; //$s4w_smarty->trusted_dir = $theme_path . "/trusted"; } else { if (defined('SMARTY_PATH')) { $s4w_smarty->template_dir = SMARTY_PATH . "/templates"; $s4w_smarty->compile_dir = SMARTY_PATH . "/templates_c"; $s4w_smarty->config_dir = SMARTY_PATH . "/config"; $s4w_smarty->cache_dir = SMARTY_PATH . "/cache"; //$s4w_smarty->plugins_dir[] = SMARTY_PATH . "/plugins"; //$s4w_smarty->trusted_dir = SMARTY_PATH . "/trusted"; } } smarty_create_tempdir($s4w_smarty); $s4w_smarty->smartybc = get_option('s4w_smartybc', '0') == '1' ? true : false; $s4w_smarty->auto_literal = get_option('s4w_auto_literal', '0') == '1' ? true : false; $s4w_smarty->cache_lifetime = get_option('s4w_cache_lifetime'); $s4w_smarty->cache_modified_check = get_option('s4w_cache_modified_check', '0') == '1' ? true : false; $s4w_smarty->config_booleanize = get_option('s4w_config_bolleanized', '0') == '1' ? true : false; $s4w_smarty->config_overwrite = get_option('s4w_config_overwrite', '0') == '1' ? true : false; $s4w_smarty->config_read_hidden = get_option('s4w_config_read_hidden', '0') == '1' ? true : false; $s4w_smarty->debugging = get_option('s4w_debugging', '0') == '1' ? true : false; $s4w_smarty->force_compile = get_option('s4w_force_compile', '0') == '1' ? true : false; $s4w_smarty->php_handling = get_option('s4w_php_handling', 0); $s4w_smarty->use_sub_dirs = get_option('s4w_use_sub_dirs', '0') == '1' ? true : false; $s4w_smarty->display($tpl); }
/** * isCached method * NOTE: Overwrites parent * * @param mixed $template_name * @param int $cache_id * @param int $compile_id * @param mixed $parent * @return mixed */ public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null) { if (is_null($cache_id) || $cache_id === '') { $cache_id = $this->_global_cache_id; } else { if ($cache_id[0] == '|') { $cache_id = $this->_global_cache_id . $cache_id; } } return parent::isCached($template, $cache_id, $compile_id, $parent); }
$registry = new Registry(); $router = new Router($registry); $registry['router'] = $router; $registry['log'] = $log; $router->setPath(site_path . 'controllers'); class My_Security_Policy extends Smarty_Security { // disable all PHP functions public $php_functions = array(); // remove PHP tags public $php_handling = Smarty::PHP_REMOVE; // allow everthing as modifier public $modifiers = array(); public $trusted_dir = array(); public $allow_php_tag = true; public function __construct($smarty) { parent::__construct($smarty); $this->secure_dir[] = dirname(__FILE__); } } $smarty = new SmartyBC(); $smarty->enableSecurity('My_Security_Policy'); $smarty->debugging = false; //$smarty->allow_php_tag = true; $smarty->caching = false; //$smarty->cache_lifetime = 120; $smarty->template_dir = site_path . "templates" . DIRSEP . $template_name . DIRSEP; $smarty->config_dir = site_path . "configs" . DIRSEP; $registry['smarty'] = $smarty; $router->deligate();
/** * Main constructor * * @param plugins $plugins Galette's plugins * @param I18n $i18n Galette's I18n * @param Preferences $preferences Galette's preferences * @param Logo $logo Galette's logo * @param Login $login Galette's login * @param array $session Galette's session */ function __construct($plugins, $i18n, $preferences, $logo, $login, $session) { parent::__construct(); //paths configuration $this->setTemplateDir(GALETTE_ROOT . GALETTE_TPL_SUBDIR); $this->setCompileDir(GALETTE_COMPILE_DIR); $this->setConfigDir(GALETTE_CONFIG_PATH); $this->setCacheDir(GALETTE_CACHE_DIR); /*if ( GALETTE_MODE !== 'DEV' ) { //enable caching $this->caching = \Smarty::CACHING_LIFETIME_CURRENT; $this->setCompileCheck(false); }*/ $this->addPluginsDir(GALETTE_ROOT . 'includes/smarty_plugins'); $this->assign('login', $login); $this->assign('logo', $logo); $this->assign('template_subdir', GALETTE_BASE_PATH . GALETTE_TPL_SUBDIR); foreach ($plugins->getTplAssignments() as $k => $v) { $this->assign($k, $v); } $this->assign('tpl', $this); $this->assign('headers', $plugins->getTplHeaders()); $this->assign('plugin_actions', $plugins->getTplAdhActions()); $this->assign('plugin_batch_actions', $plugins->getTplAdhBatchActions()); $this->assign('plugin_detailled_actions', $plugins->getTplAdhDetailledActions()); $this->assign('jquery_dir', GALETTE_BASE_PATH . 'includes/jquery/'); $this->assign('jquery_version', JQUERY_VERSION); $this->assign('jquery_migrate_version', JQUERY_MIGRATE_VERSION); $this->assign('jquery_ui_version', JQUERY_UI_VERSION); $this->assign('jquery_markitup_version', JQUERY_MARKITUP_VERSION); $this->assign('jquery_jqplot_version', JQUERY_JQPLOT_VERSION); $this->assign('scripts_dir', GALETTE_BASE_PATH . 'includes/'); $this->assign('PAGENAME', basename($_SERVER['SCRIPT_NAME'])); $this->assign('galette_base_path', GALETTE_BASE_PATH); $this->assign('GALETTE_VERSION', GALETTE_VERSION); $this->assign('GALETTE_MODE', GALETTE_MODE); /** galette_lang should be removed and languages used instead */ $this->assign('galette_lang', $i18n->getAbbrev()); $this->assign('languages', $i18n->getList()); $this->assign('plugins', $plugins); $this->assign('preferences', $preferences); $this->assign('pref_slogan', $preferences->pref_slogan); $this->assign('pref_theme', $preferences->pref_theme); $this->assign('pref_editor_enabled', $preferences->pref_editor_enabled); $this->assign('pref_mail_method', $preferences->pref_mail_method); $this->assign('existing_mailing', isset($session['mailing'])); $this->assign('require_tabs', null); $this->assign('require_cookie', null); $this->assign('contentcls', null); $this->assign('require_tabs', null); $this->assign('require_cookie', false); $this->assign('additionnal_html_class', null); $this->assign('require_calendar', null); $this->assign('head_redirect', null); $this->assign('error_detected', null); $this->assign('warning_detected', null); $this->assign('success_detected', null); $this->assign('color_picker', null); $this->assign('require_sorter', null); $this->assign('require_dialog', null); $this->assign('require_tree', null); $this->assign('html_editor', null); $this->assign('require_charts', null); }
// e.g. http://dev.freebg.de/modules/ define("LITO_LANG_PATH", LITO_ROOT_PATH . 'lang/'); // e.g. /srv/www/vhosts/freebg.de/subdomains/dev/httpdocs/lang/ define("LITO_LANG_PATH_URL", LITO_ROOT_PATH_URL . 'lang/'); // e.g. http://dev.freebg.de/lang/ 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");
/** * * * @return Smarty The smarty object used for rendering. */ public function smarty() { if (is_null($this->_Smarty)) { $Smarty = new SmartyBC(); $Smarty->setCacheDir(PATH_CACHE . '/Smarty/cache'); $Smarty->setCompileDir(PATH_CACHE . '/Smarty/compile'); $Smarty->addPluginsDir(PATH_LIBRARY . '/SmartyPlugins'); // Gdn::PluginManager()->Trace = TRUE; Gdn::pluginManager()->callEventHandlers($Smarty, 'Gdn_Smarty', 'Init'); $this->_Smarty = $Smarty; } return $this->_Smarty; }
if (!empty($_REQUEST)) { remove_magic_quotes($_REQUEST); } ini_set('magic_quotes_gpc', 0); } // register_globals off? Well I like it... extract($_REQUEST); // security check if ($id) { validate_input($id); } if ($ajax_update) { validate_input($ajax_update); } // Smarty setup $smarty = new SmartyBC(); $smarty->compile_dir = './cache/smarty'; // path to compiled templates $smarty->cache_dir = './cache/smarty'; // path to cached html $smarty->plugins_dir = array('./lib/smarty/custom', './lib/smarty/plugins'); $smarty->use_sub_dirs = 0; // restrict caching to one folder $smarty->loadFilter('output', 'trimwhitespace'); // remove whitespace from output #$smarty->setCaching(Smarty::CACHING_LIFETIME_SAVED); #$smarty->force_compile = true; #$smarty->debugging = true; $smarty->error_reporting = E_ALL & ~E_NOTICE; // added for Smarty 3 // load config