403Webshell
Server IP : 103.234.187.230  /  Your IP : 216.73.216.216
Web Server : Apache
System : Linux lserver42043-ind.megavelocity.net 3.10.0-1160.108.1.el7.x86_64 #1 SMP Thu Jan 25 16:17:31 UTC 2024 x86_64
User : apache ( 48)
PHP Version : 7.4.33
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : ON  |  Perl : ON  |  Python : ON  |  Sudo : ON  |  Pkexec : ON
Directory :  /var/www/html/b2c.hellogtx.com/application/admin/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2c.hellogtx.com/application/admin/controllers/AboutyitController.php
<?php

/* * *************************************************************
 * Catabatic Technology Pvt. Ltd.
 * File Name     : StaticpageController.php
 * File Desc.    : Staticpage controller managed all staic content pages
 * Created By    : Ranvir Singh <ranvir@catpl.co.in>
 * Created Date  : 23 May 2017
 * Updated Date  : 23 May 2017
 * ************************************************************* */

class Admin_aboutyitController extends Zend_Controller_Action {

	public $dbAdapter;
	public $perPageLimit;
	public $siteurl;
	public $DIR_WRITE_MODE;

	public function init() {
		/* Initialize db and session access */
		$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
		$this->view->siteurl = $this->siteurl = $aConfig['bootstrap']['siteUrl'];
                $this->view->stylecss = $this->stylecss = $aConfig['bootstrap']['stylecss'];
		$this->appmode = $aConfig['bootstrap']['appmode'];
		$this->per_page_record = 20;

		$this->logo_large_image_width = $aConfig['bootstrap']['logo_large_image_width'];
        $this->logo_large_image_height = $aConfig['bootstrap']['logo_large_image_height'];
        $this->logo_medium_image_width = $aConfig['bootstrap']['logo_medium_image_width'];
        $this->logo_medium_image_height = $aConfig['bootstrap']['logo_medium_image_height'];
        $this->logo_small_image_width = $aConfig['bootstrap']['logo_small_image_width'];
        $this->logo_small_image_height = $aConfig['bootstrap']['logo_small_image_height'];
		$this->large_image_width = $aConfig['bootstrap']['large_image_width'];
        $this->large_image_height = $aConfig['bootstrap']['large_image_height'];
        $this->medium_image_width = $aConfig['bootstrap']['medium_image_width'];
        $this->medium_image_height = $aConfig['bootstrap']['medium_image_height'];
        $this->small_image_width = $aConfig['bootstrap']['small_image_width'];
        $this->small_image_height = $aConfig['bootstrap']['small_image_height'];
		$this->dbAdapter = Zend_Db_Table::getDefaultAdapter();

		$auth = Zend_Auth::getInstance();
		$authStorage = $auth->getStorage()->read();
		$this->username = $authStorage->username;
		$this->admin_type = $authStorage->role;

		$this->current_time = time();
		$this->imageUrl = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/'.$this->stylecss.'/aboutyit/';
		$this->imageUrlAwards = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/'.$this->stylecss.'/awards/';
		$this->imageUrlAccreditationsClient = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/'.$this->stylecss.'/accreditations-client/';
		$this->imageUrlClient = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/'.$this->stylecss.'/accreditations-client/clients';


		$this->DIR_WRITE_MODE = 0777;

		$this->table = 'tbl_about_yit';
		$this->tablepopular = 'tbl_popular_city';
		$this->tablepopularl = 'tbl_popular_logo';

		$this->tableAwards = 'tbl_accolades_awards';
		$this->tableClients = 'tbl_accreditations_client';
		$this->tablePopularCity = 'tbl_popular_city';
	    $this->tablePopularLogo = 'tbl_popular_logo';

	}

	/**
	 * index() method is used to admin login for form call
	 * @param Null
	 * @return Array
	 */
	public function indexAction() {
		//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$resultset = $crud->rv_select_all($this->table, ['*'], ['IsMarkForDel' => 0], ['AboutId' => 'DESC']);
//        echo "<pre>";print_r($resultset);die;
		$result_destination = $crud->rv_select_all("tb_tbb2c_destinations", ['*'], ['IsPublish' => 1, 'IsMarkForDel' => 0], ['Title' => 'ASC']);

		# Start : Pagination
		$page = $this->_getParam('page', 1);
		$resultset = Zend_Paginator::factory($resultset);
		$resultset->setItemCountPerPage($this->per_page_record);
		$resultset->setCurrentPageNumber($page);
		# End : Pagination
		$this->view->page = $page;
		$this->view->per_page_record = $this->per_page_record;
		$this->view->resultset = $resultset;
		$this->view->result_destination = $result_destination;
		$this->view->messages = $this->_helper->flashMessenger->getMessages();
	}

	public function awardsAction() {
		//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$resultset = $crud->rv_select_all($this->tableAwards, ['*'], ['IsMarkForDel' => 0], ['AwardId' => 'DESC']);
//        echo "<pre>";print_r($resultset);die;
		# Start : Pagination
		$page = $this->_getParam('page', 1);
		$resultset = Zend_Paginator::factory($resultset);
		$resultset->setItemCountPerPage($this->per_page_record);
		$resultset->setCurrentPageNumber($page);
		# End : Pagination
		$this->view->page = $page;
		$this->view->per_page_record = $this->per_page_record;
		$this->view->resultset = $resultset;
		$this->view->result_destination = $result_destination;
		$this->view->messages = $this->_helper->flashMessenger->getMessages();
	}

