/** * Загружает переменную в шаблон * * @param string|array $mName Имя переменной в шаблоне или ассоциативный массив со списком параметров * @param mixed $mValue Значение переменной. $bByRef = true, то значение должно быть в виде массива array(&$mValue) для корректной работы передачи по ссылке * @param bool $bLocal Загружает переменную в локальную область видимости шаблонизатора (доступна только для конкретного шаблона) * @param bool $bByRef Загружает переменную по ссылке */ public function Assign($mName, $mValue = null, $bLocal = false, $bByRef = false) { if ($bByRef and isset($mValue[0])) { $this->oSmarty->assignByRef($mName, $mValue[0]); } else { $this->oSmarty->assign($mName, $mValue, false, $bLocal); } }
$smarty->setConfigDir('../../smarty/configs'); //read questions $questions = json_decode(file_get_contents($qfile)); $number_questions = count((array) $questions); //$constits = json_decode(file_get_contents($constitfile)); //read regional info $region = json_decode(file_get_contents($rfile)); //partners if (isset($_GET['partner'])) { switch ($_GET['partner']) { case 'ihned': $partner = array('name' => 'ihned', 'swatch_bar' => 'g', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'a'); break; case 'denik': $partner = array('name' => 'denik', 'swatch_bar' => 'h', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'a'); break; case 'idnes': $partner = array('name' => 'idnes', 'swatch_bar' => 'i', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'i'); break; default: $partner = array('name' => 'default', 'swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e'); } } else { $partner = array('name' => 'default', 'swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e'); } $smarty->assign('partner', $partner); $smarty->assignByRef('questions', $questions); $smarty->assign('number_questions', $number_questions); $smarty->assign('region', $region); //$smarty->assignByRef('constits', $constits); $smarty->display('page-region.tpl');
function assign_by_ref($var, &$value) { return parent::assignByRef($var, $value); }
if ((is_null($enabled_modules) || in_array($filename, $enabled_modules)) && (preg_match('/^[a-zA-Z0-9]/',$filename)) && (is_dir($suspected_module_dir . $filename)) && file_exists($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'configuration.php')) { @include($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'locale' . DIRECTORY_SEPARATOR . $_ui_language . DIRECTORY_SEPARATOR . 'strings.php'); include($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'configuration.php'); if (is_dir($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR)) { $plugins = glob($suspected_module_dir . $filename . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . '*.php'); if (!empty($plugins)) foreach ($plugins as $plugin_name) if (is_readable($plugin_name)) include($plugin_name); } } } } $SMARTY->assignByRef('LANGDEFS', $LANGDEFS); $SMARTY->assignByRef('_ui_language', $LMS->ui_lang); $SMARTY->assignByRef('_language', $LMS->lang); $SMARTY->setTemplateDir(null); $style = ConfigHelper::getConfig('userpanel.style', 'default'); $SMARTY->addTemplateDir(array( USERPANEL_DIR . DIRECTORY_SEPARATOR . 'style' . DIRECTORY_SEPARATOR . $style . DIRECTORY_SEPARATOR . 'templates', USERPANEL_DIR . DIRECTORY_SEPARATOR . 'templates', )); $SMARTY->setCompileDir(SMARTY_COMPILE_DIR); $SMARTY->debugging = ConfigHelper::checkConfig('phpui.smarty_debug'); require_once(USERPANEL_LIB_DIR . DIRECTORY_SEPARATOR . 'smarty_addons.php'); $layout['upv'] = $USERPANEL->_version.' ('.$USERPANEL->_revision.'/'.$SESSION->_revision.')'; $layout['lmsdbv'] = $DB->GetVersion(); $layout['lmsv'] = $LMS->_version;
require_once LIB_DIR . '/LMSDB.php'; $DB = DBInit($_DBTYPE, $_DBHOST, $_DBUSER, $_DBPASS, $_DBNAME); // Read configuration of LMS-UI from database if ($cfg = $DB->GetAll('SELECT section, var, value FROM uiconfig WHERE disabled=0')) { foreach ($cfg as $row) { $CONFIG[$row['section']][$row['var']] = $row['value']; } } // Initialize templates engine require_once LIB_DIR . '/Smarty/Smarty.class.php'; $SMARTY = new Smarty(); // Include required files (including sequence is important) require_once LIB_DIR . '/language.php'; require_once LIB_DIR . '/definitions.php'; require_once LIB_DIR . '/common.php'; require_once LIB_DIR . '/LMS.class.php'; // Initialize LMS class $AUTH = NULL; $LMS = new LMS($DB, $AUTH, $CONFIG); $LMS->ui_lang = $_ui_language; $LMS->lang = $_language; // set some template and layout variables $SMARTY->assignByRef('LANGDEFS', $LANGDEFS); $SMARTY->assignByRef('_ui_language', $LMS->ui_lang); $SMARTY->assignByRef('_language', $LMS->lang); $SMARTY->template_dir = getcwd(); $SMARTY->compile_dir = SMARTY_COMPILE_DIR; @(include 'locale/' . $LMS->ui_lang . '/strings.php'); $layout['lmsv'] = '1.11-cvs'; $SMARTY->assignByRef('layout', $layout); $SMARTY->assignByRef('_config', $CONFIG);
} // Set some template and layout variables $SMARTY->setTemplateDir(NULL); $SMARTY->addTemplateDir(array(SMARTY_TEMPLATES_DIR . '/custom', SMARTY_TEMPLATES_DIR)); $SMARTY->compile_dir = SMARTY_COMPILE_DIR; $SMARTY->debugging = isset($CONFIG['phpui']['smarty_debug']) ? chkconfig($CONFIG['phpui']['smarty_debug']) : FALSE; $SMARTY->use_sub_dirs = TRUE; //$SMARTY->error_reporting = false; $SMARTY->error_unassigned = false; $my_security_policy = new Smarty_Security($SMARTY); $my_security_policy->allow_php_tag = true; $my_security_policy->php_functions = array(); $my_security_policy->php_handling = Smarty::PHP_PASSTHRU; $my_security_policy->php_modifier = array(); $my_security_policy->modifiers = array(); $SMARTY->assignByRef('layout', $layout); $SMARTY->assignByRef('LANGDEFS', $LANGDEFS); $SMARTY->assignByRef('_ui_language', $LMS->ui_lang); $SMARTY->assignByRef('_language', $LMS->lang); $error = NULL; // initialize error variable needed for (almost) all modules header('X-Powered-By: iNET LMS/' . $layout['lmsv']); $PLUG->updateDBPlugins(); // Check privileges and execute modules if ($AUTH->islogged) { $RIGHTS_LIST = $_RL_ = $RIGHTS_USER = array(); // info o polach w formularzach if ($cfg = $DB->GetAll('SELECT section, var, value FROM formconfig')) { foreach ($cfg as $row) { $CONFIGFORM[$row['section']][$row['var']] = $row['value'] ? $row['value'] : 0; }
break; case 'denik': $partner = array('name' => 'denik', 'swatch_bar' => 'h', 'swatch_question_body' => 'd', 'swatch_progressbar' => 'a'); break; default: $partner = array('name' => 'default', 'swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e'); } } else { $partner = array('name' => 'default', 'swatch_bar' => 'f', 'swatch_question_body' => 'e', 'swatch_progressbar' => 'e'); } /*print_r($user); print_r($parties); print_r($questions); die();*/ $smarty->assign('partner', $partner); $smarty->assignByRef('questions', $questions); $smarty->assignByRef('parties', $parties); $smarty->assign('region', $region); $smarty->assign('user', $user); $smarty->assign('order', $order2); $smarty->display('compare.tpl'); //save email if provided if (isset($_GET['email']) and $_GET['email'] != '') { $str = session_id() . "\t" . $region->code . "\t" . date("Y-m-d H:i:s") . "\t" . $_SERVER['QUERY_STRING'] . "\t" . trim($_GET['email']) . "\n"; $file = fopen('../../email.txt', 'a'); fwrite($file, $str); fclose($file); } /** * extracts user's answers */
foreach (filesys::getFilesInDir(SD_ROOT_DIR . 'install/lang/' . $currLang . '/') as $fileLang) { require_once SD_ROOT_DIR . 'install/lang/' . $currLang . '/' . $fileLang; } /********** Инициализация Smarty **********/ define('SMARTY_SPL_AUTOLOAD', 1); require_once SD_ROOT_DIR . 'install/Smarty/Smarty.class.php'; $smarty = new Smarty(); //core smarty object $smarty->error_reporting = E_ALL & ~E_NOTICE; $smarty->template_dir = SD_ROOT_DIR . 'install/templates/'; $smarty->compile_dir = SD_ROOT_DIR . 'install/templates_c/'; $smarty->debugging = false; $smarty->force_compile = true; #################################################################### ############################### INIT ############################### #################################################################### if (isset($_GET['step']) && (int) $_GET['step'] && $_GET['step'] > 0) { if (@file_exists(SD_ROOT_DIR . 'install/includes/step' . $_GET['step'] . '.php') && @file_exists(SD_ROOT_DIR . 'install/templates/step' . $_GET['step'] . '.tpl')) { $arrErrors = array(); include_once SD_ROOT_DIR . 'install/includes/step' . $_GET['step'] . '.php'; $main_template = 'step' . $_GET['step'] . '.tpl'; /********** Передаем в Smarty выводимый шаблон и отображаем его **********/ $smarty->assignByRef('mainTemplate', $main_template); $smarty->assignByRef('arrErrors', $arrErrors); $smarty->display('index.tpl'); } else { exit(ERROR_INSTALL_FILES_NOT_EXISTS); } } else { exit(ERROR_NOT_PAGE_FOUND); }
{ foreach ($items as &$item) { if ($item['id'] == $id) { $path[] = array($item['url'], $item['name']); return true; } if (self::find_path($id, $item['children'], $path)) { $path[] = array($item['url'], $item['name']); return true; } } return false; } } $menuid = ''; $smarty->assignByRef('menuid', $menuid); function show($template, $name) { global $smarty, $lang; $smarty->assign('name', $name); $smarty->assign('tpl', "{$template}.tpl"); $crumbs = array(); $mid = $_REQUEST['mid']; if ($mid) { $crumbs = MainMenu::path($mid); } else { if ($_REQUEST['referer']) { $referer = array(); parse_str(parse_url($_REQUEST['referer'], PHP_URL_QUERY), $referer); if (array_key_exists('mid', $referer)) { $mid = $referer['mid'];
/** * Return all comments for a given kill * * @global Smarty $smarty * @param integer $kll_id * @param string $message * @return xajaxResponse */ function getComments($kll_id, $message = '') { if (config::get('comments')) { $kll_id = intval($kll_id); $comments = new Comments($kll_id); global $smarty; $config = new Config(); if (!$smarty) { $smarty = new Smarty(); $themename = config::get('theme_name'); if (is_dir('./themes/' . $themename . '/templates')) { $smarty->template_dir = './themes/' . $themename . '/templates'; } else { $smarty->template_dir = './themes/default/templates'; } if (!is_dir(KB_CACHEDIR . '/templates_c/' . $themename)) { mkdir(KB_CACHEDIR . '/templates_c/' . $themename); } $smarty->compile_dir = KB_CACHEDIR . '/templates_c/' . $themename; $smarty->cache_dir = KB_CACHEDIR . '/data'; $smarty->assign('theme_url', THEME_URL); $smarty->assign('theme_name', $themename); $smarty->assign('img_url', config::get('cfg_img')); $smarty->assign('img_host', IMG_HOST); $smarty->assign('kb_host', KB_HOST); $smarty->assignByRef('config', $config); $smarty->assign('is_IGB', IS_IGB); $smarty->assign('kll_id', $kll_id); } $smarty->assignByRef('page', new Page("Comments")); $message = $message . $comments->getHtml(true); } else { $message = ''; } $objResponse = new xajaxResponse(); $objResponse->assign('kl-detail-comment-list', "innerHTML", $message); return $objResponse; }
//} } usort($las, 'cmp'); //rename order $order2 = array(); foreach ($user['order'] as $row) { $order2[] = $row; } //read questions $questions = json_decode(file_get_contents($qfile)); /*print_r($user); print_r($parties); print_r($questions); die();*/ $smarty->assign('partner', $partner); $smarty->assignByRef('questions', $questions); $smarty->assignByRef('parties', $candidates); $smarty->assignByRef('long_answers', $las); $smarty->assign('region', $region); $smarty->assign('user', $user); $smarty->assign('order', $order2); $smarty->display('compare-president.tpl'); //save email if provided if (isset($_GET['email']) and $_GET['email'] != '') { $str = session_id() . "\t" . $region->code . "\t" . date("Y-m-d H:i:s") . "\t" . $_SERVER['QUERY_STRING'] . "\t" . trim($_GET['email']) . "\n"; $file = fopen('../../email.txt', 'a'); fwrite($file, $str); fclose($file); } /** *
try { $tpl->template_dir = $path . 'themes/templates/'; $tpl->compile_dir = $path . 'themes/templates/templates_c/'; $tpl->config_dir = $path . 'modules/lang/'; } catch (SmartyException $e) { } //Variable du template $arrStr = explode("/", $_SERVER['SCRIPT_NAME']); $arrStr = array_reverse($arrStr); $tpl->assign('url', $arrStr[0]); $dedis = ORM::for_table('habbophp_dedis')->find_many(); $tpl->assign('dedis', $dedis); $tpl->assign('emulator', EMULATOR); $tpl->assign('lang_dir', $path . 'modules/lang'); $tpl->assign('lang', $config->lang); $tpl->assignByRef('config', $config); $tpl->assignByRef('user', $user); $tpl->configLoad($path . 'modules/lang/' . $config->lang . '.lang'); define('SMARTY_DEBUG_CONSOLE', false); $k_public = '6LenR88SAAAAAMcaw4UWGvAUyDD_HIj97eUBsNhf'; $privatekey = '6LenR88SAAAAAGhwPRprdBpxYR1D591QjX-TVgB9'; $tpl->assign('captcha', recaptcha_get_html($k_public)); $tpl->assign('public_key', $k_public); /*+===================================+ | Gestion des erreurs | +===================================+*/ if (!isset($_SERVER['REQUEST_URI']) or empty($_SERVER['REQUEST_URI'])) { if (substr($_SERVER['SCRIPT_NAME'], -9) == 'index.php' && empty($_SERVER['QUERY_STRING'])) { $_SERVER['REQUEST_URI'] = dirname($_SERVER['SCRIPT_NAME']) . '/'; } else { $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
echo $modname . " <br> "; } echo "</body>"; die; } $none = ''; event::call('mods_initialised', $none); if (!$settingsPage && !file_exists('common/' . $page . '.php') && !$modOverrides) { $page = 'home'; } $smarty->assign('theme_name', $themename); $smarty->assign('theme_url', THEME_URL); $smarty->assign('img_url', IMG_URL); $smarty->assign('img_host', IMG_HOST); $smarty->assign('kb_host', KB_HOST); $smarty->assignByRef('config', $config); $smarty->assign('is_IGB', IS_IGB); // Set the name of the board owner. $owners = array(); if (config::get('cfg_allianceid')) { foreach (config::get('cfg_allianceid') as $owner) { $alliance = new Alliance($owner); $owners[] = htmlentities($alliance->getName()); } unset($alliance); } if (config::get('cfg_corpid')) { foreach (config::get('cfg_corpid') as $owner) { $corp = new Corporation($owner); $owners[] = htmlentities($corp->getName()); }
} } usort($candidates, 'cmp'); //rename order $order2 = array(); foreach ($user['order'] as $row) { $order2[] = $row; } //read questions $questions = json_decode(file_get_contents($qfile)); /*print_r($user); print_r($parties); print_r($questions); die();*/ $smarty->assign('partner', $partner); $smarty->assignByRef('questions', $questions); $smarty->assignByRef('parties', $candidates); $smarty->assign('region', $region); $smarty->assign('user', $user); $smarty->assign('order', $order2); $smarty->display('compare.tpl'); //save email if provided if (isset($_GET['email']) and $_GET['email'] != '') { $str = session_id() . "\t" . $region->code . "\t" . date("Y-m-d H:i:s") . "\t" . $_SERVER['QUERY_STRING'] . "\t" . trim($_GET['email']) . "\n"; $file = fopen('../../email.txt', 'a'); fwrite($file, $str); fclose($file); } /** * */
} // Set some template and layout variables $SMARTY->setTemplateDir(NULL); $SMARTY->addTemplateDir(array(SMARTY_TEMPLATES_DIR . '/custom', SMARTY_TEMPLATES_DIR)); $SMARTY->compile_dir = SMARTY_COMPILE_DIR; $SMARTY->debugging = isset($CONFIG['phpui']['smarty_debug']) ? chkconfig($CONFIG['phpui']['smarty_debug']) : FALSE; $SMARTY->use_sub_dirs = TRUE; //$SMARTY->error_reporting = false; $SMARTY->error_unassigned = false; $my_security_policy = new Smarty_Security($SMARTY); $my_security_policy->allow_php_tag = true; $my_security_policy->php_functions = array(); $my_security_policy->php_handling = Smarty::PHP_PASSTHRU; $my_security_policy->php_modifier = array(); $my_security_policy->modifiers = array(); $SMARTY->assignByRef('layout', $layout); $SMARTY->assignByRef('LANGDEFS', $LANGDEFS); $SMARTY->assignByRef('_ui_language', $LMS->ui_lang); $SMARTY->assignByRef('_language', $LMS->lang); $SMARTY->assignByRef('global_warning', $SESSION->global_warning); $error = NULL; // initialize error variable needed for (almost) all modules header('X-Powered-By: iNET LMS/' . $layout['lmsv']); $PLUG->initPlugins(); $PLUG->updateDBPlugins(); $PLUG->IncludeRegisterHook(); // Check privileges and execute modules if ($AUTH->islogged) { $RIGHTS_LIST = $_RL_ = $RIGHTS_USER = array(); // info o polach w formularzach if ($cfg = $DB->GetAll('SELECT section, var, value FROM formconfig')) {
// Initialize templates engine $SMARTY = new Smarty(); $SMARTY->addPluginsDir(LIB_DIR . DIRECTORY_SEPARATOR . 'SmartyPlugins'); // Include required files (including sequence is important) require_once LIB_DIR . DIRECTORY_SEPARATOR . 'language.php'; require_once LIB_DIR . DIRECTORY_SEPARATOR . 'common.php'; require_once LIB_DIR . DIRECTORY_SEPARATOR . 'definitions.php'; // Initialize LMS class $SESSION = new Session($DB, ConfigHelper::getConfig('phpui.timeout')); $AUTH = new Auth($DB, $SESSION, $SYSLOG); $SYSLOG = null; $LMS = new LMS($DB, $AUTH, $SYSLOG); $LMS->ui_lang = $_ui_language; $LMS->lang = $_language; // set some template and layout variables $SMARTY->assignByRef('_LANG', $_LANG); $SMARTY->assignByRef('LANGDEFS', $LANGDEFS); $SMARTY->assignByRef('_ui_language', $LMS->ui_lang); $SMARTY->assignByRef('_language', $LMS->lang); $SMARTY->template_dir = getcwd(); $SMARTY->compile_dir = SMARTY_COMPILE_DIR; include 'lang.php'; $SMARTY->assignByRef('layout', $layout); if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $forwarded_ip = explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']); $nodeid = $LMS->GetNodeIDByIP($forwarded_ip['0']); } else { $nodeid = $LMS->GetNodeIDByIP(str_replace('::ffff:', '', $_SERVER['REMOTE_ADDR'])); } $customerid = $LMS->GetNodeOwner($nodeid); $nodeinfo = $LMS->GetNode($nodeid);
<?php /** * VAA * reads questions from json */ $qfile = '../data/questions_jm.json'; $constitfile = '../backend/obvody.json'; $qfile = 'plzensky-kraj-2012/questions_pl.json'; $constitfile = '../backend/obvody.json'; // put full path to Smarty.class.php require '/usr/local/lib/php/Smarty/libs/Smarty.class.php'; $smarty = new Smarty(); $smarty->setTemplateDir('../smarty/templates'); $smarty->setCompileDir('../smarty/templates_c'); $smarty->setCacheDir('../smarty/cache'); $smarty->setConfigDir('../smarty/configs'); //read questions $questions = json_decode(file_get_contents($qfile)); $number_questions = count((array) $questions); $constits = json_decode(file_get_contents($constitfile)); $smarty->assignByRef('questions', $questions); $smarty->assign('number_questions', $number_questions); $smarty->assignByRef('constits', $constits); $smarty->display('page.tpl');
/** * Assign a variable to the template * * @param string $key The variable name. * @param mixed $val The variable value. * @return void */ public function __set($key, $val) { $this->_smarty->assignByRef($key, $val); }
$nome = ucwords($clt->fields['nome']) . ' ' . ucwords($clt->fields['cognome']); $tel = $clt->fields['tel']; $mail = $clt->fields['email']; /* * INVIO MAIL ---------------------------------------------------------------------------- */ //Variabili Smarty $pagamento = $lang['prev']['payments'][$clt->fields['pagamento']]; //$mp = sprintf($pagamento['info'],$cart->getTotal()); $mp = $pagamento['label']; $smarty->assign('table_prod', $spesa); $smarty->assign('totale', number_format($cart->getTotal(), 2, ',', '.')); $smarty->assign('spedizione', 0); $smarty->assign('pagamento', $mp); $smarty->assign('promozioni', $lang['prev']['promotions']); $smarty->assignByRef("dati", $clt); $smarty->assign('dir', DIR2); //MAIL A CLIENTE $msg = $smarty->fetch('mail/' . $_SESSION['lang']['label'] . '/clt-ordine.html'); //messaggio cliente $mailer = new mailer(HOST, PORT, USER, PASS, NAME); $mailer->inviaMail($clt->fields['email'], "Ordine concluso - Ceramiche Sofia", $msg); $mailer->logoutSMTP(); //MAIL A NEGOZIO $msg2 = $smarty->fetch('mail/' . $_SESSION['lang']['label'] . '/info-ordine.html'); //messaggio negozio $mailer = new mailer(HOST, PORT, USER, PASS, NAME); $mailer->inviaMail('*****@*****.**', "Hai ricevuto un ordine", $msg2); $mailer->logoutSMTP(); } else { header("Location: ./?nonverificato");