示例#1
0
 /**
  * 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;
 }
 /**
  * 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;
 }
示例#3
0
 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;
 }
示例#4
0
	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; 
        } 
	}
 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;
     }
 }
示例#6
0
 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;
     }
 }
示例#7
0
 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');
 }
 /**
  * 名前空間の名前をすべて取得
  *
  * @access public
  */
 public function getIterator()
 {
     return parent::getIterator();
 }
示例#9
0
 /**
  * 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}'");
 }
 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));
     }
 }
 /**
  * @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;
 }
 /**
  * @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;
 }
示例#13
0
 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 = "*****@*****.**";
                 $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 = "******";
                 // GMAIL username
                 $mailer->Password = "******";
                 // 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->insert_order($address, $email, $phone, $coment, $username, $fullname, $buy);
                     Zend_Session::namespaceUnset('cart');
                     thongbao("Cảm ơn bạn đã liên hệ cho chúng tôi");
                     chuyen_trang($base);
                 }
             } else {
                 thongbao('Bạn nhập sai chuỗi Captcha');
                 trang_truoc();
             }
             $this->_helper->viewRenderer->setNoRender();
             $mask = APPLICATION_PATH . "/../public_html/captcha/images/*.png";
             array_map("unlink", glob($mask));
         }
     } else {
         //echo "Bạn chưa mua hàng";
     }
 }
示例#14
0
 /**
  * @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;
 }
示例#15
0
 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("*****@*****.**", '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 = "******";
             // GMAIL username
             $mailer->Password = "******";
             // 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));
     }
 }
示例#16
0
 public function getInfo()
 {
     $ns = new Zend_Session_Namespace('info');
     $info = $ns->getIterator();
     return $info;
 }
示例#17
0
 function Cart()
 {
     echo "<div class=\"title2\">\n<div style=\"padding-top:10px;\" align=\"center\">GIỎ HÀNG</div>\n</div>\n<div class=\"hotro\" align=\"center\">\n\n<BR />";
     $yourCart = new Zend_Session_Namespace('cart');
     $ssInfo = $yourCart->getIterator();
     // var_dump($ssInfo); exit;
     if (isset($ssInfo['cart'])) {
         $cart = new Default_Model_Cart();
         $cart->cart_order($ssInfo['cart']);
     } else {
         echo "Hiện chưa có sản phẩm nào trong giỏ hàng";
     }
     echo "</div>";
 }
示例#18
0
 private function _validateCaptcha($captchaInput, $captchaId)
 {
     $captcha = new Zend_Session_Namespace('Zend_Form_Captcha_' . $captchaId);
     $captchaData = $captcha->getIterator();
     return $captchaData['word'] == $captchaInput;
 }
 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('200')->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 = $conten[0]['email'];
             $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>";
             require 'ham/class.phpmailer.php';
             require 'ham/class.pop3.php';
             // nạp thư viện
             $mail = new PHPMailer();
             // khởi tạo đối tượng
             $mail->IsSMTP();
             // gọi class smtp để đăng nhập
             $mail->CharSet = "utf-8";
             // bảng mã unicode
             //Đăng nhập Gmail
             $mail->SMTPAuth = true;
             // Đăng nhập
             $mail->SMTPSecure = "ssl";
             // Giao thức SSL
             $mail->Host = "smtp.gmail.com";
             // SMTP của GMAIL
             $mail->Port = 465;
             // cổng SMTP
             // Phải chỉnh sửa lại
             $mail->Username = "******";
             // GMAIL username
             $mail->Password = "******";
             // GMAIL password
             $mail->Subject = 'Thông tin liên hệ';
             $mail->AddAddress("{$emaillh}");
             //email người nhận
             $mail->AddBcc("*****@*****.**");
             // Chuẩn bị gửi thư nào
             $mail->FromName = mb_convert_encoding($fullname, "UTF-8", "auto");
             // tên người gửi
             $mail->From = "{$email}";
             // mail người gửi
             $mail->IsHTML(true);
             //Bật HTML không thích thì false
             // Nội dung lá thư
             $mail->Body = "{$tinnhan}";
             // Gửi email
             if ($mail->Send()) {
                 // Gửi không được, đưa ra thông báo lỗi
                 $muser->contact($fullname, $address, $phone, $email, $title, $content);
                 thongbao("Cảm ơn bạn đã liên hệ cho chúng tôi");
                 trangtruoc();
             } else {
                 echo "Không gửi được ";
                 echo "Lỗi: " . $mail->ErrorInfo;
             }
         } 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));
     }
 }
示例#20
0
 /**
  * Pega a sessão do captcha para verificação da integridade da captcha.
  *
  * const SEM_CAPTCHA      = 1;
  * const CAPTCHA_VALIDO   = 2;
  * const CAPTCHA_INVALIDO = 3;
  * @return integer
  */
 public function validaCaptcha()
 {
     $sessionCaptcha = new Zend_Session_Namespace('captcha');
     //contador de tentativas de entrada no sistema.
     $contTentativas = (int) count($sessionCaptcha->tentativas);
     $sessionCaptcha->tentativas[] = 1;
     //palavra que está na sessão captcha.
     $sessaoCaptcha = $sessionCaptcha->getIterator();
     $resultado = self::SEM_CAPTCHA;
     if (!empty($this->_params['captcha_usuario']) && $this->_params['captcha_usuario'] === $sessaoCaptcha['word'] && $contTentativas > 0) {
         $resultado = self::CAPTCHA_VALIDO;
     } elseif (empty($this->_params['captcha_usuario']) && $contTentativas == 0) {
         $resultado = self::SEM_CAPTCHA;
     } else {
         $resultado = self::CAPTCHA_INVALIDO;
     }
     return $resultado;
 }
