コード例 #1
0
 public function filterAction()
 {
     $ssFilter = new Container($this->_namespace);
     $purifier = new \HTMLPurifier_HTMLPurifier();
     if ($this->_arrParam['type'] == 'search') {
         if ($this->_arrParam['col'] == 'null' && $this->_arrParam['by'] == 'null' && $this->_arrParam['key'] == 1) {
             if ($this->params()->fromPost('keywords') != '') {
                 $ssFilter->keywords = $purifier->purify(trim($this->params()->fromPost('keywords')));
                 $ssFilter->field = $this->params()->fromPost('field');
             }
             $ssFilter->status = $this->params()->fromPost('status');
             $ssFilter->city = $this->params()->fromPost('city_id');
             $ssFilter->group = $this->params()->fromPost('group_id');
         }
         if ($this->_arrParam['col'] == 'null' && $this->_arrParam['by'] == 'null' && $this->_arrParam['key'] == 0) {
             $ssFilter->getManager()->getStorage()->clear();
         }
     }
     if ($this->_arrParam['type'] == 'order' && $this->_arrParam['col'] != 'null' && $this->_arrParam['by'] != 'null') {
         $ssFilter->col = $this->_arrParam['col'];
         $ssFilter->order = $this->_arrParam['by'];
     }
     if ($this->_arrParam['type'] == 'record') {
         $ssFilter->record = $this->params()->fromPost('record');
     }
     $this->redirect()->toUrl('/admin/legislationhousing/');
     return $this->getResponse();
 }
コード例 #2
0
 public function supportAction()
 {
     $view = new ViewModel();
     //Tiêu đề
     $title = 'Trao đổi liên hệ';
     $this->headTitle($title)->setSeparator(" - ")->append("Website bất động sản");
     $this->_arrParam['id'] = 1;
     $item = $this->getConfigTable()->getItem($this->_arrParam, array('task' => 'get-item'));
     $contactMeForm = $this->serviceLocator->get('FormElementManager')->get('contactMeForm');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $contactMeForm->setData($data);
         if ($contactMeForm->isValid()) {
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('fullname' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['contact-me-fullname'])), 'email' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['contact-me-email'])), 'phone' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['contact-me-phone'])), 'title' => 'Chưa có tiêu đề', 'content' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['contact-me-content'])), 'date_time' => date('d/m/y h:i:s'));
             $this->getContactTable()->saveItem($data, array('task' => 'add'));
             $this->flashMessenger()->addSuccessMessage('Bạn đã đăng kí email thành công');
             $this->redirect()->toUrl('/home/index/support');
         }
     }
     $view->setVariables(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $contactMeForm, 'item' => $item));
     return $view;
 }
コード例 #3
0
 public function contactMeAction()
 {
     $contactMeForm = $this->serviceLocator->get('FormElementManager')->get('contactMeForm');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $contactMeForm->setData($data);
         if ($contactMeForm->isValid()) {
             //insert db
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('user_id' => $this->_arrPost['contact-me-user-id'], 'fullname' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['contact-me-fullname'])), 'phone' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['contact-me-phone'])), 'email' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['contact-me-email'])), 'content' => $purifier->purify($this->_arrPost['contact-me-content']), 'date_time' => date('d/m/y h:i:s'));
             $item = $this->getTable()->saveItem($data, array('task' => 'contact-me'));
             $result['status'] = 'success';
             $result['messages']['success'] = 'Gửi liên hệ thành công';
         } else {
             $result['status'] = 'error';
             $result['messages']['fullname'] = current($contactMeForm->getMessages('contact-me-fullname'));
             $result['messages']['phone'] = current($contactMeForm->getMessages('contact-me-phone'));
             $result['messages']['email'] = current($contactMeForm->getMessages('contact-me-email'));
             $result['messages']['content'] = current($contactMeForm->getMessages('contact-me-content'));
         }
     }
     echo \Zend\Json\Json::encode($result);
     return $this->getResponse();
 }
