public function beforeAction($action)
 {
     /*
     		if(strtolower($this->action->Id)!='acceptemailfrompostfix'){
     			$this->render('moving');
     			Yii::app()->end();
     		}else{
     			throw new CHttpException(403,"Damn You!, you are not authorized to perform this action.");
     		}
     
     		Yii::app()->end();
     */
     //print_r(parent::beforeAction($action));
     $userAction = strtolower($this->action->Id);
     $model = new CheckActions();
     $model->userAction = $userAction;
     if ($model->validate()) {
         if ($model->checkAllowedAction()) {
             $this->baseUrl = Yii::app()->baseUrl;
             $cs = Yii::app()->getClientScript();
             $cs->registerScriptFile('/js/jquery-1.11.1.js');
             $cs->registerScriptFile('/js/jquery-ui-1.10.4.js');
             $cs->registerScriptFile('/js/forge.bundle.js');
             $cs->registerScriptFile('/js/core.js');
             $cs->registerScriptFile('/js/x64-core.js');
             $cs->registerScriptFile('/js/aes.js');
             $cs->registerScriptFile('/js/twofish.js');
             $cs->registerScriptFile("/js/uniFunctions.js?r={$this->fileVers}");
             $cs->registerScriptFile("/js/genFunctions.js?r={$this->fileVers}");
             //$cs->registerScriptFile("/js/genFunctions.js");
             $cs->registerScriptFile('/js/bootstrap/bootstrap.js');
             $cs->registerScriptFile('/js/plugin/masked-input/jquery.maskedinput.min.js');
             $cs->registerScriptFile("/js/app.config.js?r={$this->fileVers}");
             $cs->registerScriptFile('/js/plugin/select2/select2.min.js');
             $cs->registerScriptFile('/js/notification/SmartNotification.js');
             $cs->registerScriptFile("/js/xss/xss.js?r={$this->fileVers}");
             //rangy-core.js
             $cs->registerCssFile('/css/bootstrap.min.css');
             $cs->registerCssFile('/css/font-awesome.min.css');
             $cs->registerCssFile("/css/smartadmin-production.min.css?r={$this->fileVers}");
             return true;
         } else {
             echo '{"answer":"Limit is reached"}';
             return false;
         }
     } else {
         echo json_encode($model->getErrors());
         return false;
     }
     //if (parent::beforeAction($action)) {
     //}
     //return false;
 }
Пример #2
0
 public function checkAllowedAction()
 {
     $result = true;
     $allActions = CheckActions::arrayOfActions();
     if ($this->userAction == 'modallogin') {
         $result = $this->mailHashPerMinute($allActions, 30);
     }
     //if($this->userAction=='getobjects'){
     //	$result=$this->sessionIdPerMinute($allActions,3);
     //}
     //if($this->userAction=='checkemailexist'){
     //	$result=$this->mailHashPerTenMinutes($allActions,1);
     //}
     if ($this->userAction == 'sendlocalmessage') {
         $result = $this->sendEmailPerHour($allActions);
     }
     if ($this->userAction == 'sendoutmessagenopin') {
         $result = $this->sendEmailPerHour($allActions);
     }
     if ($this->userAction == 'sendoutmessagepin') {
         $result = $this->sendEmailPerHour($allActions);
     }
     if ($this->userAction == 'sendlocalmessageunreg') {
         $result = $this->sendEmailPerHourUnreg($allActions);
     }
     return $result;
 }