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

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/holidays.tripjack.com/application/admin/controllers/NotificationController.php
<?php
/***************************************************************
* Catabatic Technology Pvt. Ltd.
* File Name     : StaticpageController.php
* File Desc.    : Staticpage controller managed all staic content pages
* Created By    : Piyush Tiwari <piyush@catpl.co.in>
* Created Date  : 23 May 2018
* Updated Date  : 23 May 2018
***************************************************************/



class Admin_NotificationController extends Zend_Controller_Action
{
    

    public $dbAdapter;
    public $perPageLimit;
    public $siteurl;
    public $DIR_WRITE_MODE;
    
    
    
    public function init(){

       /*Initialize db and session access */
         parent::init(); 
       $aConfig = $this->getInvokeArg('bootstrap')->getOptions();

       //echo"<pre>";print_r($aConfig);die;
       $this->siteurl = $aConfig['bootstrap']['siteUrl']; 
		$this->appmode = $aConfig['bootstrap']['appmode'];
                $this->view->gtxagencysysid = $this->gtxagencysysid = $aConfig['bootstrap']['gtxagencysysid'];
		$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->large_image_width = $aConfig['bootstrap']['large_image_width'];
       $this->large_image_height = $aConfig['bootstrap']['large_image_height'];
        
        
        $this->table = 'tbl_notification';   
        $this->current_time = time();
        $this->imageUrl     = (($this->appmode == 'MODE_BETA') ? 'beta/' : '') . 'public/upload/'.$this->gtxagencysysid.'/notification/';
            $this->DIR_WRITE_MODE = 0777;
     
    }
    
    
    
    /**
    * index() method is used to admin login for form call
    * @param Null
    * @return Array 
    */
    
