public function validate_cmt_id($arg) { $arg = (int) $arg; if ($arg === 0) { return false; } return GWF_Comment::getByID($arg) === false ? $this->lang('err_comment') : false; }
private function sanitize($cmt_id) { if (false === ($c = GWF_Comment::getByID($cmt_id))) { return $this->module->error('err_comment'); } if (Common::getGetString('ctoken', '') !== $c->getHashcode()) { return $this->module->error('err_hashcode'); } $this->comment = $c; return false; }
public function execute() { if (false === ($comment = GWF_Comment::getByID(Common::getGetString('cmt_id')))) { return $this->module->error('err_comment'); } if (false === ($comments = $comment->getComments())) { return $this->module->error('err_comments'); } if (!$comments->canModerate(GWF_Session::getUser())) { return GWF_HTML::err('ERR_NO_PERMISSION'); } if (false === $comment->onVisible(true)) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } return $this->module->message('msg_visible'); }
private function onSendCommentedMailB($user, GWF_Comment $comment, GWF_User $admin) { if ('' === ($rec = $admin->getValidMail())) { return; } $username = $user === false ? $_POST['username'] : $user->getVar('user_name'); $username = htmlspecialchars($username); $www = htmlspecialchars(Common::getPostString('www', '')); $email = htmlspecialchars(Common::getPostString('email', '')); $href_delete = Common::getAbsoluteURL('index.php?mo=Comments&me=Moderate&delete=' . $comment->getID() . '&ctoken=' . $comment->getHashcode()); $args = array($admin->displayUsername(), $username, $email, $www, $comment->display('cmt_message'), $href_delete); $mail = new GWF_Mail(); $mail->setSender(GWF_BOT_EMAIL); $mail->setReceiver($rec); $mail->setSubject($this->module->langUser($admin, 'subj_cmt')); $mail->setBody($this->module->langUser($admin, 'body_cmt', $args)); $mail->sendToUser($admin); }