-$replyform = $Page == 'melding' && !empty($User);
-@list ($year, $page) = explode('/', trim($Args, '/'));
+$replyform = $Page->handler == 'melding' && $User->login;
+@list ($year, $page) = explode('/', trim($Page->path, '/'));
-if ($User and $User->admin('news')) {
- print '<script src="/nieuws/edit.js"></script>'."\n";
+if ($User->admin("edit {$Page->handler}")) {
+ $Page->raw = '<script src="/nieuws/edit.js"></script>'."\n" . $Page->raw;
- print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]', ob_get_clean());
- if ($User and $User->admin('news')) {
+ else {
+ $Page->place[1] = '';
+ }
+ print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]', $Page->raw);
+ if ($User->admin("edit {$Page->link}")) {
$tagname = pathinfo($tagpath, PATHINFO_BASENAME);
$tagvalue = file_exists("$tagpath/$year-$page.html");
$tagtarget = is_writable($tagpath);
$tagname = pathinfo($tagpath, PATHINFO_BASENAME);
$tagvalue = file_exists("$tagpath/$year-$page.html");
$tagtarget = is_writable($tagpath);