    public function indexAction()
    {
                //Check admin logedin or not

        $this->checklogin();
        $this->view->messages = $this->_helper->flashMessenger->getMessages();
        $crud   = new Admin_Model_CRUD();
        $getData = array();
        

        //$resultset = $crud->rv_select_static( $this->table,['*'],['isMarkForDel' =>0 ],['Id '=> 'DESC']);  
        //echo "<pre>";print_r($resultset);die;

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


        $searchArr = array(
            'heading'=>$getData['heading'],
            'rows'=>$getData['rofferIdows'],
            'page'=>$getData['page'],
            );
        $resulsetold = $crud->getCount( $this->table,['isMarkForDel' =>0],'Id'); 
        //echo "<pre>";print_r($this->table);die;
//        echo "<pre>";print_r($resulsetold);die;
        $crud->searchArr = $searchArr;
        $resultset = $crud->rv_select_static( $this->table,['*'],['isMarkForDel' =>0 ],['Id '=> 'DESC']);  
       
        if (count($resultset) > 0) {
            foreach ($resultset as $resultkey => $resultval) {
                $expiryDate = explode('-',$resultval['expiryDate']);
                $result1[] = [
                    'Id' => $resultval['Id'],
                    'heading' => $resultval['heading'],
                    'notification' => $resultval['notification'],
                    'expiryDate' => $expiryDate[2].'/'.$expiryDate[1].'/'.$expiryDate[0],
                    'isActive' => $resultval['isActive']==1?'Active':'Deactive',
                    'IsFeatured' => $resultval['IsFeatured'],
                 ];
            }
        }
        
        $result = Zend_Json::encode($result1);
        $newResult = Zend_Json::decode($result,false);     
        $finalResult["total"]=$resulsetold[0]['Id'];
        $finalResult["rows"]=$newResult;
        echo json_encode($finalResult);
        exit;        
        }
        //die('test');

    }
    
    public function editnotificationAction()
    {
//Check admin logedin or not
       
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $pId = (int)$this->getRequest()->getParam("id");
         
        if( $this->getRequest()->isPost() ) {
            $getData = $this->getRequest()->getPost();
          
           
                //-------Start Code for Approve and Publish content---------//
    

               if(isset($getData['save'])=="Save") {
                  
                    $id = $getData['id'];
                    $orignalFIleName = $image = $_FILES["image"]["name"];
                    $fileName = '';
                
                    $expiryDate = explode('/',$getData['expiryDate']);
                    $editPageData = [                    
                        'heading' => ($getData['heading']),                                                               
                        'notification' => ($getData['notification']),                                                               
                        'expiryDate' => $expiryDate[2].'-'.$expiryDate[1].'-'.$expiryDate[0],                                                             
                        'url' => ($getData['url']),                                                               
                        'tab' => ($getData['tab']),                                                               
                        'isActive' => ($getData['isActive']),
                    ];
                                
                    
                    $crud->rv_update($this->table, $editPageData, ['Id =?'=>$pId]);
                    $this->view->successMessage ="Page content has been saved successfully.";
                    $this->_helper->flashMessenger->addMessage("Page content has been updated successfully.");
                   $this->_redirect("/admin/notification/index");
                }
                           
        }

        $result = $crud->getCmsdata($this->table, ['*'], ['Id'=>$pId], ['Id'=>'DESC']);
        //echo "<pre>";print_r($result);die;
        $editdata["Id"] = @$result->Id;
        $editdata["heading"] = @$result->heading;
        $editdata["notification"] = @$result->notification;
        $expiryDate = explode('-',$result->expiryDate);
        $editdata["expiryDate"] = $expiryDate[2].'/'.$expiryDate[1].'/'.$expiryDate[0];
        $editdata["url"] = @$result->url;
        $editdata["tab"] = @$result->tab;
        $editdata["isActive"] = @$result->isActive;
      //echo "<pre>";print_r($editdata);die;
       
       
        $this->view->editdata = $editdata;
        $this->view->large_image_width = $this->large_image_width;
        $this->view->large_image_height = $this->large_image_height;
        
                    
    }
    
    
    public function addnotificationAction()
    {
   
//Check admin logedin or not
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
             
        if( $this->getRequest()->isPost() ) {
            $getData = $this->getRequest()->getPost();     
            $lastRow = $crud->getCmsdata($this->table, ['Id'], ['Id'], ['Id'=>'DESC']);

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

            $pId = $lastRow['Id'] + 1;

            if(isset($getData['save'])=="Save") {

                    //echo "<pre>";print_r($getData);die;
                    $id = $getData['id'];
                    $orignalFIleName = $image = $_FILES["image"]["name"];
                    $fileName = '';
                        $expiryDate = explode('/',$getData['expiryDate']);
                        $savePageData = [                    
                            'heading' => ($getData['heading']),
                            'notification' => ($getData['notification']),
                            'url' => ($getData['url']),
                            'expiryDate' => $expiryDate[2].'-'.$expiryDate[1].'-'.$expiryDate[0],
                            'isActive' => ($getData['isActive']),
                            'isMarkForDel' => 0,
                            'IsFeatured' => 1,
                            'tab' => (int)($getData['tab']),
                         ];
                   
                    try{
                      $crud->rv_insert($this->table, $savePageData);
                    }
                    catch (Exception $err) {
                            print_r($err); exit;
                        $err->getMessage();
                        $issend = FALSE;
                    }

                    $this->view->successMessage = "Page content has been saved successfully.";
                    $this->_helper->flashMessenger->addMessage("Page content has been added successfully.");
                    $this->_redirect("/admin/notification/index");
            
             }  
             
          
        }

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


    public function activeAction() {
        $this->checklogin();
        $crud = new Admin_Model_CRUD();
        $tId = (int) $this->getRequest()->getParam("id");
        $val = (int) $this->getRequest()->getParam("val");
        //echo $val; exit;
        if ($tId) {
            try {
                $updatedata = [
                    'IsFeatured' => $val
                ];
                $result = $crud->rv_update($this->table, $updatedata, ['Id =?' => $tId]);
                if (!$result) {
                    $result_message = ['status' => false, 'message' => 'Oops something wrong!!'];
                    echo Zend_Json::encode($result_message);
                    exit;
                } else {
                    $result_message = ['status' => true, 'message' => 'Active successfully'];
                    echo Zend_Json::encode($result_message);
                    exit;
                }
            } catch (Exception $ex) {
                $ex->getMessage();
            }
        }
    }
    
    


    
    public function deletenotificationAction() {
        $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, ['Id'], ['Id' => $tId], ['Id' => 'asc']);
            if (count($checkdata) > 0) {
                $crud->rv_update($this->table, ['isMarkForDel'=> 1], ['Id  =?'=>$tId]);
                $this->_helper->flashMessenger->addMessage("Delete successfully.");
                $this->_redirect("/admin/notification/index");
            } 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