mirror of
https://github.com/e107inc/e107.git
synced 2025-08-03 05:07:27 +02:00
Bad menu parsing problem in Administration area leading to duplicate/wrong menu area numbers/layout
This commit is contained in:
@@ -869,149 +869,174 @@ class e_menuManager {
|
|||||||
$text .= "</select>
|
$text .= "</select>
|
||||||
</div></form>";
|
</div></form>";
|
||||||
return $text;
|
return $text;
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
|
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||||
function parseheader($LAYOUT, $check = FALSE)
|
function parseheader($LAYOUT, $check = FALSE)
|
||||||
{
|
{
|
||||||
// $tmp = explode("\n", $LAYOUT);
|
// $tmp = explode("\n", $LAYOUT);
|
||||||
// Split up using the same function as the shortcode handler
|
// 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 );
|
$tmp = preg_split('#(\{\S[^\x02]*?\S\})#', $LAYOUT, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE);
|
||||||
for ($c = 0; $c < count($tmp); $c++)
|
$str = array();
|
||||||
{
|
for($c = 0; $c < count($tmp); $c++)
|
||||||
if (preg_match("/[\{|\}]/", $tmp[$c]))
|
{
|
||||||
{
|
if(preg_match("/[\{|\}]/", $tmp[$c]))
|
||||||
if ($check)
|
{
|
||||||
{
|
if($check)
|
||||||
if (strstr($tmp[$c], "{MENU="))
|
{
|
||||||
{
|
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)
|
||||||
else
|
preg_match_all("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", $tmp[$c], $matches);
|
||||||
{
|
$this->menuSetCode($matches, $str);
|
||||||
$this->checklayout($tmp[$c],$this->curLayout);
|
}
|
||||||
}
|
}
|
||||||
}
|
else
|
||||||
else
|
{
|
||||||
{
|
$this->checklayout($tmp[$c]);
|
||||||
if (!$check)
|
}
|
||||||
{
|
}
|
||||||
echo $tmp[$c];
|
else
|
||||||
}
|
{
|
||||||
}
|
if(!$check)
|
||||||
}
|
{
|
||||||
if ($check)
|
echo $tmp[$c];
|
||||||
{
|
}
|
||||||
return $str;
|
}
|
||||||
}
|
}
|
||||||
|
if($check)
|
||||||
|
{
|
||||||
|
return $str;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function checklayout($str)
|
function menuSetCode($matches, &$ret)
|
||||||
{ // Displays a basic representation of the theme
|
{
|
||||||
global $pref, $ns, $PLUGINS_DIRECTORY, $rs, $sc_style, $tp, $menu_order;
|
if(!$matches || !varsettrue($matches[1]))
|
||||||
|
|
||||||
$menuLayout = ($this->curLayout != $pref['sitetheme_deflayout']) ? $this->curLayout : "";
|
|
||||||
|
|
||||||
if (strstr($str, "LOGO"))
|
|
||||||
{
|
{
|
||||||
echo $tp -> parseTemplate("{LOGO}");
|
return;
|
||||||
}
|
}
|
||||||
else if(strstr($str, "SITENAME"))
|
|
||||||
|
foreach ($matches[1] as $match)
|
||||||
{
|
{
|
||||||
echo "<div style='padding: 2px'>[SiteName]</div>";
|
$ret[] = $match;
|
||||||
}
|
|
||||||
else if (strstr($str, "SITETAG"))
|
|
||||||
{
|
|
||||||
echo "<div style='padding: 2px'>[SiteTag]</div>";
|
|
||||||
}
|
|
||||||
else if (strstr($str, "SITELINKS"))
|
|
||||||
{
|
|
||||||
echo "<div style='padding: 2px; text-align: center'>[SiteLinks]</div>";
|
|
||||||
}
|
|
||||||
else if (strstr($str, "LANGUAGELINKS"))
|
|
||||||
{
|
|
||||||
echo "<div class=text style='padding: 2px; text-align: center'>[Language]</div>";
|
|
||||||
}
|
|
||||||
else if (strstr($str, "CUSTOM"))
|
|
||||||
{
|
|
||||||
$cust = preg_replace("/\W*\{CUSTOM=(.*?)(\+.*)?\}\W*/si", "\\1", $str);
|
|
||||||
echo "<div style='padding: 2px'>[".$cust."]</div>";
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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 "<div style='padding: 2px'>[SiteName]</div>";
|
||||||
|
}
|
||||||
|
else if(strstr($str, "SITETAG"))
|
||||||
|
{
|
||||||
|
echo "<div style='padding: 2px'>[SiteTag]</div>";
|
||||||
|
}
|
||||||
|
else if(strstr($str, "SITELINKS"))
|
||||||
|
{
|
||||||
|
echo "<div style='padding: 2px; text-align: center'>[SiteLinks]</div>";
|
||||||
|
}
|
||||||
|
else if(strstr($str, "LANGUAGELINKS"))
|
||||||
|
{
|
||||||
|
echo "<div class=text style='padding: 2px; text-align: center'>[Language]</div>";
|
||||||
|
}
|
||||||
|
else if(strstr($str, "CUSTOM"))
|
||||||
|
{
|
||||||
|
$cust = preg_replace("/\W*\{CUSTOM=(.*?)(\+.*)?\}\W*/si", "\\1", $str);
|
||||||
|
echo "<div style='padding: 2px'>[" . $cust . "]</div>";
|
||||||
|
}
|
||||||
// Display embedded Plugin information.
|
// Display embedded Plugin information.
|
||||||
else if (strstr($str, "PLUGIN"))
|
else if(strstr($str, "PLUGIN"))
|
||||||
{
|
{
|
||||||
$plug = preg_replace("/\{PLUGIN=(.*?)\}/si", "\\1", $str);
|
$plug = preg_replace("/\{PLUGIN=(.*?)\}/si", "\\1", $str);
|
||||||
$plug = trim($plug);
|
$plug = trim($plug);
|
||||||
if (file_exists((e_PLUGIN."{$plug}/{$plug}_config.php")))
|
if(file_exists((e_PLUGIN . "{$plug}/{$plug}_config.php")))
|
||||||
{
|
{
|
||||||
$link = e_PLUGIN."{$plug}/{$plug}_config.php";
|
$link = e_PLUGIN . "{$plug}/{$plug}_config.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
if(file_exists((e_PLUGIN.$plug."/config.php")))
|
if(file_exists((e_PLUGIN . $plug . "/config.php")))
|
||||||
{
|
{
|
||||||
$link = e_PLUGIN.$plug."/config.php";
|
$link = e_PLUGIN . $plug . "/config.php";
|
||||||
}
|
}
|
||||||
|
|
||||||
$plugtext = ($link) ? "(".MENLAN_34.":<a href='$link' title='".LAN_CONFIGURE."'>".LAN_CONFIGURE."</a>)" : "(".MENLAN_34.")" ;
|
$plugtext = ($link) ? "(" . MENLAN_34 . ":<a href='$link' title='" . LAN_CONFIGURE . "'>" . LAN_CONFIGURE . "</a>)" : "(" . MENLAN_34 . ")";
|
||||||
echo "<br />";
|
echo "<br />";
|
||||||
$ns -> tablerender($plug, $plugtext);
|
$ns->tablerender($plug, $plugtext);
|
||||||
}
|
}
|
||||||
else if (strstr($str, "MENU"))
|
else if(strstr($str, "MENU"))
|
||||||
{
|
{
|
||||||
// $ns = new e107table;
|
$matches = array();
|
||||||
$menu = preg_replace("/\{MENU=(.*?)(:.*?)?\}/si", "\\1", $str);
|
if(preg_match_all("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", $str, $matches))
|
||||||
if (isset($sc_style['MENU']['pre']) && strpos($str, 'ret') !== false)
|
{
|
||||||
{
|
foreach($matches[1] as $menu)
|
||||||
echo $sc_style['MENU']['pre'];
|
{
|
||||||
}
|
$menu = preg_replace("/\{MENU=(.*?)(:.*?)?\}/si", "\\1", $str);
|
||||||
echo "
|
if(isset($sc_style['MENU']['pre']) && strpos($str, 'ret') !== false)
|
||||||
<div class='portal-column' id='portal-column-".$menu."'>
|
{
|
||||||
|
echo $sc_style['MENU']['pre'];
|
||||||
<div style='text-align:center; font-size:14px' class='fborder'>
|
}
|
||||||
|
echo "
|
||||||
<div class='forumheader'><b>".MENLAN_14." ".$menu."</b></div></div><br />";
|
<div class='portal-column' id='portal-column-" . $menu . "'>
|
||||||
$text = " ";
|
|
||||||
$sql9 = new db;
|
<div style='text-align:center; font-size:14px' class='fborder'>
|
||||||
if ($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' AND menu_layout = '".$this->dbLayout."' "))
|
|
||||||
{
|
<div class='forumheader'><b>" . MENLAN_14 . " " . $menu . "</b></div></div><br />";
|
||||||
unset($text);
|
$text = " ";
|
||||||
echo $rs->form_open("post", e_SELF."?configure=".$this->curLayout, "frm_menu_".intval($menu));
|
$sql9 = new db();
|
||||||
|
if($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' AND menu_layout = '" . $this->dbLayout . "' "))
|
||||||
$MODE = 1;
|
{
|
||||||
|
unset($text);
|
||||||
$sql9->db_Select("menus", "*", "menu_location='$menu' AND menu_layout='".$this->dbLayout."' ORDER BY menu_order");
|
echo $rs->form_open("post", e_SELF . "?configure=" . $this->curLayout, "frm_menu_" . intval($menu));
|
||||||
$menu_count = $sql9->db_Rows();
|
|
||||||
while ($row = $sql9->db_Fetch(MYSQL_ASSOC))
|
$MODE = 1;
|
||||||
{
|
|
||||||
echo "\n\n\n <!-- Menu Start -->\n\n
|
$sql9->db_Select("menus", "*", "menu_location='$menu' AND menu_layout='" . $this->dbLayout . "' ORDER BY menu_order");
|
||||||
<div class='block' id='block-".$row['menu_id']."--".$this->dbLayout."'>
|
$menu_count = $sql9->db_Rows();
|
||||||
|
while($row = $sql9->db_Fetch(MYSQL_ASSOC))
|
||||||
<div class='content'>";
|
{
|
||||||
|
echo "\n\n\n <!-- Menu Start -->\n\n
|
||||||
echo $this->menuRenderMenu($row,$menu_count);
|
<div class='block' id='block-" . $row['menu_id'] . "--" . $this->dbLayout . "'>
|
||||||
|
|
||||||
echo "\n</div></div>";
|
<div class='content'>";
|
||||||
echo "\n\n\n<!-- Menu end -->\n\n\n";
|
|
||||||
echo "<div><br /></div>";
|
echo $this->menuRenderMenu($row, $menu_count);
|
||||||
|
|
||||||
|
echo "\n</div></div>";
|
||||||
}
|
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) {
|
echo $rs->form_close();
|
||||||
echo $sc_style['MENU']['post'];
|
}
|
||||||
}
|
echo "</div>";
|
||||||
}
|
if(isset($sc_style['MENU']['post']) && strpos($str, 'ret') !== false)
|
||||||
else if (strstr($str, "SETSTYLE")) {
|
{
|
||||||
$tmp = explode("=", $str);
|
echo $sc_style['MENU']['post'];
|
||||||
$style = preg_replace("/\{SETSTYLE=(.*?)\}/si", "\\1", $str);
|
}
|
||||||
}
|
}
|
||||||
else if (strstr($str, "SITEDISCLAIMER")) {
|
}
|
||||||
echo "[Sitedisclaimer]";
|
}
|
||||||
}
|
else if(strstr($str, "SETSTYLE"))
|
||||||
|
{
|
||||||
|
$tmp = explode("=", $str);
|
||||||
|
$style = preg_replace("/\{SETSTYLE=(.*?)\}/si", "\\1", $str);
|
||||||
|
}
|
||||||
|
else if(strstr($str, "SITEDISCLAIMER"))
|
||||||
|
{
|
||||||
|
echo "[Sitedisclaimer]";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
|
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user