当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Session_Namespace::getIterator方法代码示例

本文整理汇总了PHP中Zend_Session_Namespace::getIterator方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Session_Namespace::getIterator方法的具体用法?PHP Zend_Session_Namespace::getIterator怎么用?PHP Zend_Session_Namespace::getIterator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Zend_Session_Namespace的用法示例。


在下文中一共展示了Zend_Session_Namespace::getIterator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _getByFilter

 /**
  * Retrieve array of messages by provided filter
  * 
  * @param string $type
  * @param string $namespace
  * @return array messages array
  */
 private function _getByFilter($type = null, $namespace = null)
 {
     $messages = array();
     if (null !== $type && null !== $namespace) {
         if (is_array(self::$_session->{$namespace}) && isset(self::$_session->{$namespace}[$type])) {
             $messages[$type] = self::$_session->{$namespace}[$type];
             unset(self::$_session->{$namespace}[$type]);
         }
     } elseif (null !== $type) {
         foreach (self::$_session->getIterator() as $messageNamespace => $messageStack) {
             foreach ($messageStack as $messageType => $messageArray) {
                 if ($messageType != $type) {
                     continue;
                 }
                 foreach ($messageArray as $message) {
                     $messages[$messageType][] = $message;
                 }
                 unset(self::$_session->{$messageNamespace}[$messageType]);
             }
         }
     } elseif (is_array(self::$_session->{$namespace})) {
         $messages = self::$_session->{$namespace};
         unset(self::$_session->{$namespace});
     }
     return $messages;
 }
开发者ID:rommmka,项目名称:axiscommerce,代码行数:33,代码来源:Message.php

示例2: getFullErrorMessage

 /**
  * Create exception message error.
  *
  * @return string
  */
 public function getFullErrorMessage()
 {
     $message = '';
     if (!empty($this->_server['SERVER_ADDR'])) {
         $message .= 'Server IP: ' . htmlspecialchars($this->_server['SERVER_ADDR'], ENT_QUOTES, 'UTF-8') . "\n";
     }
     if (!empty($this->_server['REMOTE_ADDR'])) {
         $message .= 'Client IP: ' . htmlspecialchars($this->_server['REMOTE_ADDR'], ENT_QUOTES, 'UTF-8') . "\n";
     }
     if (!empty($this->_server['HTTP_USER_AGENT'])) {
         $message .= 'User agent: ' . htmlspecialchars($this->_server['HTTP_USER_AGENT'], ENT_QUOTES, 'UTF-8') . "\n";
     }
     if (!empty($this->_server['HTTP_X_REQUESTED_WITH'])) {
         $message .= 'Request type: ' . htmlspecialchars($this->_server['HTTP_X_REQUESTED_WITH'], ENT_QUOTES, 'UTF-8') . "\n";
     }
     $message .= 'Server time: ' . date('Y-m-d H:i:s') . "\n";
     $message .= 'RequestURI: ' . htmlspecialchars($this->_error->request->getRequestUri(), ENT_QUOTES, 'UTF-8') . "\n";
     if (!empty($this->_server['HTTP_REFERER'])) {
         $message .= 'Referer: ' . htmlspecialchars($this->_server['HTTP_REFERER'], ENT_QUOTES, 'UTF-8') . "\n";
     }
     $message .= '<b>Message: ' . htmlspecialchars($this->_error->exception->getMessage(), ENT_QUOTES, 'UTF-8') . "</b>\n\n";
     $message .= "Trace:\n" . htmlspecialchars($this->_error->exception->getTraceAsString(), ENT_QUOTES, 'UTF-8') . "\n\n";
     $message .= 'Request data: ' . htmlspecialchars(var_export($this->_error->request->getParams(), true), ENT_QUOTES, 'UTF-8') . "\n\n";
     $it = $this->_session->getIterator();
     $message .= "Session data:\n";
     foreach ($it as $key => $value) {
         $message .= htmlspecialchars($key, ENT_QUOTES, 'UTF-8') . ': ' . htmlspecialchars(var_export($value, true), ENT_QUOTES, 'UTF-8') . "\n";
     }
     $message .= "\n";
     return $message;
 }
