From 1f92578030350b9429ade4ad0d48550c68319807 Mon Sep 17 00:00:00 2001
From: Starbeamrainbowlabs <sbrl@starbeamrainbowlabs.com>
Date: Sat, 18 Feb 2017 21:52:30 +0000
Subject: [PATCH] Update build

---
 build/index.php   | 51 ++++++++++++++++++++++++++++++++++++++++++++++-
 module_index.json |  9 +++++++++
 2 files changed, 59 insertions(+), 1 deletion(-)

diff --git a/build/index.php b/build/index.php
index 50a4e5a..79f32aa 100644
--- a/build/index.php
+++ b/build/index.php
@@ -1448,7 +1448,7 @@ class page_renderer
 		$result = "";
 		if(in_array($name, $settings->admins))
 			$result .= $settings->admindisplaychar;
-		$result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>$name</a>";
+		$result .= "<a href='?page=" . rawurlencode(get_user_pagename($name)) . "'>" . htmlentities($name) . "</a>";
 
 		return $result;
 	}
@@ -5427,6 +5427,55 @@ register_module([
 ]);
 
 
+
+register_module([
+	"name" => "User list",
+	"version" => "0.1",
+	"author" => "Starbeamrainbowlabs",
+	"description" => "Adds a 'user-list' action that generates a list of users. Supports json output with 'format=json' in the queyr string.",
+	"id" => "page-user-list",
+	"code" => function() {
+		global $settings;
+		/**
+		 * @api {get} ?action=user-list[format=json] List all users
+		 * @apiName UserList
+		 * @apiGroup Utility
+		 * @apiPermission Anonymous
+		 */
+		
+		/*
+		 * ██    ██ ███████ ███████ ██████        ██      ██ ███████ ████████
+		 * ██    ██ ██      ██      ██   ██       ██      ██ ██         ██
+		 * ██    ██ ███████ █████   ██████  █████ ██      ██ ███████    ██
+		 * ██    ██      ██ ██      ██   ██       ██      ██      ██    ██
+		 *  ██████  ███████ ███████ ██   ██       ███████ ██ ███████    ██
+		 */
+		add_action("user-list", function() {
+			global $env, $settings;
+			
+			$userList = array_keys(get_object_vars($settings->users));
+			if(!empty($_GET["format"]) && $_GET["format"] === "json")
+			{
+				header("content-type: application/json");
+				exit(json_encode($userList));
+			}
+			
+			$content = "<h1>User List</h1>\n";
+			$content .= "<ul class='page-list user-list invisilist'>\n";
+			foreach($userList as $username)
+				$content .= "\t<li>" . page_renderer::render_username($username) . "</li>\n";
+			$content .= "</ul>\n";
+			
+			exit(page_renderer::render_main("User List - $settings->sitename", $content));
+		});
+		
+		add_help_section("800-raw-page-content", "Viewing Raw Page Content", "<p>Although you can use the edit page to view a page's source, you can also ask $settings->sitename to send you the raw page source and nothing else. This feature is intented for those who want to automate their interaction with $settings->sitename.</p>
+		<p>To use this feature, navigate to the page for which you want to see the source, and then alter the <code>action</code> parameter in the url's query string to be <code>raw</code>. If the <code>action</code> parameter doesn't exist, add it. Note that when used on an file's page this action will return the source of the description and not the file itself.</p>");
+	}
+]);
+
+
+
 
 register_module([
 	"name" => "Page viewer",
diff --git a/module_index.json b/module_index.json
index e256060..63bd660 100755
--- a/module_index.json
+++ b/module_index.json
@@ -206,6 +206,15 @@
         "lastupdate": 1476906745,
         "optional": false
     },
+    {
+        "name": "User list",
+        "version": "0.1",
+        "author": "Starbeamrainbowlabs",
+        "description": "Adds a 'user-list' action that generates a list of users. Supports json output with 'format=json' in the queyr string.",
+        "id": "page-user-list",
+        "lastupdate": 1487454626,
+        "optional": false
+    },
     {
         "name": "Page viewer",
         "version": "0.16.4",
