page: call handler through index method
authorMischa POSLAWSKY <perl@shiar.org>
Tue, 29 Dec 2020 00:53:49 +0000 (01:53 +0100)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 6 Jan 2021 21:17:25 +0000 (22:17 +0100)
article.inc.php
issue/index.php
page.php
widget/sitemap.php

index 1dbda25e0dc1b3c70186114979605e71a8a9acfa..f14de99079301d2574d0ae5752c5d5af76a22579 100644 (file)
@@ -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()
index 62182ac28356c72c40bc029118f9c798a6497bc7..8b42d11f7c499699a2d51ac4debb80ff628478d8 100644 (file)
@@ -1,5 +1,5 @@
 <?php
-global $User, $Db;
+global $User, $Db, $Issue;
 require_once 'database.inc.php';
 @list ($id, $title) = explode('/', ltrim($Page->path, '/'));
 
index dae508103159e3518fab45a6334ba14255a95710..0c101f8026e78dfe226e0350c56198c8f7e30136 100644 (file)
--- a/page.php
+++ b/page.php
@@ -69,7 +69,7 @@ if (isset($Page->raw)) {
 include_once 'format.inc.php';
 
 ob_start();
-if ($Page->handler and !require("./{$Page->handler}/index.php")) {
+if ($Page->handler and !$Page->index($Page->api)) {
        # replace contents by code output on false return
        $Page->raw = ob_get_clean();
 }
index 35e726fb628a0866b11b18a92d8f8f64541ce8b6..e4289f896f04ac0d4ecc219d5f65509a2ae9ff43 100644 (file)
@@ -4,7 +4,7 @@ $search = new PageSearch($Page->place[0] ?? '.');
 print '<ul class="replies">'."\n";
 foreach ($search->files() as $ref => $article) {
        print '<li>';
-       include 'linkref.php';
+       require 'linkref.php';
        if (is_array($article->index)) {
                print '<ul>';
                foreach ($article->index as $article) {