コード例 #4
0
 public function filterAction()
 {
     $ssFilter = new Container($this->_namespace);
     $purifier = new \HTMLPurifier_HTMLPurifier();
     if ($this->_arrParam['type'] == 'search') {
         if ($this->_arrParam['col'] == 'null' && $this->_arrParam['by'] == 'null' && $this->_arrParam['key'] == 1) {
             if ($this->params()->fromPost('keywords_send') != '') {
                 $ssFilter->keywords_send = $purifier->purify(trim($this->params()->fromPost('keywords_send')));
                 $ssFilter->field_send = $this->params()->fromPost('field_send');
             }
             if ($this->params()->fromPost('keywords_receive') != '') {
                 $ssFilter->keywords_receive = $purifier->purify(trim($this->params()->fromPost('keywords_receive')));
                 $ssFilter->field_receive = $this->params()->fromPost('field_receive');
             }
             if ($this->params()->fromPost('keywords_user_send') != '') {
                 $ssFilter->keywords_user_send = $purifier->purify(trim($this->params()->fromPost('keywords_user_send')));
                 $ssFilter->field_user_send = $this->params()->fromPost('field_user_send');
             }
             if ($this->params()->fromPost('keywords_user_receive') != '') {
                 $ssFilter->keywords_user_receive = $purifier->purify(trim($this->params()->fromPost('keywords_user_receive')));
                 $ssFilter->field_user_receive = $this->params()->fromPost('field_user_receive');
             }
             $ssFilter->status = $this->params()->fromPost('status');
             $ssFilter->city = $this->params()->fromPost('city_id');
             $ssFilter->group = $this->params()->fromPost('group_id');
         }
         if ($this->_arrParam['col'] == 'null' && $this->_arrParam['by'] == 'null' && $this->_arrParam['key'] == 0) {
             $ssFilter->getManager()->getStorage()->clear($this->_namespace);
         }
     }
     if ($this->_arrParam['type'] == 'order' && $this->_arrParam['col'] != 'null' && $this->_arrParam['by'] != 'null') {
         $ssFilter->col = $this->_arrParam['col'];
         $ssFilter->order = $this->_arrParam['by'];
     }
     if ($this->_arrParam['type'] == 'record') {
         $ssFilter->record = $this->params()->fromPost('record');
     }
     $redirect = new Container($this->_namespace . '_redirect');
     $this->redirect()->toUrl($redirect->curentUrl);
     return $this->getResponse();
 }
コード例 #5
0
 public function addAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Hỗ trợ/ góp ý';
     $this->headTitle($title)->setSeparator(" - ")->append("Website bất động sản");
     //Nested Menu Left
     $view = new ViewModel();
     //Form
     $contactForm = $this->serviceLocator->get('FormElementManager')->get('contactUserForm');
     //Bind
     $object = new ArrayObject(array('fullname' => $this->identity()->fullname, 'email' => $this->identity()->email));
     $contactForm->bind($object);
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $contactForm->setData($data);
         if ($contactForm->isValid() && empty($error)) {
             $time = date('d-m-Y');
             //ngày đăng kí
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('fullname' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['fullname'])), 'email' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['email'])), 'phone' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['phone'])), 'title' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['title'])), 'content' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['content'])), 'date_time' => date('d/m/y h:i:s'));
             $id = $this->getTable()->saveItem($data, array('task' => 'add'));
             $this->redirect()->toUrl('/user/account/index/');
         }
     }
     $view->setVariables(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $contactForm, 'error' => $error));
     return $view;
 }
