コード例 #1
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save jurytalk
     $jurytalk = ContestJurytalkEditor::create($this->contest->contestID, $this->message, WCF::getUser()->userID, WCF::getUser()->username);
     $this->saved();
     // forward
     HeaderUtil::redirect('index.php?page=ContestJurytalk&contestID=' . $this->contest->contestID . '&jurytalkID=' . $jurytalk->jurytalkID . SID_ARG_2ND_NOT_ENCODED . '#jurytalk' . $jurytalk->jurytalkID);
     exit;
 }
コード例 #2
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save rating
     ContestSolutionRatingEditor::updateRatings($this->solutionObj->solutionID, WCF::getUser()->userID, $this->optionIDs);
     $this->saved();
     // forward
     HeaderUtil::redirect('index.php?page=ContestSolutionEntry&contestID=' . $this->solutionObj->contestID . '&solutionID=' . $this->solutionObj->solutionID);
     exit;
 }
コード例 #3
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save user
     $inserts = '';
     foreach ($this->users as $user) {
         if (!empty($inserts)) {
             $inserts .= ',';
         }
         $inserts .= "(" . WCF::getUser()->userID . ", " . $user->userID . ")";
     }
     if (!empty($inserts)) {
         $sql = "INSERT IGNORE INTO\twcf" . WCF_N . "_user_" . $this->listType . "list\n\t\t\t\t\t\t\t(userID, " . $this->listType . "UserID)\n\t\t\t\tVALUES\t\t\t" . $inserts;
         WCF::getDB()->sendQuery($sql);
     }
     // reset session
     Session::resetSessions(WCF::getUser()->userID, true, false);
     $this->saved();
     // reset field
     $this->usernames = '';
     // show success message
     WCF::getTPL()->assign(array('success' => 'add', 'users' => $this->users));
 }
コード例 #4
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save jury
     $jury = ContestJuryEditor::create($this->contest->contestID, WCF::getUser()->userID, $this->groupID, $this->state);
     $this->saved();
     // forward
     HeaderUtil::redirect('index.php?page=ContestJury&contestID=' . $this->contest->contestID . '&juryID=' . $jury->juryID . SID_ARG_2ND_NOT_ENCODED . '#jury' . $jury->juryID);
     exit;
 }
コード例 #5
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save participant
     $participant = ContestParticipantEditor::create($this->contest->contestID, WCF::getUser()->userID, $this->groupID, $this->state);
     $this->saved();
     // forward
     HeaderUtil::redirect('index.php?page=ContestParticipant' . '&contestID=' . $this->contest->contestID . '&participantID=' . $participant->participantID . SID_ARG_2ND_NOT_ENCODED . '#participant' . $participant->participantID);
     exit;
 }
