From ecf22cb1bac8c05ea8206aef7ba33867412ae720 Mon Sep 17 00:00:00 2001 From: Cameron Date: Sat, 2 Dec 2017 11:57:27 -0800 Subject: [PATCH] Plugin perms render fix. --- e107_admin/users.php | 7 ++++++- e107_handlers/plugin_class.php | 6 +++++- e107_handlers/user_handler.php | 36 ++++++++++++++++++++++------------ 3 files changed, 34 insertions(+), 15 deletions(-) diff --git a/e107_admin/users.php b/e107_admin/users.php index 393eb02c9..3792f1a1f 100644 --- a/e107_admin/users.php +++ b/e107_admin/users.php @@ -15,6 +15,11 @@ if (!defined('e107_INIT')) require_once("../class2.php"); } +if (!getperms('4|U0|U1|U2|U3')) +{ + e107::redirect('admin'); + exit; +} e107::coreLan('user'); e107::coreLan('users', true); @@ -52,7 +57,7 @@ class users_admin extends e_admin_dispatcher protected $adminMenu = array( - 'main/list' => array('caption'=> LAN_MANAGE, 'perm' => '0'), + 'main/list' => array('caption'=> LAN_MANAGE, 'perm' => '0|4'), 'main/add' => array('caption'=> LAN_USER_QUICKADD, 'perm' => '4|U0|U1'), 'main/prefs' => array('caption'=> LAN_OPTIONS, 'perm' => '4|U2'), 'main/ranks' => array('caption'=> LAN_USER_RANKS, 'perm' => '4|U3'), diff --git a/e107_handlers/plugin_class.php b/e107_handlers/plugin_class.php index e164b55b4..0cbe9bd9f 100644 --- a/e107_handlers/plugin_class.php +++ b/e107_handlers/plugin_class.php @@ -4562,7 +4562,11 @@ class e107plugin $xml = e107::getXml(); $mes = e107::getMessage(); - e107::getDebug()->log("Legacy Plugin Parse (xml): ".$plugName); + if(E107_DEBUG_LEVEL > 0) + { + $dbgArr = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS,2); + e107::getDebug()->log("Legacy Plugin Parse (xml): ".$plugName. print_a($dbgArr[1],true)); + } // $xml->setOptArrayTags('extendedField,userclass,menuLink,commentID'); // always arrays for these tags. // $xml->setOptStringTags('install,uninstall,upgrade'); diff --git a/e107_handlers/user_handler.php b/e107_handlers/user_handler.php index ea2978bb4..45bb355dc 100644 --- a/e107_handlers/user_handler.php +++ b/e107_handlers/user_handler.php @@ -1573,12 +1573,29 @@ class e_userperms ); - $sql = e107::getDb('sql2'); - $tp = e107::getParser(); + // $sql = e107::getDb('sql2'); + // $tp = e107::getParser(); + $pg = e107::getPlug(); + $installed = $pg->getInstalled(); + foreach($installed as $plug=>$version) + { + $pg->load($plug); + + $arr = array( + 0 => $pg->getName(), + 1 => $pg->getIcon(16), + 2 => $pg->getIcon(32) + ); + + $key = "P".$pg->getId(); + $this->plugin_perms[$key] = $arr; + } + +/* $plg = e107::getPlugin(); - $allPlugins = $plg->getall(1); // Needs all for 'reading' and 'installed' for writing. - + $allPlugins = $plg->getall(1); // Needs all for 'reading' and 'installed' for writing. + foreach($allPlugins as $k=>$row2) { if($plg->parse_plugin($row2['plugin_path'])) @@ -1589,15 +1606,8 @@ class e_userperms $this->plugin_perms[("P".$row2['plugin_id'])][2] = $plg->getIcon($row2['plugin_path'],32); } } - - // echo $plg->getIcon('forum'); - - // $sql->db_Select("plugin", "*", "plugin_installflag='1'"); - // while ($row2 = $sql->db_Fetch()) - // { - // $this->plugin_perms[("P".$row2['plugin_id'])] = array($tp->toHTML($row2['plugin_name'], false, 'RAWTEXT,defs')); - // $this->plugin_perms[("P".$row2['plugin_id'])][1] = $plg->getIcon('forum') - // } +*/ + asort($this->plugin_perms);