private function onEMailModerationB($user, GWF_Shoutbox $entry, GWF_User $staff) { if ('' === ($rec = $staff->getValidMail())) { return; } $mail = new GWF_Mail(); $mail->setSender(GWF_BOT_EMAIL); $mail->setReceiver($rec); $mail->setSubject($this->module->langUser($staff, 'emod_subj')); $id = $entry->getID(); $token = $entry->getHashcode(); $deletion_url = Common::getAbsoluteURL("index.php?mo=Shoutbox&me=Moderate&shoutid={$id}&token={$token}"); $deletion_link = GWF_HTML::anchor($deletion_url, $deletion_url); $message = $entry->display('shout_message'); $username = $user === false ? GWF_HTML::lang('guest') : $user->display('user_name'); $mail->setBody($this->module->langUser($staff, 'emod_body', array($username, $message, $deletion_link))); return $mail->sendToUser($staff); }
public function execute() { if (false === ($entry = GWF_Shoutbox::getByID(Common::getGetString('shoutid')))) { return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'shoutid')); } if ($entry->getHashcode() !== Common::getGetString('token')) { return GWF_HTML::err('ERR_PARAMETER', array(__FILE__, __LINE__, 'token')); } if (false === $entry->delete()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_deleted'); }
private function onDelete($array) { if (!GWF_User::isInGroupS('moderator')) { return GWF_HTML::err('ERR_NO_PERMISSION'); } if (!is_array($array)) { return GWF_HTML::err('ERR_GENERAL', array(__FILE__, __LINE__)); } if (false !== ($error = GWF_Form::validateCSRF_WeakS())) { return GWF_HTML::error('Shoutbox', $error); } foreach ($array as $id => $foo) { break; } if (false === ($row = GWF_Shoutbox::getByID($id))) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (false === $row->delete()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_deleted'); }