summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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; ?>.