login/pass: error messages below page title
[minimedit.git] / article.inc.php
index 1dbda25e0dc1b3c70186114979605e71a8a9acfa..093852f96753e712014e0f07961f6c8a34cb8552 100644 (file)
@@ -48,7 +48,7 @@ class ArchiveArticle
                $this->path = '';
                $this->restricted = FALSE;
                while (TRUE) {
-                       if (file_exists("$path/.private")) {
+                       if (file_exists("$path/.private") and !$this->restricted) {
                                $this->restricted = $path;
                        }
 
@@ -66,16 +66,16 @@ class ArchiveArticle
                return;
        }
 
-       function index()
+       function index($api = TRUE)
        {
                $this->handler;
                if (empty($this->handler)) {
                        return;
                }
-               $this->api = TRUE;
+               $this->api = $api;
                $Page = $this;
-               $res = include "./{$this->handler}/index.php";
-               return $res;
+               global $User;
+               return require "./{$this->handler}/index.php";
        }
 
        function restricted()
@@ -187,7 +187,7 @@ class ArchiveArticle
                else {
                        foreach (explode(' ', $params) as $param) {
                                if ($set = strpos($param, '=')) {
-                                       $Page->place[ substr($param, 0, $set) ] = substr($param, $set + 1);
+                                       $Page->place[ substr($param, 0, $set) ] = urldecode(substr($param, $set + 1));
                                }
                                elseif (!empty($param)) {
                                        $Page->place[] = $param;
@@ -223,7 +223,7 @@ class ArchiveArticle
                # keep either login or logout parts depending on user level
                global $User;
                $userexists = $User && property_exists($User, 'login') && $User->login;
-               if (! ($userexists and $User->admin("edit {$this->link}")) ) {
+               if (! ($userexists and !empty($this->editable)) ) {
                        # remove matching elements until first corresponding closing tag
                        $hideclass = $userexists ? 'logout' : 'login';
                        $tagmatch = '<([a-z]+) class="'.$hideclass.'"[^>]*>';