Exemple #1
0
 /**
  * Get forums within this category
  * @since Version 3.8.7
  * @yield new Forum
  */
 public function getForums()
 {
     if (!$this->User instanceof User) {
         throw new Exception("Cannot get the list of forums within this category because no valid user has been specified");
     }
     $userdata = $this->User->generateUserData();
     $Index = ForumsFactory::CreateIndex();
     #new Index;
     if (!isset($prefix)) {
         $prefix = "nuke";
     }
     if (!isset($user_prefix)) {
         $user_prefix = "nuke";
     }
     require_once "includes" . DS . "auth.php";
     require_once "includes" . DS . "constants.php";
     $is_auth_ary = auth(AUTH_VIEW, AUTH_LIST_ALL, $userdata, $Index->forums());
     $forums = array();
     foreach ($is_auth_ary as $forum_id => $perms) {
         if (intval($perms['auth_view']) === 1) {
             $forums[] = $forum_id;
         }
         #printArray($perms);die;
     }
     $query = "SELECT forum_id FROM nuke_bbforums WHERE cat_id = ? AND forum_id IN ('" . implode("', '", $forums) . "') ORDER BY forum_order";
     foreach ($this->db->fetchAll($query, $this->id) as $row) {
         (yield new Forum($row['forum_id']));
     }
 }
Exemple #2
0
 /**
  * @depends testAddForum
  * @depends testCreateUser
  */
 public function testAddThread($forum_id, $User)
 {
     $Forum = ForumsFactory::CreateForum($forum_id);
     $Thread = new Thread();
     $Thread->setAuthor($User)->setForum($Forum);
     $Thread->title = "Test thread";
     $Thread->commit();
     $Post = new Post();
     $Post->setAuthor($User)->setThread($Thread);
     $Post->text = "asdfasffasasfa87s9fsas989sfa9ffds";
     $Post->commit();
     $NewThread = ForumsFactory::CreateThread($Thread->id);
     $NewPost = ForumsFactory::CreatePost($Post->id);
     $Index = ForumsFactory::CreateIndex();
     ForumsUtility::updateUserThreadView($Thread, $User);
     ForumsUtility::updateUserThreadView($Thread);
     ForumsUtility::getForumNotifications($User);
 }