From d60a5edeabef4e6b91fe085fb9b72f161e7a64aa Mon Sep 17 00:00:00 2001 From: Cameron Date: Thu, 23 Apr 2015 20:19:14 -0700 Subject: [PATCH] Fixes #973 - permissions lookup issue corrected. --- e107_plugins/forum/forum_class.php | 15 +++++++++++---- e107_plugins/forum/forum_post.php | 7 +++---- 2 files changed, 14 insertions(+), 8 deletions(-) diff --git a/e107_plugins/forum/forum_class.php b/e107_plugins/forum/forum_class.php index 0b0c26764..a9eca3086 100644 --- a/e107_plugins/forum/forum_class.php +++ b/e107_plugins/forum/forum_class.php @@ -454,16 +454,17 @@ class e107forum private function loadPermList() { - $e107 = e107::getInstance(); - if($tmp = $e107->ecache->retrieve_sys('forum_perms')) + if($tmp = e107::getCache()->retrieve_sys('forum_perms')) { + e107::getMessage()->addDebug("Using Permlist cache: True"); $this->permList = e107::unserialize($tmp); } else { + e107::getMessage()->addDebug("Using Permlist cache: False"); $this->_getForumPermList(); $tmp = e107::serialize($this->permList, false); - $e107->ecache->set_sys('forum_perms', $tmp); + e107::getCache()->set_sys('forum_perms', $tmp); } unset($tmp); } @@ -497,7 +498,6 @@ class e107forum private function _getForumPermList() { - $e107 = e107::getInstance(); $sql = e107::getDb(); $this->permList = array(); @@ -535,6 +535,12 @@ class e107forum $tmp[$row['forum_parent']] = 1; } ksort($tmp); + if($key == 'post') + { + //echo "

Raw Perms

"; + // echo "Qry: ".$qryList['post']; + // print_a($tmp); + } $this->permList[$key] = array_keys($tmp); $this->permList[$key.'_list'] = implode(',', array_keys($tmp)); } @@ -545,6 +551,7 @@ class e107forum function checkPerm($forumId, $type='view') { + // print_a( $this->permList[$type]); return (in_array($forumId, $this->permList[$type])); } diff --git a/e107_plugins/forum/forum_post.php b/e107_plugins/forum/forum_post.php index 1803387a5..e5f17082f 100644 --- a/e107_plugins/forum/forum_post.php +++ b/e107_plugins/forum/forum_post.php @@ -51,8 +51,9 @@ class forum_post_handler define('MODERATOR', USER && $this->forumObj->isModerator(USERID)); - $this->checkPerms($this->id); + $this->data = $this->processGet(); + $this->checkPerms($this->data['forum_id']); $this->processPosted(); $this->renderForm(); @@ -206,9 +207,7 @@ class forum_post_handler { require_once(HEADERF); $mes->addError(LAN_FORUM_3001); - // $mes->addDebug("action: ".$this->action); - // $mes->addDebug("id: ".$this->id); - // $mes->addDebug(print_a($threadInfo, true)); + $mes->addDebug(print_a($this->data, true)); $ns->tablerender(LAN_FORUM_1001, $mes->render()); require_once(FOOTERF); exit;