diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php
index 9a79d5da7..79ab61987 100644
--- a/e107_handlers/menumanager_class.php
+++ b/e107_handlers/menumanager_class.php
@@ -869,149 +869,174 @@ class e_menuManager {
$text .= "
";
return $text;
- }
-
- //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
- function parseheader($LAYOUT, $check = FALSE)
- {
+ }
+
+ //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
+ function parseheader($LAYOUT, $check = FALSE)
+ {
// $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 );
- for ($c = 0; $c < count($tmp); $c++)
- {
- if (preg_match("/[\{|\}]/", $tmp[$c]))
- {
- if ($check)
- {
- if (strstr($tmp[$c], "{MENU="))
- {
- $str[] = preg_replace("/\{MENU=(.*?)(:.*?)?\}/si", "\\1", $tmp[$c]);
- }
- }
- else
- {
- $this->checklayout($tmp[$c],$this->curLayout);
- }
- }
- else
- {
- if (!$check)
- {
- echo $tmp[$c];
- }
- }
- }
- if ($check)
- {
- return $str;
- }
+ $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]))
+ {
+ if($check)
+ {
+ if(strstr($tmp[$c], "{MENU="))
+ {
+ $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]);
+ }
+ }
+ else
+ {
+ if(!$check)
+ {
+ echo $tmp[$c];
+ }
+ }
+ }
+ if($check)
+ {
+ return $str;
+ }
}
-
- function checklayout($str)
- { // Displays a basic representation of the theme
- global $pref, $ns, $PLUGINS_DIRECTORY, $rs, $sc_style, $tp, $menu_order;
-
- $menuLayout = ($this->curLayout != $pref['sitetheme_deflayout']) ? $this->curLayout : "";
-
- if (strstr($str, "LOGO"))
+
+ function menuSetCode($matches, &$ret)
+ {
+ if(!$matches || !varsettrue($matches[1]))
{
- echo $tp -> parseTemplate("{LOGO}");
+ return;
}
- else if(strstr($str, "SITENAME"))
+
+ foreach ($matches[1] as $match)
{
- echo "
[SiteName]
";
- }
- else if (strstr($str, "SITETAG"))
- {
- echo "[SiteTag]
";
- }
- else if (strstr($str, "SITELINKS"))
- {
- echo "[SiteLinks]
";
- }
- else if (strstr($str, "LANGUAGELINKS"))
- {
- echo "[Language]
";
- }
- else if (strstr($str, "CUSTOM"))
- {
- $cust = preg_replace("/\W*\{CUSTOM=(.*?)(\+.*)?\}\W*/si", "\\1", $str);
- echo "[".$cust."]
";
+ $ret[] = $match;
}
+ }
+
+ function checklayout($str)
+ { // Displays a basic representation of the theme
+ global $pref, $ns, $PLUGINS_DIRECTORY, $rs, $sc_style, $tp, $menu_order;
+
+ $menuLayout = ($this->curLayout != $pref['sitetheme_deflayout']) ? $this->curLayout : "";
+
+ if(strstr($str, "LOGO"))
+ {
+ echo $tp->parseTemplate("{LOGO}");
+ }
+ else if(strstr($str, "SITENAME"))
+ {
+ echo "[SiteName]
";
+ }
+ else if(strstr($str, "SITETAG"))
+ {
+ echo "[SiteTag]
";
+ }
+ else if(strstr($str, "SITELINKS"))
+ {
+ echo "[SiteLinks]
";
+ }
+ else if(strstr($str, "LANGUAGELINKS"))
+ {
+ echo "[Language]
";
+ }
+ else if(strstr($str, "CUSTOM"))
+ {
+ $cust = preg_replace("/\W*\{CUSTOM=(.*?)(\+.*)?\}\W*/si", "\\1", $str);
+ echo "[" . $cust . "]
";
+ }
// Display embedded Plugin information.
- else if (strstr($str, "PLUGIN"))
- {
- $plug = preg_replace("/\{PLUGIN=(.*?)\}/si", "\\1", $str);
- $plug = trim($plug);
- if (file_exists((e_PLUGIN."{$plug}/{$plug}_config.php")))
- {
- $link = e_PLUGIN."{$plug}/{$plug}_config.php";
- }
-
- if(file_exists((e_PLUGIN.$plug."/config.php")))
- {
- $link = e_PLUGIN.$plug."/config.php";
- }
-
- $plugtext = ($link) ? "(".MENLAN_34.":".LAN_CONFIGURE.")" : "(".MENLAN_34.")" ;
- echo "
";
- $ns -> tablerender($plug, $plugtext);
- }
- else if (strstr($str, "MENU"))
- {
- // $ns = new e107table;
- $menu = preg_replace("/\{MENU=(.*?)(:.*?)?\}/si", "\\1", $str);
- if (isset($sc_style['MENU']['pre']) && strpos($str, 'ret') !== false)
- {
- echo $sc_style['MENU']['pre'];
- }
- echo "
-
-
-
-
-
";
- $text = " ";
- $sql9 = new db;
- if ($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' AND menu_layout = '".$this->dbLayout."' "))
- {
- unset($text);
- echo $rs->form_open("post", e_SELF."?configure=".$this->curLayout, "frm_menu_".intval($menu));
-
- $MODE = 1;
-
- $sql9->db_Select("menus", "*", "menu_location='$menu' AND menu_layout='".$this->dbLayout."' ORDER BY menu_order");
- $menu_count = $sql9->db_Rows();
- while ($row = $sql9->db_Fetch(MYSQL_ASSOC))
- {
- echo "\n\n\n \n\n
-
dbLayout."'>
-
-
";
-
- echo $this->menuRenderMenu($row,$menu_count);
-
- echo "\n
";
- echo "\n\n\n\n\n\n";
- echo "
";
-
-
- }
-
- echo $rs->form_close();
- }
- echo "
";
- if(isset($sc_style['MENU']['post']) && strpos($str, 'ret') !== false) {
- echo $sc_style['MENU']['post'];
- }
- }
- else if (strstr($str, "SETSTYLE")) {
- $tmp = explode("=", $str);
- $style = preg_replace("/\{SETSTYLE=(.*?)\}/si", "\\1", $str);
- }
- else if (strstr($str, "SITEDISCLAIMER")) {
- echo "[Sitedisclaimer]";
- }
+ else if(strstr($str, "PLUGIN"))
+ {
+ $plug = preg_replace("/\{PLUGIN=(.*?)\}/si", "\\1", $str);
+ $plug = trim($plug);
+ if(file_exists((e_PLUGIN . "{$plug}/{$plug}_config.php")))
+ {
+ $link = e_PLUGIN . "{$plug}/{$plug}_config.php";
+ }
+
+ if(file_exists((e_PLUGIN . $plug . "/config.php")))
+ {
+ $link = e_PLUGIN . $plug . "/config.php";
+ }
+
+ $plugtext = ($link) ? "(" . MENLAN_34 . ":" . LAN_CONFIGURE . ")" : "(" . MENLAN_34 . ")";
+ echo "
";
+ $ns->tablerender($plug, $plugtext);
+ }
+ else if(strstr($str, "MENU"))
+ {
+ $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)
+ {
+ echo $sc_style['MENU']['pre'];
+ }
+ echo "
+
+
+
+
+
";
+ $text = " ";
+ $sql9 = new db();
+ if($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' AND menu_layout = '" . $this->dbLayout . "' "))
+ {
+ unset($text);
+ echo $rs->form_open("post", e_SELF . "?configure=" . $this->curLayout, "frm_menu_" . intval($menu));
+
+ $MODE = 1;
+
+ $sql9->db_Select("menus", "*", "menu_location='$menu' AND menu_layout='" . $this->dbLayout . "' ORDER BY menu_order");
+ $menu_count = $sql9->db_Rows();
+ while($row = $sql9->db_Fetch(MYSQL_ASSOC))
+ {
+ echo "\n\n\n \n\n
+
dbLayout . "'>
+
+
";
+
+ echo $this->menuRenderMenu($row, $menu_count);
+
+ echo "\n
";
+ echo "\n\n\n\n\n\n";
+ echo "
";
+
+ }
+
+ echo $rs->form_close();
+ }
+ echo "
";
+ if(isset($sc_style['MENU']['post']) && strpos($str, 'ret') !== false)
+ {
+ echo $sc_style['MENU']['post'];
+ }
+ }
+ }
+ }
+ else if(strstr($str, "SETSTYLE"))
+ {
+ $tmp = explode("=", $str);
+ $style = preg_replace("/\{SETSTYLE=(.*?)\}/si", "\\1", $str);
+ }
+ else if(strstr($str, "SITEDISCLAIMER"))
+ {
+ echo "[Sitedisclaimer]";
+ }
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//