开发者ID:josephsnyder,项目名称:Midas,代码行数:36,代码来源:NotifyErrorComponent.php

示例3: createRole

 public function createRole($option = null)
 {
     $ns = new Zend_Session_Namespace('info');
     $nsInfo = $ns->getIterator();
     $info = $nsInfo['group'];
     $group_name = $info['group_name'];
     $ns->acl['role'] = $group_name;
 }
开发者ID:brianbui171,项目名称:website_zend_1.11,代码行数:8,代码来源:Acl.php

示例4: isCaptchaValid

	function isCaptchaValid($captcha)
	{
		$capId = $captcha['id']; 
        $capInput = $captcha['input']; 
        $capSession = new Zend_Session_Namespace('Zend_Form_Captcha_'.$capId); 
        $capWord = $capSession->getIterator(); 
        if(isset($capWord['word']) && $capWord['word'] == $capInput){ 
            return TRUE; 
        }else{ 
            return FALSE; 
        } 
	}
开发者ID:hungnv0789,项目名称:vhtm,代码行数:12,代码来源:TintucController.php

示例5: validateCaptcha

 public function validateCaptcha($captcha)
 {
     $captchaId = $captcha["id"];
     $captchaInput = $captcha["input"];
     $captchaSession = new Zend_Session_Namespace("Zend_Form_Captcha_" . $captchaId);
     $captchaIterator = $captchaSession->getIterator();
     if (isset($captchaIterator["word"])) {
         if ($captchaInput != $captchaIterator["word"]) {
             return false;
         } else {
             return true;
         }
     } else {
         return false;
     }
 }
开发者ID:sonvq,项目名称:2015_freelance6,代码行数:16,代码来源:ContactController.php

示例6: validateCaptcha

 public function validateCaptcha($captcha)
 {
     $captchaId = $captcha['id'];
     // And here's the user submitted word...
     $captchaInput = $captcha['input'];
     // We are accessing the session with the corresponding namespace
     // Try overwriting this, hah!
     $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaId);
     // To access what's inside the session, we need the Iterator
     // So we get one...
     $captchaIterator = $captchaSession->getIterator();
     // And here's the correct word which is on the image...
     $captchaWord = $captchaIterator['word'];
     // Now just compare them...
     if ($captchaInput == $captchaWord) {
         return true;
     } else {
         return false;
     }
 }
开发者ID:BGCX262,项目名称:zufangzi-svn-to-git,代码行数:20,代码来源:Common.php

示例7: processAction

 public function processAction()
 {
     $ns = new Zend_Session_Namespace("default");
     $request = $this->getRequest();
     $form = new Default_Form_ContactsForm(array('action' => '/contacts/process', 'method' => 'post'));
     $this->view->form = $form;
     // Check if we have a POST request
     if (!$request->isPost()) {
         return $this->_helper->redirector('index', 'contacts', 'default');
     }
     if ($form->isValid($request->getPost())) {
         // Get the values posted
         $params = $form->getValues();
         $captcha = $params['captcha'];
         // Actually it's an array, so both the ID and the submitted word
         // is in it with the corresponding keys
         // So here's the ID...
         $captchaId = $captcha['id'];
         // And here's the user submitted word...
         $captchaInput = $captcha['input'];
         // We are accessing the session with the corresponding namespace
         // Try overwriting this, hah!
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaId);
         // To access what's inside the session, we need the Iterator
         // So we get one...
         $captchaIterator = $captchaSession->getIterator();
         // And here's the correct word which is on the image...
         $captchaWord = $captchaIterator['word'];
         // Now just compare them...
         if ($captchaInput == $captchaWord) {
             $isp = Shineisp_Registry::get('ISP');
             Shineisp_Commons_Utilities::sendEmailTemplate($isp->email, 'contact', array('fullname' => $params['fullname'], 'company' => $params['company'], 'email' => $params['email'], 'subject' => $params['subject'], 'message' => $params['message']), null, null, null, null, $ns->langid);
             // Redirect the visitor to the contact page
             return $this->_helper->redirector('index', 'contacts', 'default', array('mex' => 'The task requested has been executed successfully.', 'status' => 'success'));
         }
     }
     return $this->_helper->viewRenderer('index');
 }
