mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 13:17:24 +02:00
Bad menu parsing problem in Administration area leading to duplicate/wrong menu area numbers/layout
This commit is contained in:
@@ -877,6 +877,7 @@ class e_menuManager {
|
||||
// $tmp = explode("\n", $LAYOUT);
|
||||
// Split up using the same function as the shortcode handler
|
||||
$tmp = preg_split('#(\{\S[^\x02]*?\S\})#', $LAYOUT, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||
$str = array();
|
||||
for($c = 0; $c < count($tmp); $c++)
|
||||
{
|
||||
if(preg_match("/[\{|\}]/", $tmp[$c]))
|
||||
@@ -885,12 +886,15 @@ class e_menuManager {
|
||||
{
|
||||
if(strstr($tmp[$c], "{MENU="))
|
||||
{
|
||||
$str[] = preg_replace("/\{MENU=(.*?)(:.*?)?\}/si", "\\1", $tmp[$c]);
|
||||
$matches = array();
|
||||
// Match all menu areas, menu number is limited to tinyint(3)
|
||||
preg_match_all("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", $tmp[$c], $matches);
|
||||
$this->menuSetCode($matches, $str);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->checklayout($tmp[$c],$this->curLayout);
|
||||
$this->checklayout($tmp[$c]);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -907,6 +911,19 @@ class e_menuManager {
|
||||
}
|
||||
}
|
||||
|
||||
function menuSetCode($matches, &$ret)
|
||||
{
|
||||
if(!$matches || !varsettrue($matches[1]))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
foreach ($matches[1] as $match)
|
||||
{
|
||||
$ret[] = $match;
|
||||
}
|
||||
}
|
||||
|
||||
function checklayout($str)
|
||||
{ // Displays a basic representation of the theme
|
||||
global $pref, $ns, $PLUGINS_DIRECTORY, $rs, $sc_style, $tp, $menu_order;
|
||||
@@ -959,7 +976,11 @@ class e_menuManager {
|
||||
}
|
||||
else if(strstr($str, "MENU"))
|
||||
{
|
||||
// $ns = new e107table;
|
||||
$matches = array();
|
||||
if(preg_match_all("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", $str, $matches))
|
||||
{
|
||||
foreach($matches[1] as $menu)
|
||||
{
|
||||
$menu = preg_replace("/\{MENU=(.*?)(:.*?)?\}/si", "\\1", $str);
|
||||
if(isset($sc_style['MENU']['pre']) && strpos($str, 'ret') !== false)
|
||||
{
|
||||
@@ -972,7 +993,7 @@ class e_menuManager {
|
||||
|
||||
<div class='forumheader'><b>" . MENLAN_14 . " " . $menu . "</b></div></div><br />";
|
||||
$text = " ";
|
||||
$sql9 = new db;
|
||||
$sql9 = new db();
|
||||
if($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' AND menu_layout = '" . $this->dbLayout . "' "))
|
||||
{
|
||||
unset($text);
|
||||
@@ -995,21 +1016,25 @@ class e_menuManager {
|
||||
echo "\n\n\n<!-- Menu end -->\n\n\n";
|
||||
echo "<div><br /></div>";
|
||||
|
||||
|
||||
}
|
||||
|
||||
echo $rs->form_close();
|
||||
}
|
||||
echo "</div>";
|
||||
if(isset($sc_style['MENU']['post']) && strpos($str, 'ret') !== false) {
|
||||
if(isset($sc_style['MENU']['post']) && strpos($str, 'ret') !== false)
|
||||
{
|
||||
echo $sc_style['MENU']['post'];
|
||||
}
|
||||
}
|
||||
else if (strstr($str, "SETSTYLE")) {
|
||||
}
|
||||
}
|
||||
else if(strstr($str, "SETSTYLE"))
|
||||
{
|
||||
$tmp = explode("=", $str);
|
||||
$style = preg_replace("/\{SETSTYLE=(.*?)\}/si", "\\1", $str);
|
||||
}
|
||||
else if (strstr($str, "SITEDISCLAIMER")) {
|
||||
else if(strstr($str, "SITEDISCLAIMER"))
|
||||
{
|
||||
echo "[Sitedisclaimer]";
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user