page: replace global variables by $Page object
[minimedit.git] / nieuws / index.php
index ff433d5d7b80001921a3d360b66a4796f98f4041..08400153ff15dbaffdf2130d66078b16df0a5971 100644 (file)
@@ -1,27 +1,27 @@
 <?php
-$replyform = $Page == 'melding' && $User->login;
-@list ($year, $page) = explode('/', trim($Args, '/'));
+$replyform = $Page->handler == 'melding' && $User->login;
+@list ($year, $page) = explode('/', trim($Page->path, '/'));
 
-if ($User->admin("edit $Page")) {
+if ($User->admin("edit {$Page->handler}")) {
        print '<script src="/nieuws/edit.js"></script>'."\n";
 }
 
 if ($page and !is_numeric($page)) {
-       $Article->meta['og:type'] = 'article';
-       $edit = $User->admin("edit $Page$Args") ? htmlspecialchars(@$_GET['edit']) : NULL;
+       $Page->meta['og:type'] = 'article';
+       $edit = $User->admin("edit {$Page->link}") ? htmlspecialchars(@$_GET['edit']) : NULL;
        if ($edit) {
-               $Article->title = $edit;
+               $Page->title = $edit;
        }
-       if ($Article->dateparts) {
-               $Place[1] = ' <small class="date">'.$Article->date.'</small>';
+       if ($Page->dateparts) {
+               $Place[1] = ' <small class="date">'.$Page->date.'</small>';
        }
        else {
                $Place[1] = '';
        }
-       print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]', $Article->raw);
-       if ($User->admin("edit $Page$Args")) {
+       print preg_replace('{(?<=<h2>)(.*?)(?=</h2>)}', ($edit ?: '\1').' [[1]]', $Page->raw);
+       if ($User->admin("edit {$Page->link}")) {
                $taglist = [];
-               foreach (glob("$Page/.tags/*") as $tagpath) {
+               foreach (glob("{$Page->handler}/.tags/*") as $tagpath) {
                        $tagname = pathinfo($tagpath, PATHINFO_BASENAME);
                        $tagvalue = file_exists("$tagpath/$year-$page.html");
                        $tagtarget = is_writable($tagpath);
@@ -47,7 +47,7 @@ if ($page and !is_numeric($page)) {
 }
 
 if ($year) {
-       $match = $Page;
+       $match = $Page->handler;
        $title = "Nieuws";
        if (is_numeric($year) and $year > 999) {
                $match .= "/$year";
@@ -61,7 +61,7 @@ if ($year) {
                $match .= "/19??";
                $title .= " vóór 2000";
        }
-       elseif (file_exists("$Page/.tags/$year")) {
+       elseif (file_exists("{$Page->handler}/.tags/$year")) {
                $match .= "/.tags/$year";
                $title .= " met $year";
        }