public static function newThread(GWF_User $user, $title = '', $message = '', $options = 0, $bid = 0, $gid = 0) { // No params if ($title === '' && $message === '') { return false; } // insert thread $postcount = $message === '' ? 0 : 1; $thread = self::fakeThread($user, $title, $bid, $gid, $postcount, $options); if (false === $thread->insert()) { return false; } // Insert message if there is one. if ($message !== '') { $threadid = $thread->getID(); $post = GWF_ForumPost::fakePost($user, $title, $message, $options, $threadid, $gid); if (false === $post->insert()) { return false; } } $thread->onApprove(false, $postcount); Module_Forum::getInstance()->cachePostcount(); return $thread; }
/** * Check if new threads are allowed in this board for current user. * @return boolean */ public function isNewThreadAllowed() { if (!$this->isOptionEnabled(self::ALLOW_THREADS)) { return false; } if ($this->isOptionEnabled(self::LOCKED)) { return false; } if (false === ($user = GWF_Session::getUser())) { if (!$this->isGuestPostAllowed()) { return false; } if (!Module_Forum::getInstance()->isGuestPostAllowed()) { return false; } } return $this->hasPermissionS(); }