コード例 #6
0
 public function addAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Gửi tin nhắn';
     $this->headTitle($title)->setSeparator(" - ")->append("Website bất động sản");
     //Nested Menu Left
     $view = new ViewModel();
     //Form
     $messageUserForm = $this->serviceLocator->get('FormElementManager')->get('messageUserForm');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $messageUserForm->setData($data);
         $result = $this->getTable()->getItem($this->_arrPost['username'], array('task' => 'check-username'));
         if (empty($result)) {
             $error[] = 'Thành viên này không tồn tại';
         } else {
             $idUser = $result[0]['id'];
             if ($idUser == $this->identity()->id) {
                 $error[] = 'Bạn không thể gửi tin cho chính mình';
             }
         }
         if ($messageUserForm->isValid() && empty($error)) {
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('user_id_send' => $this->identity()->id, 'user_id_nhan' => $idUser, 'name' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['name'])), 'content' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['content'])), 'date_time' => date('d/m/y h:i:s'));
             //người gửi
             $this->getTable()->saveItem($data, array('task' => 'user_send'));
             //người nhận
             $this->getTable()->saveItem($data, array('task' => 'user_receive'));
             $this->redirect()->toUrl('/user/message/send/');
         }
     }
     $view->setVariables(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $messageUserForm, 'error' => $error));
     return $view;
 }
コード例 #7
0
 /**
  * Singleton for enforcing just one HTML Purifier in your system
  *
  * @param HTMLPurifier|HTMLPurifier_Config $prototype Optional prototype
  *                   HTMLPurifier instance to overload singleton with,
  *                   or HTMLPurifier_Config instance to configure the
  *                   generated version with.
  *
  * @return HTMLPurifier
  */
 public static function instance($prototype = null)
 {
     if (!self::$instance || $prototype) {
         if ($prototype instanceof HTMLPurifier) {
             self::$instance = $prototype;
         } elseif ($prototype) {
             self::$instance = new HTMLPurifier($prototype);
         } else {
             self::$instance = new HTMLPurifier();
         }
     }
     return self::$instance;
 }
コード例 #8
0
 public function bannerAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Banner website';
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     $bannerAdminForm = $this->serviceLocator->get('FormElementManager')->get('bannerAdminForm');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $bannerAdminForm->setData($data);
         if ($bannerAdminForm->isValid() && empty($error)) {
             $item = $this->getTable()->getItem($this->_arrParam, array('task' => 'get-item'));
             $arrConfig = \Zend\Json\Json::decode($item->config_banner);
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $arrConfigBanner = array('banner' => $arrConfig->banner, 'width' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['width'])), 'height' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['height'])), 'url' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['url'])));
             $data = array('id' => 1, 'config_banner' => \Zend\Json\Json::encode($arrConfigBanner));
             $this->getTable()->saveItem($data, array('task' => 'edit'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/admin/skin/banner');
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $bannerAdminForm, 'error' => $error));
 }
コード例 #9
0
ファイル: PurifierController.php プロジェクト: trongle/zend-2
 public function index11Action()
 {
     $config = \HTMLPurifier_Config::createDefault();
     $purifier = new \HTMLPurifier_HTMLPurifier($config);
     $input = "<h4>TRongLE";
     $output = $purifier->purify($input);
     echo "<h3 style='color:red;font-weight:bold'>input : </h3>" . $input . "<br>";
     echo "<h3 style='color:red;font-weight:bold'>output : </h3>" . $output;
     return false;
 }
