1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-12-04 08:03:00 +00:00
Pepperminty-Wiki/modules/page-user-list.php

52 lines
2.1 KiB
PHP
Raw Permalink Normal View History

2017-02-18 21:52:05 +00:00
<?php
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */
2017-02-18 21:52:05 +00:00
register_module([
"name" => "User list",
2024-09-06 01:35:46 +00:00
"version" => "0.1.1",
2017-02-18 21:52:05 +00:00
"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
2017-02-18 21:52:05 +00:00
* @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));
});
2024-09-06 01:35:46 +00:00
add_help_section("18-user-list", "User list", "<p>$settings->sitename has a page that lists all the users on the site. You can access it here: <a href='?action=user-list'>user list</a>.</p>");
2017-02-18 21:52:05 +00:00
}
]);
?>