	/**
	 * editpage() method is used to admin can edit cms static page
	 * @param password string
	 * @return ture
	 */
	public function editaboutyitAction(){
//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$form = new Admin_Form_Editaboutyit();
		$pId = (int) $this->getRequest()->getParam("id");
		$form->setMethod("POST");
		$form->setAction("admin/aboutyit/editaboutyit/id/" . $pId);

		$form->setName("edit_aboutyit");

		if ($this->getRequest()->isPost()) {
			$getData = $this->getRequest()->getPost();

			if ($form->isValid($getData)) {

				//-------Start Code for Approve and Publish content---------//
				if (isset($getData['save']) == "Save") {
//                         echo "<pre>";print_r($getData);die;
					$AboutId = $getData['AboutId'];
					$orignalFIleName = $image = $_FILES["AboutImage"]["name"];

					if (!empty($orignalFIleName)) {
						$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl;
						$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
						$fileName = $this->current_time . '.' . $fileExt;
						if (!file_exists($orignalFolderName)) {
							mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
						}
						$temp_file_name = $_FILES["AboutImage"]["tmp_name"]; // temprary file name
						@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
					}

					if ($fileName != "") {
						$image_edit = $fileName;
					}

					$editPageData = [

						'AboutTitle' => ($getData['AboutTitle']),
						'AboutDescription' => ($getData['AboutDescription']),
						'url' => trim($getData['url']),
						'opt' => isset($getData['opt']) ? $getData['opt'] : 0,
						'UpdateDate' => date('Y-m-d H:i:s'),
						'status' => ($getData['status']),
					];

					if ($fileName) {
						$editPageData['AboutImage'] = $fileName;
					}
//                  echo "<pre>";print_r($editPageData);die;
					$crud->rv_update($this->table, $editPageData, ['AboutId =?' => $AboutId]);
					$this->view->successMessage = "Page content has been saved successfully.";
					$this->_helper->flashMessenger->addMessage("Page content has been updated successfully.");
					$this->_redirect("/admin/aboutyit/popularcity");
				}
			}
		}

		$result = $crud->getCmsdata($this->table, ['*'], ['AboutId' => $pId], ['AboutId' => 'DESC']);
//        echo "<pre>";print_r($result);die;
		$editdata["AboutId"] = @$result->AboutId;
		$editdata["AboutTitle"] = @$result->AboutTitle;
		$editdata["AboutImage"] = @$result->AboutImage;
		$editdata["AboutDescription"] = @$result->AboutDescription;
		$editdata["url"] = @$result->url;
		$editdata["opt"] = @$result->opt;
		$editdata["status"] = @$result->status;
//        echo "<pre>";print_r($editdata);die;
		$form->populate($editdata);
		$this->view->AboutImage = @$result->AboutImage;
		$this->view->editData = $editdata;
		$this->view->form = $form;
	}

	public function addaboutyitAction(){

//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$form = new Admin_Form_Editaboutyit();
		$pId = (int) $this->getRequest()->getParam("id");
		$form->setMethod("POST");
		$form->setAction("admin/aboutyit/addaboutyit");
		$form->setName("edit_aboutyit");

		if ($this->getRequest()->isPost()) {
			$getData = $this->getRequest()->getPost();
			if ($form->isValid($getData)) {

				//-------Start Code for Approve and Publish content---------//
				if (isset($getData['save']) == "Save") {
//                echo "<pre>";print_r($getData);die;

					$orignalFIleName = $image = $_FILES["AboutImage"]["name"];

					if (!empty($orignalFIleName)) {
						$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl;
						$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
						$fileName = $this->current_time . '.' . $fileExt;
						if (!file_exists($orignalFolderName)) {
							mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
						}
						$temp_file_name = $_FILES["AboutImage"]["tmp_name"]; // temprary file name
						@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
					}

					if ($fileName != "") {
						$image_add = $fileName;
					} else {
						$image_add = "";
					}
//                $BlogDate1 = explode('/', $getData['BlogDate']);
					//                $BlogDate = $BlogDate1[2]."-".$BlogDate1[1]."-".$BlogDate[0];

					$savePageData = [
						'AboutTitle' => ($getData['AboutTitle']),
						'AboutImage' => $image_add,
						'AboutDescription' => ($getData['AboutDescription']),
						'url' => trim($getData['url']),
						'opt' => isset($getData['opt']) ? $getData['opt'] : 0,
						'CreateDate' => date('Y-m-d H:i:s'),
						'UpdateDate' => date('Y-m-d H:i:s'),
						'status' => ($getData['status']),
						'isMarkForDel' => 0,
					];
//                echo "<pre>";print_r($savePageData);die;
					$crud->rv_insert($this->table, $savePageData);
					$this->view->successMessage = "Page content has been saved successfully.";
					$this->_helper->flashMessenger->addMessage("Page content has been added successfully.");
					$this->_redirect("/admin/aboutyit/popularcity");
				}
			}
		}

		$this->view->form = $form;
		$this->view->messages = $this->_helper->flashMessenger->getMessages();
	}

