/** * @see Action::execute() */ public function execute() { parent::execute(); // check permission WCF::getUser()->checkPermission('admin.user.infraction.canDeleteWarning'); // delete warning $this->userWarning->delete(); $this->executed(); // forward to list page HeaderUtil::redirect('index.php?page=UserWarningList&deletedUserWarningID=' . $this->userWarningID . '&packageID=' . PACKAGE_ID . SID_ARG_2ND_NOT_ENCODED); exit; }
/** * @see Form::save() */ public function save() { parent::save(); $this->userWarning->update($this->warningID, $this->title, $this->points, $this->expiresDay && $this->expiresMonth && $this->expiresYear ? DateUtil::getUTC(gmmktime($this->expiresHour, $this->expiresMinute, 0, $this->expiresMonth, $this->expiresDay, $this->expiresYear)) : 0, $this->reason); $this->saved(); // show success message WCF::getTPL()->assign('success', true); }
/** * @see Form::save() */ public function save() { parent::save(); // create user warning $expires = $this->expiresHour * 3600 + $this->expiresDay * 86400 + $this->expiresWeek * 86400 * 7; $userWarning = UserWarningEditor::create($this->userID, WCF::getUser()->userID, $this->warningID, $this->objectID, $this->objectType, $this->title, $this->points, $expires ? TIME_NOW + $expires : 0, $this->reason); // check suspensions UserWarningEditor::checkWarnings($this->userID); // get language $languages = array(WCF::getLanguage()->getLanguageID() => WCF::getLanguage(), 0 => WCF::getLanguage()); if (!isset($languages[$this->user->languageID])) { $languages[$this->user->languageID] = new Language($this->user->languageID); } $languages[$this->user->languageID]->setLocale(); // send pm require_once WCF_DIR . 'lib/data/message/pm/PMEditor.class.php'; PMEditor::create(0, array($this->user->userID => array('userID' => $this->user->userID, 'username' => $this->user->username)), array(), $languages[$this->user->languageID]->get('wcf.user.infraction.userWarning.message.subject'), $languages[$this->user->languageID]->getDynamicVariable('wcf.user.infraction.userWarning.message.text', array('title' => $this->title, 'reason' => $this->reason)), WCF::getUser()->userID, WCF::getUser()->username); $this->saved(); // reset language WCF::getLanguage()->setLocale(); // show success message and forward user $url = ($this->object !== null ? $this->object->getURL() : 'index.php?page=User&userID=' . $this->userID) . SID_ARG_2ND_NOT_ENCODED; WCF::getTPL()->assign(array('url' => $url, 'message' => WCF::getLanguage()->get('wcf.user.infraction.userWarning.add.success'), 'wait' => 5)); WCF::getTPL()->display('redirect'); exit; }