1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-24 17:13:01 +00:00

Improve HTTP accepts handling & update docs

This commit is contained in:
Starbeamrainbowlabs 2018-03-27 16:59:11 +01:00
parent f6057b14b9
commit 5af29c133f
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
62 changed files with 282 additions and 246 deletions

View file

@ -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`.

View file

@ -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.
*/

View file

@ -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;

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1107965876"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-425711529"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1107965876" class="accordion-body collapse in">
<div id="namespace-425711529" class="accordion-body collapse in">
<div class="accordion-inner">
@ -365,7 +365,7 @@ with a URL encoded version of the page name.</em></p>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1672493508"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1186031156"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1672493508" class="accordion-body collapse in">
<div id="namespace-1186031156" class="accordion-body collapse in">
<div class="accordion-inner">
@ -414,7 +414,7 @@ Added image support</p>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1802082726"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-540145657"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1802082726" class="accordion-body collapse in">
<div id="namespace-540145657" class="accordion-body collapse in">
<div class="accordion-inner">
@ -368,7 +368,7 @@ that the destination name doesn't already exist.</p>
<tr>
<td>string</td>
<td>$newpagename </td>
<td><p>The new pagee name to move the old page name to.</p></td>
<td><p>The new page name to move the old page name to.</p></td>
</tr>
</table>
@ -525,7 +525,7 @@ index.</p>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1859412471"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1518551345"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1859412471" class="accordion-body collapse in">
<div id="namespace-1518551345" class="accordion-body collapse in">
<div class="accordion-inner">
@ -943,7 +943,7 @@ navigation bar.</p></td>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1845438421"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1584606938"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1845438421" class="accordion-body collapse in">
<div id="namespace-1584606938" class="accordion-body collapse in">
<div class="accordion-inner">
@ -919,7 +919,7 @@ in a list of search results.</em></p>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-244214847"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1501432742"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-244214847" class="accordion-body collapse in">
<div id="namespace-1501432742" class="accordion-body collapse in">
<div class="accordion-inner">
@ -2487,7 +2487,7 @@ an edit is saved.</em></p>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -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));

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1846985423"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-615219511"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1846985423" class="accordion-body collapse in">
<div id="namespace-615219511" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1568925422"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1937681687"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1568925422" class="accordion-body collapse in">
<div id="namespace-1937681687" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1075669396"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-826570683"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1075669396" class="accordion-body collapse in">
<div id="namespace-826570683" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1028100166"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1107660964"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1028100166" class="accordion-body collapse in">
<div id="namespace-1107660964" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-570644175"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-2076669498"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-570644175" class="accordion-body collapse in">
<div id="namespace-2076669498" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-438654213"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-875762809"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-438654213" class="accordion-body collapse in">
<div id="namespace-875762809" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-297484429"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-2022587188"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-297484429" class="accordion-body collapse in">
<div id="namespace-2022587188" class="accordion-body collapse in">
<div class="accordion-inner">
@ -298,7 +298,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1649409454"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-977356070"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1649409454" class="accordion-body collapse in">
<div id="namespace-977356070" class="accordion-body collapse in">
<div class="accordion-inner">
@ -544,7 +544,7 @@ at which the comments are being rendered.</p></td>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1086690381"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1313301697"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1086690381" class="accordion-body collapse in">
<div id="namespace-1313301697" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1517549479"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1929473902"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1517549479" class="accordion-body collapse in">
<div id="namespace-1929473902" class="accordion-body collapse in">
<div class="accordion-inner">
@ -304,7 +304,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1214730968"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-131874565"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1214730968" class="accordion-body collapse in">
<div id="namespace-131874565" class="accordion-body collapse in">
<div class="accordion-inner">
@ -384,7 +384,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-461751090"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-775827532"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-461751090" class="accordion-body collapse in">
<div id="namespace-775827532" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1960358223"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1918430307"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1960358223" class="accordion-body collapse in">
<div id="namespace-1918430307" class="accordion-body collapse in">
<div class="accordion-inner">
@ -246,7 +246,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1934782792"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-251834310"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1934782792" class="accordion-body collapse in">
<div id="namespace-251834310" class="accordion-body collapse in">
<div class="accordion-inner">
@ -381,7 +381,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1594508827"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-417747000"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1594508827" class="accordion-body collapse in">
<div id="namespace-417747000" class="accordion-body collapse in">
<div class="accordion-inner">
@ -503,7 +503,7 @@ the image.</p></td>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-124847631"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1707546201"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-124847631" class="accordion-body collapse in">
<div id="namespace-1707546201" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1806874526"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-25228693"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1806874526" class="accordion-body collapse in">
<div id="namespace-25228693" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1225415547"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-638372598"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1225415547" class="accordion-body collapse in">
<div id="namespace-638372598" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1051402007"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-373741980"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1051402007" class="accordion-body collapse in">
<div id="namespace-373741980" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1600661756"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-119593812"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1600661756" class="accordion-body collapse in">
<div id="namespace-119593812" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1814085800"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1306164280"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1814085800" class="accordion-body collapse in">
<div id="namespace-1306164280" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-630243056"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-423912745"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-630243056" class="accordion-body collapse in">
<div id="namespace-423912745" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1785272022"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1367647496"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1785272022" class="accordion-body collapse in">
<div id="namespace-1367647496" class="accordion-body collapse in">
<div class="accordion-inner">
@ -340,7 +340,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1205710674"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-453139013"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1205710674" class="accordion-body collapse in">
<div id="namespace-453139013" class="accordion-body collapse in">
<div class="accordion-inner">
@ -295,7 +295,7 @@ enabled, or sha256 otherwise.</p>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1867778079"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1278657214"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1867778079" class="accordion-body collapse in">
<div id="namespace-1278657214" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-61663576"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-2027577659"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-61663576" class="accordion-body collapse in">
<div id="namespace-2027577659" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1968917468"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-857635256"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1968917468" class="accordion-body collapse in">
<div id="namespace-857635256" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-721554424"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1889324532"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-721554424" class="accordion-body collapse in">
<div id="namespace-1889324532" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-2076603952"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1486509053"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-2076603952" class="accordion-body collapse in">
<div id="namespace-1486509053" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-965621944"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1288297845"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-965621944" class="accordion-body collapse in">
<div id="namespace-1288297845" class="accordion-body collapse in">
<div class="accordion-inner">
@ -246,7 +246,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1079981442"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1876411094"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1079981442" class="accordion-body collapse in">
<div id="namespace-1876411094" class="accordion-body collapse in">
<div class="accordion-inner">
@ -246,7 +246,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -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", "<p>$settings->sitename has a function that can send you to a random page. To use it, click <a href='?action=random'>here</a>. $settings->admindetails_name ($settings->sitename's adminstrator) may have added it to one of the menus.</p>");

View file

@ -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.
*/

View file

@ -244,12 +244,17 @@ function render_recent_change($rchange)
$result .= "<a href='?page=" . rawurlencode($rchange->page) . ($revisionId !== false ? "&revision=$revisionId" : "") . "'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml <span class='$size_display_class' title='$size_title_display'>($size_display)</span>";
break;
case "deletion":
$resultClasses[] = "deletion";
$result .= "$pageDisplayHtml $editorDisplayHtml $timeDisplayHtml";
break;
case "move":
$resultClasses[] = "move";
$result .= "$rchange->oldpage &#11106; <a href='?page=" . rawurlencode($rchange->page) . "'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml";
break;
case "upload":
$resultClasses[] = "upload";
$result .= "<a href='?page=$rchange->page'>$pageDisplayHtml</a> $editorDisplayHtml $timeDisplayHtml (" . human_filesize($rchange->filesize) . ")";

View file

@ -1,7 +1,7 @@
<?php
register_module([
"name" => "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('/</u', '&lt;', $context)
);
/*if(strlen($context) == 0)
{
$context = search::strip_markup(file_get_contents("$env->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", "<strong class='search-term-highlight'>$0</strong>", $context);
$context = preg_replace("/" . preg_replace('/\\//u', "\/", preg_quote($qterm)) . "/iu", "<strong class='search-term-highlight'>$0</strong>", $context);
}
return $context;

View file

@ -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

View file

@ -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), "<p><a href='index.php?page=" . rawurlencode($env->page) . "'>" . htmlentities($env->page) . "</a> has been moved to <a href='index.php?page=" . rawurlencode($new_name) . "'>" . htmlentities($new_name) . "</a> successfully.</p>"));
});

View file

@ -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.

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1979943815"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1037350861"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1979943815" class="accordion-body collapse in">
<div id="namespace-1037350861" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -136,10 +136,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-470325388"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1317610252"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-470325388" class="accordion-body collapse in">
<div id="namespace-1317610252" class="accordion-body collapse in">
<div class="accordion-inner">
@ -239,7 +239,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -152,7 +152,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -88,10 +88,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-427073806"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1616927494"></a>
<a href="namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-427073806" class="accordion-body collapse in">
<div id="namespace-1616927494" class="accordion-body collapse in">
<div class="accordion-inner">
@ -3515,7 +3515,7 @@ listed to be cacnonical.</em></p>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -88,10 +88,10 @@
<div class="accordion" style="margin-bottom: 0">
<div class="accordion-group">
<div class="accordion-heading">
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1657348484"></a>
<a class="accordion-toggle " data-toggle="collapse" data-target="#namespace-1392434946"></a>
<a href="../namespaces/default.html" style="margin-left: 30px; padding-left: 0">\</a>
</div>
<div id="namespace-1657348484" class="accordion-body collapse in">
<div id="namespace-1392434946" class="accordion-body collapse in">
<div class="accordion-inner">
@ -3515,7 +3515,7 @@ listed to be cacnonical.</em></p>
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -142,7 +142,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -1086,7 +1086,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -121,12 +121,12 @@
</tr>
<tr>
<td>TODO</td>
<td>373</td>
<td>376</td>
<td>Make this moree clevererer :D</td>
</tr>
<tr>
<td>TODO</td>
<td>644</td>
<td>652</td>
<td>Identify which platforms don&#039;t have it and whether we still need this</td>
</tr>
</table>
@ -214,7 +214,7 @@
</tr>
<tr>
<td>TODO</td>
<td>636</td>
<td>655</td>
<td>Remove this function and make everything streamable</td>
</tr>
</table>
@ -260,7 +260,7 @@
<section class="span10 offset1">
<hr />
Documentation is powered by <a href="http://www.phpdoc.org/">phpDocumentor </a> and authored
on February 14th, 2018 at 22:17.
on March 27th, 2018 at 15:57.
</section>
</section>
</section>

View file

@ -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": "<p>The page to return the source of.</p>"
}
]
}
},
"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": "<p>Outputs the id index. Useful if you need to verify that it's working as expected.</p>",
"description": "<p>Outputs the id index. Useful if you need to verify that it's working as expected. Output is a json object.</p>",
"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}]",

View file

@ -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": "<p>The page to return the source of.</p>"
}
]
}
},
"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": "<p>Outputs the id index. Useful if you need to verify that it's working as expected.</p>",
"description": "<p>Outputs the id index. Useful if you need to verify that it's working as expected. Output is a json object.</p>",
"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}]",

View file

@ -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"
}

View file

@ -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"
}

View file

@ -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
},
{

View file

@ -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.
*/