private static function emailSubscriptionB(Module_Forum $module, array $posts) { $threaded = self::getThreaded($module, $posts); self::log(sprintf('In %d different threads...', count($threaded))); foreach ($threaded as $tid => $data) { list($thread, $posts) = $data; GWF_ForumSubscription::sendSubscription($module, $thread, $posts); } }
private function onAddThread() { $form = $this->getForm(); if (false !== ($error = $form->validate($this->module))) { return $error . $this->templateAddThread(); } $user = GWF_Session::getUser(); $is_mod = $user === false && $this->module->isGuestPostModerated(); $title = $form->getVar('title'); $message = $form->getVar('message'); $bid = $this->board->getID(); $gid = $this->board->getGroupID(); $options = 0; $options |= $is_mod === false ? 0 : GWF_ForumThread::IN_MODERATION; $options |= $this->board->isGuestView() ? GWF_ForumThread::GUEST_VIEW : 0; // $options |= Common::getPost('guest_view') === false ? 0 : GWF_ForumThread::GUEST_VIEW; $date = GWF_Time::getDate(GWF_Time::LEN_SECOND); $thread = GWF_ForumThread::fakeThread($user, $title, $bid, $gid, 1, $options, $date); if (false === $thread->insert()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } $tid = $thread->getID(); $gid = $thread->getGroupID(); $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 === false ? 0 : GWF_ForumPost::IN_MODERATION; $options |= $this->board->isGuestView() ? GWF_ForumPost::GUEST_VIEW : 0; $post = GWF_ForumPost::fakePost($user, $title, $message, $options, $tid, $gid, $date); if (false === $post->insert()) { return GWF_HTML::err('ERR_DATABASE', array(__FILE__, __LINE__)); } if (!$is_mod) { $thread->onApprove(); // $this->module->cachePostcoun(); return $this->module->message('msg_posted', array($thread->getLastPageHREF())); } else { GWF_ForumSubscription::sendModerateThread($this->module, $thread, $message); return $this->module->message('msg_posted_mod', array($this->board->getShowBoardHREF())); } }
public function canUnSubscribe() { if (false === ($user = GWF_Session::getUser())) { return false; } if (GWF_ForumSubscription::hasSubscribedManually($user, $this->getID())) { return true; } return false; }
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())); }
$buttons .= GWF_Button::generic($tLang->lang('btn_edit'), $tVars['href_edit']); } if ($buttons !== '') { echo sprintf('<div class="gwf_buttons_outer"><div class="gwf_buttons">%s</div></div>', $buttons); } } echo $tVars['pagemenu']; ?> <?php if ($tVars['nav'] === true) { ?> <div class="box box_c"> <?php if ($tVars['actions']) { $subs = GWF_ForumSubscription::getSubscriptions($t, false); // var_dump($subs); $back = ''; if (count($subs) > 0) { foreach ($subs as $sub) { $back .= ', ' . $sub->displayProfileLink(); } echo $tLang->lang('subscribers', array(substr($back, 2))) . '<br/>' . PHP_EOL; } echo $tLang->lang('watchers', array($t->getVar('thread_watchers'))) . PHP_EOL; echo '<br/>' . PHP_EOL; echo $tLang->lang('views', array($t->getVar('thread_viewcount'))) . PHP_EOL; } ?> </div> <?php
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())); } }