diff options
Diffstat (limited to 'forum/utils/files.php')
-rw-r--r-- | forum/utils/files.php | 62 |
1 files changed, 36 insertions, 26 deletions
diff --git a/forum/utils/files.php b/forum/utils/files.php index 7356ff8..2fa3ec4 100644 --- a/forum/utils/files.php +++ b/forum/utils/files.php @@ -18,18 +18,23 @@ class File { public function show() { global $PERMSTORE, $current_user, $users; - echo " <div class=\"file\">\n"; + + $str = ""; + + $str .= " <div class=\"file\">\n"; if($current_user->uid == 0) { - echo " <a class=\"delete\" onclick=\"return confirm('Really delete?')\" onkeypress=\"return confirm('Really delete?')\" href=\"?mode=filehandler&task=delete&fid=" . $this->fid . "\">X</a>\n"; + $str .= " <a class=\"delete\" onclick=\"return confirm('Really delete?')\" onkeypress=\"return confirm('Really delete?')\" href=\"?mode=filehandler&task=delete&fid=" . $this->fid . "\">X</a>\n"; } - echo " <div class=\"preview\"><a href=\"" . $this->link() . "\"><img src=\"?mode=file&preview=1&fid=" . $this->fid . "\"/></a></div>\n"; - echo " <div class=\"insertcommand\">{{" . $this->fid . "}}</div>\n"; - echo " <div class=\"filename\"><a href=\"" . $this->link() . "\">" . $this->name . "</a></div>\n"; - echo " <div class=\"mimetype\">" . $this->mimetype. "</div>\n"; - echo " <div class=\"fileuser\">" . $users->getUser($this->uid)->name . "</div>\n"; - echo " <div class=\"filesize\">" . ceil(filesize($PERMSTORE . "/" . $this->fid) / 1024) . "kb</div>\n"; - echo " <div class=\"filedate\">" . date("M jS Y - G:i", $this->date) . "</div>\n"; - echo " </div>\n"; + $str .= " <div class=\"preview\"><a href=\"" . $this->link() . "\"><img src=\"?mode=file&preview=1&fid=" . $this->fid . "\"/></a></div>\n"; + $str .= " <div class=\"insertcommand\">{{" . $this->fid . "}}</div>\n"; + $str .= " <div class=\"filename\"><a href=\"" . $this->link() . "\">" . $this->name . "</a></div>\n"; + $str .= " <div class=\"mimetype\">" . $this->mimetype. "</div>\n"; + $str .= " <div class=\"fileuser\">" . $users->getUser($this->uid)->name . "</div>\n"; + $str .= " <div class=\"filesize\">" . ceil(filesize($PERMSTORE . "/" . $this->fid) / 1024) . "kb</div>\n"; + $str .= " <div class=\"filedate\">" . date("M jS Y - G:i", $this->date) . "</div>\n"; + $str .= " </div>\n"; + + return $str; } public function File($fid, $uid, $name, $date, $mimetype) @@ -83,25 +88,30 @@ class Files { public function show() { global $current_user; - echo "<div class=\"files\">\n"; - echo " <div class=\"file\">\n"; - echo " <div class=\"fileheader\">\n"; + + $str = ""; + + $str .= "<div class=\"files\">\n"; + $str .= " <div class=\"file\">\n"; + $str .= " <div class=\"fileheader\">\n"; if($current_user->uid == 0) { - echo " <div class=\"delete\"></div>\n"; + $str .= " <div class=\"delete\"></div>\n"; } - echo " <div class=\"preview\">Preview</div>\n"; - echo " <div class=\"insertcommand\">Command</div>\n"; - echo " <div class=\"filename\">Filename</div>\n"; - echo " <div class=\"mimetype\">Mimetype</div>\n"; - echo " <div class=\"fileuser\">User</div>\n"; - echo " <div class=\"filesize\">Size</div>\n"; - echo " <div class=\"filedate\">Date</div>\n"; - echo " </div>\n"; - echo " </div>\n"; + $str .= " <div class=\"preview\">Preview</div>\n"; + $str .= " <div class=\"insertcommand\">Command</div>\n"; + $str .= " <div class=\"filename\">Filename</div>\n"; + $str .= " <div class=\"mimetype\">Mimetype</div>\n"; + $str .= " <div class=\"fileuser\">User</div>\n"; + $str .= " <div class=\"filesize\">Size</div>\n"; + $str .= " <div class=\"filedate\">Date</div>\n"; + $str .= " </div>\n"; + $str .= " </div>\n"; foreach($this->files as $file) { - $file->show(); + $str .= $file->show(); } - echo "</div>\n"; + $str .= "</div>\n"; + + return $str; } public function getFile($fid) @@ -154,7 +164,7 @@ class Files { $this->add($file); } - + krsort($this->files); } public function Files($file) |