}
}
+ # 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);
+
return preg_replace_callback(
'{ (?<! <!--BLOCK: ) \[\[ ([^] ]+) ([^]]*) \]\] }x',
function ($sub) use ($blocks) {
# user login and control
+$User = NULL;
include_once 'auth.inc.php';
$Edit = isset($_GET['edit']);
elseif (file_exists("$Page$Args/index.html")) {
$staticpage = "$Page$Args/index.html";
}
-elseif (!empty($User['admin'])) {
+elseif ($User and $User->admin) {
$staticpage = (file_exists("$Page/template.html") ? "$Page/template.html" : 'template.html');
}
}
$Place += [
- 'user' => empty($User) ? '' : $User['name'],
+ 'user' => $User ? $User->login : '',
'url' => htmlspecialchars($_SERVER['REQUEST_URI']),
];