private function onAddBan() { $form = $this->getFormBan(); if (false !== ($errors = $form->validate($this->module))) { return $errors; } $perm = $form->getVar('perm'); $ban = $form->getVar('type'); $ends = $form->getVar('ends'); $msg = $form->getVar('msg'); $userid = $this->user->getID(); if ($ban) { if ($perm) { $ends = ''; } elseif ($ends === '') { return $this->module->error('err_perm_or_date'); } elseif ($ends < date('YmdHis')) { return $this->module->error('err_future_is_past'); } GWF_Ban::insertBan($userid, $ends, $msg); if ($ends === '') { return $this->module->message('msg_permbanned', array($this->user->displayUsername())); } else { return $this->module->message('msg_tempbanned', array($this->user->displayUsername(), GWF_Time::displayDate($ends))); } } else { GWF_Ban::insertWarning($userid, $msg); return $this->module->message('msg_warned', array($this->user->displayUsername())); } }
public function onStartup() { if (false !== ($user = GWF_Session::getUser())) { $this->onInclude(); $userid = $user->getID(); # Check if we have unread messages. $msgs = GWF_Ban::getUnread($userid); if (count($msgs) > 0) { $this->onLoadLanguage(); # Display Unread Bans/Warnings $this->onStartupMessages($msgs); } } }
public function execute() { if (false === ($ban = GWF_Ban::getByID(Common::getGet('bid')))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if ($ban->getUser()->getID() !== GWF_Session::getUserID()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (!$ban->isWarning()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $ban->saveOption(GWF_Ban::READ, true)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_marked_read'); }