コード例 #1
0
 public function execute($par)
 {
     $this->setHeaders();
     // sets robotPolicy = "noindex,nofollow" + set page title
     $user = $this->getUser();
     $output = $this->getOutput();
     $request = $this->getRequest();
     // Check rights and block if necessary
     if (!$this->userCanExecute($user)) {
         // If anon, redirect to login
         if ($user->isAnon()) {
             $output->redirect($this->getTitleFor('UserLogin')->getLocalURL(array('returnto' => $this->getFullTitle())), '401');
             return;
         }
         // Else display an error page.
         $this->displayRestrictionError();
         return;
     }
     if (isset($par) && $par != '') {
         $explosion = explode(':', $par);
         if (count($explosion) == 1) {
             $this->action = $explosion[0];
             $this->category_id = $this->getRequest()->getText('category', null);
         } else {
             if (count($explosion) == 2) {
                 $this->action = $explosion[0];
                 $this->category_id = $explosion[1];
             }
         }
     } else {
         $this->action = $this->getRequest()->getText('action', null);
         $this->category_id = $this->getRequest()->getText('category', null);
     }
     if ($user->isAllowed(WP_ADMIN_RIGHT)) {
         $this->userIsAdmin = true;
         $this->userInvitationsCategories = WpInvitationCategory::factoryAllAvailable(true);
         // with admin categories
     } else {
         $this->userIsAdmin = false;
         $this->userActiveSubscription = WpSubscription::newActiveByUserId($user->getId());
         $this->userInvitationsCategories = WpInvitationCategory::factoryAllAvailable(false);
         // without admin categories
         $this->setUsageThisMonth();
         $this->setUsageLeftThisMonth();
     }
     $this->msgType = $request->getText('msgtype', null);
     $msgKey = $request->getText('msgkey', null);
     if ($msgKey != null) {
         $msg = wfMessage($msgKey);
         if ($msg->exists()) {
             $this->msg = $msg;
         }
     }
     $this->display();
 }