From 42c62cb041a2b2b95c9cda0c20fcf70334fd244c Mon Sep 17 00:00:00 2001 From: deva Date: Tue, 1 Nov 2011 09:32:21 +0000 Subject: Rewl og krat... needs cleaning up - after port to GIT. --- forum/utils/posts.php | 82 ++++++++++++++++++++++++++++----------------------- 1 file changed, 45 insertions(+), 37 deletions(-) (limited to 'forum/utils/posts.php') 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 . "
\n"; + $str .= $indent . "
\n"; if($client_is_mobile_device) { $avatar = "mobileavatar.gif"; } else { if($user->avatar) $avatar = $user->avatar; else $avatar = "default.gif"; } - echo $indent . " \"avatar\"\n"; + $str .= $indent . " \"avatar\"\n"; if(!$client_is_mobile_device) { - echo $indent . "
ID: " . $this->pid . "
\n"; - echo $indent . "
Title: " . convert_xml($this->title) . "
\n"; + $str .= $indent . "
ID: " . $this->pid . "
\n"; + $str .= $indent . "
Title: " . convert_xml($this->title) . "
\n"; } - echo $indent . "
"; - if(!$client_is_mobile_device) echo "UserID: "; - echo $user->name . "
\n"; - echo $indent . "
"; - if(!$client_is_mobile_device) echo "Date: "; - echo date("j. M Y - G:i", $this->date) . "
\n"; - echo $indent . "
\n"; - echo parse($this->message, $indent . " ") . "\n"; + $str .= $indent . "
"; + if(!$client_is_mobile_device) $str .= "UserID: "; + $str .= $user->name . "
\n"; + $str .= $indent . "
"; + if(!$client_is_mobile_device) $str .= "Date: "; + $str .= date("j. M Y - G:i", $this->date) . "
\n"; + $str .= $indent . "
\n"; + $str .= parse($this->message, $indent . " ") . "\n"; if(trim($user->signature) != "") { - echo $indent . "
\n"; - echo parse("--------------------------\n" . $user->signature, $indent . " ") . "\n"; - echo $indent . "
\n"; + $str .= $indent . "
\n"; + $str .= parse("--------------------------\n" . $user->signature, $indent . " ") . "\n"; + $str .= $indent . "
\n"; } - echo $indent . "
\n"; - echo $indent . "
\n"; + $str .= $indent . "
\n"; + $str .= $indent . "
\n"; if($current_user->uid == $this->user) { - echo $indent . + $str .= $indent . " "; - echo "\"edit\"\n"; + $str .= "\"edit\"\n"; } - echo $indent . + $str .= $indent . " "; - echo "\"quote\"\n"; + $str .= "\"quote\"\n"; - echo $indent . + $str .= $indent . " "; - echo "\"reply\"\n"; + $str .= "\"reply\"\n"; - echo $indent . "
\n"; - echo $indent . "
\n"; + $str .= $indent . "
\n"; + $str .= $indent . "
\n"; if($recurse) { foreach($this->replies as $reply) { - $reply->show($indent . " "); + $str .= $reply->show($indent . " "); } } - echo $indent . "
\n"; - echo $indent . "
\n"; + $str .= $indent . "
\n"; + $str .= $indent . "
\n"; + + return $str; } public function Post($pid, $title, $user, $date, $message = "") @@ -185,15 +189,17 @@ class Posts { { global $current_user; - echo "

Down to the bottom"; + $str = ""; + + $str .= "

Down to the bottom"; foreach($this->posts_linear as $post) { if($post->date > $this->thread->lastseen[$current_user->uid]) { - echo " Down to first unread\n"; + $str .= " Down to first unread\n"; break; } } - echo "

\n"; - echo "

" . $this->thread->name . "

\n"; + $str .= "

\n"; + $str .= "

" . $this->thread->name . "

\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 "
\n"; - echo "
\n"; + $str .= "
\n"; + $str .= "
\n"; } - $post->show(" ", false); + $str .= $post->show(" ", false); } if($firstunread == true) { - echo "
\n"; + $str .= "
\n"; } $this->thread->lastseen[$current_user->uid] = time(); $this->write(); - echo "

Up to the top

\n"; + $str .= "

Up to the top

\n"; + + return $str; } private function recurser($parentpost, $element) -- cgit v1.2.3