public function createSmarty() { $smarty = new JSmartyTemplate($this->templateName); foreach ( $this->rsNotify as $n ) $smarty->append('notify',$n); if ( $this->alert!=null ) $smarty->assign('alert',$this->alert); if ( isset($GLOBALS['page_title']) ) $smarty->assign( 'page_title', $GLOBALS['page_title'] ); return $smarty; }
function smarty_function_pager($params, &$smarty) { global $REQUEST_URI; if (!isset($params['info']) || empty($params['info'])) { $smarty->trigger_error('pager: required parameter "info" missing'); } $pager = $params['info']; $skin = !isset($params['skin']) || empty($params['skin']) ? 'default' : $params['skin']; $seeklast = !isset($params['seeklast']) || empty($params['seeklast']) ? 'on' : strtolower($params['seeklast']); $pSmarty = new JSmartyTemplate(); $pSmarty->assign('seeklast', $seeklast); $pSmarty->assign('pager', $pager); $out = $pSmarty->fetch(dirname(__FILE__) . "/pager/{$skin}.tpl.htm"); return $out; }
function smarty_function_vercode($params, &$smarty) { global $REQUEST_URI, $_SESSION; if (!isset($params['name']) || empty($params['name'])) { $smarty->trigger_error('vercode: required parameter "name" missing'); } $name = $params['name']; $id = !isset($params['id']) || empty($params['id']) ? $name : $params['id']; $class = !isset($params['class']) || empty($params['class']) ? '' : $params['class']; $style = !isset($params['style']) || empty($params['style']) ? '' : $params['style']; $value = !isset($params['value']) || empty($params['value']) ? '' : $params['value']; $accept_chars = !isset($params['accept_chars']) || empty($params['accept_chars']) ? '234689BEFHJKMPQRTVWXY' : $params['accept_chars']; $length = !isset($params['length']) || empty($params['length']) ? 4 : $params['length']; $case_sensitive = !isset($params['case_sensitive']) || empty($params['case_sensitive']) ? 'N' : $params['case_sensitive']; $skin = !isset($params['skin']) || empty($params['skin']) ? 'default' : $params['skin']; $i = 0; while (isset($_SESSION['vercode'][$instance_id = rand(0, 1024)])) { if ($i++ > 200) { $smarty->trigger_error('vercode: create instance_id fail!'); } } $setting = (object) array('case_sensitive' => $case_sensitive, 'accept_chars' => $accept_chars, 'length' => $length); $_SESSION['vercode'][$instance_id] = $setting; if (defined('Smarty::SMARTY_VERSION') && preg_match('/^Smarty-3\\.[0-9\\.]+$/', Smarty::SMARTY_VERSION)) { $smarty2 = new JSmartyTemplate(); $smarty2->assign('name', $name); $smarty2->assign('id', $id); $smarty2->assign('class', $class); $smarty2->assign('style', $style); $smarty2->assign('value', $value); $smarty2->assign('instance_id', $instance_id); $smarty2->assign('case_sensitive', $case_sensitive); $smarty2->assign('length', $length); $out = $smarty2->fetch(dirname(__FILE__) . "/vercode/{$skin}.tpl.htm"); } return $out; }
switch($action) { case 'form': $smarty = new JSmartyTemplate($templateName); if( isset($_REQUEST['error']) ) $smarty->assign('error', $_REQUEST['error']); $smarty->display(dirname(__FILE__).'/login.tpl.htm'); break; case 'login': if( !Vercode::verify( $_POST['vercode_instance_id'], $_POST['vercode']) ) { Vercode::clear(); $smarty = new JSmartyTemplate( $templateName ); $smarty->assign( 'error', '驗証碼錯誤' ); $smarty->display( dirname(__FILE__).'/login.tpl.htm' ); exit; } Vercode::clear(); if( !JTUser::login( $_POST['account'], $_POST['password'] ) ) { $smarty = new JSmartyTemplate($templateName); $smarty->assign('error', JTUser::$errorMessage); $smarty->display(dirname(__FILE__).'/login.tpl.htm'); } else { $uri = JUtil::ifv($_POST['uri']=='','/admin/',$_POST['uri']); JWStdio::location($uri); } break; case 'logout': JTUser::logout(); JWStdio::location("/admin/"); break; } ?>
<? require_once('./local.inc'); $smarty = new JSmartyTemplate($templateName); $news = new JTNews(); $smarty->assign('news_count', $news->count()); $team = new JTTeam(); $smarty->assign('team_count', $team->count()); $advisory = new JTAdvisory(); $smarty->assign('advisory_count', $advisory->count()); $report = new JTReport(); $smarty->assign('report_count', $report->count()); $document = new JTDocument(); $smarty->assign('document_count', $document->count()); $saleschannel = new JTSaleschannel(); $smarty->assign('saleschannel_count', $saleschannel->count()); $faq = new JTFAQ(); $smarty->assign('faq_count', $faq->count()); $user = new JTUser(); $smarty->assign('user_count', $user->count()); $smarty->display(dirname(__FILE__).'/index.tpl.htm'); ?>
$smartyMail->assign('r', $contactus); $mail->Body = $smartyMail->fetch('message.tpl.htm'); $mail->Subject = "康和期貨經理事業 - 聯絡表單"; $mail->AddAddress($contactus->data['email'], $contactus->data['name']); if (!$mail->Send()) { JWStdio::error($mail->ErrorInfo); exit; } // // from user to 管理者 // $mail = new JMailer(); // if( !empty($contactus->data['email']) ) { $mail->AddReplyTo($contactus->data['email'], $contactus->data['name']); // } $mail->setFromAsService(); $smartyMail = new JSmartyTemplate(); $smartyMail->assign('openTo', 'admin'); $smartyMail->assign('r', $contactus); $mail->Body = $smartyMail->fetch('message.tpl.htm'); $mail->Subject = "康和期貨經理事業 - 聯絡表單"; $ru = new JTUser(); $rsUser = $ru->all(); foreach ($rsUser as $rUser) { $mail->AddAddress($rUser->email, $rUser->name); } if (!$mail->Send()) { JWStdio::error($mail->ErrorInfo); exit; } JWStdio::alert('送出完成', $_POST['url']);
public function createSmarty() { $smarty = new JSmartyTemplate(); foreach ( $this->rsNotify as $n ) $smarty->append('notify',$n); if ( $this->alert!=null ) $smarty->assign('alert',$this->alert); return $smarty; }