コード例 #10
0
 public function payAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Thanh toán Dịch vụ tài khoản cao cấp';
     $this->headTitle($title)->setSeparator(" - ")->append("Website bất động sản");
     //Nested Menu Left
     $view = new ViewModel();
     //Kiểm tra có chọn dịch vụ không
     if (empty($this->_arrParam['id'])) {
         $this->redirect()->toUrl('/user/service/index/');
     }
     $item = $this->getTable()->getItem($this->_arrParam, array('task' => 'get-item'));
     $itemThoiHanSuDung = $this->getTable()->getItem($this->identity()->id, array('task' => 'get-item-thoi-han-su-dung'));
     //Form
     $serviceAccountForm = $this->serviceLocator->get('FormElementManager')->get('serviceAccountUserForm');
     //Bind
     $object = new ArrayObject(array('fullname' => $this->identity()->fullname, 'name' => $item->name, 'email' => $this->identity()->email));
     $serviceAccountForm->bind($object);
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $serviceAccountForm->setData($data);
         //Kiểm tra chọn select box
         if (empty($this->_arrPost['payment'])) {
             $error[] = 'Bạn phải chọn Hình thức thanh toán!';
         }
         if ($serviceAccountForm->isValid() && empty($error)) {
             //Lấy ngày hiện tại
             $thoihan = 182;
             //6 tháng
             $time = date('d-m-Y');
             //ngày đăng kí
             $hansudung = strtotime(date("d-m-Y", strtotime($time)) . " +{$thoihan} day");
             $hansudung = strftime("%d-%m-%Y", $hansudung);
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('user_id' => $this->identity()->id, 'date_start' => $time, 'date_end' => $hansudung, 'total_price' => $purifier->purify($this->_arrPost['total_price']), 'note' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['note'])), 'service_account_id' => $item->id, 'hinhthuc_thanhtoan' => $purifier->purify($this->_arrPost['payment']), 'payment_status' => 0, 'status' => 0);
             $id = $this->getTable()->saveItem($data, array('task' => 'add'));
             $this->redirect()->toUrl('/user/account/index/');
         }
     }
     $view->setVariables(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'itemThoiHanSuDung' => $itemThoiHanSuDung, 'myForm' => $serviceAccountForm, 'error' => $error, 'item' => $item));
     return $view;
 }
コード例 #11
0
 public function editAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Doanh nghiệp BĐS > Chỉnh sửa';
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     //list city
     $itemsCity = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-city'));
     //loại hình doanh nghiệp
     $itemsTypeBusinesss = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-type-business'));
     $item = $this->getTable()->getItem($this->_arrParam, array('task' => 'get-item'));
     $businessForm = $this->serviceLocator->get('FormElementManager')->get('businessUserForm');
     $businessForm->setInputFilter(new \User\Form\BusinessFilter(array('task' => 'edit', 'id' => $this->_arrParam['id'])));
     $businessForm->bind($item);
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $businessForm->setData($data);
         //Kiểm tra chọn select box
         if (empty($this->_arrPost['city'])) {
             $error[] = 'Bạn phải chọn thông tin Thành phố của doanh nghiệp!';
         }
         if (empty($this->_arrPost['district'])) {
             $error[] = 'Bạn phải chọn thông tin Quận huyện của doanh nghiệp!';
         }
         if (empty($this->_arrPost['type_business'])) {
             $error[] = 'Bạn phải chọn thông tin loại hình doanh nghiệp!';
         }
         if ($businessForm->isValid() && empty($error)) {
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('id' => $purifier->purify($this->_arrPost['id']), 'type_business' => $purifier->purify($this->_arrPost['type_business']), 'name' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['name'])), 'alias' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['alias'])), 'address' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['address'])), 'city' => $purifier->purify($this->_arrPost['city']), 'district' => $purifier->purify($this->_arrPost['district']), 'ward' => $purifier->purify($this->_arrPost['ward']), 'phone' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['phone'])), 'fax' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['fax'])), 'website' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['website'])), 'intro' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['intro'])), 'contact' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['contact'])), 'department' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['department'])));
             $this->getTable()->saveItem($data, array('task' => 'edit'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/user/business/');
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $businessForm, 'item' => $item, 'itemsTypeBusinesss' => $itemsTypeBusinesss, 'itemsCity' => $itemsCity, 'error' => $error));
 }
