summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2011-09-11 19:15:07 +0200
committerFlorian Pritz <bluewind@xinu.at>2011-09-11 19:15:07 +0200
commit4a35d5693a65c05e34abf1f9a01b8ff638bc907e (patch)
treecfbbff4f2faf57565f69cfe68ebae91b4c597ebe /application
parent986ac6f70c35b142f7f8166b5fc20b41d5aa565b (diff)
properly initialize $lengths array
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/controllers/file.php11
1 files changed, 6 insertions, 5 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index 07bc56dd7..7b2d70cbf 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -104,11 +104,15 @@ class File extends CI_Controller {
$data = array();
$query = array();
$lengths = array();
+ $fields = array("id", "filename", "mimetype", "date", "hash");
$data['title'] = 'Upload history';
+ foreach($fields as $length_key) {
+ $lengths[$length_key] = 0;
+ }
if ($password != "NULL") {
$query = $this->db->query("
- SELECT id, filename, mimetype, date, hash
+ SELECT ".implode(",", $fields)."
FROM files
WHERE password = ?
ORDER BY date
@@ -118,10 +122,7 @@ class File extends CI_Controller {
foreach($query as $key => $item) {
$query[$key]["date"] = date("r", $item["date"]);
// Keep track of longest string to pad plaintext output correctly
- foreach(array("id", "filename", "mimetype", "date", "hash") as $length_key) {
- if (!isset($lengths[$length_key])) {
- $lengths[$length_key] = 0;
- }
+ foreach($fields as $length_key) {
$len = mb_strlen($query[$key][$length_key]);
if ($len > $lengths[$length_key]) {
$lengths[$length_key] = $len;