Ich blicke bei den namenspace und use immer noch nicht durch,wenn ich Folgende .php für den eventlistener erstellen würde welche namenspace und use müsste ich dafür nehmen und woher weiss ich das?
Code
class MarkThreadModeratedAction extends AbstractSecureAction {
protected $threadID;
protected $reason = '';
protected $setAction = '';
protected $url = '';
/**
* @see AbstractSecureAction::readParameters()
*/
public function readParameters() {
parent::readParameters();
//get threadID
if (isset($_REQUEST['threadID']) && isset($_REQUEST['reason']) && isset($_REQUEST['setAction']) && isset($_REQUEST['url'])) {
$this->threadID = intval($_REQUEST['threadID']);
if (!empty($_REQUEST['reason'])) {
$this->reason = escapeString($_REQUEST['reason']);
}
$this->setAction = escapeString($_REQUEST['setAction']);
$this->url = escapeString($_REQUEST['url']);
} else {
throw new IllegalLinkException();
}
//check permission
if (!WCF::getUser()->getPermission('mod.board.thread.canSetThreadAsModerated')) {
throw new PermissionDeniedException();
}
}
/**
* @see AbstractAction::execute()
*/
public function execute() {
parent::execute();
// set thread state
if ($this->setAction == 'setModerated') {
$sql = "UPDATE wbb".WBB_N."_thread
SET isMarkedModerated = 1,
isModeratedByUserID = ".WCF::getUser()->userID.",
isModeratedByUserName = '".WCF::getUser()->username."',
isModeratedReason = '".$this->reason."',
isModeratedTime = ".TIME_NOW."
WHERE threadID = ".$this->threadID;
WCF::getDB()->sendQuery($sql);
}
elseif ($this->setAction == 'unsetModerated') {
$sql = "UPDATE wbb".WBB_N."_thread
SET isMarkedModerated = 0,
isModeratedByUserID = 0,
isModeratedByUserName = '',
isModeratedReason = '',
isModeratedTime = 0
WHERE threadID = ".$this->threadID;
WCF::getDB()->sendQuery($sql);
}
else {
throw new IllegalLinkException();
}
$this->executed();
// redirect to previous page
HeaderUtil::redirect($this->url.SID_ARG_2ND_NOT_ENCODED);
exit;
}
}
?>
Alles anzeigen