diff options
-rw-r--r-- | forum/utils/files.php | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/forum/utils/files.php b/forum/utils/files.php index e17ca8b..57dc42d 100644 --- a/forum/utils/files.php +++ b/forum/utils/files.php @@ -7,6 +7,7 @@ class File { public $fid; public $uid; public $name; + public $date; public $mimetype; public function link() @@ -24,16 +25,18 @@ class File { echo " <div class=\"preview\"><img src=\"?mode=file&preview=1&fid=" . $this->fid . "\"</div>\n"; echo " <div class=\"filename\">Filename: <a href=\"" . $this->link() . "\">" . $this->name . "</a> (" . $this->mimetype. ")</div>\n"; echo " <div class=\"fileuser\">Uploaded by: " . $users->getUser($this->uid)->name . "</div>\n"; + echo " <div class=\"filedate\">" . date("c", $this->date) . "</div>\n"; echo " <div class=\"filesize\">Size: " . ceil(filesize($PERMSTORE . "/" . $this->fid) / 1024) . "kb</div>\n"; echo " <div class=\"insertcommand\">Use this command to insert the file: {{" . $this->fid . "}}</div>\n"; echo "</div>\n"; } - public function File($fid, $uid, $name, $mimetype) + public function File($fid, $uid, $name, $date, $mimetype) { $this->fid = $fid; $this->uid = $uid; $this->name = $name; + $this->date = $date; $this->mimetype = $mimetype; } } @@ -65,6 +68,8 @@ class Files { htmlspecialchars($file->uid, ENT_QUOTES, "UTF-8") . "\"\n"); fwrite($fp, " name=\"" . htmlspecialchars($file->name, ENT_QUOTES, "UTF-8") . "\"\n"); + fwrite($fp, " date=\"" . + htmlspecialchars($file->date, ENT_QUOTES, "UTF-8") . "\"\n"); fwrite($fp, " mimetype=\"" . htmlspecialchars($file->mimetype, ENT_QUOTES, "UTF-8") . "\">\n"); fwrite($fp, " </file>\n"); @@ -95,7 +100,7 @@ class Files { // move tempfile to permstore and put it in db. move_uploaded_file($tempfile, $PERMSTORE . "/" . $fid); - $f = new File($fid, $current_user->uid, $name, getMimeType($name)->name); + $f = new File($fid, $current_user->uid, $name, time(), getMimeType($name)->name); $this->add($f); // We cannot wait to write the db, otherwise we'll get inconsistency! @@ -126,6 +131,7 @@ class Files { $file = new File($f->getAttribute('fid'), $f->getAttribute('uid'), $f->getAttribute('name'), + $f->getAttribute('date'), $f->getAttribute('mimetype')); $this->add($file); |