From 15a4531b0cf36db097169bd2aef567231a12bd24 Mon Sep 17 00:00:00 2001 From: deva Date: Sun, 12 Oct 2008 17:21:08 +0000 Subject: Added date to files. --- forum/utils/files.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'forum') 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 "
fid . "\"
\n"; echo "
Filename: link() . "\">" . $this->name . " (" . $this->mimetype. ")
\n"; echo "
Uploaded by: " . $users->getUser($this->uid)->name . "
\n"; + echo "
" . date("c", $this->date) . "
\n"; echo "
Size: " . ceil(filesize($PERMSTORE . "/" . $this->fid) / 1024) . "kb
\n"; echo "
Use this command to insert the file: {{" . $this->fid . "}}
\n"; echo "\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, " \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); -- cgit v1.2.3