コード例 #12
0
 public function editAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Sửa tin bất động sản';
     $this->headTitle($title)->setSeparator(" - ")->append("Website bất động sản");
     //Item select box
     $itemsTypeRealEstate = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-type-real-estate'));
     $itemsCity = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-city'));
     //Nested Menu Left
     $view = new ViewModel();
     $view->setTemplate('user/real-estate/edit');
     $menuLeft = new ViewModel(array('nameMenu' => 'Trang thành viên'));
     $menuLeft->setTemplate('user/block/menuLeft');
     $view->addChild($menuLeft, 'menuLeft');
     $item = $this->getTable()->getItem($this->_arrParam, array('task' => 'get-item'));
     //Bind
     $RealEstateForm = $this->serviceLocator->get('FormElementManager')->get('RealEstateForm');
     $RealEstateForm->setInputFilter(new \User\Form\RealEstateFilter(array('task' => 'edit', 'id' => $this->_arrParam['id'])));
     $RealEstateForm->bind($item);
     $object = new ArrayObject(array('fullname' => $this->identity()->fullname, 'phone' => $this->identity()->phone, 'skype' => $this->identity()->website, 'email' => $this->identity()->email));
     $RealEstateForm->bind($object);
     //find parent Cat
     $parentCat = $this->getTable()->getItem($item->cat_id, array('task' => 'get-item-find-parent-cat'));
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $RealEstateForm->setData($data);
         //Kiểm tra chọn select box
         if (empty($this->_arrPost['type_real_estate'])) {
             $error[] = 'Bạn phải chọn loại Bất động sản!';
         }
         if (empty($this->_arrPost['city'])) {
             $error[] = 'Bạn phải chọn Thành phố!';
         }
         if (empty($this->_arrPost['district'])) {
             $error[] = 'Bạn phải chọn Quận huyện!';
         }
         if ($RealEstateForm->isValid() && empty($error)) {
             //Lấy ngày hiện tại
             $date_start = date('d/m/Y');
             //Cộng thêm 7 ngày
             $date_end = strtotime(date("d-m-Y", strtotime(date('d-m-Y'))) . " +7 day");
             $date_end = strftime("%d/%m/%Y", $date_end);
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('id' => $purifier->purify($this->_arrPost['id']), 'cat_id' => $purifier->purify($this->_arrPost['type_real_estate_child']), 'title' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['title'])), 'content' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['content'])), 'transaction' => $purifier->purify($this->_arrPost['type_transaction']), 'area' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['area'])), 'price' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['price'])), 'price_m2' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['price_m2'])), 'price_display' => $purifier->purify($this->_arrPost['display_price']), 'direction' => $purifier->purify($this->_arrPost['direction']), 'avenue' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['avenue'])), 'juridical' => $purifier->purify($this->_arrPost['juridical']), 'floor' => $purifier->purify($this->_arrPost['floor']), 'bedroom' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['bedroom'])), 'bathroom' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['bathroom'])), 'city' => $purifier->purify($this->_arrPost['city']), 'district' => $purifier->purify($this->_arrPost['district']), 'ward' => $purifier->purify($this->_arrPost['ward']), 'project' => $purifier->purify($this->_arrPost['project_bds']), 'numberhouse' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['numberhouse'])), 'nameavenue' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['nameavenue'])), 'user_id' => $this->identity()->id, 'latitude_gmap' => $purifier->purify($this->_arrPost['latitude']), 'longitude_gmap' => $purifier->purify($this->_arrPost['longitude']), 'date_modifi' => $date_start);
             $this->getTable()->saveItem($data, array('task' => 'edit'));
             $this->redirect()->toUrl('/user/real-estate/active/');
         }
     }
     $view->setVariables(array('arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $RealEstateForm, 'itemsTypeRealEstate' => $itemsTypeRealEstate, 'itemsCity' => $itemsCity, 'error' => $error, 'item' => $item, 'parentCat' => $parentCat));
     return $view;
 }
コード例 #13
0
 public function validateRegisterAction()
 {
     $registerHomeForm = $this->serviceLocator->get('FormElementManager')->get('registerHomeForm');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $registerHomeForm->setData($data);
         if ($registerHomeForm->isValid()) {
             $arrInfoServiceAccount = array('service_account' => 'Tài khoản thường', 'normal' => 10, 'vip' => 10, 'hot' => 10, 'free' => 10, 'chinhchu' => 10, 'date_start' => '21-12-2014', 'date_end' => '21-12-2014');
             $config = new \ZendVN\Config\Config();
             if ($config->activeAccountEmail() == 1) {
                 $active_code = mt_rand() . mt_rand() . mt_rand() . mt_rand() . mt_rand();
                 //Kích hoạt qua email cẩn phải có mã kích hoạt
                 $status = 0;
                 //Sau khi kích hoạt tài khoản mới hoạt động được
             } else {
                 //Nếu không phải kích hoạt qua email thì không cần mã kích hoạt
                 $active_code = '';
                 $status = 1;
                 //tài khoản hoạt động được luôn
             }
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('username' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['username'])), 'password' => md5($this->_arrPost['password']), 'email' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['email'])), 'avatar' => '', 'fullname' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['fullname'])), 'city_id' => 1, 'website' => '', 'phone' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['phone'])), 'active_code' => $active_code, 'status' => $status, 'group_id' => 4, 'register_ip' => $_SERVER['REMOTE_ADDR'], 'register_date' => date('d/m/y h:i:s'), 'diachi' => '', 'info_service_account' => \Zend\Json\Json::encode($arrInfoServiceAccount));
             $lastInsertId = $this->getTable()->saveItem($data, array('task' => 'add'));
             if ($config->activeAccountEmail() == 1) {
                 $AccountActiveLink = \ZendVN\Url\CurrentDomain::get() . $this->url()->fromRoute('MVC_HomeRouter/active', array('module' => 'home', 'controller' => 'user', 'action' => 'active', 'id' => $lastInsertId, 'code' => $active_code));
                 $this->sendMail($this->_arrPost['fullname'], 'Bất động sản', $this->_arrPost['email'], $this->_arrPost['password'], $AccountActiveLink);
                 $result['messages']['success'] = 'Một email vừa được gửi tới ' . $this->_arrPost['email'] . ' Với một mã kích hoạt. Bạn vui lòng kiểm tra email để kích hoạt tài khoản';
             } else {
                 $result['messages']['success'] = 'Chúc mừng bạn đã đăng kí thành công';
             }
             $result['status'] = 'success';
         } else {
             $result['status'] = 'error';
             $result['messages']['fullname'] = current($registerHomeForm->getMessages('fullname'));
             $result['messages']['username'] = current($registerHomeForm->getMessages('username'));
             $result['messages']['password'] = current($registerHomeForm->getMessages('password'));
             $result['messages']['confirmpassword'] = current($registerHomeForm->getMessages('confirm-password'));
             $result['messages']['email'] = current($registerHomeForm->getMessages('email'));
             $result['messages']['phone'] = current($registerHomeForm->getMessages('phone'));
             $result['messages']['captcha'] = '';
             if (current($registerHomeForm->getMessages('captcha')) != '') {
                 $result['messages']['captcha'] = 'Mã an toàn không chính xác';
             }
         }
     }
     echo \Zend\Json\Json::encode($result);
     return $this->getResponse();
 }
