/** * @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; }
/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); // display branding require_once WCF_DIR . 'lib/util/ContestUtil.class.php'; ContestUtil::assignVariablesBranding(); WCF::getTPL()->assign(array('states' => $this->states, 'state' => $this->state, 'availableGroups' => $this->availableGroups, 'ownerID' => $this->ownerID)); }
/** * @see Page::assignVariables() */ public function assignVariables() { parent::assignVariables(); // display branding require_once WCF_DIR . 'lib/util/ContestUtil.class.php'; ContestUtil::assignVariablesBranding(); WCF::getTPL()->assign(array('message' => $this->message, 'maxTextLength' => WCF::getUser()->getPermission('user.contest.maxSolutionLength'))); }
/** * @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::readFormParameters() */ public function readFormParameters() { parent::readFormParameters(); $this->doSave = isset($_POST[get_class($this)]); }
/** * @see Page::show() */ public function show() { if (!WCF::getUser()->userID) { throw new PermissionDeniedException(); } // set active tab UserCPMenu::getInstance()->setActiveMenuItem('wcf.user.usercp.menu.link.management.' . $this->listType . 'list'); // show form parent::show(); }
/** * @see Page::show() */ public function show() { if (!WCF::getUser()->userID) { throw new PermissionDeniedException(); } if (!MODULE_INVITATION) { throw new IllegalLinkException(); } WCF::getUser()->checkPermission($this->neededPermissions); UserCPMenu::getInstance()->setActiveMenuItem('wcf.user.usercp.menu.link.management.invitations'); parent::show(); }
/** * @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(); } } } } } }