make_thread_list($threads, $showAdminOptions); $page->set_title(html_escape("Forum")); $page->set_heading(html_escape("Forum")); $page->add_block(new Block("Forum", $html, "main", 10)); $this->display_paginator($page, "forum/index", null, $pageNumber, $totalPages); } public function display_new_thread_composer(Page $page, $threadText = null, $threadTitle = null) { global $config, $user; $max_characters = $config->get_int('forumMaxCharsPerPost'); $html = make_form(make_link("forum/create")); if (!is_null($threadTitle)) $threadTitle = html_escape($threadTitle); if(!is_null($threadText)) $threadText = html_escape($threadText); $html .= " "; if($user->is_admin()){ $html .= ""; } $html .= "
Title:
Message:
Max characters alowed: $max_characters.
"; $blockTitle = "Write a new thread"; $page->set_title(html_escape($blockTitle)); $page->set_heading(html_escape($blockTitle)); $page->add_block(new Block($blockTitle, $html, "main", 20)); } public function display_new_post_composer(Page $page, $threadID) { global $config; $max_characters = $config->get_int('forumMaxCharsPerPost'); $html = make_form(make_link("forum/answer")); $html .= ''; $html .= " "; $html .= "
Message:
Max characters alowed: $max_characters.
"; $blockTitle = "Answer to this thread"; $page->add_block(new Block($blockTitle, $html, "main", 30)); } public function display_thread($posts, $showAdminOptions, $threadTitle, $threadID, $pageNumber, $totalPages) { global $config, $page/*, $user*/; $theme_name = $config->get_string('theme'); $html = ""; $n = 0; $html = "". "". "". "". ""; foreach ($posts as $post) { $message = $post["message"]; $tfe = new TextFormattingEvent($message); send_event($tfe); $message = $tfe->formatted; $message = str_replace('\n\r', '
', $message); $message = str_replace('\r\n', '
', $message); $message = str_replace('\n', '
', $message); $message = str_replace('\r', '
', $message); $message = stripslashes($message); $user = "".$post["user_name"].""; $poster = User::by_name($post["user_name"]); $gravatar = $poster->get_avatar_html(); $oe = ($n++ % 2 == 0) ? "even" : "odd"; if ($post["user_admin"] == "Y") { $rank = "admin"; } else { $rank = "user"; } $postID = $post['id']; //if($user->is_admin()){ //$delete_link = "Delete"; //} else { //$delete_link = ""; //} if($showAdminOptions){ $delete_link = "Delete"; }else{ $delete_link = ""; } $html .= "". "". "".""; } $html .= "
UserMessage
".$user."
".$rank."
".$gravatar."
".$message."
".autodate($post["date"])." ".$delete_link."
"; $this->display_paginator($page, "forum/view/".$threadID, null, $pageNumber, $totalPages); $page->set_title(html_escape($threadTitle)); $page->set_heading(html_escape($threadTitle)); $page->add_block(new Block("Thread", $html, "main", 20)); } public function add_actions_block(Page $page, $threadID) { $html = 'Delete this thread and its posts.'; $page->add_block(new Block("Admin Actions", $html, "main", 40)); } private function make_thread_list($threads, $showAdminOptions) { $html = "". "". "". "". "". ""; if($showAdminOptions) { $html .= ""; } $html .= ""; $n = 0; foreach($threads as $thread) { $oe = ($n++ % 2 == 0) ? "even" : "odd"; global $config; $titleSubString = $config->get_int('forumTitleSubString'); if ($titleSubString < strlen($thread["title"])) { $title = substr($thread["title"], 0, $titleSubString); $title = $title."..."; } else { $title = $thread["title"]; } if($thread["sticky"] == "Y"){ $sticky = "Sticky: "; } else { $sticky = ""; } $html .= "". '". '". "". ""; if ($showAdminOptions) $html .= ''; $html .= ""; } $html .= "
TitleAuthorUpdatedResponsesActions
'.$sticky.''.$title."'.$thread["user_name"]."".autodate($thread["uptodate"])."".$thread["response_count"]."Delete
"; return $html; } } ?>