# keep either login or logout parts depending on user level
global $User;
$hideclass = empty($User) ? 'login' : 'logout';
- $doc = preg_replace('{\s*<(p|li|span) class="'.$hideclass.'">.*?</\1>}s', '', $doc);
+ $doc = preg_replace('{\s*<([a-z]+) class="'.$hideclass.'">.*?</\1>}s', '', $doc);
return preg_replace_callback(
'{ (?<! <!--BLOCK: ) \[\[ ([^] ]+) ([^]]*) \]\] }x',
function fail($error)
{
+ global $User, $Page, $Args;
http_response_code(500);
+ if (!isset($Article)) {
+ $Article = new ArchiveArticle(NULL);
+ $Article->title = 'Fout';
+ }
include_once 'page.inc.php';
ob_start();
- require_once '500.inc.html';
- print getoutput(['debug' => $error]);
+ require '500.inc.html';
+ print getoutput(['debug' => htmlspecialchars($error)]);
}
set_exception_handler('fail');
];
if (isset($Article->raw)) {
+ if ($User and $User->admin("edit $Page$Args")) {
+ # restore meta tags in static contents for editing
+ foreach (array_reverse($Article->meta) as $metaprop => $val) {
+ $Article->raw = sprintf(
+ '<meta property="%s" content="%s" />'."\n",
+ $metaprop, $val
+ ) . $Article->raw;
+ }
+ }
$Article->raw = '<div class="static">'."\n\n".$Article->raw."</div>\n\n";
}