Esempio n. 1
0
 private function onUnSubscribeExtThread($token)
 {
     if (false === $this->checkExternalToken($token)) {
         return $this->module->error('err_token');
     }
     if (!GWF_ForumSubscription::hasSubscribedManually($this->user, $this->thread->getID())) {
         return $this->module->error('err_sub_by_global');
     }
     if (false === GWF_ForumSubscription::unsubscribe($this->user->getID(), $this->thread->getID())) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     return $this->module->message('msg_unsubscribed', array($this->thread->getLastPageHREF()));
 }
Esempio n. 2
0
 private function onReply()
 {
     $form = $this->getForm();
     if (false !== ($error = $form->validate($this->module))) {
         return $error . $this->templateReply();
     }
     # Gather vars
     $user = GWF_Session::getUser();
     $is_mod = $user === false && $this->module->isGuestPostModerated();
     $title = $form->getVar('title');
     $message = $form->getVar('message');
     $options = 0;
     $options |= Common::getPost('bbcode') === false ? 0 : GWF_ForumPost::DISABLE_BB;
     $options |= Common::getPost('smileys') === false ? 0 : GWF_ForumPost::DISABLE_SMILE;
     $options |= $is_mod ? GWF_ForumPost::IN_MODERATION : 0;
     //		$options |= Common::getPost('guest_view') === false ? 0 : $this->thread->isGuestView();
     $options |= $this->thread->isGuestView() ? GWF_ForumPost::GUEST_VIEW : 0;
     $threadid = $this->thread->getID();
     $groupid = $this->thread->getGroupID();
     # Post it
     $post = GWF_ForumPost::fakePost($user, $title, $message, $options, $threadid, $groupid);
     if (false === $post->insert()) {
         return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
     }
     if (!$is_mod) {
         if (false === $post->onApprove($this->module)) {
             return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__));
         }
         //			$this->thread->increase('thread_postcount', 1); # Increase cache :/
         $this->module->cachePostcount();
         return $this->module->message('msg_posted', array($post->getThread()->getLastPageHREF()));
     } else {
         GWF_ForumSubscription::sendModeratePost($this->module, $post);
         return $this->module->message('msg_posted_mod', array($this->thread->getLastPageHREF()));
     }
 }
Esempio n. 3
0
 private static function sendSubscriptionB(Module_Forum $module, GWF_ForumThread $thread, GWF_User $user, $postername, $msg_block, $msg_count, $boardText, $threadTitle, $sender)
 {
     $userid = $user->getID();
     $username = $user->displayUsername();
     if (false === ($receiver = $user->getValidMail())) {
         GWF_Log::logCron('[ERROR] User ' . $username . ' has no valid email.');
         return false;
     }
     if (false === ($options = GWF_ForumOptions::getUserOptions($user))) {
         GWF_Log::logCron('[ERROR] User ' . $username . ' has no valid forum options.');
     }
     $token = $options->getVar('fopt_token');
     $href = Common::getAbsoluteURL($thread->getLastPageHREF(false), false);
     $showLink = GWF_HTML::anchor($href, $href);
     $href = Common::getAbsoluteURL($thread->getExternalUnSubscribeHREF($userid, $token, true), false);
     $unsubLink = GWF_HTML::anchor($href, $href);
     $href = Common::getAbsoluteURL($thread->getExternalUnSubscribeAllHREF($userid, $token, true), false);
     $unsubLinkAll = GWF_HTML::anchor($href, $href);
     $mail = new GWF_Mail();
     $mail->setSender($sender);
     $mail->setReceiver($receiver);
     $mail->setSubject($module->langUser($user, 'submail_subj', array($threadTitle, $postername, $boardText)));
     $mail->setBody($module->langUser($user, 'submail_body', array($username, $msg_count, $boardText, $threadTitle, $msg_block, $showLink, $unsubLink, $unsubLinkAll)));
     if (false === $mail->sendToUser($user)) {
         GWF_Log::logCron('[ERROR] Can not send mail to ' . $username . '; EMail: ' . $receiver);
     } else {
         GWF_Log::logCron('[+] Successfully sent Email to ' . $username . '; EMail: ' . $receiver);
     }
 }