コード例 #1
0
ファイル: AuthPresenter.php プロジェクト: blitzik/CMS
 protected function startup()
 {
     parent::startup();
     if ($this->session->hasSection('cms_localization')) {
         $localizationSection = $this->session->getSection('cms_localization');
         if ($localizationSection->locale !== null) {
             $this->locale = $localizationSection->locale;
         }
     }
 }
コード例 #2
0
ファイル: ProtectedPresenter.php プロジェクト: blitzik/CMS
 protected function createComponent($name)
 {
     $ucname = ucfirst($name);
     $method = 'createComponent' . $ucname;
     $presenterReflection = $this->getReflection();
     if ($presenterReflection->hasMethod($method)) {
         $methodReflection = $presenterReflection->getMethod($method);
         $this->checkRequirements($methodReflection);
         if ($methodReflection->hasAnnotation('Actions')) {
             $actions = explode(',', $methodReflection->getAnnotation('Actions'));
             foreach ($actions as $key => $action) {
                 $actions[$key] = trim($action);
             }
             if (!empty($actions) and !in_array($this->getAction(), $actions)) {
                 throw new ForbiddenRequestException("Creation of component '{$name}' is forbidden for action '{$this->action}'.");
             }
         }
     }
     return parent::createComponent($name);
 }