From 5af29c133fe0c5660344c8a21dc6dbcef01c57fa Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Tue, 27 Mar 2018 16:59:11 +0100 Subject: [PATCH] Improve HTTP accepts handling & update docs --- Changelog.md | 1 + build/index.php | 14 +++-- core.php | 7 ++- .../classes/PeppermintParsedown.html | 6 +-- docs/ModuleApi/classes/Slimdown.html | 6 +-- docs/ModuleApi/classes/ids.html | 8 +-- docs/ModuleApi/classes/page_renderer.html | 6 +-- docs/ModuleApi/classes/search.html | 6 +-- docs/ModuleApi/files/core.html | 6 +-- docs/ModuleApi/files/core.php.txt | 34 +++++++----- docs/ModuleApi/files/download.html | 6 +-- docs/ModuleApi/files/modules.action-hash.html | 6 +-- .../files/modules.action-protect.html | 6 +-- .../files/modules.action-random.html | 6 +-- docs/ModuleApi/files/modules.action-raw.html | 6 +-- docs/ModuleApi/files/modules.api-status.html | 6 +-- .../files/modules.extra-sidebar.html | 6 +-- .../files/modules.feature-comments.html | 6 +-- .../files/modules.feature-guiconfig.html | 6 +-- .../files/modules.feature-history.html | 6 +-- .../files/modules.feature-recent-changes.html | 6 +-- .../files/modules.feature-redirect.html | 6 +-- .../files/modules.feature-search.html | 6 +-- .../files/modules.feature-stats.html | 6 +-- .../files/modules.feature-upload.html | 6 +-- .../modules.feature-user-preferences.html | 6 +-- .../ModuleApi/files/modules.page-credits.html | 6 +-- .../files/modules.page-debug-info.html | 6 +-- docs/ModuleApi/files/modules.page-delete.html | 6 +-- docs/ModuleApi/files/modules.page-edit.html | 6 +-- docs/ModuleApi/files/modules.page-export.html | 6 +-- docs/ModuleApi/files/modules.page-help.html | 6 +-- docs/ModuleApi/files/modules.page-list.html | 6 +-- docs/ModuleApi/files/modules.page-login.html | 6 +-- docs/ModuleApi/files/modules.page-logout.html | 6 +-- docs/ModuleApi/files/modules.page-move.html | 6 +-- docs/ModuleApi/files/modules.page-update.html | 6 +-- .../files/modules.page-user-list.html | 6 +-- docs/ModuleApi/files/modules.page-view.html | 6 +-- .../files/modules.parser-default-old.html | 6 +-- .../files/modules.parser-parsedown.html | 6 +-- .../files/modules/action-random.php.txt | 12 +++-- .../files/modules/api-status.php.txt | 7 ++- .../modules/feature-recent-changes.php.txt | 7 ++- .../files/modules/feature-search.php.txt | 52 +++++++++++++------ .../ModuleApi/files/modules/page-edit.php.txt | 4 +- .../ModuleApi/files/modules/page-move.php.txt | 13 +++++ .../ModuleApi/files/modules/page-view.php.txt | 4 +- docs/ModuleApi/files/pack.html | 6 +-- docs/ModuleApi/files/settings.fragment.html | 6 +-- docs/ModuleApi/graphs/class.html | 2 +- docs/ModuleApi/index.html | 6 +-- docs/ModuleApi/namespaces/default.html | 6 +-- docs/ModuleApi/reports/deprecated.html | 2 +- docs/ModuleApi/reports/errors.html | 2 +- docs/ModuleApi/reports/markers.html | 8 +-- docs/RestApi/api_data.js | 49 +++++++---------- docs/RestApi/api_data.json | 49 +++++++---------- docs/RestApi/api_project.js | 2 +- docs/RestApi/api_project.json | 2 +- module_index.json | 2 +- modules/api-status.php | 7 ++- 62 files changed, 282 insertions(+), 246 deletions(-) diff --git a/Changelog.md b/Changelog.md index e412e13..e8c5c1b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -18,6 +18,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t - Fixed that age-old warning in the search results if you have pages with special characters! I learnt a _lot_ about utf8 whilst fixing this one.... (#114) - You'll need to rebuild your search index for this fix to fully take effect (call the `invindex-rebuild` action as a mod or better) - Normalise utf8 text to avoid duplicate ids and missing search results. + - Improved handling of mime types in some places in the API. ### Changed - Disallow uploads if editing is disabled. Previously files could still be uploaded even if editing was disabled - unless `upload_enabled` was set to `false`. diff --git a/build/index.php b/build/index.php index 5cf6ea5..4a9b5f9 100644 --- a/build/index.php +++ b/build/index.php @@ -946,9 +946,14 @@ function system_extension_mime_type($ext) { */ function accept_contains_mime($accept_header, $mime_type) { + $target_mime = explode("/", $mime_type); + $accepted_mimes = explode(",", $accept_header); foreach($accepted_mimes as $accepted_mime) { - if(explode(";", $accepted_mime)[0] == $mime_type) + $next_mime = explode("/", explode(";", $accepted_mime)[0]); + if($next_mime == $mime_type || ($next_mime[0] == "*" && $next_mime[1] == "*")) + return true; + if($next_mime[1] == "*" && $next_mime[0] == $mime_type[0]) return true; } return false; @@ -2363,12 +2368,11 @@ register_module([ "code" => function() { global $settings; /** - * @api {get} ?action=raw&page={pageName} Get the raw source code of a page - * @apiName RawSource - * @apiGroup Page + * @api {get} ?action=status Get the json-formatted status of this wiki + * @apiName Status + * @apiGroup Stats * @apiPermission Anonymous * - * @apiParam {string} page The page to return the source of. */ diff --git a/core.php b/core.php index fd50a5e..ab7d5c4 100644 --- a/core.php +++ b/core.php @@ -569,9 +569,14 @@ function system_extension_mime_type($ext) { */ function accept_contains_mime($accept_header, $mime_type) { + $target_mime = explode("/", $mime_type); + $accepted_mimes = explode(",", $accept_header); foreach($accepted_mimes as $accepted_mime) { - if(explode(";", $accepted_mime)[0] == $mime_type) + $next_mime = explode("/", explode(";", $accepted_mime)[0]); + if($next_mime == $mime_type || ($next_mime[0] == "*" && $next_mime[1] == "*")) + return true; + if($next_mime[1] == "*" && $next_mime[0] == $mime_type[0]) return true; } return false; diff --git a/docs/ModuleApi/classes/PeppermintParsedown.html b/docs/ModuleApi/classes/PeppermintParsedown.html index 15c30ba..3a6003f 100644 --- a/docs/ModuleApi/classes/PeppermintParsedown.html +++ b/docs/ModuleApi/classes/PeppermintParsedown.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -365,7 +365,7 @@ with a URL encoded version of the page name.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/classes/Slimdown.html b/docs/ModuleApi/classes/Slimdown.html index 8005fe1..0bbec6c 100644 --- a/docs/ModuleApi/classes/Slimdown.html +++ b/docs/ModuleApi/classes/Slimdown.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -414,7 +414,7 @@ Added image support


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/classes/ids.html b/docs/ModuleApi/classes/ids.html index 0dece07..d70b11e 100644 --- a/docs/ModuleApi/classes/ids.html +++ b/docs/ModuleApi/classes/ids.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -368,7 +368,7 @@ that the destination name doesn't already exist.

string $newpagename -

The new pagee name to move the old page name to.

+

The new page name to move the old page name to.

@@ -525,7 +525,7 @@ index.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/classes/page_renderer.html b/docs/ModuleApi/classes/page_renderer.html index fb08c10..4f2e538 100644 --- a/docs/ModuleApi/classes/page_renderer.html +++ b/docs/ModuleApi/classes/page_renderer.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -943,7 +943,7 @@ navigation bar.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/classes/search.html b/docs/ModuleApi/classes/search.html index 51bad47..89d21f0 100644 --- a/docs/ModuleApi/classes/search.html +++ b/docs/ModuleApi/classes/search.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -919,7 +919,7 @@ in a list of search results.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/core.html b/docs/ModuleApi/files/core.html index 99914a6..2365f29 100644 --- a/docs/ModuleApi/files/core.html +++ b/docs/ModuleApi/files/core.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -2487,7 +2487,7 @@ an edit is saved.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/core.php.txt b/docs/ModuleApi/files/core.php.txt index cf8a65e..e4c6127 100644 --- a/docs/ModuleApi/files/core.php.txt +++ b/docs/ModuleApi/files/core.php.txt @@ -125,8 +125,11 @@ if($env->is_logged_in) // APIDoc strings // //////////////////// /** - * @apiDefine Moderator Only users loggged with a moderator account may use this call. + * @apiDefine Admin Only the wiki administrator may use this call. */ + /** + * @apiDefine Moderator Only users loggged with a moderator account may use this call. + */ /** * @apiDefine User Only users loggged in may use this call. */ @@ -566,9 +569,14 @@ function system_extension_mime_type($ext) { */ function accept_contains_mime($accept_header, $mime_type) { + $target_mime = explode("/", $mime_type); + $accepted_mimes = explode(",", $accept_header); foreach($accepted_mimes as $accepted_mime) { - if(explode(";", $accepted_mime)[0] == $mime_type) + $next_mime = explode("/", explode(";", $accepted_mime)[0]); + if($next_mime == $mime_type || ($next_mime[0] == "*" && $next_mime[1] == "*")) + return true; + if($next_mime[1] == "*" && $next_mime[0] == $mime_type[0]) return true; } return false; @@ -810,19 +818,19 @@ if(!file_exists($paths->pageindex)) // Create a new entry $newentry = new stdClass(); - $newentry->filename = utf8_encode(substr( // Store the filename, whilst trimming the storage prefix + $newentry->filename = substr( // Store the filename, whilst trimming the storage prefix $pagefilename, - strlen(preg_replace("/^\.\//i", "", $env->storage_prefix)) // glob_recursive trim the ./ from returned filenames , so we need to as well - )); + mb_strlen(preg_replace("/^\.\//iu", "", $env->storage_prefix)) // glob_recursive trim the ./ from returned filenames , so we need to as well + ); // Remove the `./` from the beginning if it's still hanging around if(substr($newentry->filename, 0, 2) == "./") $newentry->filename = substr($newentry->filename, 2); $newentry->size = filesize($pagefilename); // Store the page size $newentry->lastmodified = filemtime($pagefilename); // Store the date last modified // Todo find a way to keep the last editor independent of the page index - $newentry->lasteditor = utf8_encode("unknown"); // Set the editor to "unknown" + $newentry->lasteditor = "unknown"; // Set the editor to "unknown" // Extract the name of the (sub)page without the ".md" - $pagekey = utf8_encode(substr($newentry->filename, 0, -3)); + $pagekey = mb_substr($newentry->filename, 0, -3); if(file_exists($env->storage_prefix . $pagekey) && // If it exists... !is_dir($env->storage_prefix . $pagekey)) // ...and isn't a directory @@ -907,7 +915,7 @@ class ids foreach ($idindex as $id => $entry) { - if($entry == $pagename) + if(Normalizer::normalize($entry, Normalizer::FORM_C) == Normalizer::normalize($pagename, Normalizer::FORM_C)) return $id; } @@ -939,14 +947,14 @@ class ids * that the destination name doesn't already exist. * @package core * @param string $oldpagename The old page name to move. - * @param string $newpagename The new pagee name to move the old page name to. + * @param string $newpagename The new page name to move the old page name to. */ public static function movepagename($oldpagename, $newpagename) { global $idindex, $paths; - $pageid = self::getid($oldpagename); - $idindex->$pageid = $newpagename; + $pageid = self::getid(Normalizer::normalize($oldpagename, Normalizer::FORM_C)); + $idindex->$pageid = Normalizer::normalize($newpagename, Normalizer::FORM_C); file_put_contents($paths->idindex, json_encode($idindex)); } @@ -1000,6 +1008,8 @@ class ids protected static function assign($pagename) { global $idindex, $paths; + + $pagename = Normalizer::normalize($pagename, Normalizer::FORM_C); $nextid = count(array_keys(get_object_vars($idindex))); // Increment the generated id until it's unique @@ -1007,7 +1017,7 @@ class ids $nextid++; // Update the id index - $idindex->$nextid = utf8_encode($pagename); + $idindex->$nextid = $pagename; // Save the id index file_put_contents($paths->idindex, json_encode($idindex)); diff --git a/docs/ModuleApi/files/download.html b/docs/ModuleApi/files/download.html index 6a2b504..a8d433b 100644 --- a/docs/ModuleApi/files/download.html +++ b/docs/ModuleApi/files/download.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.action-hash.html b/docs/ModuleApi/files/modules.action-hash.html index b4be607..bda5700 100644 --- a/docs/ModuleApi/files/modules.action-hash.html +++ b/docs/ModuleApi/files/modules.action-hash.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.action-protect.html b/docs/ModuleApi/files/modules.action-protect.html index 02d3ebe..9de8aeb 100644 --- a/docs/ModuleApi/files/modules.action-protect.html +++ b/docs/ModuleApi/files/modules.action-protect.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.action-random.html b/docs/ModuleApi/files/modules.action-random.html index 1e313f5..d5ba4c0 100644 --- a/docs/ModuleApi/files/modules.action-random.html +++ b/docs/ModuleApi/files/modules.action-random.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.action-raw.html b/docs/ModuleApi/files/modules.action-raw.html index 68fa00b..8cba3fb 100644 --- a/docs/ModuleApi/files/modules.action-raw.html +++ b/docs/ModuleApi/files/modules.action-raw.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.api-status.html b/docs/ModuleApi/files/modules.api-status.html index c6f018d..c3fe79e 100644 --- a/docs/ModuleApi/files/modules.api-status.html +++ b/docs/ModuleApi/files/modules.api-status.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.extra-sidebar.html b/docs/ModuleApi/files/modules.extra-sidebar.html index 87c0409..b1b19df 100644 --- a/docs/ModuleApi/files/modules.extra-sidebar.html +++ b/docs/ModuleApi/files/modules.extra-sidebar.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -298,7 +298,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.feature-comments.html b/docs/ModuleApi/files/modules.feature-comments.html index f712319..f902e78 100644 --- a/docs/ModuleApi/files/modules.feature-comments.html +++ b/docs/ModuleApi/files/modules.feature-comments.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -544,7 +544,7 @@ at which the comments are being rendered.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.feature-guiconfig.html b/docs/ModuleApi/files/modules.feature-guiconfig.html index d37a7f2..55fd24f 100644 --- a/docs/ModuleApi/files/modules.feature-guiconfig.html +++ b/docs/ModuleApi/files/modules.feature-guiconfig.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.feature-history.html b/docs/ModuleApi/files/modules.feature-history.html index 2271191..9ee3c77 100644 --- a/docs/ModuleApi/files/modules.feature-history.html +++ b/docs/ModuleApi/files/modules.feature-history.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -304,7 +304,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.feature-recent-changes.html b/docs/ModuleApi/files/modules.feature-recent-changes.html index b5c6b7f..9c469ca 100644 --- a/docs/ModuleApi/files/modules.feature-recent-changes.html +++ b/docs/ModuleApi/files/modules.feature-recent-changes.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -384,7 +384,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.feature-redirect.html b/docs/ModuleApi/files/modules.feature-redirect.html index b1ff9da..244a3bd 100644 --- a/docs/ModuleApi/files/modules.feature-redirect.html +++ b/docs/ModuleApi/files/modules.feature-redirect.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.feature-search.html b/docs/ModuleApi/files/modules.feature-search.html index 7ee5939..532b867 100644 --- a/docs/ModuleApi/files/modules.feature-search.html +++ b/docs/ModuleApi/files/modules.feature-search.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -246,7 +246,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.feature-stats.html b/docs/ModuleApi/files/modules.feature-stats.html index e0d6c6a..2eb20cd 100644 --- a/docs/ModuleApi/files/modules.feature-stats.html +++ b/docs/ModuleApi/files/modules.feature-stats.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -381,7 +381,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.feature-upload.html b/docs/ModuleApi/files/modules.feature-upload.html index 51b9b9c..06dcf9e 100644 --- a/docs/ModuleApi/files/modules.feature-upload.html +++ b/docs/ModuleApi/files/modules.feature-upload.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -503,7 +503,7 @@ the image.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.feature-user-preferences.html b/docs/ModuleApi/files/modules.feature-user-preferences.html index 46d42b9..27691c8 100644 --- a/docs/ModuleApi/files/modules.feature-user-preferences.html +++ b/docs/ModuleApi/files/modules.feature-user-preferences.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-credits.html b/docs/ModuleApi/files/modules.page-credits.html index ea2a14f..5c8573b 100644 --- a/docs/ModuleApi/files/modules.page-credits.html +++ b/docs/ModuleApi/files/modules.page-credits.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-debug-info.html b/docs/ModuleApi/files/modules.page-debug-info.html index 59428ed..30a08cb 100644 --- a/docs/ModuleApi/files/modules.page-debug-info.html +++ b/docs/ModuleApi/files/modules.page-debug-info.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-delete.html b/docs/ModuleApi/files/modules.page-delete.html index 8c2c760..1025300 100644 --- a/docs/ModuleApi/files/modules.page-delete.html +++ b/docs/ModuleApi/files/modules.page-delete.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-edit.html b/docs/ModuleApi/files/modules.page-edit.html index af12094..2373548 100644 --- a/docs/ModuleApi/files/modules.page-edit.html +++ b/docs/ModuleApi/files/modules.page-edit.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-export.html b/docs/ModuleApi/files/modules.page-export.html index 6e8c2db..eb2f9a7 100644 --- a/docs/ModuleApi/files/modules.page-export.html +++ b/docs/ModuleApi/files/modules.page-export.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-help.html b/docs/ModuleApi/files/modules.page-help.html index aca777c..4f030c2 100644 --- a/docs/ModuleApi/files/modules.page-help.html +++ b/docs/ModuleApi/files/modules.page-help.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-list.html b/docs/ModuleApi/files/modules.page-list.html index da28900..2422fdd 100644 --- a/docs/ModuleApi/files/modules.page-list.html +++ b/docs/ModuleApi/files/modules.page-list.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -340,7 +340,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-login.html b/docs/ModuleApi/files/modules.page-login.html index 2ebdd30..f51b3d1 100644 --- a/docs/ModuleApi/files/modules.page-login.html +++ b/docs/ModuleApi/files/modules.page-login.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -295,7 +295,7 @@ enabled, or sha256 otherwise.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-logout.html b/docs/ModuleApi/files/modules.page-logout.html index ef80e4d..ff4217f 100644 --- a/docs/ModuleApi/files/modules.page-logout.html +++ b/docs/ModuleApi/files/modules.page-logout.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-move.html b/docs/ModuleApi/files/modules.page-move.html index bc2f391..9039fa5 100644 --- a/docs/ModuleApi/files/modules.page-move.html +++ b/docs/ModuleApi/files/modules.page-move.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-update.html b/docs/ModuleApi/files/modules.page-update.html index 3f4dff7..0148175 100644 --- a/docs/ModuleApi/files/modules.page-update.html +++ b/docs/ModuleApi/files/modules.page-update.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-user-list.html b/docs/ModuleApi/files/modules.page-user-list.html index 94f3ab8..66a2acd 100644 --- a/docs/ModuleApi/files/modules.page-user-list.html +++ b/docs/ModuleApi/files/modules.page-user-list.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.page-view.html b/docs/ModuleApi/files/modules.page-view.html index 1205c0f..ce2ca3a 100644 --- a/docs/ModuleApi/files/modules.page-view.html +++ b/docs/ModuleApi/files/modules.page-view.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.parser-default-old.html b/docs/ModuleApi/files/modules.parser-default-old.html index 8fd6b41..f6656fb 100644 --- a/docs/ModuleApi/files/modules.parser-default-old.html +++ b/docs/ModuleApi/files/modules.parser-default-old.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -246,7 +246,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules.parser-parsedown.html b/docs/ModuleApi/files/modules.parser-parsedown.html index bad9fa5..22dcd49 100644 --- a/docs/ModuleApi/files/modules.parser-parsedown.html +++ b/docs/ModuleApi/files/modules.parser-parsedown.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -246,7 +246,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/modules/action-random.php.txt b/docs/ModuleApi/files/modules/action-random.php.txt index f254eeb..70e9e73 100644 --- a/docs/ModuleApi/files/modules/action-random.php.txt +++ b/docs/ModuleApi/files/modules/action-random.php.txt @@ -8,15 +8,19 @@ register_module([ "code" => function() { global $settings; /** - * @api {get} ?action=random Redirects to a random page. - * @apiName RawSource + * @api {get} ?action=random[&mode={modeName}] Redirects to a random page + * @apiName Random * @apiGroup Page * @apiPermission Anonymous + * + * @apiParam {string} mode The view mode to redirect to. This parameter is basically just passed through to the direct. It works in the same way as the mode parameter on the view action does. */ add_action("random", function() { global $pageindex; + $mode = preg_replace("/[^a-z-_]/i", "", $_GET["mode"] ?? ""); + $pageNames = array_keys(get_object_vars($pageindex)); // Filter out pages we shouldn't send the user to @@ -28,7 +32,9 @@ register_module([ $randomPageName = $pageNames[array_rand($pageNames)]; http_response_code(307); - header("location: ?page=" . rawurlencode($randomPageName)); + $redirect_url = "?page=" . rawurlencode($randomPageName); + if(!empty($mode)) $redirect_url .= "&mode=$mode"; + header("location: $redirect_url"); }); add_help_section("26-random-redirect", "Jumping to a random page", "

$settings->sitename has a function that can send you to a random page. To use it, click here. $settings->admindetails_name ($settings->sitename's adminstrator) may have added it to one of the menus.

"); diff --git a/docs/ModuleApi/files/modules/api-status.php.txt b/docs/ModuleApi/files/modules/api-status.php.txt index 03059c4..152ed5d 100644 --- a/docs/ModuleApi/files/modules/api-status.php.txt +++ b/docs/ModuleApi/files/modules/api-status.php.txt @@ -8,12 +8,11 @@ register_module([ "code" => function() { global $settings; /** - * @api {get} ?action=raw&page={pageName} Get the raw source code of a page - * @apiName RawSource - * @apiGroup Page + * @api {get} ?action=status Get the json-formatted status of this wiki + * @apiName Status + * @apiGroup Stats * @apiPermission Anonymous * - * @apiParam {string} page The page to return the source of. */ diff --git a/docs/ModuleApi/files/modules/feature-recent-changes.php.txt b/docs/ModuleApi/files/modules/feature-recent-changes.php.txt index ac98e64..2e86b9a 100644 --- a/docs/ModuleApi/files/modules/feature-recent-changes.php.txt +++ b/docs/ModuleApi/files/modules/feature-recent-changes.php.txt @@ -244,12 +244,17 @@ function render_recent_change($rchange) $result .= "$pageDisplayHtml $editorDisplayHtml $timeDisplayHtml ($size_display)"; break; - + case "deletion": $resultClasses[] = "deletion"; $result .= "$pageDisplayHtml $editorDisplayHtml $timeDisplayHtml"; break; + case "move": + $resultClasses[] = "move"; + $result .= "$rchange->oldpage ⭢ $pageDisplayHtml $editorDisplayHtml $timeDisplayHtml"; + break; + case "upload": $resultClasses[] = "upload"; $result .= "$pageDisplayHtml $editorDisplayHtml $timeDisplayHtml (" . human_filesize($rchange->filesize) . ")"; diff --git a/docs/ModuleApi/files/modules/feature-search.php.txt b/docs/ModuleApi/files/modules/feature-search.php.txt index 2ed0708..3c5974c 100644 --- a/docs/ModuleApi/files/modules/feature-search.php.txt +++ b/docs/ModuleApi/files/modules/feature-search.php.txt @@ -1,7 +1,7 @@ "Search", - "version" => "0.6.1", + "version" => "0.6.2", "author" => "Starbeamrainbowlabs", "description" => "Adds proper search functionality to Pepperminty Wiki using an inverted index to provide a full text search engine. If pages don't show up, then you might have hit a stop word. If not, try requesting the `invindex-rebuild` action to rebuild the inverted index from scratch.", "id" => "feature-search", @@ -13,6 +13,7 @@ register_module([ * @apiName SearchIndex * @apiGroup Search * @apiPermission Anonymous + * @apiDescription For debugging purposes. Be warned - the format could change at any time! * * @apiParam {string} page The page to generate a word index page. */ @@ -83,7 +84,7 @@ register_module([ /** * @api {get} ?action=idindex-show Show the id index - * @apiDescription Outputs the id index. Useful if you need to verify that it's working as expected. + * @apiDescription Outputs the id index. Useful if you need to verify that it's working as expected. Output is a json object. * @apiName SearchShowIdIndex * @apiGroup Search * @apiPermission Anonymous @@ -95,12 +96,13 @@ register_module([ }); /** - * @api {get} ?action=search&query={text} Search the wiki for a given query string + * @api {get} ?action=search&query={text}[&format={format}] Search the wiki for a given query string * @apiName Search * @apiGroup Search * @apiPermission Anonymous * * @apiParam {string} query The query string to search for. + * @apiParam {string} format Optional. Valid values: html, json. In json mode an object is returned with page names as keys, values as search result information - sorted in ranking order. */ /* @@ -126,6 +128,20 @@ register_module([ $invindex = search::load_invindex($paths->searchindex); $results = search::query_invindex($_GET["query"], $invindex); $resultCount = count($results); + + foreach($results as &$result) { + $result["context"] = search::extract_context( + $_GET["query"], + file_get_contents($env->storage_prefix . $result["pagename"] . ".md") + ); + } + + if(!empty($_GET["format"]) && $_GET["format"] == "json") { + header("content-type: application/json"); + $json_results = new stdClass(); + foreach($results as $result) $json_results->{$result["pagename"]} = $result; + exit(json_encode($json_results)); + } $env->perfdata->search_time = round((microtime(true) - $search_start)*1000, 3); @@ -193,11 +209,14 @@ register_module([ $pagesource = file_get_contents($env->storage_prefix . $result["pagename"] . ".md"); //echo("Extracting context for result " . $result["pagename"] . ".\n"); - $context = search::extract_context($_GET["query"], $pagesource); - if(strlen($context) === 0) - $context = substr($pagesource, 0, $settings->search_characters_context * 2); + $context = $result["context"]; + if(mb_strlen($context) === 0) + $context = mb_substr($pagesource, 0, $settings->search_characters_context * 2); //echo("'Generated search context for " . $result["pagename"] . ": $context'\n"); - $context = search::highlight_context($_GET["query"], htmlentities($context)); + $context = search::highlight_context( + $_GET["query"], + preg_replace('/page.md", null, null, null, $settings->search_characters_context * 2)); @@ -319,7 +338,7 @@ register_module([ /** - * @api {get} ?action=suggest-pages[&type={type}] Get search suggestions for a query + * @api {get} ?action=suggest-pages[&type={type}] Get page name suggestions for a query * @apiName OpenSearchDescription * @apiGroup Search * @apiPermission Anonymous @@ -493,7 +512,7 @@ class search public static function index($source) { $source = html_entity_decode($source, ENT_QUOTES); - $source_length = strlen($source); + $source_length = mb_strlen($source); $index = []; @@ -527,8 +546,8 @@ class search */ public static function tokenize($source) { - $source = strtolower($source); - $source = str_replace([ '[', ']', '|', '{', '}', '/' ], " ", $source); + $source = Normalizer::normalize(strtolower($source), Normalizer::FORM_C); + $source = preg_replace('/[\[\]\|\{\}\/]/u', " ", $source); return preg_split("/((^\p{P}+)|(\p{P}*\s+\p{P}*)|(\p{P}+$))|\|/u", $source, -1, PREG_SPLIT_NO_EMPTY); } @@ -540,7 +559,7 @@ class search */ public static function strip_markup($source) { - return str_replace([ "[", "]", "\"", "*", "_", " - ", "`" ], "", $source); + return preg_replace('/([\"*_\[\]]| - |`)/u', "", $source); } /** @@ -567,12 +586,12 @@ class search { $page_filename = $env->storage_prefix . $pagedetails->filename; if(!file_exists($page_filename)) { - echo("data: [" . ($i + 1) . " / $max] Error: Can't find $page_filename"); + echo("data: [" . ($i + 1) . " / $max] Error: Can't find $page_filename\n"); flush(); $missing_files++; continue; } - $pagesource = utf8_encode(file_get_contents($page_filename)); + $pagesource = Normalizer::normalize(file_get_contents($page_filename), Normalizer::FORM_C); $index = self::index($pagesource); $pageid = ids::getid($pagename); @@ -883,7 +902,7 @@ class search return ($a[1] > $b[1]) ? +1 : -1; }); - $sourceLength = strlen($source); + $sourceLength = mb_strlen($source); $contexts = []; $basepos = 0; @@ -955,7 +974,8 @@ class search if(in_array($qterm, static::$stop_words)) continue; // From http://stackoverflow.com/a/2483859/1460422 - $context = preg_replace("/" . str_replace("/", "\/", preg_quote($qterm)) . "/i", "$0", $context); + + $context = preg_replace("/" . preg_replace('/\\//u', "\/", preg_quote($qterm)) . "/iu", "$0", $context); } return $context; diff --git a/docs/ModuleApi/files/modules/page-edit.php.txt b/docs/ModuleApi/files/modules/page-edit.php.txt index eb04be0..390f2c6 100644 --- a/docs/ModuleApi/files/modules/page-edit.php.txt +++ b/docs/ModuleApi/files/modules/page-edit.php.txt @@ -424,9 +424,9 @@ DIFFSCRIPT; $pageindex->{$env->page}->size = strlen($_POST["content"]); $pageindex->{$env->page}->lastmodified = time(); if($env->is_logged_in) - $pageindex->{$env->page}->lasteditor = utf8_encode($env->user); + $pageindex->{$env->page}->lasteditor = $env->user; else // TODO: Add an option to record the user's IP here instead - $pageindex->{$env->page}->lasteditor = utf8_encode("anonymous"); + $pageindex->{$env->page}->lasteditor = "anonymous"; $pageindex->{$env->page}->tags = $page_tags; // A hack to resave the pagedata if the preprocessors have diff --git a/docs/ModuleApi/files/modules/page-move.php.txt b/docs/ModuleApi/files/modules/page-move.php.txt index b8eb24d..9b99be6 100644 --- a/docs/ModuleApi/files/modules/page-move.php.txt +++ b/docs/ModuleApi/files/modules/page-move.php.txt @@ -127,6 +127,19 @@ register_module([ ); } + // Add a recent change announcing the move if the recent changes + // module is installed + if(module_exists("feature-recent-changes")) + { + add_recent_change([ + "type" => "move", + "timestamp" => time(), + "oldpage" => $page, + "page" => $new_name, + "user" => $env->user + ]); + } + // Exit with a nice message exit(page_renderer::render_main("Moving " . htmlentities($env->page), "

" . htmlentities($env->page) . " has been moved to " . htmlentities($new_name) . " successfully.

")); }); diff --git a/docs/ModuleApi/files/modules/page-view.php.txt b/docs/ModuleApi/files/modules/page-view.php.txt index a086e15..3342e20 100644 --- a/docs/ModuleApi/files/modules/page-view.php.txt +++ b/docs/ModuleApi/files/modules/page-view.php.txt @@ -7,14 +7,14 @@ register_module([ "id" => "page-view", "code" => function() { /** - * @api {get} ?action=view[&page={pageName}][&revision=rid][&printable=yes] View a page + * @api {get} ?action=view[&page={pageName}][&revision=rid][&printable=yes][&mode={mode}] View a page * @apiName View * @apiGroup Page * @apiPermission Anonymous * * @apiUse PageParameter * @apiParam {number} revision The revision number to display. - * @apiParam {string} mode Optional. The display mode to use. Can hld the following values: 'normal' - The default. Sends a normal page. 'printable' - Sends a printable version of the page. 'contentonly' - Sends only the content of the page, not the extra stuff around it. 'parsedsourceonly' - Sends only the raw rendered source of the page, as it appears just after it has come out of the page parser. Useful for writing external tools (see also the `raw` action). + * @apiParam {string} mode Optional. The display mode to use. Can hold the following values: 'normal' - The default. Sends a normal page. 'printable' - Sends a printable version of the page. 'contentonly' - Sends only the content of the page, not the extra stuff around it. 'parsedsourceonly' - Sends only the raw rendered source of the page, as it appears just after it has come out of the page parser. Useful for writing external tools (see also the `raw` action). * * @apiError NonExistentPageError The page doesn't exist and editing is disabled in the wiki's settings. If editing isn't disabled, you will be redirected to the edit page instead. * @apiError NonExistentRevisionError The specified revision was not found. diff --git a/docs/ModuleApi/files/pack.html b/docs/ModuleApi/files/pack.html index 65b7a7c..85d691a 100644 --- a/docs/ModuleApi/files/pack.html +++ b/docs/ModuleApi/files/pack.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/files/settings.fragment.html b/docs/ModuleApi/files/settings.fragment.html index 305e91f..8009c4f 100644 --- a/docs/ModuleApi/files/settings.fragment.html +++ b/docs/ModuleApi/files/settings.fragment.html @@ -136,10 +136,10 @@
- + \
-
+
@@ -239,7 +239,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/graphs/class.html b/docs/ModuleApi/graphs/class.html index f68e403..3e06742 100644 --- a/docs/ModuleApi/graphs/class.html +++ b/docs/ModuleApi/graphs/class.html @@ -152,7 +152,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/index.html b/docs/ModuleApi/index.html index c0db488..e0ae3ce 100644 --- a/docs/ModuleApi/index.html +++ b/docs/ModuleApi/index.html @@ -88,10 +88,10 @@
- + \
-
+
@@ -3515,7 +3515,7 @@ listed to be cacnonical.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/namespaces/default.html b/docs/ModuleApi/namespaces/default.html index 0c3606a..4de355e 100644 --- a/docs/ModuleApi/namespaces/default.html +++ b/docs/ModuleApi/namespaces/default.html @@ -88,10 +88,10 @@
- + \
-
+
@@ -3515,7 +3515,7 @@ listed to be cacnonical.


Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/reports/deprecated.html b/docs/ModuleApi/reports/deprecated.html index e56d2bc..124ae8b 100644 --- a/docs/ModuleApi/reports/deprecated.html +++ b/docs/ModuleApi/reports/deprecated.html @@ -142,7 +142,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/reports/errors.html b/docs/ModuleApi/reports/errors.html index 33f07af..f2df959 100644 --- a/docs/ModuleApi/reports/errors.html +++ b/docs/ModuleApi/reports/errors.html @@ -1086,7 +1086,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/ModuleApi/reports/markers.html b/docs/ModuleApi/reports/markers.html index 810d508..325e0f7 100644 --- a/docs/ModuleApi/reports/markers.html +++ b/docs/ModuleApi/reports/markers.html @@ -121,12 +121,12 @@ TODO - 373 + 376 Make this moree clevererer :D TODO - 644 + 652 Identify which platforms don't have it and whether we still need this @@ -214,7 +214,7 @@ TODO - 636 + 655 Remove this function and make everything streamable @@ -260,7 +260,7 @@

Documentation is powered by phpDocumentor and authored - on February 14th, 2018 at 22:17. + on March 27th, 2018 at 15:57.
diff --git a/docs/RestApi/api_data.js b/docs/RestApi/api_data.js index b69383f..e09dfa0 100644 --- a/docs/RestApi/api_data.js +++ b/docs/RestApi/api_data.js @@ -644,36 +644,6 @@ define({ "api": [ "filename": "./modules/action-raw.php", "groupTitle": "Page" }, - { - "type": "get", - "url": "?action=raw&page={pageName}", - "title": "Get the raw source code of a page", - "name": "RawSource", - "group": "Page", - "permission": [ - { - "name": "Anonymous", - "title": "Anybody may use this call.", - "description": "" - } - ], - "parameter": { - "fields": { - "Parameter": [ - { - "group": "Parameter", - "type": "string", - "optional": false, - "field": "page", - "description": "

The page to return the source of.

" - } - ] - } - }, - "version": "0.0.0", - "filename": "./modules/api-status.php", - "groupTitle": "Page" - }, { "type": "get", "url": "?action=view[&page={pageName}][&revision=rid][&printable=yes][&mode={mode}]", @@ -923,7 +893,7 @@ define({ "api": [ "type": "get", "url": "?action=idindex-show", "title": "Show the id index", - "description": "

Outputs the id index. Useful if you need to verify that it's working as expected.

", + "description": "

Outputs the id index. Useful if you need to verify that it's working as expected. Output is a json object.

", "name": "SearchShowIdIndex", "group": "Search", "permission": [ @@ -1044,6 +1014,23 @@ define({ "api": [ "filename": "./modules/feature-recent-changes.php", "groupTitle": "Stats" }, + { + "type": "get", + "url": "?action=status", + "title": "Get the json-formatted status of this wiki", + "name": "Status", + "group": "Stats", + "permission": [ + { + "name": "Anonymous", + "title": "Anybody may use this call.", + "description": "" + } + ], + "version": "0.0.0", + "filename": "./modules/api-status.php", + "groupTitle": "Stats" + }, { "type": "get", "url": "?action=avatar&user={username}[&size={size}]", diff --git a/docs/RestApi/api_data.json b/docs/RestApi/api_data.json index 575a3ba..5f43603 100644 --- a/docs/RestApi/api_data.json +++ b/docs/RestApi/api_data.json @@ -644,36 +644,6 @@ "filename": "./modules/action-raw.php", "groupTitle": "Page" }, - { - "type": "get", - "url": "?action=raw&page={pageName}", - "title": "Get the raw source code of a page", - "name": "RawSource", - "group": "Page", - "permission": [ - { - "name": "Anonymous", - "title": "Anybody may use this call.", - "description": "" - } - ], - "parameter": { - "fields": { - "Parameter": [ - { - "group": "Parameter", - "type": "string", - "optional": false, - "field": "page", - "description": "

The page to return the source of.

" - } - ] - } - }, - "version": "0.0.0", - "filename": "./modules/api-status.php", - "groupTitle": "Page" - }, { "type": "get", "url": "?action=view[&page={pageName}][&revision=rid][&printable=yes][&mode={mode}]", @@ -923,7 +893,7 @@ "type": "get", "url": "?action=idindex-show", "title": "Show the id index", - "description": "

Outputs the id index. Useful if you need to verify that it's working as expected.

", + "description": "

Outputs the id index. Useful if you need to verify that it's working as expected. Output is a json object.

", "name": "SearchShowIdIndex", "group": "Search", "permission": [ @@ -1044,6 +1014,23 @@ "filename": "./modules/feature-recent-changes.php", "groupTitle": "Stats" }, + { + "type": "get", + "url": "?action=status", + "title": "Get the json-formatted status of this wiki", + "name": "Status", + "group": "Stats", + "permission": [ + { + "name": "Anonymous", + "title": "Anybody may use this call.", + "description": "" + } + ], + "version": "0.0.0", + "filename": "./modules/api-status.php", + "groupTitle": "Stats" + }, { "type": "get", "url": "?action=avatar&user={username}[&size={size}]", diff --git a/docs/RestApi/api_project.js b/docs/RestApi/api_project.js index a8328a3..bf3d291 100644 --- a/docs/RestApi/api_project.js +++ b/docs/RestApi/api_project.js @@ -8,7 +8,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2018-02-14T23:07:15.949Z", + "time": "2018-03-27T15:57:49.013Z", "url": "http://apidocjs.com", "version": "0.17.6" } diff --git a/docs/RestApi/api_project.json b/docs/RestApi/api_project.json index e09a89d..562e8e5 100644 --- a/docs/RestApi/api_project.json +++ b/docs/RestApi/api_project.json @@ -8,7 +8,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2018-02-14T23:07:15.949Z", + "time": "2018-03-27T15:57:49.013Z", "url": "http://apidocjs.com", "version": "0.17.6" } diff --git a/module_index.json b/module_index.json index c32bebd..8a54c3f 100755 --- a/module_index.json +++ b/module_index.json @@ -41,7 +41,7 @@ "author": "Starbeamrainbowlabs", "description": "Provides a basic JSON status action that provices a few useful bits of information for API consumption.", "id": "api-status", - "lastupdate": 1498472652, + "lastupdate": 1522166256, "optional": false }, { diff --git a/modules/api-status.php b/modules/api-status.php index a970b98..f68127f 100644 --- a/modules/api-status.php +++ b/modules/api-status.php @@ -8,12 +8,11 @@ register_module([ "code" => function() { global $settings; /** - * @api {get} ?action=raw&page={pageName} Get the raw source code of a page - * @apiName RawSource - * @apiGroup Page + * @api {get} ?action=status Get the json-formatted status of this wiki + * @apiName Status + * @apiGroup Stats * @apiPermission Anonymous * - * @apiParam {string} page The page to return the source of. */