Succinct without causing PHP notices even for array access.
+if (empty($User['admin']))
abort("geen beheersrechten", '401 unauthorised');
if ($_FILES) {
abort("geen beheersrechten", '401 unauthorised');
if ($_FILES) {
$message = 'Uitgelogd.';
}
$message = 'Uitgelogd.';
}
-if (isset($_GET['goto']) and isset($User)) {
+if (empty($User)) {
+ ob_clean();
+ require_once 'login.inc.php';
+ return TRUE;
+}
+
+if (isset($_GET['goto'])) {
ob_clean();
$target = ltrim($_GET['goto'], '/');
header("Location: /$target");
http_response_code(302);
exit;
}
ob_clean();
$target = ltrim($_GET['goto'], '/');
header("Location: /$target");
http_response_code(302);
exit;
}
-
-if (empty($User)) {
- ob_clean();
- require_once 'login.inc.php';
- return TRUE;
-}
?>
<p>Ingelogd als <em><?php print $User['name']; ?></em>.</p>
?>
<p>Ingelogd als <em><?php print $User['name']; ?></em>.</p>
ob_start();
include DOCROOT.'menu.html';
ob_start();
ob_start();
include DOCROOT.'menu.html';
ob_start();
print '<div class="login"><p>';
printf('<span>Ingelogd: <b><a href="%s">%s</a></b></span>', '/login', $User['name']);
print '<div class="login"><p>';
printf('<span>Ingelogd: <b><a href="%s">%s</a></b></span>', '/login', $User['name']);
+ if (!empty($User['admin'])) {
$editpage = $Page.$Args;
if (is_dir($editpage)) {
if (file_exists("$editpage/index.html")) {
$editpage = $Page.$Args;
if (is_dir($editpage)) {
if (file_exists("$editpage/index.html")) {
$html = $request == $m[1] ? $m[2] : $m[0]; # text or full link
return $m[1] == substr($request, 0, strlen($m[1])) ? "<b>$html</b>" : $html;
}, $nav);
$html = $request == $m[1] ? $m[2] : $m[0]; # text or full link
return $m[1] == substr($request, 0, strlen($m[1])) ? "<b>$html</b>" : $html;
}, $nav);
$nav = preg_replace('{\s*<li class="logout">.*?</li>}', '', $nav);
}
else {
$nav = preg_replace('{\s*<li class="logout">.*?</li>}', '', $nav);
}
else {
print "</footer>\n";
global $User;
print "</footer>\n";
global $User;
- if (isset($User) and $User['admin']) {
+ if (!empty($User['admin'])) {
print '<script src="//cdn.ckeditor.com/4.7.3/full-all/ckeditor.js"></script>'."\n";
print '<script src="/edit.js"></script>'."\n";
}
print '<script src="//cdn.ckeditor.com/4.7.3/full-all/ckeditor.js"></script>'."\n";
print '<script src="/edit.js"></script>'."\n";
}
while (TRUE) {
if (file_exists("$Page/.private")) {
# access restriction
while (TRUE) {
if (file_exists("$Page/.private")) {
# access restriction
http_response_code(303);
$target = urlencode($_SERVER['REQUEST_URI']);
header("Location: /login?goto=$target");
http_response_code(303);
$target = urlencode($_SERVER['REQUEST_URI']);
header("Location: /login?goto=$target");
elseif (file_exists("$Page$Args.html")) {
$found = include "./$Page$Args.html";
}
elseif (file_exists("$Page$Args.html")) {
$found = include "./$Page$Args.html";
}
-elseif (isset($User) and $User['admin']) {
+elseif (!empty($User['admin'])) {
$found = include (file_exists("$Page/template.html") ? "$Page/template.html" : './template.html');
}
$found = include (file_exists("$Page/template.html") ? "$Page/template.html" : './template.html');
}