1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-22 16:33:00 +00:00

more misc bug fixes

This commit is contained in:
Starbeamrainbowlabs 2015-05-24 21:06:03 +01:00
parent 2326bc479e
commit edab5a4930
3 changed files with 33 additions and 19 deletions

View file

@ -155,7 +155,7 @@ class page_renderer
<meta charset='utf-8' /> <meta charset='utf-8' />
<title>{title}</title> <title>{title}</title>
<meta name='viewport' content='width=device-width, initial-scale=1' /> <meta name='viewport' content='width=device-width, initial-scale=1' />
<link rel='shortcut-icon' href='{favicon-url} /> <link rel='shortcut-icon' href='{favicon-url}' />
{header-html} {header-html}
</head> </head>
<body> <body>
@ -218,10 +218,16 @@ class page_renderer
self::generate_all_pages_datalist() self::generate_all_pages_datalist()
], $result); ], $result);
$result = str_replace("{content}", $content, $result); $result = str_replace([
"{title}",
"{content}"
], [
$title,
$content
], $result);
$result = str_replace("{generation-time-taken}", microtime(true) - $start_time, $result); $result = str_replace("{generation-time-taken}", microtime(true) - $start_time, $result);
return result; return $result;
} }
public static function render_main($title, $content) public static function render_main($title, $content)
{ {
@ -245,7 +251,7 @@ class page_renderer
public static function render_navigation_bar() public static function render_navigation_bar()
{ {
global $settings, $user, $page; global $settings, $user, $isloggedin, $page;
$result = "<nav>\n"; $result = "<nav>\n";
if($isloggedin) if($isloggedin)
@ -254,7 +260,7 @@ class page_renderer
$result .= "<a href='index.php?action=logout'>Logout</a>. | \n"; $result .= "<a href='index.php?action=logout'>Logout</a>. | \n";
} }
else else
$html .= "\t\t\tBrowsing as Anonymous. <a href='index.php?action=login'>Login</a>. | \n"; $result .= "\t\t\tBrowsing as Anonymous. <a href='index.php?action=login'>Login</a>. | \n";
// loop over all the navigation links // loop over all the navigation links
foreach($settings->navlinks as $item) foreach($settings->navlinks as $item)
@ -282,10 +288,11 @@ class page_renderer
} }
$result .= "\t\t</nav>"; $result .= "\t\t</nav>";
return result; return $result;
} }
public static function render_username($name) public static function render_username($name)
{ {
global $settings;
$result = ""; $result = "";
if(in_array($name, $settings->admins)) if(in_array($name, $settings->admins))
$result .= $settings->admindisplaychar; $result .= $settings->admindisplaychar;
@ -301,7 +308,7 @@ class page_renderer
$result = "<datalist id='allpages'>\n"; $result = "<datalist id='allpages'>\n";
foreach($pageindex as $pagename => $pagedetails) foreach($pageindex as $pagename => $pagedetails)
{ {
$html .= "\t\t\t<option value='$pagename' />\n"; $result .= "\t\t\t<option value='$pagename' />\n";
} }
$result = "\t\t</datalist>"; $result = "\t\t</datalist>";

View file

@ -283,7 +283,7 @@ class page_renderer
<meta charset='utf-8' /> <meta charset='utf-8' />
<title>{title}</title> <title>{title}</title>
<meta name='viewport' content='width=device-width, initial-scale=1' /> <meta name='viewport' content='width=device-width, initial-scale=1' />
<link rel='shortcut-icon' href='{favicon-url} /> <link rel='shortcut-icon' href='{favicon-url}' />
{header-html} {header-html}
</head> </head>
<body> <body>
@ -346,10 +346,16 @@ class page_renderer
self::generate_all_pages_datalist() self::generate_all_pages_datalist()
], $result); ], $result);
$result = str_replace("{content}", $content, $result); $result = str_replace([
"{title}",
"{content}"
], [
$title,
$content
], $result);
$result = str_replace("{generation-time-taken}", microtime(true) - $start_time, $result); $result = str_replace("{generation-time-taken}", microtime(true) - $start_time, $result);
return result; return $result;
} }
public static function render_main($title, $content) public static function render_main($title, $content)
{ {
@ -373,7 +379,7 @@ class page_renderer
public static function render_navigation_bar() public static function render_navigation_bar()
{ {
global $settings, $user, $page; global $settings, $user, $isloggedin, $page;
$result = "<nav>\n"; $result = "<nav>\n";
if($isloggedin) if($isloggedin)
@ -382,7 +388,7 @@ class page_renderer
$result .= "<a href='index.php?action=logout'>Logout</a>. | \n"; $result .= "<a href='index.php?action=logout'>Logout</a>. | \n";
} }
else else
$html .= "\t\t\tBrowsing as Anonymous. <a href='index.php?action=login'>Login</a>. | \n"; $result .= "\t\t\tBrowsing as Anonymous. <a href='index.php?action=login'>Login</a>. | \n";
// loop over all the navigation links // loop over all the navigation links
foreach($settings->navlinks as $item) foreach($settings->navlinks as $item)
@ -410,10 +416,11 @@ class page_renderer
} }
$result .= "\t\t</nav>"; $result .= "\t\t</nav>";
return result; return $result;
} }
public static function render_username($name) public static function render_username($name)
{ {
global $settings;
$result = ""; $result = "";
if(in_array($name, $settings->admins)) if(in_array($name, $settings->admins))
$result .= $settings->admindisplaychar; $result .= $settings->admindisplaychar;
@ -429,7 +436,7 @@ class page_renderer
$result = "<datalist id='allpages'>\n"; $result = "<datalist id='allpages'>\n";
foreach($pageindex as $pagename => $pagedetails) foreach($pageindex as $pagename => $pagedetails)
{ {
$html .= "\t\t\t<option value='$pagename' />\n"; $result .= "\t\t\t<option value='$pagename' />\n";
} }
$result = "\t\t</datalist>"; $result = "\t\t</datalist>";
@ -1149,7 +1156,7 @@ register_module([
register_module([ register_module([
"name" => "Page viewer", "name" => "Page viewer",
"version" => "0.4", "version" => "0.6",
"author" => "Starbeamrainbowlabs", "author" => "Starbeamrainbowlabs",
"description" => "Allows you to view pages. You should include this one.", "description" => "Allows you to view pages. You should include this one.",
"id" => "page-view", "id" => "page-view",
@ -1185,9 +1192,9 @@ register_module([
$content .= "\n\t<!-- Took " . (microtime(true) - $slimdown_start) . " seconds to parse markdown -->\n"; $content .= "\n\t<!-- Took " . (microtime(true) - $slimdown_start) . " seconds to parse markdown -->\n";
if(isset($_GET["printable"]) and $_GET["printable"] === "yes") if(isset($_GET["printable"]) and $_GET["printable"] === "yes")
exit(page_renderer::render_minimal($title, $content, $minimal)); exit(page_renderer::render_minimal($title, $content));
else else
exit(page_renderer::render_main($title, $content, $minimal)); exit(page_renderer::render_main($title, $content));
}); });
} }
]); ]);

View file

@ -81,10 +81,10 @@
}, },
{ {
"name": "Page viewer", "name": "Page viewer",
"version": "0.4", "version": "0.6",
"author": "Starbeamrainbowlabs", "author": "Starbeamrainbowlabs",
"description": "Allows you to view pages. You should include this one.", "description": "Allows you to view pages. You should include this one.",
"id": "page-view", "id": "page-view",
"lastupdate": 1432497592 "lastupdate": 1432497918
} }
] ]