From 7a112df543510d914bfc7f5c6fbb22a865f35c8d Mon Sep 17 00:00:00 2001
From: Andreas Gohr <andi@splitbrain.org>
Date: Fri, 27 Nov 2015 10:52:15 +0100
Subject: [PATCH] add ignoreacl parameter to tpl_include_page #1369

This is needed to accomodate for the change in page_findnearest()
---
 inc/template.php | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/inc/template.php b/inc/template.php
index a1bdc8d64..5c2dc153b 100644
--- a/inc/template.php
+++ b/inc/template.php
@@ -1709,14 +1709,19 @@ function tpl_license($img = 'badge', $imgonly = false, $return = false, $wrap =
  * This function is useful to populate sidebars or similar features in a
  * template
  *
- * @param string $pageid
- * @param bool $print
- * @param bool $propagate
+ * @param string $pageid The page name you want to include
+ * @param bool $print Should the content be printed or returned only
+ * @param bool $propagate Search higher namespaces, too?
+ * @param bool $ignoreacl Include the page without chcking ACLs?
  * @return bool|null|string
  */
-function tpl_include_page($pageid, $print = true, $propagate = false) {
+function tpl_include_page($pageid, $print = true, $propagate = false, $ignoreacl = false) {
     if (!$pageid) return false;
-    if ($propagate) $pageid = page_findnearest($pageid);
+    if($propagate) {
+        $pageid = page_findnearest($pageid, $ignoreacl);
+    } elseif(!$ignoreacl && auth_quickaclcheck($pageid) == AUTH_NONE) {
+        return false;
+    }
 
     global $TOC;
     $oldtoc = $TOC;
-- 
GitLab