예제 #1
0
 /**
  */
 public function execute()
 {
     switch ($this->_task) {
         case 'add':
             $this->setModel(SPLoader::loadModel('section'));
             $this->editForm();
             break;
         case 'edit':
             Sobi::Redirect(Sobi::Url(array('task' => 'config', 'sid' => SPRequest::sid())), null, true);
             break;
         case 'view':
         case 'entries':
             Sobi::ReturnPoint();
             $this->view($this->_task == 'entries', Sobi::GetUserState('entries_filter', 'sp_entries_filter', null));
             break;
         case 'toggle.enabled':
         case 'toggle.approval':
             $this->toggleState();
             break;
         default:
             /* case plugin didn't register this task, it was an error */
             if (!parent::execute()) {
                 Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
             }
             break;
     }
 }
예제 #2
0
 /**
  */
 public function execute()
 {
     $r = false;
     switch ($this->_task) {
         case 'chooser':
         case 'expand':
             SPLoader::loadClass('html.input');
             $r = true;
             $this->chooser($this->_task == 'expand');
             break;
         case 'parents':
             $r = true;
             $this->parents();
             break;
         case 'icon':
             $r = true;
             $this->iconChooser();
             break;
         default:
             /* case parent didn't registered this task, it was an error */
             if (!parent::execute() && $this->name() == __CLASS__) {
                 Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
             } else {
                 $r = true;
             }
             break;
     }
     return $r;
 }
예제 #3
0
 public function execute()
 {
     SPRequest::set('task', $this->_type . '.' . $this->_task);
     if (strstr($this->_task, '.')) {
         $task = explode('.', $this->_task);
         $class = SPLoader::loadClass('opt.listing.' . $task[0], false, null, true);
     } else {
         $class = SPLoader::loadClass('opt.listing.' . $this->_task, false, null, true);
     }
     if ($class) {
         $imp = class_implements($class);
         if (is_array($imp) && in_array('SPListing', $imp)) {
             /** @noinspection PhpIncludeInspection $compatibility */
             $listing = new $class();
             if (!isset($class::$compatibility)) {
                 define('SOBI_LEGACY_LISTING', true);
                 if (strstr($this->_task, '.')) {
                     $t = explode('.', $this->_task);
                     $listing->setTask($t[0]);
                 } else {
                     $listing->setTask($this->_task);
                 }
             } else {
                 $listing->setTask($this->_task);
             }
             return $listing->execute();
         } else {
             Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND Wrong class definition', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
         }
     } else {
         /* case parent didn't registered this task, it was an error */
         if (!parent::execute() && $this->name() == __CLASS__) {
             Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
         }
     }
 }
예제 #4
0
 /**
  */
 public function execute()
 {
     if (!Sobi::Can('section.search')) {
         if ($this->_task != 'suggest') {
             if (Sobi::Cfg('redirects.section_search_enabled') && strlen(Sobi::Cfg('redirects.section_search_url', null))) {
                 $this->escape(Sobi::Cfg('redirects.section_search_url', null), SPLang::e(Sobi::Cfg('redirects.section_search_msg', 'UNAUTHORIZED_ACCESS')), Sobi::Cfg('redirects.section_search_msgtype', SPC::ERROR_MSG));
             } else {
                 Sobi::Error($this->name(), SPLang::e('UNAUTHORIZED_ACCESS_TASK', SPRequest::task()), SPC::ERROR, 403, __LINE__, __FILE__);
             }
         } else {
             exit;
         }
     }
     $r = false;
     SPLoader::loadClass('env.cookie');
     SPLoader::loadClass('env.browser');
     SPRequest::set('task', $this->_type . '.' . $this->_task);
     switch ($this->_task) {
         case 'results':
         case 'view':
             $this->form();
             $r = true;
             break;
         case 'search':
             $this->search();
             $r = true;
             break;
         case 'suggest':
             $this->suggest();
             $r = true;
             break;
         default:
             if (!parent::execute()) {
                 Sobi::Error($this->name(), SPLang::e('SUCH_TASK_NOT_FOUND', SPRequest::task()), SPC::NOTICE, 404, __LINE__, __FILE__);
             }
             break;
     }
     return $r;
 }