summaryrefslogtreecommitdiff
path: root/forum
diff options
context:
space:
mode:
authordeva <deva>2008-10-12 17:21:08 +0000
committerdeva <deva>2008-10-12 17:21:08 +0000
commit15a4531b0cf36db097169bd2aef567231a12bd24 (patch)
treece617ad9ec0cedabc865e1cedd7fc51352d74161 /forum
parent870a449effd7b1c80b8d7bc5808fad100f21308f (diff)
Added date to files.
Diffstat (limited to 'forum')
-rw-r--r--forum/utils/files.php10
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&amp;preview=1&amp;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);