1
0
mirror of https://github.com/e107inc/e107.git synced 2025-04-13 09:01:59 +02:00

getperms() was failing with plugin-only access and other non-mainadmin perms. Fixed.

This commit is contained in:
CaMer0n 2009-12-24 10:51:23 +00:00
parent 1e15f1c92b
commit b019c110d0
2 changed files with 16 additions and 14 deletions

View File

@ -9,8 +9,8 @@
* General purpose file
*
* $Source: /cvs_backup/e107_0.8/class2.php,v $
* $Revision: 1.171 $
* $Date: 2009-12-24 09:59:20 $
* $Revision: 1.172 $
* $Date: 2009-12-24 10:51:23 $
* $Author: e107coders $
*
*/
@ -1321,19 +1321,20 @@ function getperms($arg, $ap = ADMINPERMS)
return true;
}
$ap = '.'.$ap;
if ($arg == 'P' && preg_match("#(.*?)/".e107::getInstance()->getFolder('plugins')."(.*?)/(.*?)#", e_SELF, $matches))
{
$psql = new db;
if ($psql->db_Select('plugin', 'plugin_id', "plugin_path = '".$matches[2]."' "))
$sql = e107::getDb('psql');
if ($sql->db_Select('plugin', 'plugin_id', "plugin_path = '".$matches[2]."' LIMIT 1 "))
{
$row = $psql->db_Fetch();
$arg = 'P'.$row[0];
$row = $sql->db_Fetch();
$arg = 'P'.$row['plugin_id'];
}
}
$ap_array = explode('.',$ap);
if (strpos($ap, '.'.$arg.'.') !== false)
if(in_array($arg,$ap_array))
{
return true;
}
@ -1342,7 +1343,7 @@ function getperms($arg, $ap = ADMINPERMS)
$tmp = explode("|", $arg);
foreach($tmp as $val)
{
if (strpos($ap, '.'.$val.'.') !== false)
if(in_array($arg,$ap_array))
{
return true;
}

View File

@ -11,8 +11,8 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/includes/infopanel.php,v $
| $Revision: 1.18 $
| $Date: 2009-12-24 10:00:30 $
| $Revision: 1.19 $
| $Date: 2009-12-24 10:51:23 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@ -39,10 +39,11 @@ if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
// ---------------------- Start Panel --------------------------------
$text = "<div style='text-align:center'>";
if (!vartrue($user_pref['core-infopanel-mye107'])) // Set default icons.
if (getperms('0') && !vartrue($user_pref['core-infopanel-mye107'])) // Set default icons.
{
$user_pref['core-infopanel-mye107'] = $pref['core-infopanel-default'];
}
$iconlist = array_merge($array_functions_assoc, getPluginLinks(E_16_PLUGMANAGER, "array"));
$text .= "
@ -62,7 +63,7 @@ if (isset($_POST['submit-mye107']) || varset($_POST['submit-mymenus']))
// Rendering the saved configuration.
foreach ($iconlist as $key=>$val)
{
if (!isset($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107']))
if (!vartrue($user_pref['core-infopanel-mye107']) || in_array($key, $user_pref['core-infopanel-mye107']))
{
$text .= render_links($val['link'], $val['title'], $val['caption'], $val['perms'], $val['icon_32'], "div");
}