	public function addawardsAction() {

//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$form = new Admin_Form_Editawards();
		$pId = (int) $this->getRequest()->getParam("id");
		$form->setMethod("POST");
		$form->setAction("admin/aboutyit/addawards");
		$form->setName("edit_awards");

		if ($this->getRequest()->isPost()) {
			$getData = $this->getRequest()->getPost();

			if ($form->isValid($getData)) {

				//-------Start Code for Approve and Publish content---------//
				if (isset($getData['save']) == "Save") {
//                echo "<pre>";print_r($getData);die;

					$orignalFIleName = $image = $_FILES["AwardImage"]["name"];

					if (!empty($orignalFIleName)) {
						$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrlAwards;
						$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
						$fileName = $this->current_time . '.' . $fileExt;
						if (!file_exists($orignalFolderName)) {
							mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
						}
						$temp_file_name = $_FILES["AwardImage"]["tmp_name"]; // temprary file name
						@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
					}

					if ($fileName != "") {
						$image_add = $fileName;
					} else {
						$image_add = "";
					}
//                $BlogDate1 = explode('/', $getData['BlogDate']);
					//                $BlogDate = $BlogDate1[2]."-".$BlogDate1[1]."-".$BlogDate[0];

					$savePageData = [
						'AwardTitle' => ($getData['AwardTitle']),
						'AwardImage' => $image_add,
						'AwardDescription' => ($getData['AwardDescription']),
						'CreateDate' => date('Y-m-d H:i:s'),
						'status' => ($getData['status']),
						'isMarkForDel' => 0,
					];
//                echo "<pre>";print_r($savePageData);die;
					$crud->rv_insert($this->tableAwards, $savePageData);
					$this->view->successMessage = "Page content has been saved successfully.";
					$this->_helper->flashMessenger->addMessage("Page content has been added successfully.");
					$this->_redirect("/admin/aboutyit/awards");
				}
			}
		}

		$this->view->form = $form;
		$this->view->messages = $this->_helper->flashMessenger->getMessages();
	}

	public function editawardsAction() {
//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$form = new Admin_Form_Editawards();
		$pId = (int) $this->getRequest()->getParam("id");
		$form->setMethod("POST");
		$form->setAction("admin/aboutyit/editawards/id/" . $pId);

		$form->setName("edit_awards");

		if ($this->getRequest()->isPost()) {
			$getData = $this->getRequest()->getPost();

			if ($form->isValid($getData)) {

				//-------Start Code for Approve and Publish content---------//
				if (isset($getData['save']) == "Save") {
//                         echo "<pre>";print_r($getData);die;
					$AwardId = $getData['AwardId'];
					$orignalFIleName = $image = $_FILES["AwardImage"]["name"];

					if (!empty($orignalFIleName)) {
						$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrlAwards;
						$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
						$fileName = $this->current_time . '.' . $fileExt;
						if (!file_exists($orignalFolderName)) {
							mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
						}
						$temp_file_name = $_FILES["AwardImage"]["tmp_name"]; // temprary file name
						@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
					}

					if ($fileName != "") {
						$image_edit = $fileName;
					}

					$editPageData = [

						'AwardTitle' => ($getData['AwardTitle']),
						'AwardDescription' => ($getData['AwardDescription']),
						'UpdateDate' => date('Y-m-d H:i:s'),
						'status' => ($getData['status']),
					];

					if ($fileName) {
						$editPageData['AwardImage'] = $fileName;
					}
//                  echo "<pre>";print_r($editPageData);die;
					$crud->rv_update($this->tableAwards, $editPageData, ['AwardId =?' => $AwardId]);
					$this->view->successMessage = "Page content has been saved successfully.";
					$this->_helper->flashMessenger->addMessage("Page content has been updated successfully.");
					$this->_redirect("/admin/aboutyit/awards");
				}
			}
		}

		$result = $crud->getCmsdata($this->tableAwards, ['*'], ['AwardId' => $pId], ['AwardId' => 'DESC']);
//        echo "<pre>";print_r($result);die;
		$editdata["AwardId"] = @$result->AwardId;
		$editdata["AwardTitle"] = @$result->AwardTitle;
		$editdata["AwardImage"] = @$result->AwardImage;
		$editdata["AwardDescription"] = @$result->AwardDescription;
		$editdata["status"] = @$result->status;
//        echo "<pre>";print_r($editdata);die;
		$form->populate($editdata);
		$this->view->AwardImage = @$result->AwardImage;
		$this->view->form = $form;
	}

	// public function deleteaboutyitAction() {
	// 	$this->checklogin();
	// 	$crud = new Admin_Model_CRUD();
	// 	$tId = (int) $this->getRequest()->getParam("id");
	// 	//echo $tId;die;
	// 	if ($tId) {
	// 		$checkdata = $crud->rv_select_row($this->table, ['AboutId'], ['AboutId' => $tId], ['AboutId' => 'asc']);
	// 		if (count($checkdata) > 0) {
	// 			$crud->rv_update($this->table, ['isMarkForDel' => 1], ['AboutId =?' => $tId]);
	// 			$this->_helper->flashMessenger->addMessage("Deleted successfully.");
	// 			$this->_redirect("/admin/aboutyit/popularcity");
	// 		} else {
	// 			die('Oops some thing wrong!!.');
	// 		}
	// 	}
	// }

