This commit is contained in:
Shish 2020-10-29 08:08:42 +00:00
parent 8a58ede5b3
commit 6789bd5fdd
2 changed files with 30 additions and 30 deletions

View file

@ -12,7 +12,7 @@ class ForumTheme extends Themelet
$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);
}
@ -24,7 +24,7 @@ class ForumTheme extends Themelet
$max_characters = $config->get_int('forumMaxCharsPerPost');
$html = make_form(make_link("forum/create"));
if (!is_null($threadTitle)) {
$threadTitle = html_escape($threadTitle);
}
@ -32,7 +32,7 @@ class ForumTheme extends Themelet
if (!is_null($threadText)) {
$threadText = html_escape($threadText);
}
$html .= "
<table style='width: 500px;'>
<tr><td>Title:</td><td><input type='text' name='title' value='$threadTitle'></td></tr>
@ -51,25 +51,25 @@ class ForumTheme extends Themelet
$page->set_heading(html_escape($blockTitle));
$page->add_block(new Block($blockTitle, $html, "main", 120));
}
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 .= '<input type="hidden" name="threadID" value="'.$threadID.'" />';
$html .= "
<table style='width: 500px;'>
<tr><td>Message:</td><td><textarea id='message' name='message' ></textarea>
<tr><td></td><td><small>Max characters alowed: $max_characters.</small></td></tr>
</td></tr>";
$html .= "<tr><td colspan='2'><input type='submit' value='Submit' /></td></tr>
</table>
</form>
@ -84,9 +84,9 @@ class ForumTheme extends Themelet
public function display_thread($posts, $showAdminOptions, $threadTitle, $threadID, $pageNumber, $totalPages)
{
global $config, $page/*, $user*/;
$posts_per_page = $config->get_int('forumPostsPerPage');
$current_post = 0;
$html =
@ -96,7 +96,7 @@ class ForumTheme extends Themelet
"<th id=threadHeadUser>User</th>".
"<th>Message</th>".
"</tr></thead>";
foreach ($posts as $post) {
$current_post++;
$message = $post["message"];
@ -104,29 +104,29 @@ class ForumTheme extends Themelet
$tfe = new TextFormattingEvent($message);
send_event($tfe);
$message = $tfe->formatted;
$message = str_replace('\n\r', '<br>', $message);
$message = str_replace('\r\n', '<br>', $message);
$message = str_replace('\n', '<br>', $message);
$message = str_replace('\r', '<br>', $message);
$message = stripslashes($message);
$userLink = "<a href='".make_link("user/".$post["user_name"]."")."'>".$post["user_name"]."</a>";
$poster = User::by_name($post["user_name"]);
$gravatar = $poster->get_avatar_html();
$rank = "<sup class='user_rank'>{$post["user_class"]}</sup>";
$postID = $post['id'];
//if($user->can(Permissions::FORUM_ADMIN)){
//$delete_link = "<a href=".make_link("forum/delete/".$threadID."/".$postID).">Delete</a>";
//} else {
//$delete_link = "";
//}
if ($showAdminOptions) {
$delete_link = "<a href=".make_link("forum/delete/".$threadID."/".$postID).">Delete</a>";
} else {
@ -152,17 +152,17 @@ class ForumTheme extends Themelet
<td class='forumSubmessage'></td>
</tr>";
}
$html .= "</tbody></table>";
$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($threadTitle, $html, "main", 20));
}
public function add_actions_block(Page $page, $threadID)
{
@ -192,29 +192,29 @@ class ForumTheme extends Themelet
$current_post = 0;
foreach ($threads as $thread) {
$oe = ($current_post++ % 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") {
if (bool_escape($thread["sticky"])) {
$sticky = "Sticky: ";
} else {
$sticky = "";
}
$html .= "<tr class='$oe'>".
'<td class="left">'.$sticky.'<a href="'.make_link("forum/view/".$thread["id"]).'">'.$title."</a></td>".
'<td><a href="'.make_link("user/".$thread["user_name"]).'">'.$thread["user_name"]."</a></td>".
"<td>".autodate($thread["uptodate"])."</td>".
"<td>".$thread["response_count"]."</td>";
if ($showAdminOptions) {
$html .= '<td><a href="'.make_link("forum/nuke/".$thread["id"]).'" title="Delete '.$title.'">Delete</a></td>';
}

View file

@ -70,7 +70,7 @@ class TipsTheme extends Themelet
$html .= "</tr></thead>";
foreach ($tips as $tip) {
$tip_enable = ($tip['enable'] == "Y") ? "Yes" : "No";
$tip_enable = bool_escape($tip['enable']) ? "Yes" : "No";
$set_link = "<a href='".make_link("tips/status/".$tip['id'])."'>".$tip_enable."</a>";
$html .= "<tr>".