diff options
Diffstat (limited to 'forum/utils/posts.php')
-rw-r--r-- | forum/utils/posts.php | 82 |
1 files changed, 45 insertions, 37 deletions
diff --git a/forum/utils/posts.php b/forum/utils/posts.php index f29354e..32e48e2 100644 --- a/forum/utils/posts.php +++ b/forum/utils/posts.php @@ -47,68 +47,72 @@ class Post { public function show($indent = " ", $recurse = true) { + $str = ""; + global $users, $fid, $tid, $current_user, $client_is_mobile_device; $user = $users->getUser($this->user); - echo $indent . "<div class=\"post\">\n"; + $str .= $indent . "<div class=\"post\">\n"; if($client_is_mobile_device) { $avatar = "mobileavatar.gif"; } else { if($user->avatar) $avatar = $user->avatar; else $avatar = "default.gif"; } - echo $indent . " <img class=\"avatar\" alt=\"avatar\" src=\"gfx/avatars/" . $avatar . "\"/>\n"; + $str .= $indent . " <img class=\"avatar\" alt=\"avatar\" src=\"gfx/avatars/" . $avatar . "\"/>\n"; if(!$client_is_mobile_device) { - echo $indent . " <div class=\"id\">ID: " . $this->pid . "</div>\n"; - echo $indent . " <div class=\"title\">Title: " . convert_xml($this->title) . "</div>\n"; + $str .= $indent . " <div class=\"id\">ID: " . $this->pid . "</div>\n"; + $str .= $indent . " <div class=\"title\">Title: " . convert_xml($this->title) . "</div>\n"; } - echo $indent . " <div class=\"user\">"; - if(!$client_is_mobile_device) echo "UserID: "; - echo $user->name . "</div>\n"; - echo $indent . " <div class=\"date\">"; - if(!$client_is_mobile_device) echo "Date: "; - echo date("j. M Y - G:i", $this->date) . "</div>\n"; - echo $indent . " <div class=\"message\">\n"; - echo parse($this->message, $indent . " ") . "\n"; + $str .= $indent . " <div class=\"user\">"; + if(!$client_is_mobile_device) $str .= "UserID: "; + $str .= $user->name . "</div>\n"; + $str .= $indent . " <div class=\"date\">"; + if(!$client_is_mobile_device) $str .= "Date: "; + $str .= date("j. M Y - G:i", $this->date) . "</div>\n"; + $str .= $indent . " <div class=\"message\">\n"; + $str .= parse($this->message, $indent . " ") . "\n"; if(trim($user->signature) != "") { - echo $indent . " <div class=\"signature\">\n"; - echo parse("--------------------------\n" . $user->signature, $indent . " ") . "\n"; - echo $indent . " </div>\n"; + $str .= $indent . " <div class=\"signature\">\n"; + $str .= parse("--------------------------\n" . $user->signature, $indent . " ") . "\n"; + $str .= $indent . " </div>\n"; } - echo $indent . " </div>\n"; - echo $indent . " <div class=\"buttons\">\n"; + $str .= $indent . " </div>\n"; + $str .= $indent . " <div class=\"buttons\">\n"; if($current_user->uid == $this->user) { - echo $indent . + $str .= $indent . " <a href=\"?mode=editor&task=edit&fid=".$fid. "&tid=".$tid. "&pid=".$this->pid."\">"; - echo "<img alt=\"edit\" src=\"gfx/btn_edit.gif\"/></a>\n"; + $str .= "<img alt=\"edit\" src=\"gfx/btn_edit.gif\"/></a>\n"; } - echo $indent . + $str .= $indent . " <a href=\"?mode=editor&task=quote&fid=".$fid. "&tid=".$tid. "&pid=".$this->pid."\">"; - echo "<img alt=\"quote\" src=\"gfx/btn_quote.gif\"/></a>\n"; + $str .= "<img alt=\"quote\" src=\"gfx/btn_quote.gif\"/></a>\n"; - echo $indent . + $str .= $indent . " <a href=\"?mode=editor&task=reply&fid=".$fid. "&tid=".$tid. "&pid=".$this->pid."\">"; - echo "<img alt=\"reply\" src=\"gfx/btn_reply.gif\"/></a>\n"; + $str .= "<img alt=\"reply\" src=\"gfx/btn_reply.gif\"/></a>\n"; - echo $indent . " </div>\n"; - echo $indent . " <div class=\"replies\">\n"; + $str .= $indent . " </div>\n"; + $str .= $indent . " <div class=\"replies\">\n"; if($recurse) { foreach($this->replies as $reply) { - $reply->show($indent . " "); + $str .= $reply->show($indent . " "); } } - echo $indent . " </div>\n"; - echo $indent . "</div>\n"; + $str .= $indent . " </div>\n"; + $str .= $indent . "</div>\n"; + + return $str; } public function Post($pid, $title, $user, $date, $message = "") @@ -185,15 +189,17 @@ class Posts { { global $current_user; - echo " <p><a href=\"#menu_bottom\">Down to the bottom</a>"; + $str = ""; + + $str .= " <p><a href=\"#menu_bottom\">Down to the bottom</a>"; foreach($this->posts_linear as $post) { if($post->date > $this->thread->lastseen[$current_user->uid]) { - echo " <a href=\"#firstunread\">Down to first unread</a>\n"; + $str .= " <a href=\"#firstunread\">Down to first unread</a>\n"; break; } } - echo "</p>\n"; - echo " <h1>" . $this->thread->name . "</h1>\n"; + $str .= "</p>\n"; + $str .= " <h1>" . $this->thread->name . "</h1>\n"; /* // Recursive foreach($this->posts as $post) { @@ -206,21 +212,23 @@ class Posts { foreach($this->posts_linear as $post) { if($post->date > $this->thread->lastseen[$current_user->uid] && $firstunread == false) { $firstunread = true; - echo " <div id=\"firstunread\"></div>\n"; - echo " <div class=\"unread\">\n"; + $str .= " <div id=\"firstunread\"></div>\n"; + $str .= " <div class=\"unread\">\n"; } - $post->show(" ", false); + $str .= $post->show(" ", false); } if($firstunread == true) { - echo " </div>\n"; + $str .= " </div>\n"; } $this->thread->lastseen[$current_user->uid] = time(); $this->write(); - echo " <p><a href=\"#menu_top\">Up to the top</a></p>\n"; + $str .= " <p><a href=\"#menu_top\">Up to the top</a></p>\n"; + + return $str; } private function recurser($parentpost, $element) |