示例#1
0
 /**
  * Request-Handler
  * @return boolean
  */
 public function request()
 {
     if ($this->getRequestVar('syscheck')) {
         $this->syscheck = $this->getRequestVar('syscheck', array(9));
     }
     if ($this->buttonClicked('configSave') && !$this->checkPageToken()) {
         $this->view->addErrorMessage('CSRF_INVALID');
         return true;
     }
     if ($this->buttonClicked('configSave')) {
         $newconfig = $this->getRequestVar();
         if (!isset($newconfig['twitter_events'])) {
             $newconfig['twitter_events'] = array('create' => 0, 'update' => 0);
         }
         foreach ($this->config->twitter_events as $key => $value) {
             $newconfig['twitter_events'][$key] = isset($newconfig['twitter_events'][$key]) && $newconfig['twitter_events'][$key] ? 1 : 0;
         }
         $newconfig['twitter_events'] = json_encode($newconfig['twitter_events']);
         if (!isset($newconfig['twitter_data'])) {
             $newconfig['twitter_data'] = array('consumer_key' => '', 'consumer_secret' => '', 'user_token' => '', 'user_secret' => '');
         }
         foreach ($this->config->twitter_data as $key => $value) {
             $newconfig['twitter_data'][$key] = isset($newconfig['twitter_data'][$key]) ? $newconfig['twitter_data'][$key] : '';
         }
         $newconfig['twitter_data'] = json_encode($newconfig['twitter_data']);
         $newconfig['articles_limit'] = (int) $newconfig['articles_limit'];
         $newconfig['articles_acp_limit'] = (int) $newconfig['articles_acp_limit'];
         $newconfig['system_cache_timeout'] = (int) $newconfig['system_cache_timeout'];
         $newconfig['system_session_length'] = (int) $newconfig['system_session_length'];
         $newconfig['comments_flood'] = (int) $newconfig['comments_flood'];
         $newconfig['system_loginfailed_locked'] = (int) $newconfig['system_loginfailed_locked'];
         $newconfig['comments_markspam_commentcount'] = (int) $newconfig['comments_markspam_commentcount'];
         $newconfig['file_img_thumb_width'] = (int) $newconfig['file_img_thumb_width'];
         $newconfig['file_img_thumb_height'] = (int) $newconfig['file_img_thumb_height'];
         $newconfig['file_list_limit'] = (int) $newconfig['file_list_limit'];
         $newconfig['system_updates_devcheck'] = (int) $newconfig['system_updates_devcheck'];
         $newconfig['articles_revisions_limit'] = (int) $newconfig['articles_revisions_limit'];
         $newconfig['articles_link_urlrewrite'] = (int) $newconfig['articles_link_urlrewrite'];
         $newconfig['articles_archive_datelimit'] = $newconfig['articles_archive_datelimit'] ? strtotime($newconfig['articles_archive_datelimit']) : 0;
         $this->config->setNewConfig($newconfig);
         if (!$this->config->update()) {
             $this->view->addErrorMessage('SAVE_FAILED_OPTIONS');
             return true;
         }
         $this->view->addNoticeMessage('SAVE_SUCCESS_OPTIONS');
     }
     if ($this->buttonClicked('twitterDisconnect')) {
         $twitterData = $this->config->twitter_data;
         $twitterData['user_token'] = '';
         $twitterData['user_secret'] = '';
         $this->config->setNewConfig(array('twitter_data' => json_encode($twitterData), 'twitter_events' => json_encode(array('create' => 0, 'update' => 0))));
         if (!$this->config->update()) {
             $this->view->addNoticeMessage('SAVE_FAILED_OPTIONS');
             return true;
         }
         $this->view->addNoticeMessage('SAVE_SUCCESS_OPTIONS');
     }
     return true;
 }