	public function deleteawardsAction(){
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$tId = (int) $this->getRequest()->getParam("id");
		//echo $tId;die;
		if ($tId) {
			$checkdata = $crud->rv_select_row($this->tableAwards, ['AwardId'], ['AwardId' => $tId], ['AwardId' => 'asc']);
			if (count($checkdata) > 0) {
				$crud->rv_update($this->tableAwards, ['isMarkForDel' => 1], ['AwardId =?' => $tId]);
				$this->_helper->flashMessenger->addMessage("Deleted successfully.");
				$this->_redirect("/admin/aboutyit/awards");
			} else {
				die('Oops some thing wrong!!.');
			}
		}
	}

	public function accreditationclientsAction() {

//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$clientResult = $crud->getCmsdata($this->tableClients, ['*'], ['ClientId' => 1], ['ClientId' => 'DESC']);

		$this->view->clientResult = $clientResult;
		if ($this->getRequest()->isPost()) {
			$getData = $this->getRequest()->getPost();

			//-------Start Code for Approve and Publish content---------//
			if (isset($getData['save']) == "Save") {

				$orignalFIleName = $_FILES["AccreditationsImage"]["name"];
				$ClientImagesN = $_FILES["ClientImages"]["name"];

				if (!empty($orignalFIleName)) {
					$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrlAccreditationsClient;
					$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
					$fileName1 = $this->current_time . '.' . $fileExt;
					if (!file_exists($orignalFolderName)) {
						mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
					}
					$temp_file_name = $_FILES["AccreditationsImage"]["tmp_name"]; // temprary file name
					@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName1);
				}

				if ($ClientImagesN) {
					foreach ($ClientImagesN as $key => $orignalFileName1) {

						if (!empty($orignalFileName1)) {

							$orignalFolderName1 = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrlAccreditationsClient . "/clients"; // root folder for destination images

							/* Get File Extension */
							$fileExt = $this->_helper->General->getFileExtension($orignalFileName1);
							$fileName2 = $this->current_time . '_' . $key . '.' . $fileExt;
							//echo $fileName;
							/* Create directory if not exists */
							if (!file_exists($orignalFolderName1)) {
								mkdir($orignalFolderName1, $this->DIR_WRITE_MODE, true);
							}

							foreach ($_FILES["ClientImages"]["tmp_name"] as $key1 => $image) {
								if ($key == $key1) {
									$temp_file_name = $image; // temprary file name
								}
							}
							@move_uploaded_file($temp_file_name, $orignalFolderName1 . "/" . $fileName2);

						} else {
							//                    echo 'else'; die;
						}
					}
				}

				$editPageData = [
					'AccreditationsTitle' => ($getData['AccreditationsTitle']),
					'CreateDate' => date('Y-m-d H:i:s'),
					'status' => 1,
					'isMarkForDel' => 0,
				];
				if ($fileName1 != "") {
					$editPageData['AccreditationsImage'] = $fileName1;
				}

// echo "<pre>";print_r($editPageData);die;

//                 echo "<pre>";print_r($fileName);die;
				if ($fileName2) {
					foreach ($ClientImagesN as $key => $image) {

						$fileExt = $this->_helper->General->getFileExtension($image);
						$fileName2 = $this->current_time . '_' . $key . '.' . $fileExt;
						$editPageData['ClientImages'][] = $fileName2;
					}
					$editPageData['ClientImages'] = $newimagenames = @implode(",", $editPageData['ClientImages']);
				}

				$oldimagenames = implode(',', $getData['oldClientsName']);
				$editPageData['ClientImages'] = "$oldimagenames";

				if (trim($newimagenames)) {
					$editPageData['ClientImages'] .= ",$newimagenames";
				}

				$editPageData['ClientImages'] = trim($editPageData['ClientImages'], ',');

//                $BlogDate1 = explode('/', $getData['BlogDate']);
				//                $BlogDate = $BlogDate1[2]."-".$BlogDate1[1]."-".$BlogDate[0];

//                echo "<pre>";print_r($editPageData);die;
				$crud->rv_update($this->tableClients, $editPageData, ['ClientId =?' => 1]);
				$this->view->successMessage = "Content has been updated successfully.";
				$this->_helper->flashMessenger->addMessage("Content has been updated successfully.");
				$this->_redirect("/admin/aboutyit/accreditationclients");
			}
		}

