';
$text .= "
";
if($sql->select('page','*',"menu_name !='' ORDER BY menu_name"))
{
$text .= "";
}
$text .= "
";
return array('caption'=>MENLAN_57,'text'=>$text);
}
//}
// new v2.1.4
class e_menu_layout
{
function __construct()
{
}
static function getLayouts($theme=null)
{
if(empty($theme))
{
$theme = e107::pref('core','sitetheme');
}
$HEADER = null;
$FOOTER = null;
$LAYOUT = null;
$CUSTOMHEADER = null;
$CUSTOMFOOTER = null;
$file = e_THEME.$theme."/theme.php";
if(!is_readable($file))
{
return false;
}
e107::set('css_enabled',false);
e107::set('js_enabled',false);
require($file);
e107::set('css_enabled',true);
e107::set('js_enabled',true);
$head = array();
$foot = array();
if(isset($LAYOUT) && is_array($LAYOUT)) // $LAYOUT is a combined $HEADER,$FOOTER.
{
foreach($LAYOUT as $key=>$template)
{
if($key == '_header_' || $key == '_footer_' || $key == '_modal_')
{
continue;
}
if(strpos($template,'{---}') !==false)
{
list($hd,$ft) = explode("{---}",$template);
$head[$key] = isset($LAYOUT['_header_']) ? $LAYOUT['_header_'] . $hd : $hd;
$foot[$key] = isset($LAYOUT['_footer_']) ? $ft . $LAYOUT['_footer_'] : $ft ;
}
else
{
e107::getMessage()->addDebug('Missing "{---}" in $LAYOUT["'.$key.'"] ');
}
}
unset($hd,$ft);
}
if(is_string($CUSTOMHEADER))
{
$head['legacyCustom'] = $CUSTOMHEADER;
}
elseif(is_array($CUSTOMHEADER))
{
foreach($CUSTOMHEADER as $k=>$v)
{
$head[$k] = $v;
}
}
if(is_string($HEADER))
{
$head['legacyDefault'] = $HEADER;
}
elseif(is_array($HEADER))
{
foreach($HEADER as $k=>$v)
{
$head[$k] = $v;
}
}
if(is_string($CUSTOMFOOTER))
{
$foot['legacyCustom'] = $CUSTOMFOOTER;
}
elseif(is_array($CUSTOMFOOTER))
{
foreach($CUSTOMFOOTER as $k=>$v)
{
$foot[$k] = $v;
}
}
if(is_string($FOOTER))
{
$foot['legacyDefault'] = $FOOTER;
}
elseif(is_array($FOOTER))
{
foreach($FOOTER as $k=>$v)
{
$foot[$k] = $v;
}
}
$layout = array();
foreach($head as $k=>$v)
{
$template = $head[$k]."\n{---}".$foot[$k];
$layout['templates'][$k] = $template;
$layout['menus'][$k] = self::countMenus($template);
}
return $layout;
}
private static function countMenus($template)
{
if(preg_match_all("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", $template, $matches))
{
sort($matches[1]);
return $matches[1];
}
return array();
}
static function menuSelector()
{
// $p = e107::getPref('e_menu_list'); // new storage for xxxxx_menu.php list.
$sql = e107::getDb();
$frm = e107::getForm();
$done = array();
$pageMenu = array();
$pluginMenu = array();
$sql->select("menus", "menu_name, menu_id, menu_pages, menu_path", "1 ORDER BY menu_name ASC");
while ($row = $sql->fetch())
{
if(in_array($row['menu_name'],$done))
{
continue;
}
$done[] = $row['menu_name'];
if(is_numeric($row['menu_path']))
{
$pageMenu[] = $row;
}
else
{
$pluginMenu[] = $row;
}
}
$tab1 = '';
$tab2 = '';
$tabs = array(
'custom' => array('caption'=>'';
foreach($layouts as $title)
{
$text .= '
';
$active = '';
}
$text .= '
';
// $ns->frontend = false;
$ns->tablerender(MENLAN_55,$text);
}
private function getHeadFoot()
{
$H = array();
$F = array();
if(is_string($this->HEADER))
{
$H['default'] = $this->HEADER;
$F['default'] = $this->FOOTER;
}
else
{
$H = $this->HEADER;
$F = $this->FOOTER;
}
// 0.6 / 0.7-1.x
if(isset($this->CUSTOMHEADER) && isset($this->CUSTOMHEADER))
{
if(!is_array($this->CUSTOMHEADER))
{
$H['legacyCustom'] = $this->CUSTOMHEADER;
$F['legacyCustom'] = $this->CUSTOMFOOTER;
}
else
{
foreach($this->CUSTOMHEADER as $k=>$v)
{
$H[$k] = $v;
}
foreach($this->CUSTOMFOOTER as $k=>$v)
{
$F[$k] = $v;
}
}
}
return array('HEADER'=>$H, 'FOOTER'=>$F);
}
//$ns = e107::getRender();
}
//include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
if (!empty($pref['e_header_list']) && is_array($pref['e_header_list']))
{
foreach($pref['e_header_list'] as $val)
{
// no checks fore existing file - performance
e107_include_once(e_PLUGIN.$val."/e_header.php");
}
}
$e_sub_cat = 'menus';
require_once(e_HANDLER."file_class.php");
require_once(e_HANDLER."menumanager_class.php");
$rs = new form;
$frm = e107::getForm();
$men = new e_menuManager(0); // use 1 for dragdrop.
$mes = e107::getMessage();
if(e_AJAX_REQUEST)
{
if(vartrue($_GET['enc']))
{
$string = base64_decode($_GET['enc']);
parse_str($string,$_GET);
// print_a($_GET);
}
// print_a($_POST);
if(vartrue($_GET['vis']))
{
$text = $men->menuVisibilityOptions();
}
// print_a($_GET);
if(vartrue($_GET['parmsId']))
{
$text = $men->menuInstanceParameters();
}
if(vartrue($_POST['mode']))
{
// print_r($_POST);
// $men->setMenuId($this->menuId);
$text = $men->menuSaveAjax($_POST['mode']);
}
echo $text;
exit;
}
if(isset($_GET['configure']) || isset($_GET['iframe']))
{
//No layout parse when in iframe mod
define('e_IFRAME', true);
}
require_once("auth.php");
if($_POST)
{
e107::getCache()->clear_sys("menus_");
}
//FIXME still used in e_HANDLER.menumanager_class.php
if (vartrue($message) != "")
{
echo $ns -> tablerender('Updated', "