2014-12-26 11:14:29 +00:00
< ? php
2014-12-26 11:06:37 +00:00
/*
* Pepperminty Wiki
* ================
* Inspired by Minty Wiki by am2064 :
* Link : https :// github . com / am2064 / Minty - Wiki
*
* Credits :
2014-12-26 18:14:38 +00:00
* Code by @ Starbeamrainbowlabs
2014-12-26 11:06:37 +00:00
* Slimdown - by Johnny Broadway from https :// gist . github . com / jbroadway / 2836900
2015-01-05 18:53:44 +00:00
* Bug reports :
2015-07-14 15:11:59 +00:00
* #2 - Incorrect closing tag - nibreh <https://github.com/nibreh/>
* #8 - Rogue <datalist /> tag - nibreh <https://github.com/nibreh/>
2014-12-26 11:06:37 +00:00
*/
2015-05-26 09:52:55 +00:00
// Initialises a new object to store your wiki's settings in. Please don't touch this.
2015-04-09 14:13:07 +00:00
$settings = new stdClass ();
2015-05-26 09:52:55 +00:00
// The site's name. Used all over the place.
2015-10-08 09:07:51 +00:00
// Note that by default the session cookie is perfixed with a variant of the
// sitename so changing this will log everyone out!
2015-04-09 14:13:07 +00:00
$settings -> sitename = " Pepperminty Wiki " ;
2014-12-26 11:06:37 +00:00
2015-10-08 09:07:51 +00:00
// A url that points to the site's logo. Leave blank to disable. When enabled
// the logo will be inserted next to the site name on every page.
$settings -> logo_url = " //starbeamrainbowlabs.com/images/logos/peppermint.png " ;
// The side of the site name at which the logo should be placed. May be set to
// either "left" or "right". Only has an effect if the above is not set to an
// empty string.
$settings -> logo_position = " left " ;
2015-05-26 09:52:55 +00:00
// 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
2015-04-09 14:13:07 +00:00
$settings -> updateurl = " https://raw.githubusercontent.com/sbrl/pepperminty-wiki/master/index.php " ;
2014-12-26 11:06:37 +00:00
2015-05-26 09:52:55 +00:00
// The secret key used to perform 'dangerous' actions, like updating the wiki,
// and deleting pages. It is strongly advised that you change this!
2015-04-09 14:13:07 +00:00
$settings -> sitesecret = " ed420502615bac9037f8f12abd4c9f02 " ;
2014-12-26 11:06:37 +00:00
2015-05-26 09:52:55 +00:00
// Determined whether edit is enabled. Set to false to disable disting for all
// users (anonymous or otherwise).
2015-04-09 14:13:07 +00:00
$settings -> editing = true ;
2014-12-26 11:06:37 +00:00
2015-05-26 09:52:55 +00:00
// The maximum number of characters allowed in a single page. The default is
// 135,000 characters, which is about 50 pages.
$settings -> maxpagesize = 135000 ;
2014-12-26 11:06:37 +00:00
2015-10-04 11:42:53 +00:00
// Whether page sources should be cleaned of HTML before rendering. If set to
// true any raw HTML will be escaped before rendering. Note that this shouldn't
// affect code blocks - they should alwys be escaped. It is STRONGLY
// recommended that you keep this option turned on, *ESPECIALLY* if you allow
// anonymous edits as no sanitizing what so ever is performed on the HTML.
2015-10-04 13:04:42 +00:00
// Also note that some parsers may override this setting and escape HTML
// sequences anyway.
2015-10-04 11:42:53 +00:00
$settings -> clean_raw_html = true ;
2015-05-26 09:52:55 +00:00
// Determined whether users who aren't logged in are allowed to edit your wiki.
// Set to true to allow anonymous users to log in.
2015-04-09 14:13:07 +00:00
$settings -> anonedits = false ;
2014-12-26 11:06:37 +00:00
2015-05-26 09:52:55 +00:00
// 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.
2015-04-09 14:13:07 +00:00
$settings -> defaultpage = " Main Page " ;
2014-12-26 11:06:37 +00:00
2015-05-26 09:52:55 +00:00
// 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).
2015-04-11 13:22:53 +00:00
$settings -> defaultaction = " view " ;
2015-10-04 08:10:14 +00:00
// The parser to use when rendering pages. Defaults to 'default', which is a
// modified version of slimdown, originally written by
// Johnny Broadway <johnny@johnnybroadway.com>.
$settings -> parser = " default " ;
2015-07-14 15:59:29 +00:00
// Whether to show a list of subpages at the bottom of the page.
$settings -> show_subpages = true ;
// The depth to which we should display when listing subpages at the bottom of
// the page.
$settings -> subpages_display_depth = 3 ;
2015-05-26 09:52:55 +00:00
// 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.
2015-04-09 14:13:07 +00:00
$settings -> users = [
2014-12-26 11:06:37 +00:00
" admin " => " 5e884898da28047151d0e56f8dc6292773603d0d6aabbdd62a11ef721d1542d8 " , //password
" user " => " 873ac9ffea4dd04fa719e8920cd6938f0c23cd678af330939cff53c3d2855f34 " //cheese
];
2015-10-10 12:00:46 +00:00
// Whether to use the new sha3 hashing algorithm that was standardised on the
// 8th August 2015. Only works if you have strawbrary's sha3 extension
// installed. Get it here: https://github.com/strawbrary/php-sha3
$settings -> use_sha3 = false ;
2015-05-26 09:52:55 +00:00
// An array of usernames that are administrators. Administrators can delete and
// move pages.
2015-04-09 14:13:07 +00:00
$settings -> admins = [ " admin " ];
2014-12-26 18:14:38 +00:00
2015-05-26 09:52:55 +00:00
// The string that is prepended before an admin's name on the nav bar. Defaults
// to a diamond shape (◆).
2015-04-09 14:13:07 +00:00
$settings -> admindisplaychar = " ◆ " ;
2014-12-26 18:14:38 +00:00
2015-09-30 06:08:03 +00:00
// The string that is prepended a page's name in the page title if it is
// protected. Defaults to a lock symbol.
$settings -> protectedpagechar = " 🔒 " ;
2015-05-26 09:52:55 +00:00
// 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.
2015-04-09 14:13:07 +00:00
$settings -> admindetails = [
2014-12-26 14:00:26 +00:00
" name " => " Administrator " ,
" email " => " admin@localhost "
];
2015-07-18 09:58:42 +00:00
// Whether to only allow adminstrators to export the your wiki as a zip using
// the page-export module.
$settings -> export_allow_only_admins = false ;
2015-05-26 09:52:55 +00:00
// Array of links and display text to display at the top of the site.
// Format:
// [ "Display Text", "Link" ]
2015-07-15 19:40:58 +00:00
// You can also use strings here and they will be printed as-is, except the
// following special strings:
2015-07-16 09:45:55 +00:00
// user-status Expands to the user's login information
// e.g. "Logged in as {name}. | Logout".
// e.g. "Browsing as Anonymous. | Login".
//
// search Expands to a search box.
//
// divider Expands to a divider to separate stuff.
//
// more Expands to the "More..." submenu.
2015-07-16 09:16:02 +00:00
$settings -> nav_links = [
2015-07-16 09:45:55 +00:00
" user-status " ,
2014-12-26 12:19:43 +00:00
[ " Home " , " index.php " ],
2015-07-16 10:33:45 +00:00
// [ "Login", "index.php?action=login" ],
2014-12-26 12:19:43 +00:00
" search " ,
[ " Read " , " index.php?page= { page} " ],
[ " Edit " , " index.php?action=edit&page= { page} " ],
[ " Printable " , " index.php?action=view&printable=yes&page= { page} " ],
2015-07-15 19:40:58 +00:00
//"divider",
[ " All Pages " , " index.php?action=list " ],
" menu "
];
// An array of additional links in the above format that will be shown under
// "More" subsection.
$settings -> nav_links_extra = [
2015-04-09 14:13:07 +00:00
[ $settings -> admindisplaychar . " Delete " , " index.php?action=delete&page= { page} " ],
2015-09-30 06:08:03 +00:00
[ $settings -> admindisplaychar . " Move " , " index.php?action=move&page= { page} " ],
[ $settings -> admindisplaychar . " Toggle Protection " , " index.php?action=protect&page= { page} " ]
2015-07-15 19:40:58 +00:00
];
// An array of links in the above format that will be shown at the bottom of
// the page.
$settings -> nav_links_bottom = [
2014-12-26 12:19:43 +00:00
[ " Credits " , " index.php?action=credits " ],
[ " Help " , " index.php?action=help " ]
2014-12-26 11:06:37 +00:00
];
2015-09-30 05:39:01 +00:00
// A message that will appear at the bottom of every page. May contain HTML.
2015-09-30 05:44:46 +00:00
$settings -> footer_message = " All content is under <a href='?page=License' target='_blank'>this license</a>. Please make sure that you read and understand the license, especially if you are thinking about copying some (or all) of this site's content, as it may restrict you from doing so. " ;
2015-09-30 05:44:12 +00:00
// A message that will appear just before the submit button on the editing
// page. May contain HTML.
2015-09-30 05:44:46 +00:00
$settings -> editing_message = " By submitting your edit, you are agreeing to release your changes under <a href='?action=view&page=License' target='_blank'>this license</a>. Also note that if you don't want your work to be edited by other users of this site, please don't submit it here! " ;
2015-09-30 05:39:01 +00:00
2015-05-26 09:52:55 +00:00
// A string of css to include. Will be included in the <head> of every page
// inside a <style> tag. This may also be a url - urls will be referenced via a
// <link rel='stylesheet' /> tag.
2015-07-15 19:40:58 +00:00
$settings -> css = " body { margin: 2rem 0; font-family: sans-serif; color: #111111; background: #eee8f2; }
2015-07-17 20:04:24 +00:00
nav { display : flex ; background - color : #8a62a7; color: #ffa74d; }
2015-07-16 09:45:55 +00:00
nav . top { position : absolute ; top : 0 ; left : 0 ; right : 0 ; box - shadow : inset 0 - 0.6 rem 0.8 rem - 0.5 rem rgba ( 50 , 50 , 50 , 0.5 ); }
nav . bottom { position : absolute ; left : 0 ; right : 0 ; box - shadow : inset 0 0.8 rem 0.8 rem - 0.5 rem rgba ( 50 , 50 , 50 , 0.5 ); }
2015-07-17 20:04:24 +00:00
2015-07-16 10:33:45 +00:00
nav > span { flex : 1 ; text - align : center ; line - height : 2 ; display : inline - block ; margin : 0 ; padding : 0.3 rem 0.5 rem ; border - left : 3 px solid #442772; border-right: 3px solid #442772; }
2015-07-17 20:04:24 +00:00
nav : not ( . nav - more - menu ) a { text - decoration : none ; font - weight : bolder ; color : inherit ; }
2015-07-15 19:40:58 +00:00
. nav - divider { color : transparent ; }
2015-07-17 20:04:24 +00:00
. nav - more { position : relative ; background - color : #442772; }
. nav - more label { cursor : pointer ; }
. nav - more - menu { display : none ; position : absolute ; flex - direction : column ; top : 2.6 rem ; right : - 0.2 rem ; background - color : #8a62a7; border-top: 3px solid #442772; border-bottom: 3px solid #442772;}
input [ type = checkbox ] : checked ~ . nav - more - menu { display : block ; box - shadow : 0.4 rem 0.4 rem 1 rem 0 rgba ( 50 , 50 , 50 , 0.5 ); }
. nav - more - menu span { min - width : 8 rem ; }
2015-07-15 19:40:58 +00:00
. inflexible { flex : none ; }
2015-07-17 20:04:24 +00:00
. off - screen { position : absolute ; top : - 1000 px ; left : - 1000 px ;}
2015-07-16 10:33:45 +00:00
input [ type = search ] { width : 14 rem ; padding : 0.3 rem 0.4 rem ; font - size : 1 rem ; color : white ; background : rgba ( 255 , 255 , 255 , 0.4 ); border : 0 ; border - radius : 0.3 rem ; }
input [ type = search ] ::- webkit - input - placeholder { color : rgba ( 255 , 255 , 255 , 0.75 ); }
2015-07-17 20:04:24 +00:00
input [ type = button ], input [ type = submit ] { cursor : pointer ; }
2015-08-04 19:12:18 +00:00
. sidebar { position : relative ; z - index : 100 ; margin - top : 0.6 rem ; padding : 1 rem 3 rem 2 rem 0.4 rem ; background : #9e7eb4; box-shadow: inset -0.6rem 0 0.8rem -0.5rem rgba(50, 50, 50, 0.5); }
. sidebar a { color : #ffa74d; }
. sidebar ul { position : relative ; margin : 0.3 rem 0.3 rem 0.3 rem 1 rem ; padding : 0.3 rem 0.3 rem 0.3 rem 1 rem ; list - style - type : none ; }
. sidebar li { position : relative ; margin : 0.3 rem ; padding : 0.3 rem ; }
2015-08-04 19:03:25 +00:00
. sidebar ul : before { content : \ " \" ; position: absolute; top: 0; left: 0; height: 100%; border-left: 2px dashed rgba(50, 50, 50, 0.4); }
. sidebar li : before { content : \ " \" ; position: absolute; width: 1rem; top: 0.8rem; left: -1.2rem; border-bottom: 2px dashed rgba(50, 50, 50, 0.4); }
2015-08-05 11:58:46 +00:00
. printable { padding : 2 rem ; }
2015-07-15 19:40:58 +00:00
h1 { text - align : center ; }
. sitename { margin - top : 5 rem ; margin - bottom : 3 rem ; font - size : 2.5 rem ; }
2015-10-08 09:07:51 +00:00
. logo { max - width : 4 rem ; max - height : 4 rem ; vertical - align : middle ; }
2015-08-05 11:58:46 +00:00
main : not ( . printable ) { padding : 2 rem ; background : #faf8fb; box-shadow: 0 0.1rem 1rem 0.3rem rgba(50, 50, 50, 0.5); }
2015-07-17 20:04:24 +00:00
2015-07-27 14:06:41 +00:00
label { display : inline - block ; min - width : 7 rem ; }
input [ type = text ], input [ type = password ], textarea { margin : 0.5 rem 0.8 rem ; padding : 0.5 rem 0.8 rem ; background : #d5cbf9; border: 0; border-radius: 0.3rem; font-size: 1rem; color: #442772; }
textarea { width : calc ( 100 % - 2 rem ); min - height : 35 rem ; font - size : 1.25 rem ; }
textarea ~ input [ type = submit ] { width : calc ( 100 % - 0.3 rem ); margin : 0.5 rem 0.8 rem ; padding : 0.5 rem ; font - weight : bolder ; }
2015-07-17 20:04:24 +00:00
2015-07-15 19:40:58 +00:00
footer { padding : 2 rem ; }
2015-07-28 12:32:18 +00:00
/* #ffdb6d #36962c */ " ;
2015-05-26 09:52:55 +00:00
// A url that points to the favicon you want to use for your wiki. By default
// this is set to a data: url of a Peppermint.
// Default favicon credit: Peppermint by bluefrog23
// Link: https://openclipart.org/detail/19571/peppermint-candy-by-bluefrog23
2015-04-09 14:13:07 +00:00
$settings -> favicon = " data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAMAAAAoLQ9TAAAB3VBMVEXhERHbKCjeVVXjb2/kR0fhKirdHBziDg6qAADaHh7qLy/pdXXUNzfMAADYPj7ZPDzUNzfbHx/fERHpamrqMTHgExPdHx/bLCzhLS3fVFTjT0/ibm7kRkbiLi7aKirdISHeFBTqNDTpeHjgERHYJCTVODjYQkLaPj6/AADVOTnpbW3cIyPdFRXcJCThMjLiTU3ibW3fVVXaKyvcERH4ODj+8fH/////fHz+Fxf4KSn0UFD/CAj/AAD/Xl7/wMD/EhL//v70xMT/+Pj/iYn/HBz/g4P/IyP/Kyv/7Oz0QUH/9PT/+vr/ior/Dg7/vr7/aGj/QED/bGz/AQH/ERH/Jib/R0f/goL/0dH/qan/YWH/7e3/Cwv4R0f/MTH/enr/vLz/u7v/cHD/oKD/n5//aWn+9/f/k5P/0tL/trb/QUH/cXH/dHT/wsL/DQ3/p6f/DAz/1dX/XV3/kpL/i4v/Vlb/2Nj/9/f/pKT+7Oz/V1f/iIj/jIz/r6//Zmb/lZX/j4//T0//Dw/4MzP/GBj/+fn/o6P/TEz/xMT/b2//Tk7/OTn/HR3/hIT/ODj/Y2P/CQn/ZGT/6Oj0UlL/Gxv//f3/Bwf/YmL/6+v0w8P/Cgr/tbX0QkL+9fX4Pz/qNzd0dFHLAAAAAXRSTlMAQObYZgAAAAFiS0dEAIgFHUgAAAAJcEhZcwAACxMAAAsTAQCanBgAAAAHdElNRQfeCxINNSdmw510AAAA5ElEQVQYGQXBzSuDAQCA8eexKXOwmSZepa1JiPJxsJOrCwcnuchBjg4O/gr7D9zk4uAgJzvuMgcTpYxaUZvSm5mUj7TX7ycAqvoLIJBwStVbP0Hom1Z/ejoxrbaR1Jz6nWinbKWttGRgMSSjanPktRY6mB9WtRNTn7Ilh7LxnNpKq2/x5LnBitfz+hx0qxUaxhZ6vwqq9bx6f2XXvuUl9SVQS38NR7cvln3v15tZ9bQpuWDtZN3Lgh5DWJex3Y+z1KrVhw21+CiM74WZo83DiXq0dVBDYNJkFEU7WrwDAZhRtQrwDzwKQbT6GboLAAAAAElFTkSuQmCC " ;
2014-12-26 11:06:37 +00:00
2015-05-26 09:52:55 +00:00
// The prefix that should be used in the names of the session variables.
// Defaults to an all lower case version of the site name with all non
// alphanumeric characters removed. Remember that changing this will log
// everyone out since the session variable's name will have changed.
// Normally you won't have to change this - This setting is left over from when
// we used a cookie to store login details.
// By default this is set to a safe variant on your site name.
2015-04-09 14:13:07 +00:00
$settings -> sessionprefix = preg_replace ( " /[^0-9a-z]/i " , " " , strtolower ( $settings -> sitename ));
2014-12-26 11:06:37 +00:00
/*
Actions :
view - view a page
2014-12-28 10:16:28 +00:00
page - page name
2014-12-26 11:06:37 +00:00
printable = [ yes / no ] - make output printable
edit - open editor for page
2014-12-28 10:16:28 +00:00
page - page name
2014-12-26 11:06:37 +00:00
save - save edits to page
2014-12-28 10:16:28 +00:00
page - page name
2014-12-26 11:06:37 +00:00
list - list pages
2015-03-14 18:38:32 +00:00
category - the category to list [ optional ] [ unimplemented ]
2014-12-26 11:06:37 +00:00
login - login to the site
logout - logout
checklogin - check login credentials and set cookie
hash - hash a string with sha256
string - string to hash
help - get help
2015-03-14 18:38:32 +00:00
update - update the wiki
do - set to `true` to actually update the wiki
secret - set to the value of the site ' s secret
2014-12-26 11:06:37 +00:00
credits - view the credits
2014-12-28 10:16:28 +00:00
delete - delete a page
page - page name
delete = yes - actually do the deletion ( otherwise we display a prompt )
2014-12-26 11:06:37 +00:00
*/
2014-12-26 11:14:29 +00:00
?>