1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-06-01 09:53:02 +00:00

Updated build of index.php

This commit is contained in:
Starbeamrainbowlabs 2014-12-26 12:26:39 +00:00
parent ec2008e678
commit 70eef95890

View file

@ -45,19 +45,19 @@ $users = [
//array of links and display text to display at the top of the site //array of links and display text to display at the top of the site
$navlinks = [ $navlinks = [
"Home" => "index.php", [ "Home", "index.php" ],
"Login" => "index.php?action=login", [ "Login", "index.php?action=login" ],
" | " => "", " | ",
"{search}" => "", "search",
" | " => "", " | ",
"Read" => "index.php?page={page}", [ "Read", "index.php?page={page}" ],
"Edit" => "index.php?action=edit&page={page}", [ "Edit", "index.php?action=edit&page={page}" ],
"Printable" => "index.php?action=view&printable=yes&page={page}", [ "Printable", "index.php?action=view&printable=yes&page={page}" ],
" | " => "", " | ",
"All Pages" => "index.php?action=list", [ "All Pages", "index.php?action=list" ],
" | " => "", " | ",
"Credits" => "index.php?action=credits", [ "Credits", "index.php?action=credits" ],
"Help" => "index.php?action=help" [ "Help", "index.php?action=help" ]
]; ];
//contact details for the site administrator. Since user 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 appropriatly obfusticateed to deter spammers. //contact details for the site administrator. Since user 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 appropriatly obfusticateed to deter spammers.
@ -260,25 +260,30 @@ function renderpage($title, $content, $minimal = false)
else else
$html .= "\t\tBrowsing as Anonymous. <a href='index.php?action=login'>Login</a>. | \n"; $html .= "\t\tBrowsing as Anonymous. <a href='index.php?action=login'>Login</a>. | \n";
foreach($navlinks as $display => $url) foreach($navlinks as $item)
{ {
if($display == "{search}") if(is_string($item))
{ {
//output a search bar //the item is a string
$html .= "<form method='get' action='index.php' style='display: inline;'><input type='search' name='page' list='allpages' placeholder='Type a page name here and hit enter' /></form>"; switch($item)
} {
else if(strlen($url) === 0) //keywords
{ case "search": //displays a search bar
//the url has not been set, output $display directly $html .= "<form method='get' action='index.php' style='display: inline;'><input type='search' name='page' list='allpages' placeholder='Type a page name here and hit enter' /></form>";
$html .= " " . trim($display) . " "; break;
//it isn't a keyword, so just output it directly
default:
$html .= $item;
}
} }
else else
{ {
//output the display as a link to the url //output the display as a link to the url
$html .= "\t\t<a href='" . str_replace("{page}", $_GET["page"], $url) . "'>$display</a>\n"; $html .= "\t\t<a href='" . str_replace("{page}", $_GET["page"], $item[1]) . "'>$item[0]</a>\n";
} }
} }
$html .= " </nav> $html .= " </nav>
<h1 class='sitename'>$sitename</h1> <h1 class='sitename'>$sitename</h1>
$content $content