コード例 #6
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // get user editor
     $editor = WCF::getUser()->getEditor();
     $success = array();
     // quit
     if (WCF::getUser()->getPermission('user.profile.canQuit')) {
         if (!WCF::getUser()->quitStarted && $this->quit == 1) {
             $sql = "UPDATE\twcf" . WCF_N . "_user\n\t\t\t\t\tSET\tquitStarted = " . TIME_NOW . "\n\t\t\t\t\tWHERE\tuserID = " . WCF::getUser()->userID;
             WCF::getDB()->sendQuery($sql);
             $this->quitStarted = TIME_NOW;
             $success[] = 'wcf.user.quit.success';
         } else {
             if (WCF::getUser()->quitStarted && $this->cancelQuit == 1) {
                 $sql = "UPDATE\twcf" . WCF_N . "_user\n\t\t\t\t\tSET\tquitStarted = 0\n\t\t\t\t\tWHERE\tuserID = " . WCF::getUser()->userID;
                 WCF::getDB()->sendQuery($sql);
                 $this->quitStarted = 0;
                 $success[] = 'wcf.user.quit.cancel.success';
             }
         }
     }
     // username
     if ($this->canChangeUsername && $this->username != WCF::getUser()->username) {
         $fields = array();
         if (StringUtil::toLowerCase($this->username) != StringUtil::toLowerCase(WCF::getUser()->username)) {
             if (!$this->canChangeUsername) {
                 $this->username = WCF::getUser()->username;
                 return;
             }
             $fields = array('lastUsernameChange' => TIME_NOW, 'oldUsername' => $editor->username);
         }
         $editor->update($this->username, '', '', null, null, $fields);
         $success[] = 'wcf.user.rename.success';
     }
     // email
     if (WCF::getUser()->getPermission('user.profile.canChangeEmail') && $this->email != WCF::getUser()->email && $this->email != WCF::getUser()->newEmail) {
         if (REGISTER_ACTIVATION_METHOD == 0 || REGISTER_ACTIVATION_METHOD == 2 || StringUtil::toLowerCase($this->email) == StringUtil::toLowerCase(WCF::getUser()->email)) {
             // update email
             $editor->update('', $this->email);
             $success[] = 'wcf.user.emailChange.success';
         } else {
             if (REGISTER_ACTIVATION_METHOD == 1) {
                 // get reactivation code
                 $activationCode = UserRegistrationUtil::getActivationCode();
                 // save as new email
                 $sql = "UPDATE\twcf" . WCF_N . "_user\n\t\t\t\t\tSET\treactivationCode = " . $activationCode . ",\n\t\t\t\t\t\tnewEmail = '" . escapeString($this->email) . "'\n\t\t\t\t\tWHERE\tuserID = " . WCF::getUser()->userID;
                 WCF::getDB()->registerShutdownUpdate($sql);
                 $subjectData = array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE));
                 $messageData = array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE), '$username' => WCF::getUser()->username, '$userID' => WCF::getUser()->userID, '$activationCode' => $activationCode, 'PAGE_URL' => PAGE_URL, 'MAIL_ADMIN_ADDRESS' => MAIL_ADMIN_ADDRESS);
                 require_once WCF_DIR . 'lib/data/mail/Mail.class.php';
                 $mail = new Mail(array(WCF::getUser()->username => $this->email), WCF::getLanguage()->get('wcf.user.emailChange.needReactivation.mail.subject', $subjectData), WCF::getLanguage()->get('wcf.user.emailChange.needReactivation.mail', $messageData));
                 $mail->send();
                 $success[] = 'wcf.user.emailChange.needReactivation';
             }
         }
     }
     // password
     if (!empty($this->newPassword) || !empty($this->confirmNewPassword)) {
         $editor->update('', '', $this->newPassword);
         // update cookie
         if (isset($_COOKIE[COOKIE_PREFIX . 'password'])) {
             HeaderUtil::setCookie('password', StringUtil::getSaltedHash($this->newPassword, $editor->salt), TIME_NOW + 365 * 24 * 3600);
         }
         $success[] = 'wcf.user.passwordChange.success';
     }
     // reset session
     WCF::getSession()->resetUserData();
     $this->saved();
     // show success message
     WCF::getTPL()->assign('success', $success);
     // reset password
     $this->password = '';
     $this->newPassword = $this->confirmNewPassword = '';
 }
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     $invitedFriends = array();
     foreach ($this->invitedMails as $email) {
         $invitation = InvitationEditor::create($email);
         $mail = new Mail(array($email => $email), WCF::getLanguage()->get('wcf.user.register.invitation.mail.subject', array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE))), WCF::getLanguage()->get('wcf.user.register.invitation.mail', array('PAGE_TITLE' => WCF::getLanguage()->get(PAGE_TITLE), 'PAGE_URL' => PAGE_URL, 'MAIL_ADMIN_ADDRESS' => MAIL_ADMIN_ADDRESS, '$username' => $invitation->senderUsername, '$invitationCode' => $invitation->code, '$email' => $invitation->email, '$emailUrlEncoded' => urlencode($invitation->email))));
         $mail->send();
         $invitedFriends[] = $invitation;
     }
     $this->saved();
     $this->emails = '';
     WCF::getTPL()->assign(array('success' => 'add', 'invitedFriends' => $invitedFriends));
 }
コード例 #8
0
 /**
  * @see Form::save()
  */
 public function save()
 {
     parent::save();
     // save sponsor
     $sponsor = ContestSponsorEditor::create($this->contest->contestID, WCF::getUser()->userID, $this->groupID, $this->state);
     $this->saved();
     // forward
     HeaderUtil::redirect('index.php?page=ContestSponsor&contestID=' . $this->contest->contestID . '&sponsorID=' . $sponsor->sponsorID . SID_ARG_2ND_NOT_ENCODED . '#sponsor' . $sponsor->sponsorID);
     exit;
 }