summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
Diffstat (limited to 'application')
-rw-r--r--application/controllers/file.php21
-rw-r--r--application/views/file_plaintext/upload_history.php12
2 files changed, 22 insertions, 11 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 0fd41404e..cc5cf159c 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -127,14 +127,24 @@ class File extends CI_Controller {
if (! $cached = $this->memcachelibrary->get("history_".$this->var->view_dir."_".$user)) {
$query = array();
$lengths = array();
- $fields = array("id", "filename", "mimetype", "date", "hash", "filesize");
+
+ // key: database field name; value: display name
+ $fields = array(
+ "id" => "ID",
+ "filename" => "Filename",
+ "mimetype" => "Mimetype",
+ "date" => "Date",
+ "hash" => "Hash",
+ "filesize" => "Size"
+ );
+
$this->data['title'] .= ' - Upload history';
- foreach($fields as $length_key) {
- $lengths[$length_key] = 0;
+ foreach($fields as $length_key => $value) {
+ $lengths[$length_key] = mb_strlen($value);
}
$query = $this->db->query("
- SELECT ".implode(",", $fields)."
+ SELECT ".implode(",", array_keys($fields))."
FROM files
WHERE user = ?
ORDER BY date
@@ -145,7 +155,7 @@ class File extends CI_Controller {
$query[$key]["filesize"] = format_bytes($item["filesize"]);
if ($this->var->cli_client) {
// Keep track of longest string to pad plaintext output correctly
- foreach($fields as $length_key) {
+ foreach($fields as $length_key => $value) {
$len = mb_strlen($query[$key][$length_key]);
if ($len > $lengths[$length_key]) {
$lengths[$length_key] = $len;
@@ -156,6 +166,7 @@ class File extends CI_Controller {
$this->data["query"] = $query;
$this->data["lengths"] = $lengths;
+ $this->data["fields"] = $fields;
$cached = "";
$cached .= $this->load->view($this->var->view_dir.'/header', $this->data, true);
diff --git a/application/views/file_plaintext/upload_history.php b/application/views/file_plaintext/upload_history.php
index 4e9308d91..87586babd 100644
--- a/application/views/file_plaintext/upload_history.php
+++ b/application/views/file_plaintext/upload_history.php
@@ -1,11 +1,11 @@
<?php
echo
- mb_str_pad("ID", $lengths["id"])." | "
- .mb_str_pad("Filename", $lengths["filename"])." | "
- .mb_str_pad("Mimetype", $lengths["mimetype"])." | "
- .mb_str_pad("Date", $lengths["date"])." | "
- .mb_str_pad("Hash", $lengths["hash"])." | "
- .mb_str_pad("Size", $lengths["filesize"])."\n";
+ mb_str_pad($fields["id"], $lengths["id"])." | "
+ .mb_str_pad($fields["filename"], $lengths["filename"])." | "
+ .mb_str_pad($fields["mimetype"], $lengths["mimetype"])." | "
+ .mb_str_pad($fields["date"], $lengths["date"])." | "
+ .mb_str_pad($fields["hash"], $lengths["hash"])." | "
+ .mb_str_pad($fields["filesize"], $lengths["filesize"])."\n";
foreach($query as $key => $item) {
echo