コード例 #1
0
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_GET['remove'])) {
         $user = new User(intval($_GET['remove']));
         if (!$user->userID) {
             throw new IllegalLinkException();
         }
         // delete user
         $sql = "DELETE FROM\twcf" . WCF_N . "_user_" . $this->listType . "list\n\t\t\t\tWHERE\t\tuserID = " . WCF::getUser()->userID . "\n\t\t\t\t\t\tAND " . $this->listType . "UserID = " . $user->userID;
         WCF::getDB()->sendQuery($sql);
         // reset session
         Session::resetSessions(WCF::getUser()->userID, true, false);
         // show success message
         WCF::getTPL()->assign(array('success' => 'remove', 'user' => $user));
     } else {
         if (isset($_GET['add'])) {
             $user = new User(intval($_GET['add']));
             if (!$user->userID) {
                 throw new IllegalLinkException();
             }
             $this->usernames = $user->username;
             $this->submit();
         }
     }
 }
コード例 #2
0
 /**
  * @see Form::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // get contest
     if (!$this->contest->isJuryable()) {
         throw new PermissionDeniedException();
     }
 }
コード例 #3
0
 /**
  * @see Form::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // get contest
     if (!$this->solutionObj->isRateable()) {
         throw new PermissionDeniedException();
     }
 }
コード例 #4
0
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // check permissions
     if (!WCF::getUser()->getPermission('user.profile.canRename') || WCF::getUser()->lastUsernameChange + WCF::getUser()->getPermission('user.profile.renamePeriod') * 86400 > TIME_NOW) {
         $this->canChangeUsername = false;
     }
     $this->quitStarted = WCF::getUser()->quitStarted;
 }
コード例 #5
0
 /**
  * @see Form::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     // get contest
     if (!$this->contest->isParticipantable()) {
         throw new PermissionDeniedException();
     }
     // set state default
     $this->state = $this->contest->enableParticipantCheck ? 'applied' : 'accepted';
 }
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     parent::readParameters();
     if (isset($_GET['cancel'])) {
         $invitation = new InvitationEditor(intval($_GET['cancel']));
         if (!$invitation->invitationID) {
             throw new IllegalLinkException();
         }
         if ($invitation->senderID !== WCF::getUser()->userID) {
             throw new PermissionDeniedException();
         }
         if ($invitation->isSealed) {
             throw new NamedUserException(WCF::getLanguage()->get('wcf.user.invitation.error.sealed'));
         }
         $invitation->delete();
         WCF::getTPL()->assign(array('success' => 'cancel', 'invitation' => $invitation));
     } else {
         if (isset($_GET['add'])) {
             $this->emails = $_GET['add'];
             $this->submit();
         }
     }
 }
コード例 #7
0
 /**
  * @see Page::readParameters()
  */
 public function readParameters()
 {
     AbstractSecureForm::readParameters();
     if (isset($_GET['remove'])) {
         $user = new User(intval($_GET['remove']));
         if (!$user->userID) {
             throw new IllegalLinkException();
         }
         // delete user
         $sql = "DELETE FROM\twcf" . WCF_N . "_user_whitelist\n\t\t\t\tWHERE\t\t(userID = " . WCF::getUser()->userID . "\n\t\t\t\t\t\tAND whiteUserID = " . $user->userID . ") OR\n\t\t\t\t\t\t(userID = " . $user->userID . "\n\t\t\t\t\t\tAND whiteUserID = " . WCF::getUser()->userID . ")";
         WCF::getDB()->sendQuery($sql);
         // reset session
         Session::resetSessions(array(WCF::getUser()->userID, $user->userID), true, false);
         // show success message
         WCF::getTPL()->assign(array('success' => 'remove', 'user' => $user));
     } else {
         if (isset($_GET['accept'])) {
             $user = new User(intval($_GET['accept']));
             if (!$user->userID) {
                 throw new IllegalLinkException();
             }
             // validate id
             $sql = "SELECT\tCOUNT(*) AS count\n\t\t\t\tFROM\twcf" . WCF_N . "_user_whitelist\n\t\t\t\tWHERE\tuserID = " . $user->userID . "\n\t\t\t\t\tAND whiteUserID = " . WCF::getUser()->userID . "\n\t\t\t\t\tAND confirmed = 0";
             $row = WCF::getDB()->getFirstRow($sql);
             if (!$row['count']) {
                 throw new IllegalLinkException();
             }
             // insert user
             $sql = "REPLACE INTO\twcf" . WCF_N . "_user_whitelist\n\t\t\t\t\t\t(userID, whiteUserID, confirmed, time)\n\t\t\t\tVALUES\t\t(" . WCF::getUser()->userID . ", " . $user->userID . ", 1, " . TIME_NOW . "),\n\t\t\t\t\t\t(" . $user->userID . ", " . WCF::getUser()->userID . ", 1, " . TIME_NOW . ")";
             WCF::getDB()->sendQuery($sql);
             // delete blacklist entries if necessary
             $sql = "DELETE FROM\twcf" . WCF_N . "_user_blacklist\n\t\t\t\tWHERE\t\t(userID = " . WCF::getUser()->userID . "\n\t\t\t\t\t\tAND blackUserID = " . $user->userID . ") OR\n\t\t\t\t\t\t(userID = " . $user->userID . "\n\t\t\t\t\t\tAND blackUserID = " . WCF::getUser()->userID . ")";
             WCF::getDB()->sendQuery($sql);
             // reset session
             Session::resetSessions(array(WCF::getUser()->userID, $user->userID), true, false);
             // show success message
             WCF::getTPL()->assign(array('success' => 'accept', 'user' => $user));
         } else {
             if (isset($_GET['decline'])) {
                 $user = new User(intval($_GET['decline']));
                 if (!$user->userID) {
                     throw new IllegalLinkException();
                 }
                 // delete user
                 $sql = "DELETE FROM\twcf" . WCF_N . "_user_whitelist\n\t\t\t\tWHERE\t\t(userID = " . $user->userID . "\n\t\t\t\t\t\tAND whiteUserID = " . WCF::getUser()->userID . ")";
                 WCF::getDB()->sendQuery($sql);
                 // reset session
                 Session::resetSessions(array(WCF::getUser()->userID, $user->userID), true, false);
                 // show success message
                 WCF::getTPL()->assign(array('success' => 'decline', 'user' => $user));
             } else {
                 if (isset($_GET['cancel'])) {
                     $user = new User(intval($_GET['cancel']));
                     if (!$user->userID) {
                         throw new IllegalLinkException();
                     }
                     // delete user
                     $sql = "DELETE FROM\twcf" . WCF_N . "_user_whitelist\n\t\t\t\tWHERE\t\t(userID = " . WCF::getUser()->userID . "\n\t\t\t\t\t\tAND whiteUserID = " . $user->userID . ")";
                     WCF::getDB()->sendQuery($sql);
                     // reset session
                     Session::resetSessions(array(WCF::getUser()->userID, $user->userID), true, false);
                     // show success message
                     WCF::getTPL()->assign(array('success' => 'cancel', 'user' => $user));
                 } else {
                     if (isset($_GET['add'])) {
                         $user = new User(intval($_GET['add']));
                         if (!$user->userID) {
                             throw new IllegalLinkException();
                         }
                         $this->usernames = $user->username;
                         $this->submit();
                     }
                 }
             }
         }
     }
 }