コード例 #14
0
 /** OutputSortAttr */
 public function Index11Action()
 {
     $config = \HTMLPurifier_Config::createDefault();
     $config->set('HTML.EnableID', true);
     $config->set('Output.SortAttr', true);
     /** không chứa các id */
     $input = '<h3>Span Tag';
     $purifier = new \HTMLPurifier_HTMLPurifier($config);
     $output = $purifier->purify($input);
     echo 'Output: ' . $output;
     return false;
 }
コード例 #15
0
 public function maintenanceAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Chế độ bảo trì';
     $this->headTitle($title)->setSeparator(" - ")->append("Hệ thống quản trị website");
     $configMaintenanceAdminForm = $this->serviceLocator->get('FormElementManager')->get('configMaintenanceAdminForm');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $configMaintenanceAdminForm->setData($data);
         if ($configMaintenanceAdminForm->isValid() && empty($error)) {
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $arrConfig = array('notice' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['notice'])), 'status' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['status'])));
             $data = array('id' => 1, 'maintenance' => \Zend\Json\Json::encode($arrConfig));
             $this->getTable()->saveItem($data, array('task' => 'edit'));
             $this->flashMessenger()->addSuccessMessage('Dữ liệu đã được lưu thành công');
             $this->redirect()->toUrl('/admin/config/maintenance');
         }
     }
     return new ViewModel(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'myForm' => $configMaintenanceAdminForm, 'error' => $error));
 }