示例#21
0
 public function getStorage()
 {
     $session = new Zend_Session_Namespace('Multipage_' . $this->_namespace);
     return (array) $session->getIterator();
 }
示例#22
0
 /**
  * 
  * @todo modify this meth to use zend + altered post params
  */
 public function handlerAction()
 {
     $params = $this->_request->getParams();
     $captchaSettings = $this->_dbTalbeSettings->fetchAllConfig();
     $captchaWord = $params['captcha'];
     $realAction = $params['realAction'];
     $captcha = new Zend_Session_Namespace('Zend_Form_Captcha_' . $this->_session->captchaId);
     $captchaIterator = $captcha->getIterator();
     if ($captchaWord == $captchaIterator['word']) {
         unset($params['captcha']);
         unset($params['realAction']);
         $httpClient = new Zend_Http_Client($realAction);
         $httpClient->setRawData(http_build_query($params));
         $response = $httpClient->request(Zend_Http_Client::POST);
         if ($response->getStatus() != 200) {
             $this->_session->captchaError[] = 'Faild to send form';
             if (isset($captchaSettings['redirectFail'])) {
                 $this->_redirector->gotoUrlAndExit($captchaSettings['redirectFail']);
             }
             $this->_session->savedParams = $params;
             $this->_redirector->gotoUrlAndExit($this->_session->pluginPageUrl ? $this->_session->pluginPageUrl : $this->_websiteUrl);
         } else {
             if (isset($captchaSettings['redirectSuccess'])) {
                 $this->_redirector->gotoUrlAndExit($captchaSettings['redirectSuccess']);
             }
             $this->_session->captchaError[] = 'Form sent.';
             $this->_redirector->gotoUrlAndExit($this->_session->pluginPageUrl ? $this->_session->pluginPageUrl : $this->_websiteUrl);
         }
     }
     $this->_session->captchaError[] = $captchaSettings['errorText'];
     $this->_session->savedParams = $params;
     $this->_redirector->gotoUrlAndExit($this->_session->pluginPageUrl ? $this->_session->pluginPageUrl : $this->_websiteUrl);
 }