开发者ID:kokkez,项目名称:shineisp,代码行数:38,代码来源:ContactsController.php

示例8: getIterator

 /**
  * 名前空間の名前をすべて取得
  *
  * @access public
  */
 public function getIterator()
 {
     return parent::getIterator();
 }
开发者ID:noriotakei,项目名称:suraimu,代码行数:9,代码来源:ComSessionNamespace.php

示例9: testUnsetAllNamespace

 /**
  * test unsetAll keys in default namespace; expect namespace will contain no keys
  *
  * @return void
  */
 public function testUnsetAllNamespace()
 {
     $s = new Zend_Session_Namespace('somenamespace');
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $this->assertTrue(empty($result), "tearDown failure, found keys in 'somenamespace' namespace: '{$result}'");
     $s->a = 'apple';
     $s->lock();
     $s->unlock();
     $s->p = 'papaya';
     $s->c = 'cherry';
     $s = new Zend_Session_Namespace('somenamespace');
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $this->assertTrue($result === 'a === apple;p === papaya;c === cherry;', "unsetAll() setup for test failed: '{$result}'");
     $s->unsetAll();
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === {$val};";
     }
     $this->assertTrue(empty($result), "unsetAll() did not remove keys from namespace: '{$result}'");
 }
开发者ID:jsnshrmn,项目名称:Suma,代码行数:31,代码来源:SessionTest.php

示例10: postingAction

 function postingAction()
 {
     $captcha = new Zend_Captcha_Image();
     $vi = new Zend_View();
     $base = $vi->baseurl();
     $muser = new Admin_Model_Page();
     $paginator = Zend_Paginator::factory($muser->option_page());
     $paginator->setItemCountPerPage(10);
     $paginator->setPageRange(10);
     $currentPage = $this->_request->getParam('page', 1);
     $paginator->setCurrentPageNumber($currentPage);
     $this->view->books = $paginator;
     $system = new Admin_Model_Category();
     $menu = $system->option_menu();
     $this->view->bookss = $menu;
     $district = $system->option_dictrict();
     $this->view->bokk = $district;
     if (!$this->_request->isPost()) {
         $captcha->setTimeout('300')->setWordLen('4')->setHeight('60')->setWidth('320')->setImgDir(APPLICATION_PATH . '/../public_html/captcha/images/')->setImgUrl($base . '/captcha/images/')->setFont(APPLICATION_PATH . '/../public_html/font/AHGBold.ttf')->setFontSize(24);
         $captcha->generate();
         $this->view->captcha = $captcha->render($this->view);
         $this->view->captchaID = $captcha->getId();
         // Dua chuoi Captcha vao session
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captcha->getId());
         $captchaSession->word = $captcha->getWord();
     } else {
         $captchaID = $this->_request->captcha_id;
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID);
         $captchaIterator = $captchaSession->getIterator();
         $captchaWord = $captchaIterator['word'];
         if ($this->_request->captcha == $captchaWord) {
             $this->view->purifier = Zend_Registry::get('purifier');
             $conf = HTMLPurifier_Config::createDefault();
             $purifier = new HTMLPurifier($conf);
             $content = $purifier->purify($this->_request->getParam('content'));
             $menu_id = $purifier->purify($this->_request->getParam('parent_id'));
             $title = $purifier->purify($this->_request->getParam('title'));
             $dis = $purifier->purify($this->_request->getParam('dis'));
             $key = $purifier->purify($this->_request->getParam('key'));
             $description = $purifier->purify($this->_request->getParam('description'));
             // $home = $purifier->purify($this->_request->getParam('home'));
             $upload = new Zend_File_Transfer();
             $images = $upload->addValidator('Extension', false, 'jpg,png,gif');
             //print_r($images, FALSE) ;
             $images = $upload->getFilename();
             $images = basename($images);
             $url = khongdau($title);
             $random_digit = rand(00, 99999);
             if (basename($images)) {
                 $img = $url . "-" . $random_digit . $images;
                 $filterRename = new Zend_Filter_File_Rename(array('target' => 'Upload/' . $img, 'overwrite' => false));
                 $upload->addFilter($filterRename);
                 if (!$upload->receive()) {
                     thongbao("Vui lòng nhập đúng định dạng hình ảnh");
                     trang_truoc();
                     return;
                 }
                 $upload->receive();
             } else {
                 $img == "no-img.png";
             }
             // $position = $purifier->purify($this->_request->getParam('position'));
             //  $active = $purifier->purify($this->_request->getParam('active'));
             $price = $purifier->purify($this->_request->getParam('price'));
             $state = $purifier->purify($this->_request->getParam('state'));
             $sales = $purifier->purify($this->_request->getParam('sales'));
             $made_in = $purifier->purify($this->_request->getParam('made_in'));
             //$members = $purifier->purify($this->_request->getParam('members'));
             $session = new Zend_Session_Namespace('identity');
             $members = $session->username;
             $dictrict_id = $purifier->purify($this->_request->getParam('dictrict_id'));
             //  $type = $purifier->purify($this->_request->getParam('type'));
             $add = new Admin_Model_Products();
             $add->insert_products($title, $description, $img, $content, $menu_id, $price, $state, $sales, $dis, $key, "", 1, 2, $made_in, $members, $dictrict_id, 1);
             thongbao("Chúc mừng {$members}, bạn đã đăng tin thành công");
             chuyen_trang($base . "/thanh-vien.html");
         } else {
             thongbao('Ban nhap sai chuoi Captcha');
             trang_truoc();
         }
         $this->_helper->viewRenderer->setNoRender();
         $mask = APPLICATION_PATH . "/../public_html/captcha/images/*.png";
         array_map("unlink", glob($mask));
     }
 }