コード例 #16
0
 public function addAction()
 {
     $error = array();
     //Tiêu đề
     $title = 'Đăng ký để nhận email về BĐS mới nhất phù hợp';
     $this->headTitle($title)->setSeparator(" - ")->append("Website bất động sản");
     //Nested Menu Left
     $view = new ViewModel();
     //Item select box
     $itemsTypeRealEstate = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-type-real-estate'));
     $itemsCity = $this->getTable()->itemInselectBox($this->_arrParam, array('task' => 'list-item-city'));
     //Form
     $registerEmailForm = $this->serviceLocator->get('FormElementManager')->get('registerEmailUserForm');
     if ($this->getRequest()->isPost()) {
         $data = $this->getRequest()->getPost();
         $registerEmailForm->setData($data);
         //Kiểm tra chọn select box
         if (empty($this->_arrPost['type_real_estate'])) {
             $error[] = 'Bạn phải chọn loại Bất động sản!';
         }
         if (empty($this->_arrPost['city'])) {
             $error[] = 'Bạn phải chọn Thành phố!';
         }
         if (empty($this->_arrPost['district'])) {
             $error[] = 'Bạn phải chọn Quận huyện!';
         }
         if (!empty($this->_arrPost['pricefrom']) && !empty($this->_arrPost['priceto'])) {
             if ($this->_arrPost['pricefrom'] > $this->_arrPost['priceto']) {
                 $error[] = 'Giá từ phải nhỏ hơn giá tới';
             }
         }
         if ($registerEmailForm->isValid() && empty($error)) {
             //Lấy ngày hiện tại
             $date_time = date('d/m/Y');
             //Chống tấn công XSS
             $purifier = new \HTMLPurifier_HTMLPurifier();
             $data = array('name' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['name'])), 'email' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['email'])), 'transaction' => $purifier->purify($this->_arrPost['type_transaction']), 'cat_id' => $purifier->purify($this->_arrPost['type_real_estate_child']), 'city' => $purifier->purify($this->_arrPost['city']), 'district' => $purifier->purify($this->_arrPost['district']), 'pricefrom' => $purifier->purify($this->_arrPost['pricefrom']), 'priceto' => $purifier->purify($this->_arrPost['priceto']), 'area' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['area'])), 'road' => $purifier->purify($this->_viewHelper->cmsReplaceString($this->_arrPost['road'])), 'direction' => $purifier->purify($this->_arrPost['direction']), 'juridical' => $purifier->purify($this->_arrPost['juridical']), 'date_time' => $date_time, 'user_id' => $this->identity()->id);
             $id = $this->getTable()->saveItem($data, array('task' => 'add'));
             $this->redirect()->toUrl('/user/register-email/index/');
         }
     }
     $view->setVariables(array('title' => $title, 'arrParam' => $this->_arrParam, 'currentController' => $this->_currentController, 'itemsCity' => $itemsCity, 'itemsTypeRealEstate' => $itemsTypeRealEstate, 'myForm' => $registerEmailForm, 'error' => $error));
     return $view;
 }