summaryrefslogtreecommitdiffstats
path: root/application
diff options
context:
space:
mode:
authorFlorian Pritz <bluewind@xinu.at>2012-07-07 00:14:21 +0200
committerFlorian Pritz <bluewind@xinu.at>2012-07-07 00:23:13 +0200
commit56d2a7f6484ff6a75872371fda6cac21cbe5917c (patch)
tree5b7959737fb7e44cb4a78f4993b5b4ac1f0a8216 /application
parentd521fec0a274ab5879462d56483a4d496ca365aa (diff)
Display total size uploaded by user on history page
Signed-off-by: Florian Pritz <bluewind@xinu.at>
Diffstat (limited to 'application')
-rw-r--r--application/controllers/file.php11
-rw-r--r--application/views/file/upload_history.php2
-rw-r--r--application/views/file_plaintext/upload_history.php2
3 files changed, 15 insertions, 0 deletions
diff --git a/application/controllers/file.php b/application/controllers/file.php
index a3156eb4b..bb0236123 100644
--- a/application/controllers/file.php
+++ b/application/controllers/file.php
@@ -339,9 +339,20 @@ class File extends CI_Controller {
}
}
+ $total_size = $this->db->query("
+ SELECT sum(filesize) sum
+ FROM (
+ SELECT filesize
+ FROM files
+ WHERE user = ?
+ GROUP BY hash
+ ) sub
+ ", array($user))->row_array();
+
$this->data["query"] = $query;
$this->data["lengths"] = $lengths;
$this->data["fields"] = $fields;
+ $this->data["total_size"] = format_bytes($total_size["sum"]);
$cached = "";
$cached .= $this->load->view($this->var->view_dir.'/header', $this->data, true);
diff --git a/application/views/file/upload_history.php b/application/views/file/upload_history.php
index 2f0d0f41f..41b055792 100644
--- a/application/views/file/upload_history.php
+++ b/application/views/file/upload_history.php
@@ -24,3 +24,5 @@
</table>
<input type="submit" value="Delete checked" name="process" />
</form>
+
+<p>Total sum of your distinct uploads: <?php echo $total_size; ?>.</p>
diff --git a/application/views/file_plaintext/upload_history.php b/application/views/file_plaintext/upload_history.php
index 87586babd..b4dbf6091 100644
--- a/application/views/file_plaintext/upload_history.php
+++ b/application/views/file_plaintext/upload_history.php
@@ -16,4 +16,6 @@ foreach($query as $key => $item) {
.$item["hash"]." | "
.$item["filesize"]."\n";
}
+?>
+Total sum of your distinct uploads: <?php echo $total_size; ?>.