开发者ID:lynguyetvan88,项目名称:kemsakura,代码行数:85,代码来源:RegisterController.php

示例11: doGetArray

 /**
  * @param  array $args
  * @return integer Always returns zero.
  */
 public function doGetArray(array $args)
 {
     $GLOBALS['fpc'] = 'get';
     session_id($args[0]);
     if (isset($args[1]) && !empty($args[1])) {
         $s = new Zend_Session_Namespace($args[1]);
     } else {
         $s = new Zend_Session_Namespace();
     }
     $result = '';
     foreach ($s->getIterator() as $key => $val) {
         $result .= "{$key} === " . str_replace(array("\n", ' '), array(';', ''), print_r($val, true)) . ';';
     }
     // file_put_contents('out.sesstiontest.get', print_r($s->someArray, true));
     Zend_Session::writeClose();
     echo $result;
     return 0;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:22,代码来源:SessionTestHelper.php

示例12: validateCaptcha

 /**
  * @return boolean
  */
 public static function validateCaptcha($captcha)
 {
     //@todo Pesquisar bug que afeta o funcionamento do captcha, Internet Explorer funciona nomalmente...
     return true;
     $session = new Zend_Session_Namespace('captcha');
     $attempts = new Zend_Session_Namespace('attempts');
     if (!isset($attempts->attempts)) {
         return true;
     }
     $stored = $session->getIterator();
     if (!empty($captcha) && $captcha === $stored['captcha']) {
         return true;
     }
     return false;
 }
开发者ID:roquebrasilia,项目名称:sgdoc-codigo,代码行数:18,代码来源:Authentication.php

示例13: orderAction

 function orderAction()
 {
     $yourCart = new Zend_Session_Namespace('cart');
     if ($this->_request->isPost()) {
         $itemProduct = $this->_arrParam['itemProduct'];
         if (count($itemProduct) > 0) {
             foreach ($itemProduct as $key => $val) {
                 if ($val == 0) {
                     unset($itemProduct[$key]);
                 }
             }
         }
         $yourCart->cart = $itemProduct;
     }
     //echo count ($yourCart->cart);
     $ssInfo = $yourCart->getIterator();
     //var_dump($ssInfo);
     $tblProduct = new Default_Model_Cart();
     $this->_arrParam['cart'] = $ssInfo['cart'];
     if (count($this->_arrParam['cart']) > 0) {
         $this->view->Items = $tblProduct->listcart($this->_arrParam);
         $this->view->cart = $ssInfo['cart'];
         $buy = "";
         foreach ($ssInfo['cart'] as $key => $val) {
             $item[] = $key;
             $demo[] = $val;
             //  echo $key;
             //  echo $val;
         }
         for ($i = 0; $i < count($ssInfo['cart']); $i++) {
             $id = $item[$i];
             $sl = $demo[$i];
             $buy = $buy . "{$id}" . "___" . "{$sl}" . "______";
         }
         $buy = substr($buy, 0, -6);
         // thanh toan
         $muser = new Default_Model_Cart();
         $captcha = new Zend_Captcha_Image();
         $vi = new Zend_View();
         $base = $vi->baseurl();
         if (!$this->_request->isPost()) {
             $captcha->setTimeout('300')->setWordLen('4')->setHeight('50')->setWidth('320')->setImgDir(APPLICATION_PATH . '/../public_html/captcha/images/')->setImgUrl($base . '/captcha/images/')->setFont(APPLICATION_PATH . '/../public_html/font/UTM-Avo.ttf');
             $captcha->generate();
             $this->view->captcha = $captcha->render($this->view);
             $this->view->captchaID = $captcha->getId();
             // Dua chuoi Captcha vao session
             $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captcha->getId());
             $captchaSession->word = $captcha->getWord();
         } else {
             $captchaID = $this->_request->captcha_id;
             $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID);
             $captchaIterator = $captchaSession->getIterator();
             $captchaWord = $captchaIterator['word'];
             if ($this->_request->captcha == $captchaWord) {
                 $session = new Zend_Session_Namespace('identity');
                 $username = $session->username;
                 $this->view->purifier = Zend_Registry::get('purifier');
                 $conf = HTMLPurifier_Config::createDefault();
                 $purifier = new HTMLPurifier($conf);
                 $fullname = $purifier->purify($this->_request->getParam('fullname'));
                 $address = $purifier->purify($this->_request->getParam('address'));
                 $phone = $purifier->purify($this->_request->getParam('phone'));
                 $email = $purifier->purify($this->_request->getParam('email'));
                 $coment = $purifier->purify($this->_request->getParam('coment'));
                 $title = $purifier->purify($this->_request->getParam('title'));
                 $emaillh = "lynguyetvan88@gmail.com";
                 $tinnhan = "\n\t\t\tHọ tên : {$fullname} <br>\n\t\t\tEmail : {$email}<br>\n\t\t\tĐịa chỉ : {$address}<br>\n\t\t\tĐiện thoại : {$phone}<br>\n\t\t\t\n\t\t\tNội dung : {$coment}<br>";
                 $to = $emaillh;
                 $subject = $title;
                 $message = $tinnhan;
                 $headers = 'Content-type: text/html;charset=utf-8';
                 mail($to, $subject, $message, $headers);
                 // Thiết lập SMTP Server
                 require 'ham/class.phpmailer.php';
                 require 'ham/class.pop3.php';
                 // nạp thư viện
                 $mailer = new PHPMailer();
                 // khởi tạo đối tượng
                 $mailer->IsSMTP();
                 // gọi class smtp để đăng nhập
                 $mailer->CharSet = "utf-8";
                 // bảng mã unicode
                 //Đăng nhập Gmail
                 $mailer->SMTPAuth = true;
                 // Đăng nhập
                 $mailer->SMTPSecure = "ssl";
                 // Giao thức SSL
                 $mailer->Host = "smtp.gmail.com";
                 // SMTP của GMAIL
                 $mailer->Port = 465;
                 // cổng SMTP
                 // Phải chỉnh sửa lại
                 $mailer->Username = "dadichvu.88@gmail.com";
                 // GMAIL username
                 $mailer->Password = "itwebsite";
                 // GMAIL password
                 $mailer->AddAddress("{$emaillh}", 'Recipient Name');
                 //email người nhận
                 // Chuẩn bị gửi thư nào
                 $mailer->FromName = "{$fullname}";
//.........这里部分代码省略.........
开发者ID:lynguyetvan88,项目名称:webtuthien,代码行数:101,代码来源:CartController.php

示例14: feedbackAction

 /**
  * @author      : AnPCD
  * @name        : feedbackAction
  * @copyright   : FPT Online
  * @todo        : Ajax insert Feedback Video (Phản hồi của user về Video)
  */
 public function feedbackAction()
 {
     // Disable render layout
     $this->_helper->layout->disableLayout(true);
     // Set not render view
     $this->_helper->viewRenderer->setNoRender(true);
     //Init ajax return value
     $response = array('isSuccess' => 0, 'isCaptchaError' => 0);
     //Get Params
     $arrParams = $this->_request->getParams();
     //Get type
     $arrParams['type'] = array_sum($arrParams['type']);
     //Init flag for Check Valid captcha
     $flagCheckCaptcha = FALSE;
     //Trim captcha id
     $captchaID = trim($arrParams['captchaID']);
     //Valid captcha id
     if ($captchaID) {
         // session namespace zend
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID);
         //Get session word captcha
         $captchaSession->word = $_SESSION['word'];
         $captchaIterator = $captchaSession->getIterator();
         //Get captcha word
         $captchaWord = $captchaIterator['word'];
         //Get & trim input captcha
         $input_word = trim($arrParams['txtCode']);
         //Valid input word captcha & word captcha session
         if ($input_word == $captchaWord) {
             $flagCheckCaptcha = TRUE;
         } else {
             //Return response Captcha Error
             $response['isCaptchaError'] = 1;
         }
     }
     //Valid check captcha
     if ($flagCheckCaptcha) {
         //push job call userFeedbackVideo
         $jobParams = array('class' => 'Job_Vnexpress_Async', 'function' => 'userFeedbackVideo', 'args' => array('params' => array('email' => NULL, 'fullname' => NULL, 'videoid' => (int) $arrParams['videoid'], 'type' => (int) $arrParams['type'], 'content' => mb_substr(trim(strip_tags($arrParams['content'])), 0, 1000, 'UTF-8'), 'siteid' => SITE_ID, 'Ip' => $_SERVER['REMOTE_ADDR'])));
         //get application config
         $config = Vnexpress_Global::getApplicationIni();
         //To array
         $jobConfiguration = $config['job']['task']['vnexpress']['feedback_video'];
         //get job post article instance
         $jobClient = Vnexpress_Global::getJobClientInstance('vnexpress');
         //Register job
         $result = $jobClient->doBackgroundTask($jobConfiguration, $jobParams);
         //Valid result
         if ($result) {
             //Return success
             $response['isSuccess'] = 1;
             //refesh array params
             $arrParams = null;
         }
     }
     echo Zend_Json::encode($response);
     return;
 }
开发者ID:Nhan-Huynh-FO,项目名称:nhan-repo,代码行数:64,代码来源:VideoController.php

示例15: contactAction

 function contactAction()
 {
     $muser = new Default_Model_System();
     $conten = $muser->list_system();
     $this->view->book = $conten;
     $captcha = new Zend_Captcha_Image();
     $vi = new Zend_View();
     $base = $vi->baseurl();
     if (!$this->_request->isPost()) {
         $captcha->setTimeout('300')->setWordLen('4')->setHeight('50')->setWidth('320')->setImgDir(APPLICATION_PATH . '/../captcha/images/')->setImgUrl($base . '/captcha/images/')->setFont(APPLICATION_PATH . '/../font/UTM-Avo.ttf');
         $captcha->generate();
         $this->view->captcha = $captcha->render($this->view);
         $this->view->captchaID = $captcha->getId();
         // Dua chuoi Captcha vao session
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captcha->getId());
         $captchaSession->word = $captcha->getWord();
     } else {
         $captchaID = $this->_request->captcha_id;
         $captchaSession = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaID);
         $captchaIterator = $captchaSession->getIterator();
         $captchaWord = $captchaIterator['word'];
         if ($this->_request->captcha == $captchaWord) {
             $this->view->purifier = Zend_Registry::get('purifier');
             $conf = HTMLPurifier_Config::createDefault();
             $purifier = new HTMLPurifier($conf);
             $fullname = $purifier->purify($this->_request->getParam('fullname'));
             $address = $purifier->purify($this->_request->getParam('address'));
             $phone = $purifier->purify($this->_request->getParam('phone'));
             $email = $purifier->purify($this->_request->getParam('email'));
             $content = $purifier->purify($this->_request->getParam('content'));
             $title = $purifier->purify($this->_request->getParam('title'));
             $emaillh = $purifier->purify($this->_request->getParam('emaillh'));
             $tinnhan = "\n\t\t\tHọ tên : {$fullname} <br>\n\t\t\tEmail : {$email}<br>\n\t\t\tĐịa chỉ : {$address}<br>\n\t\t\tĐiện thoại : {$phone}<br>\n\t\t\t\n\t\t\tNội dung : {$content}<br>";
             $to = $emaillh;
             $subject = $title;
             $message = $tinnhan;
             $headers = 'Content-type: text/html;charset=utf-8';
             // mail($to, $subject, $message, $headers);
             //$html ="<img title=\"夕食:ル・バンドーム(フランス料理)\" alt=\"夕食:ル・バンドーム(フランス料理)\" src=\"http://toursystem.biz/uploads/product/1378725993LE_VENDOME_12.jpg\">";
             //         $mail = new Zend_Mail('UTF-8');
             //          $mail->setBodyHtml("$tinnhan");
             //          $mail->setFrom("$email", "$title");
             //          $mail->addTo("lynguyetvan88@gmail.com", 'Ly Le');
             //          $mail->addTo("$emaillh", "$fullname");
             //          $mail->setSubject("Thông tin liên hệ  ngày  : ".date("F j, Y"));
             //          $mail->send();
             // Thiết lập SMTP Server
             require 'ham/class.phpmailer.php';
             require 'ham/class.pop3.php';
             // nạp thư viện
             $mailer = new PHPMailer();
             // khởi tạo đối tượng
             $mailer->IsSMTP();
             // gọi class smtp để đăng nhập
             $mailer->CharSet = "utf-8";
             // bảng mã unicode
             //Đăng nhập Gmail
             $mailer->SMTPAuth = true;
             // Đăng nhập
             $mailer->SMTPSecure = "ssl";
             // Giao thức SSL
             $mailer->Host = "smtp.gmail.com";
             // SMTP của GMAIL
             $mailer->Port = 465;
             // cổng SMTP
             // Phải chỉnh sửa lại
             $mailer->Username = "dadichvu.88@gmail.com";
             // GMAIL username
             $mailer->Password = "itwebsite";
             // GMAIL password
             $mailer->AddAddress("{$emaillh}", 'Recipient Name');
             //email người nhận
             // Chuẩn bị gửi thư nào
             $mailer->FromName = "{$fullname}";
             // tên người gửi
             $mailer->From = "{$email}";
             // mail người gửi
             $mailer->Subject = "{$base}";
             $mailer->IsHTML(true);
             //Bật HTML không thích thì false
             // Nội dung lá thư
             $mailer->Body = "{$tinnhan}";
             // Gửi email
             if (!$mailer->Send()) {
                 // Gửi không được, đưa ra thông báo lỗi
                 echo "Không gửi được ";
                 echo "Lỗi: " . $mailer->ErrorInfo;
             } else {
                 $muser->contact($fullname, $address, $phone, $email, $title, $content);
                 thongbao("Cảm ơn bạn đã liên hệ cho chúng tôi");
                 trangtruoc();
             }
         } else {
             thongbao('Bạn nhập sai chuỗi Captcha');
             trang_truoc();
         }
         $this->_helper->viewRenderer->setNoRender();
         $mask = APPLICATION_PATH . "/../captcha/images/*.png";
         array_map("unlink", glob($mask));
     }
//.........这里部分代码省略.........
开发者ID:lynguyetvan88,项目名称:kemsakura,代码行数:101,代码来源:IndexController.php


注:本文中的Zend_Session_Namespace::getIterator方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。