From f0e18ebf64ec35bf07fd7d874f786589c9210766 Mon Sep 17 00:00:00 2001
From: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
Date: Wed, 16 Dec 2015 19:05:08 +0000
Subject: [PATCH] Further improvements to all pages listing

---
 build/index.php       | 9 +++++----
 core.php              | 5 +++--
 module_index.json     | 2 +-
 modules/page-list.php | 2 +-
 settings.fragment.php | 2 +-
 5 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/build/index.php b/build/index.php
index 0be2fae..55611c3 100644
--- a/build/index.php
+++ b/build/index.php
@@ -312,7 +312,7 @@ textarea ~ input[type=submit] { margin: 0.5rem 0.8rem; padding: 0.5rem; font-wei
 
 .page-list { list-style-type: none; margin: 0.5rem; padding: 0.5rem; }
 .page-list li { margin: 0.5rem; padding: 0.5rem; }
-.page-list li .size { color: rgba(30, 30, 30, 0.5); }
+.page-list li .size { margin-left: 0.7rem; color: rgba(30, 30, 30, 0.5); }
 .page-list li .editor { display: inline-block; margin: 0 0.5rem; }
 .page-list li .tags { margin: 0 1rem; }
 .tag-list { list-style-type: none; margin: 0.5rem; padding: 0.5rem; }
@@ -460,9 +460,10 @@ if($env->is_logged_in)
  */
 function human_filesize($bytes, $decimals = 2)
 {
-	$sz = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "YB", "ZB"];
+	$sz = ["b", "kb", "mb", "gb", "tb", "pb", "eb", "yb", "zb"];
 	$factor = floor((strlen($bytes) - 1) / 3);
-	return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
+	$result = round($bytes / pow(1024, $factor), $decimals);
+	return $result . @$sz[$factor];
 }
 /*
  * @summary	Calculates the time sincce a particular timestamp and returns a
@@ -2905,7 +2906,7 @@ function generate_page_list($pagelist)
 		
 		$result .= "<li><a href='index.php?page=$pagename'>$pagename</a>
 		<em class='size'>(" . human_filesize($pageindex->$pagename->size) . ")</em>
-		<span class='editor'>&#9998;" . $pageindex->$pagename->lasteditor . "</span>
+		<span class='editor'>&#9998; " . $pageindex->$pagename->lasteditor . "</span>
 		<time title='" . date("l jS \of F Y \a\\t h:ia T", $pageindex->$pagename->lastmodified) . "'>" . human_time_since($pageindex->$pagename->lastmodified) . "</time>
 		<span class='tags'>$tags</span></li>";
 	}
diff --git a/core.php b/core.php
index 6051bff..5850d28 100644
--- a/core.php
+++ b/core.php
@@ -106,9 +106,10 @@ if($env->is_logged_in)
  */
 function human_filesize($bytes, $decimals = 2)
 {
-	$sz = ["B", "KB", "MB", "GB", "TB", "PB", "EB", "YB", "ZB"];
+	$sz = ["b", "kb", "mb", "gb", "tb", "pb", "eb", "yb", "zb"];
 	$factor = floor((strlen($bytes) - 1) / 3);
-	return sprintf("%.{$decimals}f", $bytes / pow(1024, $factor)) . @$sz[$factor];
+	$result = round($bytes / pow(1024, $factor), $decimals);
+	return $result . @$sz[$factor];
 }
 /*
  * @summary	Calculates the time sincce a particular timestamp and returns a
diff --git a/module_index.json b/module_index.json
index d2c84d1..03cb556 100644
--- a/module_index.json
+++ b/module_index.json
@@ -113,7 +113,7 @@
         "author": "Starbeamrainbowlabs",
         "description": "Adds a page that lists all the pages in the index along with their metadata.",
         "id": "page-list",
-        "lastupdate": 1450261390,
+        "lastupdate": 1450292650,
         "optional": false
     },
     {
diff --git a/modules/page-list.php b/modules/page-list.php
index 5cf794b..20feab3 100644
--- a/modules/page-list.php
+++ b/modules/page-list.php
@@ -88,7 +88,7 @@ function generate_page_list($pagelist)
 		
 		$result .= "<li><a href='index.php?page=$pagename'>$pagename</a>
 		<em class='size'>(" . human_filesize($pageindex->$pagename->size) . ")</em>
-		<span class='editor'>&#9998;" . $pageindex->$pagename->lasteditor . "</span>
+		<span class='editor'>&#9998; " . $pageindex->$pagename->lasteditor . "</span>
 		<time title='" . date("l jS \of F Y \a\\t h:ia T", $pageindex->$pagename->lastmodified) . "'>" . human_time_since($pageindex->$pagename->lastmodified) . "</time>
 		<span class='tags'>$tags</span></li>";
 	}
diff --git a/settings.fragment.php b/settings.fragment.php
index 26b15ca..1ce514b 100644
--- a/settings.fragment.php
+++ b/settings.fragment.php
@@ -301,7 +301,7 @@ textarea ~ input[type=submit] { margin: 0.5rem 0.8rem; padding: 0.5rem; font-wei
 
 .page-list { list-style-type: none; margin: 0.5rem; padding: 0.5rem; }
 .page-list li { margin: 0.5rem; padding: 0.5rem; }
-.page-list li .size { color: rgba(30, 30, 30, 0.5); }
+.page-list li .size { margin-left: 0.7rem; color: rgba(30, 30, 30, 0.5); }
 .page-list li .editor { display: inline-block; margin: 0 0.5rem; }
 .page-list li .tags { margin: 0 1rem; }
 .tag-list { list-style-type: none; margin: 0.5rem; padding: 0.5rem; }
