private function setThread($thread_id, $request_data, $render = true) { $posts = array(); $current_page = !empty($request_data['page']) ? $request_data['page'] : 0; $current_post = !empty($request_data['post_id']) ? $request_data['post_id'] : null; $thread_status = null; $thread = PaForumThread::getPaForumThread($thread_id); if ($thread) { $this->thread = $thread; $this->current_post = $current_post; $board = $thread->getBoard(); $this->setupBoard($board); $this->user_status = $this->checkUser($request_data); $posts_pagging = $this->board_settings['posts_per_page']; $avatar_size = $this->board->getAvatarSize(); $created_by = new User(); $created_by->load((int) $thread->get_user_id()); if ($current_post) { $posts = $thread->getPosts($posts_pagging, null, $current_post); } else { $posts = $thread->getPosts($posts_pagging, $current_page); } $this->current_page = $thread->get_current_page(); $this->thread_status = $thread->get_status(); } if ($render && $this->thread) { $viewed = $this->thread->get_viewed(); $this->thread->set_viewed($viewed + 1); $this->thread->save_PaForumThread(); $this->set_inner_template('cnmodule_content_forum_posts.php'); $this->inner_HTML = $this->generate_inner_html(array('page_id' => $this->page_id, 'thread' => $this->thread, 'created_by' => $created_by, 'posts' => $posts, 'current_post' => $this->current_post, 'current_page' => $this->current_page, 'forums_url' => $this->forums_url, 'theme_url' => $this->theme_url, 'user_status' => $this->user_status, 'thread_status' => $this->thread_status, 'message' => $this->message, 'avatar_size' => $avatar_size, 'board' => $this->board, 'board_settings' => $this->board_settings)); } }