*/ // Initialises a new object to store your wiki's settings in. Please don't touch this. $settings = new stdClass(); // The site's name. Used all over the place. // Note that by default the session cookie is perfixed with a variant of the sitename so changing this will log everyone out! $settings->sitename = "Pepperminty Wiki"; // The url from which to fetch updates. Defaults to the master (development) // branch If there is sufficient demand, a separate stable branch will be // created. Note that if you use the automatic updater currently it won't save // your module choices. // MAKE SURE THAT THIS POINTS TO A *HTTPS* URL, OTHERWISE SOMEONE COULD INJECT A VIRUS INTO YOUR WIKI $settings->updateurl = "https://raw.githubusercontent.com/sbrl/pepperminty-wiki/master/index.php"; // The secret key used to perform 'dangerous' actions, like updating the wiki, // and deleting pages. It is strongly advised that you change this! $settings->sitesecret = "ed420502615bac9037f8f12abd4c9f02"; // Determined whether edit is enabled. Set to false to disable disting for all // users (anonymous or otherwise). $settings->editing = true; // The maximum number of characters allowed in a single page. The default is // 135,000 characters, which is about 50 pages. $settings->maxpagesize = 135000; // Determined whether users who aren't logged in are allowed to edit your wiki. // Set to true to allow anonymous users to log in. $settings->anonedits = false; // The name of the page that will act as the home page for the wiki. This page // will be served if the user didn't specify a page. $settings->defaultpage = "Main Page"; // The default action. This action will be performed if no other action is // specified. It is recommended you set this to "view" - that way the user // automatically views the default page (see above). $settings->defaultaction = "view"; // An array of usernames and passwords - passwords should be hashed with // sha256. Put one user / password on each line, remembering the comma at the // end. The last user in the list doesn't need a comma after their details though. $settings->users = [ "admin" => "5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8", //password "user" => "873ac9ffea4dd04fa719e8920cd6938f0c23cd678af330939cff53c3d2855f34" //cheese ]; // An array of usernames that are administrators. Administrators can delete and // move pages. $settings->admins = [ "admin" ]; // The string that is prepended before an admin's name on the nav bar. Defaults // to a diamond shape (◆). $settings->admindisplaychar = "◆"; // Contact details for the site administrator. Since users can only be added by // editing this file, people will need a contact address to use to ask for an // account. Displayed at the bottom of the page, and will be appropriately // obfusticated to deter spammers. $settings->admindetails = [ "name" => "Administrator", "email" => "admin@localhost" ]; // Array of links and display text to display at the top of the site. // Format: // [ "Display Text", "Link" ] // You can also use strings here and they will be printed as-is, except the following special strings: // search: Expands to a search box. $settings->navlinks = [ [ "Home", "index.php" ], [ "Login", "index.php?action=login" ], " | ", "search", " | ", [ "Read", "index.php?page={page}" ], [ "Edit", "index.php?action=edit&page={page}" ], [ "Printable", "index.php?action=view&printable=yes&page={page}" ], " | ", [ $settings->admindisplaychar . "Delete", "index.php?action=delete&page={page}" ], [ $settings->admindisplaychar . "Move", "index.php?action=move&page={page}" ], " | ", [ "All Pages", "index.php?action=list" ], " | ", [ "Credits", "index.php?action=credits" ], [ "Help", "index.php?action=help" ] ]; // A string of css to include. Will be included in the of every page // inside a "; } public static function render_navigation_bar() { global $settings, $user, $isloggedin, $page; $result = ""; return $result; } public static function render_username($name) { global $settings; $result = ""; if(in_array($name, $settings->admins)) $result .= $settings->admindisplaychar; $result .= $name; return $result; } public static function generate_all_pages_datalist() { global $pageindex; $result = "\n"; foreach($pageindex as $pagename => $pagedetails) { $result .= "\t\t\t"; return $result; } } //////////////////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////// Slimdown ///////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////// %slimdown% // //////////////////////////////////////////////////////////////////////////////////////////// /** * Slimdown - A very basic regex-based Markdown parser. Supports the * following elements (and can be extended via Slimdown::add_rule()): * * - Headers * - Links * - Bold * - Emphasis * - Deletions * - Quotes * - Inline code * - Blockquotes * - Ordered/unordered lists * - Horizontal rules * * Author: Johnny Broadway * Website: https://gist.github.com/jbroadway/2836900 * License: MIT */ /** * Modified by Starbeamrainbowlabs (starbeamrainbowlabs) * * Changed bold to use single asterisks * Changed italics to use single underscores * Added one to add the heading levels (no

tags allowed) * Added wiki style internal link parsing * Added wiki style internal link parsing with display text */ class Slimdown { public static $rules = array ( '/\r\n/' => "\n", // new line normalisation '/(#+)(.*)/' => 'self::header', // headers '/(\*)(.*?)\1/' => '\2', // bold // todo test these '/!\[(.*)\]\((.*)\)/' => '\1', // basic images // todo end '/(_)(.*?)\1/' => '\2', // emphasis '/\[\[([a-zA-Z0-9\_\- ]+)\|([a-zA-Z0-9\_\- ]+)\]\]/' => '\2', //internal links with display text '/\[\[([a-zA-Z0-9\_\- ]+)\]\]/' => '\1', //internal links '/\[([^\[]+)\]\(([^\)]+)\)/' => '\1', // links '/\~\~(.*?)\~\~/' => '\1', // del '/\:\"(.*?)\"\:/' => '\1', // quote '/`(.*?)`/' => '\1', // inline code '/\n\s*(\*|-)(.*)/' => 'self::ul_list', // ul lists '/\n[0-9]+\.(.*)/' => 'self::ol_list', // ol lists '/\n(>|\>)(.*)/' => 'self::blockquote', // blockquotes '/\n-{3,}/' => "\n
", // horizontal rule '/\n([^\n]+)\n\n/' => 'self::para', // add paragraphs '/<\/ul>\s?