public function __invoke(ContainerInterface $container, $requestedName, array $options = null) { $config = $container->get('Configuration'); $config = $config['smarty']; /** @var $pathResolver \Zend\View\Resolver\TemplatePathStack */ $pathResolver = clone $container->get('ViewTemplatePathStack'); $pathResolver->setDefaultSuffix($config['suffix']); /** @var $resolver \Zend\View\Resolver\AggregateResolver */ $resolver = $container->get('ViewResolver'); $resolver->attach($pathResolver); $engine = new \Smarty(); $engine->setCompileDir($config['compile_dir']); $engine->setEscapeHtml($config['escape_html']); $engine->setTemplateDir($pathResolver->getPaths()->toArray()); $engine->setCaching($config['caching']); $engine->setCacheDir($config['cache_dir']); $engine->addPluginsDir($config['plugins_dir']); if (file_exists($config['config_file'])) { $engine->configLoad($config['config_file']); } $renderer = new Renderer(); $renderer->setEngine($engine); $renderer->setSuffix($config['suffix']); $renderer->setResolver($resolver); return $renderer; }
function translate($TranslationFile) { global $FreedomCore; $Language = str_replace('.language', '', $FreedomCore->loadLanguage()); try { Smarty::configLoad($Language . DS . $TranslationFile . '.language'); } catch (Exception $e) { Debugger::ReportError(3, 2, $TranslationFile . '.language in ' . $Language . ' language folder'); die; } }
protected function setSmarty() { $smarty = new \Smarty(); $smarty->setCompileDir(IE_SMARTY_COMPILE_DIR); $smarty->configLoad(IE_CORE_DIR . 'config.conf'); //load optional master config file $customConf = IE_CUSTOM_DIR . 'config.conf'; if (file_exists($customConf)) { $smarty->configLoad($customConf); } //load project config file $configFile = $this->config['configsDir'] . 'config.conf'; if (file_exists($configFile)) { $smarty->configLoad($configFile); } //load script config file $configFileScript = $this->config['configsScriptsDir'] . $this->script . '.conf'; if (file_exists($configFileScript)) { $smarty->configLoad($configFileScript); } $this->smarty = $smarty; }
} $order_status_query = xos_db_query("select orders_status_name from " . TABLE_ORDERS_STATUS . " where orders_status_id = '" . (int) $status . "' and language_id = '" . (int) $languages['languages_id'] . "'"); $order_status = xos_db_fetch_array($order_status_query); include DIR_FS_SMARTY . 'catalog/languages/' . $check_status['language_directory'] . '/email/order_status_email.php'; $smarty_order = new Smarty(); $smarty_order->template_dir = DIR_FS_SMARTY . 'catalog/templates/'; $smarty_order->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/'; $smarty_order->config_dir = DIR_FS_SMARTY . 'catalog/'; $smarty_order->cache_dir = DIR_FS_SMARTY . 'catalog/cache/'; $smarty_order->left_delimiter = '[@{'; $smarty_order->right_delimiter = '}@]'; if (isset($_POST['notify_comments']) && $_POST['notify_comments'] == 'on') { $smarty_order->assign('order_comments', $comments); } $smarty_order->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => $languages['code'], 'charset' => CHARSET, 'store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'src_embedded_shop_logo' => 'cid:shop_logo', 'src_shop_logo' => HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . (is_file(DIR_FS_CATALOG_IMAGES . 'email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'email_shop_logo/' : 'catalog/templates/' . DEFAULT_TPL . '/') . EMAIL_SHOP_LOGO, 'date_ordered' => xos_order_status_email_date_long($check_status['date_purchased']), 'order_id' => $oID, 'order_status' => $order_status['orders_status_name'], 'link_invoice' => xos_catalog_href_link(FILENAME_CATALOG_ACCOUNT_HISTORY_INFO, 'order_id=' . $oID, 'SSL'))); $smarty_order->configLoad('languages/' . $check_status['language_directory'] . '_email.conf', 'order_status_email_html'); $output_order_status_email_html = $smarty_order->fetch(DEFAULT_TPL . '/includes/email/order_status_email_html.tpl'); $smarty_order->configLoad('languages/' . $check_status['language_directory'] . '_email.conf', 'order_status_email_text'); $output_order_status_email_text = $smarty_order->fetch(DEFAULT_TPL . '/includes/email/order_status_email_text.tpl'); $email_to_customer = new mailer($check_status['customers_name'], $check_status['customers_email_address'], EMAIL_TEXT_SUBJECT, $output_order_status_email_html, $output_order_status_email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS, EMAIL_SHOP_LOGO); if (!$email_to_customer->send()) { $messageStack->add_session('header', sprintf(ERROR_PHPMAILER, $email_to_customer->ErrorInfo), 'error'); } } $customer_notified = '1'; } xos_db_query("insert into " . TABLE_ORDERS_STATUS_HISTORY . " (orders_id, orders_status_id, date_added, customer_notified, comments) values ('" . (int) $oID . "', '" . xos_db_input($status) . "', now(), '" . xos_db_input($customer_notified) . "', '" . xos_db_input($comments) . "')"); $order_updated = true; } if ($order_updated == true) { $messageStack->add_session('header', SUCCESS_ORDER_UPDATED, 'success');
function send($newsletter_id) { global $messageStack; if (SEND_EMAILS != 'true') { $messageStack->add('news_email', ERROR_EMAIL_WAS_NOT_SENT, 'error'); return false; } $ids = $_GET['customers_chosen']; $mail_query = xos_db_query("select s.subscriber_id, s.subscriber_email_address, s.subscriber_identity_code, c.customers_firstname, c.customers_lastname from " . TABLE_NEWSLETTER_SUBSCRIBERS . " s left join " . TABLE_CUSTOMERS . " c on s.customers_id = c.customers_id where s.subscriber_id in (" . $ids . ") order by s.customers_id"); if (empty($this->language_directory)) { $lang_query = xos_db_query("select directory from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'"); $lang = xos_db_fetch_array($lang_query); $this->language_directory = $lang['directory']; } //Let's build a message object using the mailer class $email_to_subscriber = new mailer(); $email_from_value = EMAIL_FROM; $from = html_entity_decode($email_from_value, ENT_QUOTES, 'UTF-8'); $address = ''; $name = ''; $pieces = explode('<', $from); if (count($pieces) == 2) { $address = trim($pieces[1], " >"); $name = trim($pieces[0]); } elseif (count($pieces) == 1) { $pos = stripos($pieces[0], '@'); $address = $pos ? trim($pieces[0], " >") : ''; } $email_to_subscriber->From = $address; $email_to_subscriber->FromName = $name; $email_to_subscriber->WordWrap = '100'; $email_to_subscriber->Subject = $this->title; $smarty_newsletter = new Smarty(); $smarty_newsletter->template_dir = DIR_FS_SMARTY . 'catalog/templates/'; $smarty_newsletter->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/'; $smarty_newsletter->config_dir = DIR_FS_SMARTY . 'catalog/'; $smarty_newsletter->cache_dir = DIR_FS_SMARTY . 'catalog/cache/'; $smarty_newsletter->left_delimiter = '[@{'; $smarty_newsletter->right_delimiter = '}@]'; $is_html = false; if ($this->content_text_htlm != '' && EMAIL_USE_HTML == 'true') { $is_html = true; $smarty_newsletter->assign(array('nl' => "\n", 'html_params' => HTML_PARAMS, 'xhtml_lang' => !empty($this->language_code) ? $this->language_code : DEFAULT_LANGUAGE, 'charset' => CHARSET, 'base_href' => substr(HTTP_SERVER, -1) == '/' ? HTTP_SERVER : '', 'content_text_htlm' => $this->content_text_htlm, 'content_text_plain' => $this->content_text_plain)); $smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_html'); $output_newsletter_email_html = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_html.tpl'); $smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_text'); $output_newsletter_email_text = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_text.tpl'); $email_to_subscriber->isHTML(true); } else { $smarty_newsletter->assign(array('nl' => "\n", 'content_text_plain' => $this->content_text_plain)); $smarty_newsletter->configLoad('languages/' . $this->language_directory . '_email.conf', 'newsletter_email_text'); $output_newsletter_email_text = $smarty_newsletter->fetch(DEFAULT_TPL . '/includes/email/newsletter_email_text.tpl'); $email_to_subscriber->isHTML(false); } while ($mail = xos_db_fetch_array($mail_query)) { $link_unsubscribe = xos_catalog_href_link('newsletter_subscribe.php', 'action=unsubscribe&identity_code=' . $mail['subscriber_identity_code'], 'SSL'); if ($is_html) { $email_to_subscriber->Body = $output_newsletter_email_html . '<a href="' . $link_unsubscribe . '" target="_blank">' . $link_unsubscribe . '</a>' . "\n" . '</div>' . "\n" . '</body>' . "\n" . '</html>' . "\n"; $email_to_subscriber->AltBody = html_entity_decode(strip_tags($output_newsletter_email_text . $link_unsubscribe), ENT_QUOTES, 'UTF-8'); } else { $email_to_subscriber->Body = html_entity_decode(strip_tags($output_newsletter_email_text . $link_unsubscribe), ENT_QUOTES, 'UTF-8'); } $email_to_subscriber->addAddress($mail['subscriber_email_address'], $mail['customers_firstname'] . ' ' . $mail['customers_lastname']); if (!$email_to_subscriber->send()) { $messageStack->add('news_email', sprintf(ERROR_PHP_MAILER, $email_to_subscriber->ErrorInfo, '<' . $mail['subscriber_email_address'] . '>'), 'error'); } else { $messageStack->add('news_email', sprintf(NOTICE_EMAIL_SENT_TO, '<' . $mail['subscriber_email_address'] . '>'), 'success'); } $email_to_subscriber->clearAddresses(); } $newsletter_id = xos_db_prepare_input($newsletter_id); xos_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1', locked = '0' where newsletters_id = '" . xos_db_input($newsletter_id) . "'"); }
} $userRequest = new Request($_REQUEST); $session = SessionController::apiCurrentSession($userRequest); if ($session['valid']) { $smarty->assign("LOGGED_IN", "1"); UITools::$IsLoggedIn = true; $smarty->assign("CURRENT_USER_USERNAME", $session["username"]); $smarty->assign("CURRENT_USER_EMAIL", $session["email"]); $smarty->assign("CURRENT_USER_IS_EMAIL_VERIFIED", $session["is_email_verified"]); $smarty->assign("CURRENT_USER_IS_ADMIN", $session["is_admin"]); $smarty->assign("CURRENT_USER_PRIVATE_CONTESTS_COUNT", $session["private_contests_count"]); $smarty->assign("CURRENT_USER_PRIVATE_PROBLEMS_COUNT", $session["private_problems_count"]); $smarty->assign("CURRENT_USER_AUTH_TOKEN", $session["auth_token"]); $smarty->assign("CURRENT_USER_GRAVATAR_URL_128", '<img src="https://secure.gravatar.com/avatar/' . md5($session["email"]) . '?s=92">'); $smarty->assign("CURRENT_USER_GRAVATAR_URL_16", '<img src="https://secure.gravatar.com/avatar/' . md5($session["email"]) . '?s=16">'); $smarty->assign("CURRENT_USER_GRAVATAR_URL_32", '<img src="https://secure.gravatar.com/avatar/' . md5($session["email"]) . '?s=32">'); UITools::$isAdmin = $session["is_admin"]; $userRequest["username"] = $session["username"]; } else { $smarty->assign("CURRENT_USER_GRAVATAR_URL_128", '<img src="/media/avatar_92.png">'); $smarty->assign("CURRENT_USER_GRAVATAR_URL_16", '<img src="/media/avatar_16.png">'); } $lang = UserController::getPreferredLanguage($userRequest); if (defined("OMEGAUP_DEVELOPMENT_MODE") && OMEGAUP_DEVELOPMENT_MODE) { $smarty->force_compile = true; $smarty->caching = 0; } $smarty->configLoad(__DIR__ . "/../templates/" . $lang . ".lang"); } // Load pager class require_once 'libs/Pager.php';
$userRequest = new Request($_REQUEST); $session = SessionController::apiCurrentSession($userRequest); if ($session['valid']) { $smarty->assign('LOGGED_IN', '1'); UITools::$IsLoggedIn = true; $smarty->assign('CURRENT_USER_USERNAME', $session['username']); $smarty->assign('CURRENT_USER_EMAIL', $session['email']); $smarty->assign('CURRENT_USER_IS_EMAIL_VERIFIED', $session['is_email_verified']); $smarty->assign('CURRENT_USER_IS_ADMIN', $session['is_admin']); $smarty->assign('CURRENT_USER_PRIVATE_CONTESTS_COUNT', $session['private_contests_count']); $smarty->assign('CURRENT_USER_PRIVATE_PROBLEMS_COUNT', $session['private_problems_count']); $smarty->assign('CURRENT_USER_AUTH_TOKEN', $session['auth_token']); $smarty->assign('CURRENT_USER_GRAVATAR_URL_128', '<img src="https://secure.gravatar.com/avatar/' . md5($session['email']) . '?s=92">'); $smarty->assign('CURRENT_USER_GRAVATAR_URL_16', '<img src="https://secure.gravatar.com/avatar/' . md5($session['email']) . '?s=16">'); $smarty->assign('CURRENT_USER_GRAVATAR_URL_32', '<img src="https://secure.gravatar.com/avatar/' . md5($session['email']) . '?s=32">'); $smarty->assign('CURRENT_USER_GRAVATAR_URL_51', '<img src="https://secure.gravatar.com/avatar/' . md5($session['email']) . '?s=51">'); UITools::$isAdmin = $session['is_admin']; $userRequest['username'] = $session['username']; } else { $smarty->assign('CURRENT_USER_GRAVATAR_URL_128', '<img src="/media/avatar_92.png">'); $smarty->assign('CURRENT_USER_GRAVATAR_URL_16', '<img src="/media/avatar_16.png">'); } $lang = UserController::getPreferredLanguage($userRequest); if (defined('OMEGAUP_DEVELOPMENT_MODE') && OMEGAUP_DEVELOPMENT_MODE) { $smarty->force_compile = true; $smarty->caching = 0; } $smarty->configLoad(__DIR__ . '/../templates/' . $lang . '.lang'); } // Load pager class require_once 'libs/Pager.php';
public static function getInstance($param = null) { // 初始化Smarty自动加载 if (!self::$isInit) { Bd_Autoloader::addClassMap(self::$smartyClassMap); self::$isInit = true; } // 从配置中读取参数 if (!is_array($param)) { // 加载配置 if (empty(self::$arrConf)) { self::$arrConf = Bd_Conf::getConf('/smarty/'); if (empty(self::$arrConf)) { self::$arrConf = null; return null; } } // 取指定的配置组 if ($param != null) { $param = self::$arrConf[$param]; // 不存在则出错 if (!$param) { return null; } } else { $param = current(self::$arrConf); } } // new一个smarty $smarty = new Smarty(); // 根据参数初始化该smarty对象 $smarty->setTemplateDir(self::__absPath($param['template_dir'])); $smarty->setCompileDir(self::__absPath($param['compile_dir'])); $smarty->setCompileCheck($param['compile_check'] != '0'); $smarty->setConfigDir(self::__absPath($param['config_dir'])); if (!empty($param['config_load'])) { $smarty->configLoad($param['config_load']); } $smarty->addPluginsDir(self::__absPath($param['plugins_dir'])); $smarty->left_delimiter = $param['left_delimiter']; $smarty->right_delimiter = $param['right_delimiter']; if (isset($_COOKIE['FIS_DEBUG']) && $_COOKIE['FIS_DEBUG'] === 'YlwtSmt' && self::isInternalIp(Bd_Ip::getClientIp())) { return new Bd_TplFactory($smarty); } return $smarty; }
$mailer_error = false; if (!empty($_POST['email_to'])) { $id1 = create_coupon_code($mail_sent_to); $languages_query = xos_db_query("select languages_id, code, directory from " . TABLE_LANGUAGES . " where use_in_id > '1' and directory = '" . $language_directory . "'"); if (!xos_db_num_rows($languages_query)) { $lang_query = xos_db_query("select languages_id, code, directory from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'"); $languages = xos_db_fetch_array($lang_query); } else { $languages = xos_db_fetch_array($languages_query); } $used_lang_id = $_SESSION['used_lng_id']; $_SESSION['used_lng_id'] = $languages['languages_id']; $currencies = new currencies(); if (EMAIL_USE_HTML == 'true') { $smarty_gv_email->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => $languages['code'], 'charset' => CHARSET, 'store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'src_embedded_shop_logo' => 'cid:shop_logo', 'src_shop_logo' => HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_IMAGES . (is_file(DIR_FS_CATALOG_IMAGES . 'email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'email_shop_logo/' : 'catalog/templates/' . DEFAULT_TPL . '/') . EMAIL_SHOP_LOGO, 'gv_message' => $message, 'gv_id' => $id1, 'gv_amount' => $currencies->format($amount), 'link_shop' => xos_catalog_href_link(), 'link_gv_redeem' => xos_catalog_href_link(FILENAME_CATALOG_GV_REDEEM, 'gv_no=' . $id1, 'SSL'))); $smarty_gv_email->configLoad('languages/' . $languages['directory'] . '_email.conf', 'gv_email_html'); $output_gv_email_html = $smarty_gv_email->fetch(DEFAULT_TPL . '/includes/email/gv_email_html.tpl'); $smarty_gv_email->configLoad('languages/' . $languages['directory'] . '_email.conf', 'gv_email_text'); $output_gv_email_text = $smarty_gv_email->fetch(DEFAULT_TPL . '/includes/email/gv_email_text.tpl'); $gv_email->isHTML(true); $gv_email->Body = $output_gv_email_html; $gv_email->AltBody = $output_gv_email_text; $gv_email->addEmbeddedImage(DIR_FS_CATALOG . (is_file(DIR_FS_CATALOG . 'images/email_shop_logo/' . EMAIL_SHOP_LOGO) ? 'images/email_shop_logo/' : 'images/catalog/templates/' . DEFAULT_TPL . '/') . EMAIL_SHOP_LOGO, 'shop_logo', '', 'base64', 'image/' . substr(strrchr(EMAIL_SHOP_LOGO, '.'), 1)); } else { $smarty_gv_email->assign(array('store_name_address' => STORE_NAME_ADDRESS, 'store_name' => STORE_NAME, 'gv_message' => $message, 'gv_id' => $id1, 'gv_amount' => $currencies->format($amount), 'link_shop' => xos_catalog_href_link(), 'link_gv_redeem' => xos_catalog_href_link(FILENAME_CATALOG_GV_REDEEM, 'gv_no=' . $id1, 'SSL'))); $smarty_gv_email->configLoad('languages/' . $languages['directory'] . '_email.conf', 'gv_email_text'); $output_gv_email_text = $smarty_gv_email->fetch(DEFAULT_TPL . '/includes/email/gv_email_text.tpl'); $gv_email->isHTML(false); $gv_email->Body = $output_gv_email_text; } $gv_email->addAddress($mail_sent_to);
$site_trail->add($name['products_name'], xos_href_link(FILENAME_PRODUCT_INFO, 'm=' . $_GET['m'] . '&p=' . $_GET['p'])); } else { $site_trail->add($name['products_name'], xos_href_link(FILENAME_PRODUCT_INFO, 'c=' . $cPath . '&p=' . $_GET['p'])); } } } // initialize the message stack for output messages require DIR_WS_CLASSES . 'message_stack.php'; $messageStack = new messageStack(); require DIR_WS_CLASSES . 'template_integration.php'; $templateIntegration = new templateIntegration(); $templateIntegration->buildBlocks(); // check for active product categories in Level 0 $check_is_shop_query = xos_db_query("select count(*) as count from " . TABLE_CATEGORIES_OR_PAGES . " where parent_id = '0' and is_page = 'false' and categories_or_pages_status = '1'"); $check_is_shop = xos_db_fetch_array($check_is_shop_query); $is_shop = false; if ($check_is_shop['count'] > 0) { $is_shop = true; } // set which precautions should be checked define('WARN_SESSION_DIRECTORY_NOT_WRITEABLE', 'true'); define('WARN_SESSION_AUTO_START', 'true'); define('WARN_DOWNLOAD_DIRECTORY_NOT_READABLE', 'true'); $smarty->caching = 0; $smarty->cache_lifetime = -1; $smarty->compile_check = constant(COMPILE_CHECK); $smarty->configLoad('languages/' . $_SESSION['language'] . '.conf', 'general'); $smarty->configLoad('templates/' . SELECTED_TPL . '/includes/configuration/config.conf'); $smarty->loadFilter('output', 'set_internal_link'); // $smarty->loadFilter('output','trimwhitespace'); $smarty->assign(array('nl' => "\n", 'is_shop' => $is_shop, 'page_info' => $page_info, 'request_type' => $request_type, 'link_filename_popup_content_6' => STATUS_POPUP_CONTENT_6 == '1' ? xos_href_link(FILENAME_POPUP_CONTENT, 'co=6', $request_type) : '', 'end_tags' => DISPLAY_PAGE_PARSE_TIME == 'true' && STORE_PAGE_PARSE_TIME == 'true' ? $templateIntegration->getBlocks('footer_scripts') : $templateIntegration->getBlocks('footer_scripts') . "</body>\n</html>", 'date_format_long' => xos_date_format(DATE_FORMAT_LONG), 'languages_path' => DIR_WS_CATALOG . DIR_WS_IMAGES . 'catalog/templates/' . SELECTED_TPL . '/' . $_SESSION['language'] . '/', 'buttons_path' => DIR_WS_CATALOG . DIR_WS_IMAGES . 'catalog/templates/' . SELECTED_TPL . '/' . $_SESSION['language'] . '/buttons/', 'images_path' => DIR_WS_CATALOG . DIR_WS_IMAGES . 'catalog/templates/' . SELECTED_TPL . '/'));
function translate($TranslationFile) { global $FreedomCore; $Language = str_replace('.language', '', $FreedomCore->loadLanguage()); Smarty::configLoad($Language . DS . $TranslationFile . '.language'); }
function send($newsletter_id) { global $messageStack; if (SEND_EMAILS != 'true') { $messageStack->add('news_email', ERROR_EMAIL_WAS_NOT_SENT, 'error'); return false; } $audience = array(); $ids = $_GET['customers_chosen']; $customers_query = xos_db_query("select c.customers_id, c.customers_firstname, c.customers_lastname, c.customers_email_address from " . TABLE_CUSTOMERS . " c where c.customers_id in (" . $ids . ")"); while ($customers = xos_db_fetch_array($customers_query)) { $audience[$customers['customers_id']] = array('firstname' => $customers['customers_firstname'], 'lastname' => $customers['customers_lastname'], 'email_address' => $customers['customers_email_address']); } if (empty($this->language_directory)) { $lang_query = xos_db_query("select directory from " . TABLE_LANGUAGES . " where code = '" . xos_db_input(DEFAULT_LANGUAGE) . "'"); $lang = xos_db_fetch_array($lang_query); $this->language_directory = $lang['directory']; } //Let's build a message object using the mailer class $email_to_customer = new mailer(); $email_from_value = EMAIL_FROM; $from = html_entity_decode($email_from_value, ENT_QUOTES, 'UTF-8'); $address = ''; $name = ''; $pieces = explode('<', $from); if (count($pieces) == 2) { $address = trim($pieces[1], " >"); $name = trim($pieces[0]); } elseif (count($pieces) == 1) { $pos = stripos($pieces[0], '@'); $address = $pos ? trim($pieces[0], " >") : ''; } $email_to_customer->From = $address; $email_to_customer->FromName = $name; $email_to_customer->WordWrap = '100'; $email_to_customer->Subject = $this->title; $smarty_product_notification = new Smarty(); $smarty_product_notification->template_dir = DIR_FS_SMARTY . 'catalog/templates/'; $smarty_product_notification->compile_dir = DIR_FS_SMARTY . 'catalog/templates_c/'; $smarty_product_notification->config_dir = DIR_FS_SMARTY . 'catalog/'; $smarty_product_notification->cache_dir = DIR_FS_SMARTY . 'catalog/cache/'; $smarty_product_notification->left_delimiter = '[@{'; $smarty_product_notification->right_delimiter = '}@]'; $is_html = false; if ($this->content_text_htlm != '' && EMAIL_USE_HTML == 'true') { $is_html = true; $smarty_product_notification->assign(array('html_params' => HTML_PARAMS, 'xhtml_lang' => !empty($this->language_code) ? $this->language_code : DEFAULT_LANGUAGE, 'charset' => CHARSET, 'base_href' => substr(HTTP_SERVER, -1) == '/' ? HTTP_SERVER : '', 'content_text_htlm' => $this->content_text_htlm, 'content_text_plain' => $this->content_text_plain)); $smarty_product_notification->configLoad('languages/' . $this->language_directory . '_email.conf', 'product_notification_email_html.tpl'); $output_product_notification_email_html = $smarty_product_notification->fetch(DEFAULT_TPL . '/includes/email/product_notification_email_html.tpl'); $smarty_product_notification->configLoad('languages/' . $this->language_directory . '_email.conf', 'product_notification_email_text.tpl'); $output_product_notification_email_text = $smarty_product_notification->fetch(DEFAULT_TPL . '/includes/email/product_notification_email_text.tpl'); $email_to_customer->isHTML(true); } else { $smarty_product_notification->assign('content_text_plain', $this->content_text_plain); $smarty_product_notification->configLoad('languages/' . $this->language_directory . '_email.conf', 'product_notification_email_text.tpl'); $output_product_notification_email_text = $smarty_product_notification->fetch(DEFAULT_TPL . '/includes/email/product_notification_email_text.tpl'); $email_to_customer->isHTML(false); } reset($audience); while (list($key, $value) = each($audience)) { if ($is_html) { $email_to_customer->Body = $output_product_notification_email_html; $email_to_customer->AltBody = html_entity_decode(strip_tags($output_product_notification_email_text), ENT_QUOTES, 'UTF-8'); } else { $email_to_customer->Body = html_entity_decode(strip_tags($output_product_notification_email_text), ENT_QUOTES, 'UTF-8'); } $email_to_customer->addAddress($value['email_address'], $value['firstname'] . ' ' . $value['lastname']); if (!$email_to_customer->send()) { $messageStack->add('news_email', sprintf(ERROR_PHP_MAILER, $email_to_customer->ErrorInfo, '<' . $value['email_address'] . '>'), 'error'); } else { $messageStack->add('news_email', sprintf(NOTICE_EMAIL_SENT_TO, '<' . $value['email_address'] . '>'), 'success'); } $email_to_customer->clearAddresses(); } $newsletter_id = xos_db_prepare_input($newsletter_id); xos_db_query("update " . TABLE_NEWSLETTERS . " set date_sent = now(), status = '1', locked = '0' where newsletters_id = '" . xos_db_input($newsletter_id) . "'"); }
$page_contents = 'install_1.php'; } break; case '4': if (xos_in_array('configure', $_POST['install'])) { $page_contents = 'install_4.php'; } else { $page_contents = 'install_1.php'; } break; case '5': if (xos_in_array('configure', $_POST['install'])) { $page_contents = 'install_5.php'; } else { $page_contents = 'install_1.php'; } break; case '6': if (xos_in_array('configure', $_POST['install'])) { $page_contents = 'install_6.php'; } else { $page_contents = 'install_1.php'; } break; default: $page_contents = 'install_1.php'; } $smarty->configLoad('languages/' . $_POST['language_file_name'] . '.conf', substr($page_contents, 0, -4)); $smarty->configLoad('configuration/config.conf'); require 'includes/' . $page_contents; $smarty->display('install.tpl');
<?php // start session: session_start(); // error reporting level: error_reporting(E_ALL ^ E_STRICT); include "config.php"; // looooooaaaadddiiiiiinnnnnnggggg..... include $magrathea_path . "/LOAD.php"; // initialize Smarty. eh.. I don't think there is a more beautiful way of doing this $Smarty = new Smarty(); $Smarty->template_dir = $site_path . "/app/Views/"; $Smarty->compile_dir = $site_path . "/app/Views/_compiled"; $Smarty->config_dir = $site_path . "/app/Views/configs"; $Smarty->cache_dir = $site_path . "/app/Views/_cache"; $Smarty->error_reporting = E_ALL & ~E_NOTICE; $Smarty->configLoad("site.conf"); // initialize the MagratheaView and sets it to Smarty $Smarty->assign("View", MagratheaView::Instance()); // for printing the paths of your css and javascript (that will be included in the index.php) MagratheaView::Instance()->IsRelativePath(false); // debugging settings: // options: dev; debug; log; none; MagratheaDebugger::Instance()->SetType(MagratheaDebugger::DEV)->LogQueries(false);
/** * Execute compile command */ protected function execute(InputInterface $input, OutputInterface $output) { //get project name & set source/output dirs $project = $input->getArgument('project'); $this->config = new \Implico\Email\Config($project, $input->getOption('dir')); if ($error = $this->config->getErrors()) { switch ($error) { case 'projectNotFound': $output->writeln('<fg=red>ERROR: project directory not found</fg=red>'); exit(1); break; } } SmartyUtils::init($this->config); //get script name(s) $scripts = $input->getOption('script'); //if script name(s) not passed, set all scripts (exclude dirs) if (!$scripts) { $scripts = array_filter(array_diff(scandir($this->config['scriptsDir']), array('.', '..')), function ($script) { return !is_dir($this->config['scriptsDir'] . $script); }); } //add ".tpl" extension when applicable foreach ($scripts as $i => $script) { if (strpos($script, '.') === false) { $scripts[$i] = $script . '.tpl'; } } //get watch option $watch = $input->getOption('watch'); //get output option $outputMode = $input->getOption('output'); //create & configure Smarty object $smarty = new \Smarty(); $smarty->setCompileDir(IE_SMARTY_COMPILE_DIR); $smarty->addPluginsDir(IE_SMARTY_PLUGINS_DIR); $smarty->addPluginsDir(IE_SMARTY_CUSTOM_PLUGINS_DIR); $smarty->compile_check = false; $smarty->force_compile = true; $smarty->error_reporting = E_ALL; $smarty->registerClass('SmartyUtils', 'Implico\\Email\\Utils\\Smarty'); //set directories $smarty->setTemplateDir(array(0 => $this->config['dir'], 'core' => IE_CORE_DIR, 'layouts' => $this->config['layoutsDir'], 'scripts' => $this->config['scriptsDir'], 'styles' => $this->config['stylesDir'])); //master config file $smarty->configLoad(IE_CORE_DIR . 'config.conf'); //optional master custom config file $customConf = IE_CUSTOM_DIR . 'config.conf'; if (file_exists($customConf)) { $smarty->configLoad($customConf); } //console message for watching if ($watch) { $output->writeln('Watching for changes...'); } //main loop - watch for changes (or execute once if not watching) $compileNo = 1; $compileDirStamp = ''; //dirs to inspect file change $checkDirs = array($this->config['configsDir'], $this->config['configsScriptsDir'], $this->config['layoutsDir'], $this->config['scriptsDir'], $this->config['stylesDir']); //set output mode variables $outputMinified = in_array('m', $outputMode); $outputFormatted = in_array('f', $outputMode); //formatter object $formatter = null; //css inliner object $cssToInlineStyles = new CssToInlineStyles(); while (true) { //compile only if not watching or the dirs filestamp changes if (!$watch || $compileDirStamp != $this->getDirStamp($checkDirs)) { //clear compiled templates $smarty->clearCompiledTemplate(); //Smarty assign project-specific config file path $configFile = $this->config['configsDir'] . 'config.conf'; $loadConfigFile = file_exists($configFile); //set random complile_id (forces Smarty to compile) $smarty->compile_id = uniqid(); //list of compiled scripts $compiledScripts = $scripts; //fetch & save templates foreach ($scripts as $i => $script) { //script name without extension $scriptName = substr($script, 0, strrpos($script, '.')); $smarty->clearConfig(); if ($loadConfigFile) { $smarty->configLoad($configFile); } //set script-specific config file path if exists $configFileScript = $this->config['configsScriptsDir'] . $scriptName . '.conf'; if (file_exists($configFileScript)) { $smarty->configLoad($configFileScript); } //lazy create indenter if ($outputFormatted && !$formatter) { $formatter = new \Gajus\Dindent\Indenter(array('indentation_character' => $smarty->getConfigVars('indentChar'))); } //set encoding $outputEncoding = $smarty->getConfigVars('encoding'); if (!$outputEncoding) { $outputEncoding = 'utf-8'; } $outputEncodingUtf8 = strtoupper($outputEncoding) == 'UTF-8'; try { //get the html $html = $smarty->fetch($this->config['scriptsDir'] . $script); //get inline styles $inlineCss = $smarty->fetch($this->config['stylesDir'] . 'inline.tpl'); if (trim($inlineCss)) { $cssToInlineStyles->setHTML($html); $cssToInlineStyles->setCSS($inlineCss); $html = $cssToInlineStyles->convert(); } //save minified if ($outputMinified) { $htmlSave = $html; if (!$outputEncodingUtf8) { $htmlSave = mb_convert_encoding($htmlSave, $outputEncoding, 'utf-8'); } //max line width = 900 chars $maxPerLine = 750; $endLine = false; $newHtml = ''; for ($i = 0; $i < mb_strlen($htmlSave, $outputEncoding); $i++) { if ($i % $maxPerLine == 0 && $i > 0) { $endLine = true; } $curChar = mb_substr($htmlSave, $i, 1, $outputEncoding); $newHtml .= $curChar; if ($endLine) { if ($curChar == '>') { $newHtml .= PHP_EOL; $endLine = false; } } } $htmlSave = $newHtml; $this->saveOutput($this->config['outputsDir'] . $scriptName . '.min.html', $htmlSave); } //save formatted if ($outputFormatted) { $htmlSave = $formatter->indent($html); if (!$outputEncodingUtf8) { $htmlSave = mb_convert_encoding($htmlSave, $outputEncoding, 'utf-8'); } $this->saveOutput($this->config['outputsDir'] . $scriptName . '.html', $htmlSave, true); } } catch (\Exception $e) { $output->writeln('<fg=red>' . $e->getMessage() . '</fg=red>'); $compiledScripts[$i] .= ' <fg=red>(ERROR)</fg=red>'; } } //console info message $output->writeln(($watch ? '#' . $compileNo++ . ' ' : '') . 'Compiled ' . date('d-m-Y H:i:s') . ' ' . implode(', ', $compiledScripts)); } //break if not watching if (!$watch) { break; } //calculate dirs filestamp to compare $compileDirStamp = $this->getDirStamp($checkDirs); //pause usleep(500000); } }
} } else { $hidden_fields .= xos_draw_hidden_field($key, $value); } } } $db_error .= ' '; $smarty->assign(array('form_begin' => '<form name="install" action="install.php?step=3" method="post">', 'form_end' => '</form>', 'db_error' => $db_error, 'href_link_index' => 'index.php?lang=' . $_POST['language_code'], 'hidden_fields' => $hidden_fields)); } else { reset($_POST); $hidden_fields = ''; while (list($key, $value) = each($_POST)) { if ($key != 'x' && $key != 'y' && $key != 'DB_TEST_CONNECTION') { if (is_array($value)) { for ($i = 0; $i < sizeof($value); $i++) { $hidden_fields .= xos_draw_hidden_field($key . '[]', $value[$i]); } } else { $hidden_fields .= xos_draw_hidden_field($key, $value); } } } $smarty->assign(array('form_begin' => '<form name="install" action="install.php?step=4" method="post">', 'form_end' => '</form>', 'configure_also' => xos_in_array('configure', $_POST['install']) ? true : false, 'href_link_index' => 'index.php?lang=' . $_POST['language_code'], 'hidden_fields' => $hidden_fields)); } } else { $smarty->assign('fatal_error', true); } $smarty->configLoad('languages/' . $_POST['language_file_name'] . '.conf', 'install_db'); $smarty->configLoad('configuration/config.conf'); $smarty->display('install_db.tpl'); }
$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']; if (isset($_SERVER['QUERY_STRING']) and !empty($_SERVER['QUERY_STRING'])) { $_SERVER['REQUEST_URI'] .= '?' . $_SERVER['QUERY_STRING'];
$hidden_fields = ''; $hidden_fields .= xos_draw_hidden_field('language_code', $lng->language['code']); $hidden_fields .= xos_draw_hidden_field('language_name', $lng->language['name']); $hidden_fields .= xos_draw_hidden_field('language_image', $lng->language['image']); $hidden_fields .= xos_draw_hidden_field('language_file_name', $lng->language['file_name']); $hidden_fields .= xos_draw_hidden_field('language_directory', $lng->language['directory']); // Define the admin template define('INSTALL_TPL', 'xos-shop_install_default_v1.0.7'); // require the smarty class and create an instance require '../smarty/Smarty-3.1.27/Smarty.class.php'; $smarty = new Smarty(); $smarty->setTemplateDir('templates/' . INSTALL_TPL . '/'); $smarty->setConfigDir('templates/' . INSTALL_TPL . '/'); $smarty->setCompileDir('templates_c/'); $smarty->assign(array('css_path' => 'templates/' . INSTALL_TPL . '/', 'images_path' => 'templates/' . INSTALL_TPL . '/images/', 'buttons_path' => 'templates/' . INSTALL_TPL . '/images/' . $lng->language['directory'] . '/buttons/')); if (!function_exists('version_compare') || version_compare(PHP_VERSION, '5.2.0', '<')) { $smarty->assign('php_ver_warning', true); } else { if (extension_loaded('gd')) { $ver_info = gd_info(); preg_match('/\\d/', $ver_info['GD Version'], $match); $gd_ver = $match[0]; } else { $gd_ver = false; } $smarty->assign(array('register_globals' => (bool) ini_get('register_globals') ? 'On' : 'Off', 'file_uploads' => (bool) ini_get('file_uploads') ? 'On' : 'Off', 'session_auto_start' => (bool) ini_get('session.auto_start') ? 'On' : 'Off', 'session_use_trans_sid' => (bool) ini_get('session.use_trans_sid') ? 'On' : 'Off', 'extension_gd_loaded' => $gd_ver ? $gd_ver >= 2 ? '2' : '1' : 'not_loaded', 'extension_openssl_loaded' => extension_loaded('openssl') ? 'loaded' : 'not_loaded', 'extension_curl_loaded' => extension_loaded('curl') ? 'loaded' : 'not_loaded', 'extension_mysql_loaded' => class_exists('mysql') || class_exists('mysqli') && version_compare(PHP_VERSION, '5.3.0', '>=') ? 'loaded' : 'not_loaded')); } $smarty->assign(array('form_begin' => '<form name="install" action="install.php" method="post">', 'form_end' => '</form>', 'php_version' => PHP_VERSION, 'hidden_fields' => $hidden_fields)); $smarty->configLoad('languages/' . $lng->language['file_name'] . '.conf', 'index'); $smarty->configLoad('configuration/config.conf'); $smarty->display('index.tpl');
/** * Load a config file, optionally load just selected sections * * @param string $cfile filename * @param mixed $sections array of section names, single section or null * @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining */ public function configLoad($cfile, $sections = null) { return $this->_smarty->configLoad($cfile, $sections); }
} $actualUrl = getActualUrl(); if (!$hotel && !strpos($actualUrl, '/admin-') && !strpos($actualUrl, 'confirmacion') && !strpos($actualUrl, 'cancelacion') && !strpos($actualUrl, 'condiciones') && !strpos($actualUrl, 'popup') && !strpos($actualUrl, 'contacto') && !strpos($actualUrl, 'suscripcion') && !strpos($actualUrl, 'thumb') && !strpos($actualUrl, '/ajax-reserva') && !strpos($actualUrl, '/hoteles') && !strpos($actualUrl, '/validar') && !strpos($actualUrl, '/facturacion') && !strpos($actualUrl, '/reserva')) { if (isset($_REQUEST['l'])) { $smarty->assign('lang', $_REQUEST['l']); $lang_set = $_REQUEST['l']; $_SESSION['lang'] = $lang_set; } elseif (isset($_SESSION['lang'])) { $smarty->assign('lang', $_SESSION['lang']); $lang_set = $_SESSION['lang']; } else { $lang_set = 'es'; $smarty->assign('lang', $lang_set); $_SESSION['lang'] = $lang_set; } $smarty->configLoad($lang_set . '.conf'); setlocale(LC_ALL, Core_Util_General::getLocaleName($lang_set)); include 'Controllers/hoteles.php'; } else { $usuario_core = Core_Usuario::getInstance(); $usuario = $usuario_core->getUsuario(); if ($usuario) { $smarty->assign('logged_user', $usuario); } if (isset($_REQUEST["inicio"]) && isset($_REQUEST["salida"])) { $smarty->assign('inicio', str_replace('/index', '', $_REQUEST["inicio"])); $smarty->assign('salida', str_replace('/index', '', $_REQUEST["salida"])); $_SESSION['inicio'] = str_replace('/index', '', $_REQUEST["inicio"]); $_SESSION['salida'] = str_replace('/index', '', $_REQUEST["salida"]); setcookie("inicio", str_replace('/index', '', $_REQUEST["inicio"])); setcookie("salida", str_replace('/index', '', $_REQUEST["salida"]));