		$this->view->messages = $this->_helper->flashMessenger->getMessages();

	}

	public function sanitize_data($string) {
		$searchArr = array("iframe", "script", "document", "write", "alert", "%", "@", "$", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",", "and ", " &", "& ", "and", " and", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9");
		$input_data = strtolower($string);
		$input_data = str_replace($searchArr, "", $input_data);

		$input_data = str_replace(" ", "-", $input_data);
		//echo $input_data; die;
		return $input_data;
	}

	/**
	 * checklogin() method is used to check admin logedin or not
	 * @param Null
	 * @return Array
	 */
	public function checklogin(){
		if(($this->admin_type == "superadmin") || ($this->admin_type == "admin")) {
			$auth = Zend_Auth::getInstance();
			$hasIdentity = $auth->hasIdentity();
			/*             * ************* check admin identity *********** */
			if (!$hasIdentity) {
				$this->_redirect('admin/index/index');
			}
		} else {
			$this->_redirect('admin/index/index');
		}
	}

	public function popularcityAction(){
		//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$resultset = $crud->rv_select_all($this->tablePopularCity, ['*'], ['IsMarkForDel' => 0], ['AboutId' => 'DESC'] );
//        echo "<pre>";print_r($resultset);die;
		$result_destination = $crud->rv_select_all("tb_tbb2c_destinations", ['*'], ['IsPublish' => 1, 'IsMarkForDel' => 0], ['Title' => 'ASC']);

		if (count($resultset) > 0) {
			foreach ($resultset as $resultkey => $resultval) {
				$expiryDate = explode('-',$resultval['expiryDate']);
				$result1[] = [
					
					'expiryDate' => $expiryDate[2].'/'.$expiryDate[1].'/'.$expiryDate[0],
					
				];
			}
		}

		# Start : Pagination
		$page = $this->_getParam('page', 1);
		$resultset = Zend_Paginator::factory($resultset);
		$resultset->setItemCountPerPage($this->per_page_record);
		$resultset->setCurrentPageNumber($page);
		# End : Pagination
		$this->view->page = $page;
		$this->view->per_page_record = $this->per_page_record;
		$this->view->resultset = $resultset;
		$this->view->result_destination = $result_destination;
		$this->view->messages = $this->_helper->flashMessenger->getMessages();
	}

	public function addpopularcityAction(){

//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$form = new Admin_Form_Addpopularcity();
		$pId = (int) $this->getRequest()->getParam("AboutId");
		$form->setMethod("POST");
		$form->setAction("admin/aboutyit/addpopularcity");
		$form->setName("edit_aboutyit");


		if ($this->getRequest()->isPost()) {
			$lastRow = $crud->getCmsdata($this->tablepopular, ['AboutId'], ['AboutId'], ['AboutId'=>'DESC']);
			//echo "<pre>"; print_r($lastrow); die('testq');
            $pId = (int) $lastRow['AboutId'] + 1;

          //         $AboutId = $getData['AboutId'];
			$getData = $this->getRequest()->getPost();
			if ($form->isValid($getData)) {

				//-------Start Code for Approve and Publish content---------//
				if (isset($getData['save']) == "Save") {
//                echo "<pre>";print_r($getData);die;

					$orignalFIleName = $image = $_FILES["AboutImage"]["name"];
					if (!empty($orignalFIleName)) {
						$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl.$pId;
						$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
						$fileName = $this->current_time . '.' . $fileExt;
						if (!file_exists($orignalFolderName)) {
							mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
						}
						$temp_file_name = $_FILES["AboutImage"]["tmp_name"]; // temprary file name
						@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
						$originalLargeFolder = $orignalFolderName.'/large';
						$originalMediumFolder = $orignalFolderName.'/medium';
						$originalSmallFolder = $orignalFolderName.'/small';

						Catabatic_Helper::resizeImages($orignalFolderName,$originalLargeFolder,$fileName,$this->large_image_width,$this->large_image_height);
						Catabatic_Helper::resizeImages($orignalFolderName,$originalMediumFolder,$fileName,$this->medium_image_width,$this->medium_image_height);
						Catabatic_Helper::resizeImages($orignalFolderName,$originalSmallFolder,$fileName,$this->small_image_width,$this->small_image_height);
				}

					if ($fileName != "") {
						$image_add = $fileName;
					} else {
						$image_add = "";
					}

					$expiryDate = explode('/', $getData['expiryDate']);

					$savePageData = [
						'Fromcity' => ($getData['Fromcity']),
						'Tocity' => ($getData['Tocity']),
						'price' => ($getData['price']),
						'source' => ($getData['source']),
						'destination' => ($getData['destination']),
						'source_city' => ($getData['source_city']),
						'destination_city' => ($getData['destination_city']),
						'ContSysId1' => ($getData['ContSysId1']),
						'ContSysId2' => ($getData['ContSysId2']),
						'popularCityType' => ($getData['popularCityType']),
						'AboutImage' => $image_add,
						'AboutDescription' => ($getData['AboutDescription']),
						'url' => trim($getData['url']),
						'opt' => isset($getData['opt']) ? $getData['opt'] : 0,
						'CreateDate' => date('Y-m-d H:i:s'),
						'status' => ($getData['status']),
						'expiryDate' => $expiryDate[2] . '-' . $expiryDate[1] . '-' . $expiryDate[0],
						'isMarkForDel' => 0,
					];
//                echo "<pre>";print_r($savePageData);die;
					$crud->rv_insert($this->tablePopularCity, $savePageData);
					$this->view->successMessage = "Page content has been saved successfully.";
					$this->_helper->flashMessenger->addMessage("Page content has been added successfully.");
					$this->_redirect("/admin/aboutyit/popularcity");
				//}
			}
		}
		}
//        echo "<pre>";print_r($form);die;
		$this->view->form = $form;
		$this->view->messages = $this->_helper->flashMessenger->getMessages();
	}

	public function editpopularcityAction(){
            
//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$form = new Admin_Form_Addpopularcity();
		$pId = (int) $this->getRequest()->getParam("id");
		$form->setMethod("POST");
		$form->setAction("admin/aboutyit/editpopularcity/id/" . $pId);

		$form->setName("edit_aboutyit");

		if ($this->getRequest()->isPost()) {
			$getData = $this->getRequest()->getPost();

			if ($form->isValid($getData)) {

				//-------Start Code for Approve and Publish content---------//
				if (isset($getData['save']) == "Save") {
//                         echo "<pre>";print_r($getData);die;
					$AboutId = $getData['AboutId'];
					$orignalFIleName = $image = $_FILES["AboutImage"]["name"];

					if (!empty($orignalFIleName)) {
						$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl.$pId;
						$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
						$fileName = $this->current_time . '.' . $fileExt;
						if (!file_exists($orignalFolderName)) {
							mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
						}
						$temp_file_name = $_FILES["AboutImage"]["tmp_name"]; // temprary file name
						@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
 
							$originalLargeFolder = $orignalFolderName.'/large';
							$originalMediumFolder = $orignalFolderName.'/medium';
							$originalSmallFolder = $orignalFolderName.'/small';

							Catabatic_Helper::resizeImages($orignalFolderName,$originalLargeFolder,$fileName,$this->large_image_width,$this->large_image_height);
							Catabatic_Helper::resizeImages($orignalFolderName,$originalMediumFolder,$fileName,$this->medium_image_width,$this->medium_image_height);
							Catabatic_Helper::resizeImages($orignalFolderName,$originalSmallFolder,$fileName,$this->small_image_width,$this->small_image_height);
					}

					if ($fileName != "") {
						$image_edit = $fileName;
					}
					$expiryDate = explode('/', $getData['expiryDate']);
					$editPageData = [

						'Fromcity' => ($getData['Fromcity']),
						'Tocity' => ($getData['Tocity']),
						'price' => ($getData['price']),
						'source' => ($getData['source']),
						'destination' => ($getData['destination']),
						'source_city' => ($getData['source_city']),
						'destination_city' => ($getData['destination_city']),
						'ContSysId1' => ($getData['ContSysId1']),
						'ContSysId2' => ($getData['ContSysId2']),
						'popularCityType' => ($getData['popularCityType']),
						'AboutDescription' => ($getData['AboutDescription']),
						'url' => trim($getData['url']),
						'opt' => isset($getData['opt']) ? $getData['opt'] : 0,
						'UpdateDate' => date('Y-m-d H:i:s'),
						'status' => ($getData['status']),
						'expiryDate' => $expiryDate[2] . '-' . $expiryDate[1] . '-' . $expiryDate[0],
					];

					if ($fileName) {
						$editPageData['AboutImage'] = $fileName;
					}
//                  echo "<pre>";print_r($editPageData);die;
					$crud->rv_update($this->tablePopularCity, $editPageData, ['AboutId =?' => $AboutId]);
					$this->view->successMessage = "Page content has been saved successfully.";
					$this->_helper->flashMessenger->addMessage("Page content has been updated successfully.");
					$this->_redirect("/admin/aboutyit/popularcity");
				}
			}
		}

		$result = $crud->getCmsdata($this->tablePopularCity, ['*'], ['AboutId' => $pId], ['AboutId' => 'DESC']);
//	       echo "<pre>";print_r($result);die;
		$editdata["AboutId"] = @$result->AboutId;
		$editdata["Fromcity"] = @$result->Fromcity;
		$editdata["Tocity"] = @$result->Tocity;
		$editdata["price"] = @$result->price;
		$editdata["source"] = @$result->source;
		$editdata["destination"] = @$result->destination;
		$editdata["source_city"] = @$result->source_city;
		$editdata["destination_city"] = @$result->destination_city;
		$editdata["ContSysId1"] = @$result->ContSysId1;
		$editdata["ContSysId2"] = @$result->ContSysId2;
		$editdata["popularCityType"] = @$result->popularCityType;
		$editdata["AboutImage"] = @$result->AboutImage;
		$editdata["AboutDescription"] = @$result->AboutDescription;
		$editdata["url"] = @$result->url;
		$editdata["opt"] = @$result->opt;
		$editdata["status"] = @$result->status;
		$expiryDate = explode('-', $result->expiryDate);
		$editdata["expiryDate"] = $expiryDate[2] . '/' . $expiryDate[1] . '/' . $expiryDate[0];
//        echo "<pre>";print_r($editdata);die;
		$form->populate($editdata);
		$this->view->AboutId = @$result->AboutId;
		$this->view->AboutImage = @$result->AboutImage;
		$this->view->editData = $editdata;
		$this->view->form = $form;
	}
	public function dpopularcityAction(){
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $pId = (int) $this->getRequest()->getParam("id");
        //echo $tId;die;
        if ($pId){
            $checkdata = $crud->rv_select_row($this->tablePopularCity, ['AboutId'], ['AboutId' => $pId], ['AboutId' => 'asc']);
            if (count($checkdata) > 0) {
			//	
                $crud->rv_update($this->tablePopularCity, ['isMarkForDel'=> 1], ['AboutId   =?'=>$pId]);
				
                $this->_helper->flashMessenger->addMessage("Deleted successfully.");
			
                $this->_redirect("/admin/aboutyit/popularcity");
				
            } else {
                die('Oops some thing wrong!!.');
            }
        }
    }


	
	public function popularlogoAction() {
		//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$resultset = $crud->rv_select_all($this->tablePopularLogo, ['*'], ['IsMarkForDel' => 0], ['AboutId' => 'DESC']);
//        echo "<pre>";print_r($resultset);die;
		$result_destination = $crud->rv_select_all("tb_tbb2c_destinations", ['*'], ['IsPublish' => 1, 'IsMarkForDel' => 0], ['Title' => 'ASC']);

		# Start : Pagination
		$page = $this->_getParam('page', 1);
		$resultset = Zend_Paginator::factory($resultset);
		$resultset->setItemCountPerPage($this->per_page_record);
		$resultset->setCurrentPageNumber($page);
		# End : Pagination
		$this->view->page = $page;
		$this->view->per_page_record = $this->per_page_record;
		$this->view->resultset = $resultset;
		$this->view->result_destination = $result_destination;
		$this->view->messages = $this->_helper->flashMessenger->getMessages();
	}

	public function addpopularlogoAction() {

//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$form = new Admin_Form_Addpopularlogo();
		$pId = (int) $this->getRequest()->getParam("AboutId");
		$form->setMethod("POST");
		$form->setAction("admin/aboutyit/addpopularlogo");
		$form->setName("edit_aboutyit");


		 if ($this->getRequest()->isPost()) {
		 	$lastRow = $crud->getCmsdata($this->tablepopularl, ['AboutId'], ['AboutId'], ['AboutId'=>'DESC']);
			
			//echo "<pre>"; print_r($lastrow); die('testq');
            $pId = (int) $lastRow['AboutId'] + 1;

                   $AboutId = $getData['AboutId'];
		$getData = $this->getRequest()->getPost();
  //print_r($getData);die;

			if ($form->isValid($getData)) {

				//-------Start Code for Approve and Publish content---------//
				if (isset($getData['save']) == "Save") {

                
 
					$orignalFIleName = $image = $_FILES["AboutImage"]["name"];
					if (!empty($orignalFIleName)) {
						$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl.$pId;
						$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
						$fileName = $this->current_time . '.' . $fileExt;
						if (!file_exists($orignalFolderName)) {
							mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
						}
						$temp_file_name = $_FILES["AboutImage"]["tmp_name"]; // temprary file name
						@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
						$originalLargeFolder = $orignalFolderName.'/large';
						$originalMediumFolder = $orignalFolderName.'/medium';
						$originalSmallFolder = $orignalFolderName.'/small';

						Catabatic_Helper::resizeImages($orignalFolderName,$originalLargeFolder,$fileName,$this->logo_large_image_width,$this->logo_large_image_height);
						Catabatic_Helper::resizeImages($orignalFolderName,$originalMediumFolder,$fileName,$this->logo_medium_image_width,$this->logo_medium_image_height);
						Catabatic_Helper::resizeImages($orignalFolderName,$originalSmallFolder,$fileName,$this->logo_small_image_width,$this->logo_small_image_height);
				}

					if ($fileName != "") {
						$image_add = $fileName;
					} else {
						$image_add = "";
					}
//                $BlogDate1 = explode('/', $getData['BlogDate']);
					//                $BlogDate = $BlogDate1[2]."-".$BlogDate1[1]."-".$BlogDate[0];
					$expiryDate = explode('/', $getData['expiryDate']);
					$savePageData = [
						//'Fromcity' => ($getData['Fromcity']),
						//'Tocity' => ($getData['Tocity']),
						'title' => ($getData['title']),
						//'source' => ($getData['source']),
						//'destination' => ($getData['destination']),
						//'source_city' => ($getData['source_city']),
						//'destination_city' => ($getData['destination_city']),
						//'ContSysId1' => ($getData['ContSysId1']),
						//'ContSysId2' => ($getData['ContSysId2']),
						//'popularCityType' => ($getData['popularCityType']),
						'AboutImage' => $image_add,
						//'AboutDescription' => ($getData['AboutDescription']),
						//'url' => trim($getData['url']),
						//'opt' => isset($getData['opt']) ? $getData['opt'] : 0,
						'CreateDate' => date('Y-m-d H:i:s'),
						'expiryDate' => $expiryDate[2] . '-' . $expiryDate[1] . '-' . $expiryDate[0],
						'status' => ($getData['status']),
						'isMarkForDel' => 0,
					];
               //echo "<pre>";print_r($savePageData);die;
					$crud->rv_insert($this->tablePopularLogo, $savePageData);
					$this->view->successMessage = "Page content has been saved successfully.";
					$this->_helper->flashMessenger->addMessage("Page content has been added successfully.");
					$this->_redirect("/admin/aboutyit/popularlogo");
				//}
			}
		}
		}
//        echo "<pre>";print_r($form);die;
		$this->view->form = $form;
		$this->view->messages = $this->_helper->flashMessenger->getMessages();
	}

	public function editpopularlogoAction() {
            
//Check admin logedin or not
		$this->checklogin();
		$crud = new Admin_Model_CRUD();
		$form = new Admin_Form_Addpopularlogo();
		$pId = (int) $this->getRequest()->getParam("id");
		$form->setMethod("POST");
		$form->setAction("admin/aboutyit/editpopularlogo/id/" . $pId);

		$form->setName("edit_aboutyit");

		if ($this->getRequest()->isPost()) {
			$getData = $this->getRequest()->getPost();

			if ($form->isValid($getData)) {

				//-------Start Code for Approve and Publish content---------//
				if (isset($getData['save']) == "Save") {
//                         echo "<pre>";print_r($getData);die;
					$AboutId = $getData['AboutId'];
					$orignalFIleName = $image = $_FILES["AboutImage"]["name"];

					if (!empty($orignalFIleName)) {
						$orignalFolderName = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl.$pId;
						$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
						$fileName = $this->current_time . '.' . $fileExt;
						if (!file_exists($orignalFolderName)) {
							mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
						}
						$temp_file_name = $_FILES["AboutImage"]["tmp_name"]; // temprary file name
						@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
 
							$originalLargeFolder = $orignalFolderName.'/large';
							$originalMediumFolder = $orignalFolderName.'/medium';
							$originalSmallFolder = $orignalFolderName.'/small';

							Catabatic_Helper::resizeImages($orignalFolderName,$originalLargeFolder,$fileName,$this->logo_large_image_width,$this->logo_large_image_height);
							Catabatic_Helper::resizeImages($orignalFolderName,$originalMediumFolder,$fileName,$this->logo_medium_image_width,$this->logo_medium_image_height);
							Catabatic_Helper::resizeImages($orignalFolderName,$originalSmallFolder,$fileName,$this->logo_small_image_width,$this->logo_small_image_height);
					}

					if ($fileName != "") {
						$image_edit = $fileName;
					}

					$editPageData = [

						//'Fromcity' => ($getData['Fromcity']),
						//'Tocity' => ($getData['Tocity']),
						'title' => ($getData['title']),
						//'source' => ($getData['source']),
						//'destination' => ($getData['destination']),
						//'source_city' => ($getData['source_city']),
						//'destination_city' => ($getData['destination_city']),
						//'ContSysId1' => ($getData['ContSysId1']),
						//'ContSysId2' => ($getData['ContSysId2']),
						//'popularCityType' => ($getData['popularCityType']),
						//'AboutDescription' => ($getData['AboutDescription']),
						//'url' => trim($getData['url']),
						//'opt' => isset($getData['opt']) ? $getData['opt'] : 0,
						'UpdateDate' => date('Y-m-d H:i:s'),
						'status' => ($getData['status']),
					];

					if ($fileName) {
						$editPageData['AboutImage'] = $fileName;
					}
//                  echo "<pre>";print_r($editPageData);die;
					$crud->rv_update($this->tablePopularLogo, $editPageData, ['AboutId =?' => $AboutId]);
					$this->view->successMessage = "Page content has been saved successfully.";
					$this->_helper->flashMessenger->addMessage("Page content has been updated successfully.");
					$this->_redirect("/admin/aboutyit/popularlogo");
				}
			}
		}

		$result = $crud->getCmsdata($this->tablePopularLogo, ['*'], ['AboutId' => $pId], ['AboutId' => 'DESC']);
//	       echo "<pre>";print_r($result);die;
		$editdata["AboutId"] = @$result->AboutId;
		//$editdata["Fromcity"] = @$result->Fromcity;
		//$editdata["Tocity"] = @$result->Tocity;
		$editdata["title"] = @$result->title;
		//$editdata["source"] = @$result->source;
		//$editdata["destination"] = @$result->destination;
		//$editdata["source_city"] = @$result->source_city;
		//$editdata["destination_city"] = @$result->destination_city;
		//$editdata["ContSysId1"] = @$result->ContSysId1;
		//$editdata["ContSysId2"] = @$result->ContSysId2;
		//$editdata["popularCityType"] = @$result->popularCityType;
		$editdata["AboutImage"] = @$result->AboutImage;
		//$editdata["AboutDescription"] = @$result->AboutDescription;
		//$editdata["url"] = @$result->url;
		//$editdata["opt"] = @$result->opt;
		$editdata["status"] = @$result->status;
//        echo "<pre>";print_r($editdata);die;
		$form->populate($editdata);
		$this->view->AboutId = @$result->AboutId;
		$this->view->AboutImage = @$result->AboutImage;
		$this->view->editData = $editdata;
		$this->view->form = $form;
	}
	public function dpopularlogoAction() {
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $pId = (int) $this->getRequest()->getParam("id");
        //echo $tId;die;
        if ($pId) {
            $checkdata = $crud->rv_select_row($this->tablePopularLogo, ['AboutId'], ['AboutId' => $pId], ['AboutId' => 'asc']);
            if (count($checkdata) > 0) {
			//	
                $crud->rv_update($this->tablePopularLogo, ['isMarkForDel'=> 1], ['AboutId   =?'=>$pId]);
				
                $this->_helper->flashMessenger->addMessage("Deleted successfully.");
			
                $this->_redirect("/admin/aboutyit/popularlogo");
				
            } else {
                die('Oops some thing wrong!!.');
            }
        }
    }
    

}

Youez - 2016 - github.com/yon3zu
LinuXploit