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/travelbrace.com/application/admin/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/travelbrace.com/application/admin/controllers/ContactusController.php
<?php
	/***************************************************************
		* Catabatic Technology Pvt. Ltd.
		* File Name     : ContactusController.php
		* File Desc.    : Contactus controller managed all contact queries
		* Created By    : Piyush Tiwari <piyush@catpl.co.in>
		* Created Date  : 23 May 2017
		* Updated Date  : 23 May 2017
	***************************************************************/
	
	
	class Admin_ContactusController extends Zend_Controller_Action
	{
		
		public $dbAdapter;
		public $perPageLimit;
		
		
		public function init()
		{
			/*Initialize db and session access */
			$aConfig = $this->getInvokeArg('bootstrap')->getOptions();
			$this->siteurl           = $aConfig['bootstrap']['siteUrl']; 
			$this->appmode = $aConfig['bootstrap']['appmode'];
			$this->per_page_record   = 20;
			$options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('bootstrap');
			$this->gtxagencysysid = $options['gtxagencysysid'];
			$this->stylecss = $options['stylecss'];
			
			$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->iconUrl     = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/'.$this->stylecss.'/';
			
			$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->DIR_WRITE_MODE = 0777;
		}
		
		/**
			* index() method is used to admin login for form call
			* @param Null
			* @return Array 
		*/
		
		public function managecontactusaddAction(){
			
			//Check admin logedin or not
			$this->checklogin();
			$this->view->messages = $this->_helper->flashMessenger->getMessages();
			$crud = new Admin_Model_CRUD();
			$getData = array();
			if ($this->getRequest()->isPost()) {
				$getData = $this->getRequest()->getPost();
				$searchArr = array(
                'Title' => $getData['Title'],
                'rows' => $getData['rows'],
                'page' => $getData['page'],
				);
				$resulsetold = $crud->getCount('tb_tbb2c_contactus_address', ['isMarkForDel' => 0, 'AgencySysId' => $this->gtxagencysysid], 'DesSysId');
				$crud->searchArr = $searchArr;
				$resultset = $crud->rv_select_static('tb_tbb2c_contactus_address', ['DesSysId', 'address'], ['isMarkForDel' => 0,'isPublish' =>1, 'AgencySysId' => $this->gtxagencysysid], ['DesSysId' => 'DESC']);
				// print_r( $resultset);die;'IsPublish' => 1,
				
				
				foreach ($resultset as $key => $value) {
					$resultsetArr[] = [
					'DesSysId' =>  $value['DesSysId'], 
					
					'address' =>  $value['address'],
					
					'isMarkForDel' =>0,
					'isPublish' =>1,
					
					]; 
				}
				
				$result = Zend_Json::encode($resultsetArr);
				$newResult = Zend_Json::decode($result, false);
				$finalResult["total"] = $resulsetold[0]['DesSysId'];
				$finalResult["rows"] = $newResult;
				echo json_encode($finalResult);
				exit;
			}
		}
		
		
		
		public function editcontactusaddAction() {
			$this->checklogin();
			$crud = new Admin_Model_CRUD();
			// $form = new Admin_Form_Editdestinationpage();
			$pId = $this->getRequest()->getParam("DesSysId");
			$page = ($this->getRequest()->getParam("page")) ? $this->getRequest()->getParam("page") : 1;
			
			//$form->setMethod("POST");
			//$form->setAction("admin/destination/editdesti/id/" . $pId . "/page/$page");
			// $form->setName("edit_destination_page");
			
			if ($this->getRequest()->isPost()) {
				$getData = $this->getRequest()->getPost();
				
				$id = $getData['DesSysId'];
				
				
				$editDestinationData = [
				'address' => ($getData['address']),
				//'content_description' => ($getData['content_description']),
				
				];
				
				
				
				
				
				$crud->rv_update('tb_tbb2c_contactus_address', $editDestinationData, ['DesSysId =?' => $id]);
				$this->view->successMessage = "things To Do Category has been Updated successfully.";
				$this->_helper->flashMessenger->addMessage("Destination has been updated successfully.");
				$this->_redirect("/admin/contactus/managecontactusadd");
				
				
			}
			$result = $crud->rv_select_static('tb_tbb2c_contactus_address', ['DesSysId', 'address'], ['isMarkForDel' => 0,'isPublish' =>1,'DesSysId' => $pId ], ['DesSysId' => 'DESC']);
			
			//        $result = $crud->getCmsdata('tb_tbb2c_destinations', ['*'], ['DesSysId' => $pId], ['DesSysId' => 'DESC']);
			//$result = $crud->getDestinations( ['tbl.IsMarkForDel'=>0 ,'DesSysId' => $pId ], ['tbl.DesSysId'=>'DESC'] );
			$result = $result[0];
			
			$this->view->getdata = $result;
			
		}
		
		public function addcontactusaddAction(){
			$this->checklogin();
			$crud = new Admin_Model_CRUD();
			//$form = new Admin_Form_Adddestination();
			$tId = (int) $this->getRequest()->getParam("DesSysId");
			
			//$form->setAction("admin/promotion/addpromotioncontent");
			//$form->setMethod("POST");
			//$form->setName("add_destination");
			
			if ($this->getRequest()->isPost()) {
				$getData = $this->getRequest()->getPost();
                //echo "<pre>";print_r($getData);die;
				
				if (isset($getData['save']) == "Save") {
					
					$savePageData = [
                    'address' => ($getData['address']),
                    //'content_description' => ($getData['content_description']),
                    
                    'IsPublish' => 1,
                    
                    'IsMarkForDel' => 0,
					];
					//                echo "<pre>";print_r($savePageData);die;
					$crud->rv_insert('tb_tbb2c_contactus_address', $savePageData);
					
					$this->view->successMessage = "things To Do Category has been saved successfully.";
					$this->_helper->flashMessenger->addMessage("Destination has been added successfully.");
					$this->_redirect("/admin/contactus/managecontactusadd");
				}
			}
			
			$this->view->form = $form;
			$this->view->messages = $this->_helper->flashMessenger->getMessages();
		}
		
		public function deletecontactusaddAction() {
			$this->checklogin();
			$crud = new Admin_Model_CRUD();
			$tId = (int) $this->getRequest()->getParam("DesSysId");
			//echo $tId;die;
			if ($tId) {
				$checkdata = $crud->rv_select_row('tb_tbb2c_contactus_address', ['DesSysId'], ['DesSysId' => $tId], ['DesSysId' => 'asc']);
				if (count($checkdata) > 0) {
					$crud->rv_delete('tb_tbb2c_contactus_address', ['DesSysId =?' => $tId]);
					$this->_helper->flashMessenger->addMessage("Deleted successfully.");
					$this->_redirect("/admin/contactus/managecontactusadd");
					} else {
					die('Oops some thing wrong!!.');
				}
			}
		}
		public function indexAction()
		{
			//Check admin logedin or not
			$this->checklogin();
			$crud   = new Admin_Model_CRUD();
			$resultset  = $crud->rv_select_all("tbl_contactus", ['*'], ['status'=>1], ['sid'=>'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->resultset  = $resultset;
			$this->view->messages   = $this->_helper->flashMessenger->getMessages();
			
		}
		
		public function managecontactusAction()
		{ 
			//Check admin logedin or not
			
			$this->checklogin();
			$this->view->messages = $this->_helper->flashMessenger->getMessages();
			
			
			$crud   = new Admin_Model_CRUD();
			$getData = array();
			if($this->getRequest()->isPost())
			{
				$getData = $this->getRequest()->getPost();
				$searchArr = array(
				'Title'=>$getData['Title'],
				'rows'=>$getData['rows'],
				'page'=>$getData['page'],
				);
				$resulsetold = $crud->getCount('tbl_branches',['isMarkForDel' =>0],'DesSysId');  
				$crud->searchArr = $searchArr;
				$resultset = $crud->getAddress(['*'],['tbl.isMarkForDel' =>0 ],['tbl.DesSysId'=> 'DESC']);  
				
				if (count($resultset) > 0) {
					foreach ($resultset as $resultkey => $resultval) {
						if($resultval['AgencySysId']==$this->gtxagencysysid){
							$result1[] = [
							'DesSysId' => $resultval['DesSysId'],
							'office_address' => $resultval['office_address'],
							'office_address_name' => $resultval['office_address_name'],
							'branch_mailid' => $resultval['branch_mailid'],
							'address' => $resultval['address'],
							'image' => $resultval['image'],
							
							];
						}	
					}
				}
				$result = Zend_Json::encode($result1);
				$newResult = Zend_Json::decode($result,false);     
				$finalResult["total"]=$resulsetold[0]['id'];
				$finalResult["rows"]=$newResult;
				echo json_encode($finalResult);
				exit;        
			}
		}
		
		
		
		/**
			* editpage() method is used to admin can edit cms static page
			* @param password string
			* @return ture 
		*/
		
		public function editcontactusAction()
		{
			//Check admin logedin or not
			$this->checklogin();
			$crud = new Admin_Model_CRUD();
			$pId = (int)$this->getRequest()->getParam("DesSysId");
            
			
			if( $this->getRequest()->isPost() ) {
				$getData = $this->getRequest()->getPost();
				
                
                //-------Start Code for Approve and Publish content---------//
				if(isset($getData['save'])=="Save") {
                    //   echo "<pre>";print_r($this->iconUrl);die;
					$DesSysId = $getData['DesSysId'];
					$orignalFIleName = $icon = $_FILES["image"]["name"];
					$fileName = '';
					if (!empty($orignalFIleName)) {
						$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
						$allowedExtensions = ['jpg', 'jpeg', 'gif', 'png', 'webp'];
						if(in_array($fileExt, $allowedExtensions, true)){
							$orignalFolderName  = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->iconUrl.$pId ;
							$fileExt    = $this->_helper->General->getFileExtension($orignalFIleName);
							$fileName   = $this->current_time . '.' . $fileExt;
							$fileName1   = $this->current_time;
							
							
							if (!file_exists($orignalFolderName)) {
								mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
							}
							
							$temp_file_name = $_FILES["image"]["tmp_name"]; // temprary file name
							@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
							
							$originalLargeFolder = $orignalFolderName.'/large';
							$originalMediumFolder = $orignalFolderName.'/medium';
							$originalSmallFolder = $orignalFolderName.'/small';
							
							$sourceFile = $orignalFolderName . "/" . $fileName;
							$destinationFile = $orignalFolderName . "/" . $fileName1.'.webp';
							$quality = 80;
							if ($crud->convertToWebP($sourceFile, $destinationFile, $quality)) {
								if (!file_exists($originalLargeFolder)) {
									mkdir($originalLargeFolder, 0777, true);
								}
								if (!file_exists($originalMediumFolder)) {
									mkdir($originalMediumFolder, 0777, true);
								}
								if (!file_exists($originalSmallFolder)) {
									mkdir($originalSmallFolder, 0777, true);
								}
								
								@copy($destinationFile, $originalLargeFolder . "/" . $fileName1.'.webp'); 
								@copy($destinationFile, $originalMediumFolder . "/" . $fileName1.'.webp'); 
								@copy($destinationFile, $originalSmallFolder . "/" . $fileName1.'.webp'); 
								$fileName = $fileName1.'.webp';
								} else {
								$this->view->errorMessage ="Only allow  'jpg', 'png', 'webp' "; 
							}
							
							}else{
							$this->view->errorMessage ="Only allow  'jpg', 'png', 'webp' "; 
						}
						
						
						} 
						
						
						
						$editPageData = [                    
						'address' => ($getData['address']),
						'office_address' => ($getData['office_address']),
						'office_address_name' => ($getData['office_address_name']),
						'branch_mailid' => ($getData['branch_mailid']),
						'toll_free_name' => ($getData['toll_free_name']),
						'website_link' => ($getData['website_link']),
						];
						
						if ($fileName != "") {
							$editPageData['image'] = $fileName;
						}
						// echo "<pre>";print_r($editPageData);die;
						$crud->rv_update('tbl_branches', $editPageData, ['DesSysId =?'=>$pId]);
						$this->view->successMessage ="Page content has been saved successfully.";
						$this->_helper->flashMessenger->addMessage("Page content has been updated successfully.");
						$this->_redirect("/admin/contactus/managecontactus");
					}
					
				}
				
				$result = $crud->getCmsdata('tbl_branches', ['*'], ['DesSysId'=>$pId], ['DesSysId'=>'DESC']);
				$get = $crud->rv_select_all('tb_tbb2c_contactus_address', ['DesSysId', 'address'], ['IsPublish' => 1, 'IsMarkForDel' => 0],['DesSysId' => 'DESC']); 
				//        echo "<pre>";print_r($result);die;
				$editdata["DesSysId"] = @$result->DesSysId;
				$editdata["address"] = @$result->address;
				$editdata["image"] = @$result->image;
				$editdata["office_address"] = @$result->office_address;
				$editdata["office_address_name"] = @$result->office_address_name;  
				$editdata["branch_mailid"] = @$result->branch_mailid;
				$editdata["website_link"] = @$result->website_link;  
				$editdata["toll_free_name"] = @$result->toll_free_name;
				//        echo "<pre>";print_r($editdata);die;
				
				$this->view->image = @$result->image;
				$this->view->editdata = $editdata;
				$this->view->getaddress = $get;
				//echo "<pre>";print_r($get);die;        
			}
			
			
			public function addcontactusAction()
			{
				$this->checklogin();
				$crud = new Admin_Model_CRUD();
				
				$pId = (int)$this->getRequest()->getParam("DesSysId");
				$resultaddress = $crud->rv_select_all('tb_tbb2c_contactus_address', ['DesSysId', 'address'], ['IsPublish' => 1, 'IsMarkForDel' => 0],['DesSysId' => 'DESC']);   $this->view->getaddress = $resultaddress;
				
				if( $this->getRequest()->isPost() ) {
					$getData = $this->getRequest()->getPost();          
					$lastRow = $crud->getCmsdata('tbl_branches', ['DesSysId'], ['DesSysId'], ['DesSysId'=>'DESC']);
					$pId = $lastRow['DesSysId'] + 1;
					//-------Start Code for Approve and Publish content---------//
					if (isset($getData['save']) == "Save") {
						//                echo "<pre>";print_r($getData);die;
						$DesSysId = $getData['DesSysId'];
						$orignalFIleName = $icon = $_FILES["image"]["name"];
						
						$fileName = '';
						
						if (!empty($orignalFIleName)) {
							$fileExt = $this->_helper->General->getFileExtension($orignalFIleName);
							$allowedExtensions = ['jpg', 'jpeg', 'gif', 'png', 'webp'];
							if(in_array($fileExt, $allowedExtensions, true)){
								$orignalFolderName  = $_SERVER["DOCUMENT_ROOT"] . $this->iconUrl.$pId ;
								$fileExt    = $this->_helper->General->getFileExtension($orignalFIleName);
								$fileName   = $this->current_time . '.' . $fileExt;
								$fileName1   = $this->current_time;
								
								// echo "<pre>";print_r($orignalFolderName);die;
								if (!file_exists($orignalFolderName)) {
									mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
								}
								
								$temp_file_name = $_FILES["image"]["tmp_name"]; // temprary file name
								@move_uploaded_file($temp_file_name, $orignalFolderName . "/" . $fileName);
								
								$originalLargeFolder = $orignalFolderName.'/large';
								$originalMediumFolder = $orignalFolderName.'/medium';
								$originalSmallFolder = $orignalFolderName.'/small';
								
								$sourceFile = $orignalFolderName . "/" . $fileName;
								$destinationFile = $orignalFolderName . "/" . $fileName1.'.webp';
								$quality = 80;
								if ($crud->convertToWebP($sourceFile, $destinationFile, $quality)) {
									if (!file_exists($originalLargeFolder)) {
										mkdir($originalLargeFolder, 0777, true);
									}
									if (!file_exists($originalMediumFolder)) {
										mkdir($originalMediumFolder, 0777, true);
									}
									if (!file_exists($originalSmallFolder)) {
										mkdir($originalSmallFolder, 0777, true);
									}
									
									@copy($destinationFile, $originalLargeFolder . "/" . $fileName1.'.webp'); 
									@copy($destinationFile, $originalMediumFolder . "/" . $fileName1.'.webp'); 
									@copy($destinationFile, $originalSmallFolder . "/" . $fileName1.'.webp'); 
									$fileName = $fileName1.'.webp';
									} else {
									$this->view->errorMessage ="Only allow  'jpg', 'png', 'webp' "; 
								}
								
								}else{
								$this->view->errorMessage ="Only allow  'jpg', 'png', 'webp' "; 
							}
							
							
						} 
						
						
						$savePageData = [                    
						//'title' => ($getData['title']),
						'image' =>   $fileName ,
						'address' => ($getData['address']),
						'office_address' => ($getData['office_address']),
						'office_address_name' => ($getData['office_address_name']),
						'branch_mailid' => ($getData['branch_mailid']),
						'website_link' => ($getData['website_link']),
						'toll_free_name' => ($getData['toll_free_name']),
						//'tab' => (int)($getData['tab']),
						//'isActive' => ($getData['isActive']),
						'isMarkForDel' => 0,
						];
						//                echo "<pre>";print_r($savePageData);die;
						$crud->rv_insert('tbl_branches', $savePageData);
						
						$this->view->successMessage = "Page content has been saved successfully.";
						$this->_helper->flashMessenger->addMessage("Page content has been added successfully.");
						$this->_redirect("/admin/contactus/managecontactus");
						
					}  
					
					
				}
				
				
				$this->view->messages   = $this->_helper->flashMessenger->getMessages();
				
				
			}
			
			
			
			public function deletecontactusAction() {
				$this->checklogin();
				$crud = new Admin_Model_CRUD();
				$tId = (int) $this->getRequest()->getParam("DesSysId");
				//echo $tId;die;
				if ($tId) {
					$checkdata = $crud->rv_select_row('tbl_branches', ['DesSysId'], ['DesSysId' => $tId], ['DesSysId' => 'asc']);
					if (count($checkdata) > 0) {
						$crud->rv_delete('tbl_branches', ['DesSysId =?' => $tId]);
						
						$this->_helper->flashMessenger->addMessage("Delete successfully.");
						$this->_redirect("/admin/contactus/managecontactus");
						} else {
						die('Oops some thing wrong!!.');
					}
				}
			}
			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');   
				} 
			}
		}			

Youez - 2016 - github.com/yon3zu
LinuXploit