mirror of
https://github.com/e107inc/e107.git
synced 2025-08-02 12:48:26 +02:00
Menu visibility fix and improvements
This commit is contained in:
@@ -9,9 +9,9 @@
|
||||
* e107 Menu Class
|
||||
*
|
||||
* $Source: /cvs_backup/e107_0.8/e107_handlers/menu_class.php,v $
|
||||
* $Revision: 1.17 $
|
||||
* $Date: 2009-12-27 10:52:22 $
|
||||
* $Author: e107coders $
|
||||
* $Revision: 1.18 $
|
||||
* $Date: 2010-01-12 12:23:02 $
|
||||
* $Author: secretr $
|
||||
*/
|
||||
|
||||
if(!defined('e107_INIT'))
|
||||
@@ -119,7 +119,7 @@ class e_menu
|
||||
*/
|
||||
protected function isVisible($row, $url = '')
|
||||
{
|
||||
$iD = varset($row['id']);
|
||||
$iD = varset($row['menu_id']);
|
||||
|
||||
if(isset($this->_visibility_cache[$iD]))
|
||||
{
|
||||
@@ -127,23 +127,31 @@ class e_menu
|
||||
}
|
||||
|
||||
$show_menu = TRUE;
|
||||
$tp = e107::getParser();
|
||||
if($row['menu_pages'])
|
||||
{
|
||||
list ($listtype, $listpages) = explode("-", $row['menu_pages'], 2);
|
||||
$pagelist = explode("|", $listpages);
|
||||
$check_url = $url ? $url : e_SELF.(e_QUERY ? "?".e_QUERY : '');
|
||||
// TODO - check against REQUEST_URI, see what would get broken
|
||||
$check_url = $url ? $url : ($_SERVER['REQUEST_URI'] ? SITEURLBASE.$_SERVER['REQUEST_URI'] : e_SELF.(e_QUERY ? "?".e_QUERY : ''));
|
||||
|
||||
switch($listtype)
|
||||
{
|
||||
case '1': //show menu
|
||||
$show_menu = false;
|
||||
|
||||
foreach($pagelist as $p)
|
||||
{
|
||||
$p = $tp->replaceConstants($p, 'full');
|
||||
if(substr($p, -1)==='!')
|
||||
{
|
||||
$p = substr($p, 0, -1);
|
||||
if(substr($check_url, strlen($p)*-1) == $p)
|
||||
{
|
||||
$show_menu = true;
|
||||
break 2;
|
||||
}
|
||||
}
|
||||
elseif(strpos($check_url, $p) !== false)
|
||||
{
|
||||
$show_menu = true;
|
||||
@@ -155,6 +163,7 @@ class e_menu
|
||||
$show_menu = true;
|
||||
foreach($pagelist as $p)
|
||||
{
|
||||
$p = $tp->replaceConstants($p, 'full');
|
||||
if(substr($p, -1)=='!')
|
||||
{
|
||||
$p = substr($p, 0, -1);
|
||||
|
Reference in New Issue
Block a user