2006-12-02 04:36:16 +00:00
< ? php
/*
+ ----------------------------------------------------------------------------+
| e107 website system
|
| <EFBFBD> Steve Dunstan 2001 - 2002
| http :// e107 . org
| jalist @ e107 . org
|
| Released under the terms and conditions of the
| GNU General Public License ( http :// gnu . org ) .
|
| $Source : / cvs_backup / e107_0 . 8 / e107_admin / menus . php , v $
2009-07-08 06:58:00 +00:00
| $Revision : 1.21 $
| $Date : 2009 - 07 - 08 06 : 58 : 00 $
2009-07-05 11:57:40 +00:00
| $Author : e107coders $
2006-12-02 04:36:16 +00:00
+----------------------------------------------------------------------------+
*/
require_once ( " ../class2.php " );
2009-01-21 22:04:36 +00:00
if ( ! getperms ( " 2 " ))
2008-12-08 22:21:29 +00:00
{
2006-12-02 04:36:16 +00:00
header ( " location: " . e_BASE . " index.php " );
exit ;
}
$e_sub_cat = 'menus' ;
require_once ( " auth.php " );
require_once ( e_HANDLER . " form_handler.php " );
require_once ( e_HANDLER . " file_class.php " );
$frm = new form ;
2007-11-18 02:20:59 +00:00
if ( $_POST )
{
2008-06-24 20:53:07 +00:00
// print_a($_POST);
2007-11-18 02:20:59 +00:00
// exit;
2008-12-17 20:42:30 +00:00
$e107cache -> clear_sys ( " menus_ " );
2006-12-02 04:36:16 +00:00
}
$menus_equery = explode ( '.' , e_QUERY );
2009-07-07 12:54:47 +00:00
$curLayout = $menus_equery [ 1 ];
2006-12-02 04:36:16 +00:00
2009-01-21 22:04:36 +00:00
if ( isset ( $_POST [ 'custom_select' ]))
2007-03-06 19:59:36 +00:00
{
2009-07-07 12:54:47 +00:00
$curLayout = $_POST [ 'custom_select' ];
2006-12-02 04:36:16 +00:00
//header("location:".e_SELF."?".$_POST['custom_select']);
//exit;
2007-03-06 19:59:36 +00:00
}
2009-07-07 12:54:47 +00:00
else if ( ! isset ( $curLayout ))
2007-03-06 19:59:36 +00:00
{
2009-07-07 12:54:47 +00:00
$curLayout = '' ;
2006-12-02 04:36:16 +00:00
}
2007-03-06 19:59:36 +00:00
2009-07-07 12:54:47 +00:00
if ( $curLayout == '' || $curLayout == 'default_layout' )
2007-03-06 19:59:36 +00:00
{
2009-07-05 11:57:40 +00:00
$menus_header = is_array ( $HEADER ) ? $HEADER [ $pref [ 'sitetheme_deflayout' ]] : $HEADER ;
$menus_footer = is_array ( $FOOTER ) ? $FOOTER [ $pref [ 'sitetheme_deflayout' ]] : $FOOTER ;
2006-12-02 04:36:16 +00:00
}
2009-07-07 12:54:47 +00:00
else if ( $curLayout == 'no_array' )
2007-03-06 19:59:36 +00:00
{
2009-07-05 11:57:40 +00:00
$menus_header = $CUSTOMHEADER ? $CUSTOMHEADER : $HEADER ;
$menus_footer = $CUSTOMFOOTER ? $CUSTOMFOOTER : $FOOTER ;
2006-12-02 04:36:16 +00:00
}
2009-07-07 12:54:47 +00:00
else if ( $curLayout == 'newsheader_layout' )
2007-03-06 19:59:36 +00:00
{
2009-07-05 11:57:40 +00:00
$menus_header = $NEWSHEADER ? $NEWSHEADER : $HEADER ;
2006-12-02 04:36:16 +00:00
$menus_footer = $FOOTER ;
2009-01-21 22:04:36 +00:00
}
2009-07-05 11:57:40 +00:00
elseif ( is_array ( $HEADER ) || is_array ( $FOOTER )) // 0.8 themes
{
2009-07-07 12:54:47 +00:00
$menus_header = ( is_array ( $HEADER ) && isset ( $HEADER [ $curLayout ])) ? $HEADER [ $curLayout ] : $HEADER ;
$menus_footer = ( is_array ( $FOOTER ) && isset ( $FOOTER [ $curLayout ])) ? $FOOTER [ $curLayout ] : $FOOTER ;
2009-07-05 11:57:40 +00:00
}
2009-01-21 22:04:36 +00:00
else
2007-03-06 19:59:36 +00:00
{
2009-07-07 12:54:47 +00:00
$menus_header = $CUSTOMHEADER [ $curLayout ] ? $CUSTOMHEADER [ $curLayout ] : $HEADER ;
$menus_footer = $CUSTOMFOOTER [ $curLayout ] ? $CUSTOMFOOTER [ $curLayout ] : $FOOTER ;
2006-12-02 04:36:16 +00:00
}
2007-03-06 19:59:36 +00:00
2009-07-05 11:57:40 +00:00
// $layouts_str = $HEADER.$FOOTER;
$layouts_str = $menus_header . $menus_footer ;
2009-01-21 22:04:36 +00:00
if ( $NEWSHEADER )
2008-12-06 22:14:37 +00:00
{
2006-12-02 04:36:16 +00:00
$layouts_str .= $NEWSHEADER ;
}
2009-07-05 11:57:40 +00:00
/* if ( $CUSTOMPAGES )
2008-12-06 22:14:37 +00:00
{
2009-01-21 22:04:36 +00:00
if ( is_array ( $CUSTOMPAGES ))
2008-12-06 22:14:37 +00:00
{
2009-01-21 22:04:36 +00:00
foreach ( $CUSTOMPAGES as $custom_extract_key => $custom_extract_value )
2008-12-06 22:14:37 +00:00
{
2009-01-21 22:04:36 +00:00
if ( $CUSTOMHEADER [ $custom_extract_key ])
2008-12-06 22:14:37 +00:00
{
2006-12-02 04:36:16 +00:00
$layouts_str .= $CUSTOMHEADER [ $custom_extract_key ];
}
2009-01-21 22:04:36 +00:00
if ( $CUSTOMFOOTER [ $custom_extract_key ])
2008-12-06 22:14:37 +00:00
{
2006-12-02 04:36:16 +00:00
$layouts_str .= $CUSTOMFOOTER [ $custom_extract_key ];
}
}
2009-01-21 22:04:36 +00:00
}
else
2008-12-06 22:14:37 +00:00
{
2009-01-21 22:04:36 +00:00
if ( $CUSTOMHEADER )
2008-12-06 22:14:37 +00:00
{
2006-12-02 04:36:16 +00:00
$layouts_str .= $CUSTOMHEADER ;
}
2009-01-21 22:04:36 +00:00
if ( $CUSTOMFOOTER )
2008-12-06 22:14:37 +00:00
{
2006-12-02 04:36:16 +00:00
$layouts_str .= $CUSTOMFOOTER ;
}
}
2009-07-05 11:57:40 +00:00
} */
2006-12-02 04:36:16 +00:00
2008-12-06 22:14:37 +00:00
2006-12-02 04:36:16 +00:00
$menu_array = parseheader ( $layouts_str , 'check' );
sort ( $menu_array , SORT_NUMERIC );
$menu_check = 'set' ;
2009-01-21 22:04:36 +00:00
foreach ( $menu_array as $menu_value )
2008-12-06 22:14:37 +00:00
{
2009-01-21 22:04:36 +00:00
if ( $menu_value != $menu_check )
2008-12-06 22:14:37 +00:00
{
2006-12-02 04:36:16 +00:00
$menu_areas [] = $menu_value ;
}
$menu_check = $menu_value ;
}
// Cams Bit ----------- Activate Multiple Menus ---
if ( $_POST [ 'menuActivate' ])
{
2009-07-07 12:54:47 +00:00
menuActivate ();
}
if ( $_POST [ 'menuSetCustomPages' ])
{
menuSetCustomPages ( $_POST [ 'custompages' ]);
}
function menuActivate ()
{
global $sql , $admin_log , $pref ;
$location = key ( $_POST [ 'menuActivate' ]);
2009-07-07 16:04:51 +00:00
2009-07-07 12:54:47 +00:00
$layout = ( $_POST [ 'curLayout' ] != $pref [ 'sitetheme_deflayout' ]) ? $_POST [ 'curLayout' ] : " " ;
2006-12-02 04:36:16 +00:00
2009-07-07 12:54:47 +00:00
$menu_count = $sql -> db_Count ( " menus " , " (*) " , " WHERE menu_location= " . $location . " AND menu_layout = ' $layout ' " );
2006-12-02 04:36:16 +00:00
foreach ( $_POST [ 'menuselect' ] as $sel_mens )
{
2007-11-18 02:20:59 +00:00
//Get info from menu being activated
2009-07-07 12:54:47 +00:00
if ( $sql -> db_Select ( " menus " , 'menu_name, menu_path' , " menu_id = " . $sel_mens . " " ))
2007-11-18 02:20:59 +00:00
{
$row = $sql -> db_Fetch ();
//If menu is not already activated in that area, add the record.
2009-07-07 12:54:47 +00:00
2009-07-08 01:28:55 +00:00
if ( ! $sql -> db_Select ( 'menus' , 'menu_name,menu_path' , " menu_name=' " . $row [ 'menu_name' ] . " ' AND menu_layout = ' $layout ' AND menu_location = " . $location . " LIMIT 1 " ))
2007-11-18 02:20:59 +00:00
{
$qry = "
INSERT into #menus
2009-07-07 12:54:47 +00:00
( `menu_name` , `menu_location` , `menu_order` , `menu_pages` , `menu_path` , `menu_layout` )
VALUES ( '{$row[' menu_name ']}' , { $location }, { $menu_count }, '' , '{$row[' menu_path ']}' , '{$layout}' )
2007-11-18 02:20:59 +00:00
" ;
2009-07-07 16:04:51 +00:00
$sql -> db_Select_gen ( $qry );
2008-12-06 22:14:37 +00:00
$admin_log -> log_event ( 'MENU_01' , $row [ 'menu_name' ] . '[!br!]' . $location . '[!br!]' . $menu_count . '[!br!]' . $row [ 'menu_path' ], E_LOG_INFORMATIVE , '' );
2007-11-18 02:20:59 +00:00
$menu_count ++ ;
}
}
2006-12-02 04:36:16 +00:00
}
}
2009-07-05 11:57:40 +00:00
2009-07-07 12:54:47 +00:00
function menuSetCustomPages ( $array )
{
global $pref ;
$key = key ( $array );
2009-07-07 16:04:51 +00:00
$pref [ 'sitetheme_custompages' ][ $key ] = array_filter ( explode ( " " , $array [ $key ]));
2009-07-07 12:54:47 +00:00
save_prefs ();
}
2009-07-05 11:57:40 +00:00
function getMenuPreset ( $layout )
{
global $pref ;
// print_a($pref['sitetheme_layouts'][$layout]['menuPresets']);
if ( ! isset ( $pref [ 'sitetheme_layouts' ][ $layout ][ 'menuPresets' ]))
{
return ;
}
$temp = $pref [ 'sitetheme_layouts' ][ $layout ][ 'menuPresets' ][ 'area' ];
foreach ( $temp as $key => $val )
{
$iD = $val [ '@attributes' ][ 'id' ];
foreach ( $val [ 'menu' ] as $k => $v )
{
2009-07-08 06:58:00 +00:00
$uclass = ( defined ( trim ( $v [ '@attributes' ][ 'userclass' ]))) ? constant ( trim ( $v [ '@attributes' ][ 'userclass' ])) : 0 ;
2009-07-05 11:57:40 +00:00
$menuArea [] = array (
'menu_location' => $iD ,
'menu_order' => $k ,
'menu_name' => $v [ '@attributes' ][ 'name' ] . " _menu " ,
2009-07-08 06:58:00 +00:00
'menu_class' => intval ( $uclass )
2009-07-05 11:57:40 +00:00
);
}
}
return $menuArea ;
}
function checkMenuPreset ( $array , $name )
{
if ( ! is_array ( $array ))
{
return ;
}
foreach ( $array as $key => $val )
{
if ( $val [ 'menu_name' ] == $name )
{
return $val [ 'menu_location' ];
}
}
return FALSE ;
}
2009-07-07 12:54:47 +00:00
if ( isset ( $_POST [ 'menuUsePreset' ]) && $_POST [ 'curLayout' ])
2009-07-05 11:57:40 +00:00
{
2009-07-07 12:54:47 +00:00
global $pref ;
$layout = ( $_POST [ 'curLayout' ] != $pref [ 'sitetheme_deflayout' ]) ? $_POST [ 'curLayout' ] : " " ;
$menuAreas = getMenuPreset ( $_POST [ 'curLayout' ]);
2009-07-05 11:57:40 +00:00
2009-07-07 12:54:47 +00:00
$sql -> db_Update ( " menus " , " menu_location='0' WHERE menu_layout = ' $layout ' " ); // Clear All existing.
2009-07-05 11:57:40 +00:00
foreach ( $menuAreas as $val )
{
2009-07-07 12:54:47 +00:00
if ( $sql -> db_Select ( " menus " , 'menu_name, menu_path' , " menu_name = ' " . $val [ 'menu_name' ] . " ' LIMIT 1 " ))
2009-07-05 11:57:40 +00:00
{
2009-07-07 12:54:47 +00:00
$row = $sql -> db_Fetch ();
2009-07-07 22:56:13 +00:00
if ( ! $sql -> db_Update ( 'menus' , " menu_order=' { $val [ 'menu_order' ] } ', menu_location = " . $val [ 'menu_location' ] . " , menu_class= " . $val [ 'menu_class' ] . " WHERE menu_name=' " . $val [ 'menu_name' ] . " ' AND menu_layout = ' $layout ' LIMIT 1 " ))
2009-07-07 12:54:47 +00:00
{
$qry = "
INSERT into #menus
( `menu_name` , `menu_location` , `menu_order` , `menu_pages` , `menu_class` , `menu_path` , `menu_layout` )
VALUES ( '{$val[' menu_name ']}' , { $val [ 'menu_location' ]}, { $val [ 'menu_order' ]}, '' , '{$val[' menu_class ']}' , '{$row[' menu_path ']}' , '{$layout}' )
" ;
2009-07-07 22:56:13 +00:00
$sql -> db_Select_gen ( $qry );
2009-07-07 12:54:47 +00:00
$admin_log -> log_event ( 'MENU_01' , $row [ 'menu_name' ] . '[!br!]' . $location . '[!br!]' . $menu_count . '[!br!]' . $row [ 'menu_path' ], E_LOG_INFORMATIVE , '' );
}
}
2009-07-05 11:57:40 +00:00
}
2009-07-07 12:54:47 +00:00
2009-07-05 11:57:40 +00:00
}
2006-12-02 04:36:16 +00:00
// =============
2007-02-10 13:36:27 +00:00
if ( isset ( $_POST [ 'menuAct' ]))
{
2009-01-21 22:04:36 +00:00
foreach ( $_POST [ 'menuAct' ] as $k => $v )
2007-02-10 13:36:27 +00:00
{
2009-01-21 22:04:36 +00:00
if ( trim ( $v ))
2007-02-10 13:36:27 +00:00
{
$id = $k ;
list ( $menu_act , $location , $position , $newloc ) = explode ( " . " , $_POST [ 'menuAct' ][ $k ]);
2006-12-02 04:36:16 +00:00
}
2007-02-10 13:36:27 +00:00
}
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
if ( $menu_act == 'config' )
2008-12-06 22:14:37 +00:00
{
2006-12-02 04:36:16 +00:00
if ( $newloc )
{
$newloc = " . " . $newloc ;
}
$newurl = $PLUGINS_DIRECTORY . $location . " / { $position } { $newloc } .php " ;
$newurl = SITEURL . str_replace ( " // " , " / " , $newurl );
2008-12-06 22:14:37 +00:00
echo " <script> top.location.href = ' { $newurl } '; </script> " ;
2006-12-02 04:36:16 +00:00
exit ;
}
2009-01-21 22:04:36 +00:00
if ( $menu_act == " adv " )
2008-12-06 22:14:37 +00:00
{
2009-07-06 05:59:42 +00:00
showVisibility ();
}
function showVisibility ()
{
global $sql , $ns ;
2006-12-02 04:36:16 +00:00
require_once ( e_HANDLER . " userclass_class.php " );
2007-11-18 03:05:06 +00:00
$sql -> db_Select ( " menus " , " * " , " menu_id= " . $id );
2006-12-02 04:36:16 +00:00
$row = $sql -> db_Fetch ();
2007-11-18 03:05:06 +00:00
$listtype = substr ( $row [ 'menu_pages' ], 0 , 1 );
$menu_pages = substr ( $row [ 'menu_pages' ], 2 );
2006-12-02 04:36:16 +00:00
$menu_pages = str_replace ( " | " , " \n " , $menu_pages );
$text = " <div style='text-align:center;'>
2009-07-07 12:54:47 +00:00
< form method = 'post' action = '".e_SELF."?configure.".$curLayout."' >
2006-12-02 04:36:16 +00:00
< table style = 'width:40%' >
< tr >
< td >
2007-11-18 03:05:06 +00:00
< input type = 'hidden' name = 'menuAct[{$row[' menu_id ']}]' value = 'sv.{$row[' menu_id ']}' />
2006-12-02 04:36:16 +00:00
" .MENLAN_4. " " .
2007-11-18 03:05:06 +00:00
r_userclass ( 'menu_class' , $row [ 'menu_class' ], " off " , " public,member,guest,admin,main,classes,nobody " ) . "
2006-12-02 04:36:16 +00:00
</ td >
</ tr >
< tr >< td >< br /> " ;
2007-11-18 03:05:06 +00:00
$checked = ( $listtype == 1 ) ? " checked='checked' " : " " ;
2006-12-02 04:36:16 +00:00
$text .= " <input type='radio' { $checked } name='listtype' value='1' /> " . MENLAN_26 . " <br /> " ;
2007-11-18 03:05:06 +00:00
$checked = ( $listtype == 2 ) ? " checked='checked' " : " " ;
2006-12-02 04:36:16 +00:00
$text .= " <input type='radio' { $checked } name='listtype' value='2' /> " . MENLAN_27 . " <br /><br /> " . MENLAN_28 . " <br /> " ;
$text .= " <textarea name='pagelist' cols='60' rows='10' class='tbox'> $menu_pages </textarea> " ;
$text .= "
< tr >
< td style = 'text-align:center' >< br />
< input class = 'button' type = 'submit' name = 'class_submit' value = '".MENLAN_6."' />
</ td >
</ tr >
</ table >
</ form >
</ div > " ;
2007-11-18 03:05:06 +00:00
$caption = MENLAN_7 . " " . $row [ 'menu_name' ];
2006-12-02 04:36:16 +00:00
$ns -> tablerender ( $caption , $text );
2009-07-06 05:59:42 +00:00
2006-12-02 04:36:16 +00:00
}
2009-07-06 05:59:42 +00:00
2006-12-02 04:36:16 +00:00
unset ( $message );
2009-01-21 22:04:36 +00:00
if ( $menu_act == " sv " )
2008-12-06 22:14:37 +00:00
{
2006-12-02 04:36:16 +00:00
$pagelist = explode ( " \r \n " , $_POST [ 'pagelist' ]);
2009-01-21 22:04:36 +00:00
for ( $i = 0 ; $i < count ( $pagelist ) ; $i ++ )
2008-12-06 22:14:37 +00:00
{
2006-12-02 04:36:16 +00:00
$pagelist [ $i ] = trim ( $pagelist [ $i ]);
}
$plist = implode ( " | " , $pagelist );
$pageparms = $_POST [ 'listtype' ] . '-' . $plist ;
$pageparms = preg_replace ( " # \ | $ # " , " " , $pageparms );
2008-12-06 22:14:37 +00:00
$pageparms = ( trim ( $_POST [ 'pagelist' ]) == '' ) ? '' : $pageparms ;
$sql -> db_Update ( " menus " , " menu_class=' " . $_POST [ 'menu_class' ] . " ', menu_pages=' { $pageparms } ' WHERE menu_id= " . intval ( $id ));
$admin_log -> log_event ( 'MENU_02' , $_POST [ 'menu_class' ] . '[!br!]' . $pageparms . '[!br!]' . $id , E_LOG_INFORMATIVE , '' );
2006-12-02 04:36:16 +00:00
$message = " <br /> " . MENLAN_8 . " <br /> " ;
}
2009-01-21 22:04:36 +00:00
if ( $menu_act == " move " )
2008-12-06 22:14:37 +00:00
{
2007-11-18 02:20:59 +00:00
// Get current menu name
if ( $sql -> db_Select ( 'menus' , 'menu_name' , 'menu_id=' . $id , 'default' ))
{
$row = $sql -> db_Fetch ();
//Check to see if menu is already active in the new area, if not then move it
if ( ! $sql -> db_Select ( 'menus' , 'menu_id' , " menu_name=' { $row [ 'menu_name' ] } ' AND menu_location = " . $newloc ))
{
$menu_count = $sql -> db_Count ( " menus " , " (*) " , " WHERE menu_location= " . $newloc );
2008-12-06 22:14:37 +00:00
$sql -> db_Update ( " menus " , " menu_location=' { $newloc } ', menu_order= " . ( $menu_count + 1 ) . " WHERE menu_id= " . $id );
$sql -> db_Update ( " menus " , " menu_order=menu_order-1 WHERE menu_location=' { $location } ' AND menu_order > { $position } " );
2007-11-18 02:20:59 +00:00
}
2008-12-06 22:14:37 +00:00
$admin_log -> log_event ( 'MENU_03' , $row [ 'menu_name' ] . '[!br!]' . $newloc . '[!br!]' . $id , E_LOG_INFORMATIVE , '' );
2007-11-18 02:20:59 +00:00
}
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
if ( $menu_act == " deac " )
2008-12-06 22:14:37 +00:00
{
2007-11-18 02:20:59 +00:00
// Get current menu name
if ( $sql -> db_Select ( 'menus' , 'menu_name' , 'menu_id=' . $id , 'default' ))
{
$row = $sql -> db_Fetch ();
//Check to see if there is already a menu with location = 0 (to maintain BC)
if ( $sql -> db_Select ( 'menus' , 'menu_id' , " menu_name=' { $row [ 'menu_name' ] } ' AND menu_location = 0 " ))
{
//menu_location=0 already exists, we can just delete this record
$sql -> db_Delete ( 'menus' , 'menu_id=' . $id );
}
else
{
//menu_location=0 does NOT exist, let's just convert this to it
$sql -> db_Update ( " menus " , " menu_location=0, menu_order=0, menu_class=0, menu_pages='' WHERE menu_id= " . $id );
}
//Move all other menus up
2008-12-06 22:14:37 +00:00
$sql -> db_Update ( " menus " , " menu_order=menu_order-1 WHERE menu_location= { $location } AND menu_order > { $position } " );
$admin_log -> log_event ( 'MENU_04' , $row [ 'menu_name' ] . '[!br!]' . $location . '[!br!]' . $position . '[!br!]' . $id , E_LOG_INFORMATIVE , '' );
2007-11-18 02:20:59 +00:00
}
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
if ( $menu_act == " bot " )
2008-12-06 22:14:37 +00:00
{
2009-07-07 12:54:47 +00:00
$menu_count = $sql -> db_Count ( " menus " , " (*) " , " WHERE menu_location=' { $location } ' AND menu_layout = ' $curLayout ' " );
$sql -> db_Update ( " menus " , " menu_order= " . ( $menu_count + 1 ) . " WHERE menu_order=' { $position } ' AND menu_location=' { $location } ' AND menu_layout = ' $curLayout ' " );
$sql -> db_Update ( " menus " , " menu_order=menu_order-1 WHERE menu_location=' { $location } ' AND menu_order > { $position } AND menu_layout = ' $curLayout ' " );
2008-12-06 22:14:37 +00:00
$admin_log -> log_event ( 'MENU_06' , $location . '[!br!]' . $position . '[!br!]' . $id , E_LOG_INFORMATIVE , '' );
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
if ( $menu_act == " top " )
2008-12-06 22:14:37 +00:00
{
2009-07-07 12:54:47 +00:00
$sql -> db_Update ( " menus " , " menu_order=menu_order+1 WHERE menu_location=' { $location } ' AND menu_order < { $position } AND menu_layout = ' $curLayout ' " );
2008-12-06 22:14:37 +00:00
$sql -> db_Update ( " menus " , " menu_order=1 WHERE menu_id=' { $id } ' " );
$admin_log -> log_event ( 'MENU_05' , $location . '[!br!]' . $position . '[!br!]' . $id , E_LOG_INFORMATIVE , '' );
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
if ( $menu_act == " dec " )
2008-12-06 22:14:37 +00:00
{
2009-07-07 12:54:47 +00:00
$sql -> db_Update ( " menus " , " menu_order=menu_order-1 WHERE menu_order=' " . ( $position + 1 ) . " ' AND menu_location=' { $location } ' AND menu_layout = ' $curLayout ' " );
$sql -> db_Update ( " menus " , " menu_order=menu_order+1 WHERE menu_id=' { $id } ' AND menu_location=' { $location } ' AND menu_layout = ' $curLayout ' " );
2008-12-06 22:14:37 +00:00
$admin_log -> log_event ( 'MENU_08' , $location . '[!br!]' . $position . '[!br!]' . $id , E_LOG_INFORMATIVE , '' );
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
if ( $menu_act == " inc " )
2008-12-06 22:14:37 +00:00
{
2009-07-07 12:54:47 +00:00
$sql -> db_Update ( " menus " , " menu_order=menu_order+1 WHERE menu_order=' " . ( $position - 1 ) . " ' AND menu_location=' { $location } ' AND menu_layout = ' $curLayout ' " );
$sql -> db_Update ( " menus " , " menu_order=menu_order-1 WHERE menu_id=' { $id } ' AND menu_location=' { $location } ' AND menu_layout = ' $curLayout ' " );
2008-12-06 22:14:37 +00:00
$admin_log -> log_event ( 'MENU_07' , $location . '[!br!]' . $position . '[!br!]' . $id , E_LOG_INFORMATIVE , '' );
2006-12-02 04:36:16 +00:00
}
if ( strpos ( e_QUERY , 'configure' ) === FALSE )
2007-02-10 13:36:27 +00:00
{ // Scan plugin directories to see if menus to add
2006-12-02 04:36:16 +00:00
$efile = new e_file ;
2009-01-27 12:00:56 +00:00
$efile -> dirFilter = array ( '/' , 'CVS' , '.svn' , 'languages' );
$fileList = $efile -> get_files ( e_PLUGIN , " _menu \ .php $ " , 'standard' , 2 );
2009-01-21 22:04:36 +00:00
foreach ( $fileList as $file )
2007-02-10 13:36:27 +00:00
{
list ( $parent_dir ) = explode ( '/' , str_replace ( e_PLUGIN , " " , $file [ 'path' ]));
$file [ 'path' ] = str_replace ( e_PLUGIN , " " , $file [ 'path' ]);
$file [ 'fname' ] = str_replace ( " .php " , " " , $file [ 'fname' ]);
$valid_menu = FALSE ;
$existing_menu = $sql -> db_Count ( " menus " , " (*) " , " WHERE menu_name=' { $file [ 'fname' ] } ' " );
2009-01-21 22:04:36 +00:00
if ( file_exists ( e_PLUGIN . $parent_dir . " /plugin.xml " ) ||
file_exists ( e_PLUGIN . $parent_dir . " /plugin.php " ))
2007-02-10 13:36:27 +00:00
{
2008-08-25 13:43:08 +00:00
// include(e_PLUGIN.$parent_dir."/plugin.php");
if ( isset ( $pref [ 'plug_installed' ][ $parent_dir ]))
2009-01-21 22:04:36 +00:00
// if ($sql->db_Select("plugin", "*", "plugin_path='".$eplug_folder."' AND plugin_installflag='1' "))
2008-08-25 13:43:08 +00:00
{ // Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed
2007-02-10 13:36:27 +00:00
$valid_menu = TRUE ; // Whether new or existing, include in list
}
2009-01-21 22:04:36 +00:00
}
else
2007-02-10 13:36:27 +00:00
{ // Just add the menu anyway
$valid_menu = TRUE ;
}
2009-01-21 22:04:36 +00:00
if ( $valid_menu )
2007-02-10 13:36:27 +00:00
{
$menustr .= " & " . str_replace ( " .php " , " " , $file [ 'fname' ]);
if ( ! $existing_menu )
{ // New menu to add to list
2009-07-07 12:54:47 +00:00
if ( $sql -> db_Insert ( " menus " , " 0, ' { $file [ 'fname' ] } ', 0, 0, 0, '' ,' { $file [ 'path' ] } ', '' " ))
{
// Could do admin logging here - but probably not needed
$message .= " <b> " . MENLAN_10 . " - " . $file [ 'fname' ] . " </b><br /> " ;
}
2006-12-02 04:36:16 +00:00
}
2007-02-10 13:36:27 +00:00
}
2006-12-02 04:36:16 +00:00
}
2007-11-18 03:05:06 +00:00
//Reorder all menus into 1...x order
if ( ! is_object ( $sql2 )) $sql2 = new db ; // Shouldn't be needed
2009-01-21 22:04:36 +00:00
foreach ( $menu_areas as $menu_act )
2008-08-25 13:43:08 +00:00
{
2009-01-21 22:04:36 +00:00
if ( $sql -> db_Select ( " menus " , " menu_id " , " menu_location= { $menu_act } ORDER BY menu_order ASC " ))
2008-08-25 13:43:08 +00:00
{
2007-11-18 03:05:06 +00:00
$c = 1 ;
2009-01-21 22:04:36 +00:00
while ( $row = $sql -> db_Fetch ())
2008-08-25 13:43:08 +00:00
{
2007-11-18 03:05:06 +00:00
$sql2 -> db_Update ( " menus " , " menu_order= { $c } WHERE menu_id= " . $row [ 'menu_id' ]);
$c ++ ;
}
2006-12-02 04:36:16 +00:00
}
}
2009-01-21 22:04:36 +00:00
2007-11-18 03:05:06 +00:00
$sql -> db_Select ( " menus " , " * " , " menu_path NOT REGEXP('[0-9]+') " );
2009-01-21 22:04:36 +00:00
while ( list ( $menu_id , $menu_name , $menu_location , $menu_order ) = $sql -> db_Fetch ( MYSQL_NUM ))
2006-12-02 04:36:16 +00:00
{
2007-11-18 03:05:06 +00:00
if ( stristr ( $menustr , $menu_name ) === FALSE )
{
$sql2 -> db_Delete ( " menus " , " menu_name=' $menu_name ' " );
$message .= " <b> " . MENLAN_11 . " - " . $menu_name . " </b><br /> " ;
}
2006-12-02 04:36:16 +00:00
}
}
if ( $message != " " )
{
echo $ns -> tablerender ( 'Updated' , " <div style='text-align:center'><b> " . $message . " </b></div><br /><br /> " );
}
2009-07-05 11:57:40 +00:00
2006-12-02 04:36:16 +00:00
if ( strpos ( e_QUERY , 'configure' ) === FALSE )
{
2009-07-07 12:54:47 +00:00
$cnt = $sql -> db_Select ( " menus " , " * " , " menu_location > 0 AND menu_layout = ' $curLayout ' ORDER BY menu_name " ); // calculate height to remove vertical scroll-bar.
$text .= " COUNT = " . $cnt ;
2009-07-05 11:57:40 +00:00
2009-07-07 12:54:47 +00:00
$text = " <iframe id='menu_iframe' src=' " . e_SELF . " ?configure. $curLayout ' width='100%' style='width: 100%; height: " . (( $cnt * 80 ) + 600 ) . " px; border: 0px' frameborder='0' scrolling='auto' ></iframe> " ;
2006-12-02 04:36:16 +00:00
echo $ns -> tablerender ( MENLAN_35 , $text , 'menus_config' );
}
2009-07-05 11:57:40 +00:00
else // Within the IFrame.
2006-12-02 04:36:16 +00:00
{
2009-07-07 12:54:47 +00:00
echo layout_list ();
menuRenderPage ();
2006-12-02 04:36:16 +00:00
2009-07-07 12:54:47 +00:00
}
2006-12-02 04:36:16 +00:00
2009-07-07 12:54:47 +00:00
// =-----------------------------------------------------------------------------
2006-12-02 04:36:16 +00:00
2009-07-07 12:54:47 +00:00
function menuRenderPage ()
{
global $sql , $ns , $menus_header , $menus_footer , $frm , $curLayout , $pref , $tp , $menu_areas ;
2009-07-05 11:57:40 +00:00
2009-07-07 12:54:47 +00:00
parseheader ( $menus_header ); // $layouts_str;
2009-07-05 11:57:40 +00:00
2009-07-07 12:54:47 +00:00
$layout = ( $curLayout ) ? $curLayout : $pref [ 'sitetheme_deflayout' ];
2009-07-05 11:57:40 +00:00
$menuPreset = getMenuPreset ( $layout );
2006-12-02 04:36:16 +00:00
echo " <div style='text-align:center'> " ;
2009-07-07 12:54:47 +00:00
echo $frm -> form_open ( " post " , e_SELF . " ?configure. " . $curLayout , " menuActivation " );
2009-07-05 11:57:40 +00:00
$text = " <table style='width:80%;margin-left:auto;margin-right:auto'> " ;
2006-12-02 04:36:16 +00:00
2009-07-07 12:54:47 +00:00
$sql -> db_Select ( " menus " , " menu_name, menu_id, menu_pages " , " 1 GROUP BY menu_name ORDER BY menu_name ASC " );
2006-12-02 04:36:16 +00:00
$text .= " <tr><td style='width:50%;text-align:center;padding-bottom:4px'> " . MENLAN_36 . " ...</td><td style='width:50%;padding-bottom:4px;text-align:center'>... " . MENLAN_37 . " </td></tr> " ;
$text .= " <tr><td style='width:50%;vertical-align:top;text-align:center'> " ;
2009-07-05 11:57:40 +00:00
$text .= " <div style='border:1px inset black;height:200px;display:block;overflow:auto;margin-bottom:20px'>
< table style = 'width:100%;margin-left:auto;margin-right:auto' cellspacing = '0' cellpadding = '0' > \n " ;
while ( $row = $sql -> db_Fetch ())
{
$pdeta = " " ;
$color = ( $color == " white " ) ? " #DDDDDD " : " white " ;
if ( $row [ 'menu_pages' ] == " dbcustom " )
{
$pdeta = MENLAN_42 ;
}
else
{
$row [ 'menu_name' ] = preg_replace ( " #_menu $ #i " , " " , $row [ 'menu_name' ]);
if ( $pnum = checkMenuPreset ( $menuPreset , $row [ 'menu_name' ] . " _menu " ))
{
$pdeta = MENLAN_39 . " { $pnum } " ;
}
}
$text .= " <tr style='background-color: $color ;color:black'>
2009-07-07 12:54:47 +00:00
< td style = 'text-align:left; color:black;' >< input type = 'checkbox' name = 'menuselect[]' value = '{$row[' menu_id ']}' /> " . $row['menu_name'] . " </ td >
< td style = 'color:black' > " . $pdeta . " & nbsp ; </ td >
2009-07-05 11:57:40 +00:00
</ tr > \n " ;
}
$text .= " </table></div> " ;
2006-12-02 04:36:16 +00:00
$text .= " </td><td style='width:50%;vertical-align:top;text-align:center'><br /> " ;
2007-11-18 02:20:59 +00:00
foreach ( $menu_areas as $menu_act )
{
2009-07-05 11:57:40 +00:00
$text .= " <input type='submit' class='button' id='menuActivate_ " . trim ( $menu_act ) . " ' name='menuActivate[ " . trim ( $menu_act ) . " ]' value=' " . MENLAN_13 . " " . trim ( $menu_act ) . " ' /><br /><br /> \n " ;
}
2009-07-07 12:54:47 +00:00
if ( $layout )
2009-07-05 11:57:40 +00:00
{
2009-07-07 12:54:47 +00:00
if ( isset ( $pref [ 'sitetheme_layouts' ][ $layout ][ 'menuPresets' ]))
{
$text .= " <input type='submit' class='button' name='menuUsePreset' value= \" " . MENLAN_40 . " \" onclick= \" return jsconfirm(' " . $tp -> toJS ( MENLAN_41 ) . " ') \" /><br /><br /> \n " ; // Use Menu Presets
$text .= " <input type='hidden' name='menuPreset' value=' " . $layout . " ' /> " ;
}
$text .= " <input type='hidden' name='curLayout' value=' " . $layout . " ' /> " ;
}
2009-07-05 11:57:40 +00:00
2006-12-02 04:36:16 +00:00
$text .= " </td> " ;
$text .= " </tr></table> " ;
echo $ns -> tablerender ( MENLAN_22 , $text );
echo $frm -> form_close ();
echo " </div> " ;
parseheader ( $menus_footer );
}
2009-07-07 12:54:47 +00:00
2006-12-02 04:36:16 +00:00
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
2009-07-05 11:57:40 +00:00
function layout_list ()
{
2009-07-07 12:54:47 +00:00
global $frm , $curLayout , $menus_equery , $pref , $HEADER , $CUSTOMHEADER , $CUSTOMFOOTER , $CUSTOMPAGES ;
2009-07-05 11:57:40 +00:00
2009-07-07 12:54:47 +00:00
$text .= " <form method='post' action=' " . e_SELF . " ?configure. " . $curLayout . " '> " ;
2009-07-05 11:57:40 +00:00
$text .= " <div style='color:white;background-color:black;width:99%;left:0px;position:relative;display:block;padding:15px;text-align:center'> " . MENLAN_30 . " " ;
2009-07-07 12:54:47 +00:00
// $text .= $frm->form_select_open('custom_select', 'onchange="this.form.submit()"');
2009-07-05 11:57:40 +00:00
2009-07-07 12:54:47 +00:00
$text .= " <select style='color:black' name='custom_select' onchange= \" this.form.submit() \" > \n " ;
2009-07-05 11:57:40 +00:00
if ( is_array ( $HEADER ))
{
foreach ( $HEADER as $key => $val )
{
2009-07-07 12:54:47 +00:00
$default = ( $curLayout == $key || $curLayout == 'default_layout' ) ? " selected " : FALSE ;
2009-07-05 11:57:40 +00:00
$deftext = ( $key == $pref [ 'sitetheme_deflayout' ]) ? " ( " . MENLAN_31 . " ) " : " " ;
$diz = str_replace ( " _ " , " " , $key );
$text .= $frm -> form_option ( ucwords ( $diz ) . $deftext , $default , $key );
}
}
else
{
$text .= $frm -> form_option ( MENLAN_31 , '' , '' );
}
if ( $CUSTOMHEADER && ! is_array ( $CUSTOMHEADER ))
{
2009-07-07 12:54:47 +00:00
$CUSTOMHEADER = array ( 'no_array' => $CUSTOMHEADER );
2009-07-05 11:57:40 +00:00
}
if ( $CUSTOMFOOTER && ! is_array ( $CUSTOMFOOTER ))
{
2009-07-07 12:54:47 +00:00
$CUSTOMFOOTER = array ( 'no_array' => $CUSTOMFOOTER );
2009-07-05 11:57:40 +00:00
}
if ( is_array ( $CUSTOMHEADER ) || is_array ( $CUSTOMFOOTER ))
{
$customlist = ( is_array ( $CUSTOMHEADER )) ? array_merge ( $CUSTOMHEADER , $CUSTOMFOOTER ) : $CUSTOMFOOTER ;
foreach ( $customlist as $key => $val )
{
2009-07-07 12:54:47 +00:00
$selected = ( $curLayout == $key || $curLayout == 'default_layout' ) ? " selected='selected' " : " " ;
2009-07-05 11:57:40 +00:00
$deftext = ( $key == $pref [ 'sitetheme_deflayout' ]) ? " ( " . MENLAN_31 . " ) " : " " ;
2009-07-07 12:54:47 +00:00
$diz = ( $key == " no_array " ) ? MENLAN_33 : str_replace ( " _ " , " " , $key );
$text .= " <option value=' $key ' $selected style='color:black'> " . ucwords ( $diz ) . $deftext . " </option> \n " ;
// $text .= $frm->form_option(ucwords($diz).$deftext, $default, $key);
2009-07-05 11:57:40 +00:00
}
}
$text .= " </select> " ;
// TO-DO Saving of the custompage preference for each layout.
2009-07-07 12:54:47 +00:00
if ( $curLayout && ( $curLayout != $pref [ 'sitetheme_deflayout' ]))
2009-07-05 11:57:40 +00:00
{
2009-07-07 12:54:47 +00:00
2009-07-07 16:04:51 +00:00
if ( ! isset ( $pref [ 'sitetheme_custompages' ][ $curLayout ]))
2009-07-07 12:54:47 +00:00
{
if ( isset ( $pref [ 'sitetheme_layouts' ][ $curLayout ][ 'customPages' ]))
{
$custPages = $pref [ 'sitetheme_layouts' ][ $curLayout ][ 'customPages' ];
}
elseif ( isset ( $CUSTOMPAGES [ $curLayout ]) && $curLayout != 'no_array' )
{
$custPages = $CUSTOMPAGES [ $curLayout ];
}
elseif ( $CUSTOMPAGES )
{
$custPages = $CUSTOMPAGES ;
}
menuSetCustomPages ( array ( $curLayout => $custPages ));
}
else
2009-07-05 11:57:40 +00:00
{
2009-07-07 12:54:47 +00:00
$custPages = $pref [ 'sitetheme_custompages' ][ $curLayout ];
2009-07-05 11:57:40 +00:00
}
2009-07-07 12:54:47 +00:00
2009-07-07 16:04:51 +00:00
$text .= " <div style='padding:10px'>Displays on these pages: <input type='text' style='width:80%;color:black;background-color:white' name='custompages[ " . $curLayout . " ]' value= \" " . implode ( " " , $custPages ) . " \" />
2009-07-07 12:54:47 +00:00
< input type = 'submit' name = 'menuSetCustomPages' value = '".LAN_SAVE."' />
</ div > " ;
2009-07-05 11:57:40 +00:00
}
$text .= " </div>
</ form > " ;
return $text ;
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
2009-01-21 22:04:36 +00:00
function parseheader ( $LAYOUT , $check = FALSE )
2008-06-24 20:53:07 +00:00
{
2009-07-07 12:54:47 +00:00
global $curLayout ;
2008-06-24 20:53:07 +00:00
// $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 );
2009-01-21 22:04:36 +00:00
for ( $c = 0 ; $c < count ( $tmp ); $c ++ )
2008-06-24 20:53:07 +00:00
{
2009-01-21 22:04:36 +00:00
if ( preg_match ( " /[ \ { | \ }]/ " , $tmp [ $c ]))
2008-06-24 20:53:07 +00:00
{
2009-01-21 22:04:36 +00:00
if ( $check )
2008-06-24 20:53:07 +00:00
{
2009-01-21 22:04:36 +00:00
if ( strstr ( $tmp [ $c ], " { MENU= " ))
2008-06-24 20:53:07 +00:00
{
$str [] = preg_replace ( " / \ { MENU=(.*?)(:.*?)? \ }/si " , " \\ 1 " , $tmp [ $c ]);
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
}
else
2008-06-24 20:53:07 +00:00
{
2009-07-07 12:54:47 +00:00
checklayout ( $tmp [ $c ], $curLayout );
2008-06-24 20:53:07 +00:00
}
2009-01-21 22:04:36 +00:00
}
else
2008-06-24 20:53:07 +00:00
{
2009-01-21 22:04:36 +00:00
if ( ! $check )
2008-06-24 20:53:07 +00:00
{
echo $tmp [ $c ];
}
2006-12-02 04:36:16 +00:00
}
2008-06-24 20:53:07 +00:00
}
2009-01-21 22:04:36 +00:00
if ( $check )
2008-06-24 20:53:07 +00:00
{
return $str ;
}
2006-12-02 04:36:16 +00:00
}
2009-07-07 12:54:47 +00:00
function checklayout ( $str , $curLayout )
2007-03-06 19:59:36 +00:00
{ // Displays a basic representation of the theme
global $pref , $menu_areas , $ns , $PLUGINS_DIRECTORY , $frm , $sc_style , $tp , $menus_equery ;
2006-12-02 04:36:16 +00:00
2009-07-07 12:54:47 +00:00
$menuLayout = ( $curLayout != $pref [ 'sitetheme_deflayout' ]) ? $curLayout : " " ;
2009-01-21 22:04:36 +00:00
if ( strstr ( $str , " LOGO " ))
2007-03-06 19:59:36 +00:00
{
echo $tp -> parseTemplate ( " { LOGO} " );
}
2009-01-21 22:04:36 +00:00
else if ( strstr ( $str , " SITENAME " ))
2007-03-06 19:59:36 +00:00
{
echo " <div style='padding: 2px'>[SiteName]</div> " ;
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
else if ( strstr ( $str , " SITETAG " ))
2007-03-06 19:59:36 +00:00
{
echo " <div style='padding: 2px'>[SiteTag]</div> " ;
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
else if ( strstr ( $str , " SITELINKS " ))
2007-03-06 19:59:36 +00:00
{
echo " <div style='padding: 2px; text-align: center'>[SiteLinks]</div> " ;
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
else if ( strstr ( $str , " LANGUAGELINKS " ))
2007-03-06 19:59:36 +00:00
{
2009-01-21 22:04:36 +00:00
echo " <div class=text style='padding: 2px; text-align: center'>[Language]</div> " ;
2006-12-02 04:36:16 +00:00
}
2009-01-21 22:04:36 +00:00
else if ( strstr ( $str , " CUSTOM " ))
2007-03-06 19:59:36 +00:00
{
$cust = preg_replace ( " / \ W* \ { CUSTOM=(.*?)( \ +.*)? \ } \ W*/si " , " \\ 1 " , $str );
echo " <div style='padding: 2px'>[ " . $cust . " ]</div> " ;
2006-12-02 04:36:16 +00:00
}
// Display embedded Plugin information.
2007-03-06 19:59:36 +00:00
else if ( strstr ( $str , " PLUGIN " ))
{
2006-12-02 04:36:16 +00:00
$plug = preg_replace ( " / \ { PLUGIN=(.*?) \ }/si " , " \\ 1 " , $str );
$plug = trim ( $plug );
2007-03-06 19:59:36 +00:00
if ( file_exists (( e_PLUGIN . " { $plug } / { $plug } _config.php " )))
{
$link = e_PLUGIN . " { $plug } / { $plug } _config.php " ;
2006-12-02 04:36:16 +00:00
}
2007-03-06 19:59:36 +00:00
if ( file_exists (( e_PLUGIN . $plug . " /config.php " )))
{
$link = e_PLUGIN . $plug . " /config.php " ;
2006-12-02 04:36:16 +00:00
}
$plugtext = ( $link ) ? " ( " . MENLAN_34 . " :<a href=' $link ' title=' " . MENLAN_16 . " '> " . MENLAN_16 . " </a>) " : " ( " . MENLAN_34 . " ) " ;
echo " <br /> " ;
$ns -> tablerender ( $plug , $plugtext );
}
2009-01-21 22:04:36 +00:00
else if ( strstr ( $str , " MENU " ))
2007-03-06 19:59:36 +00:00
{
2006-12-02 04:36:16 +00:00
$ns = new e107table ;
$menu = preg_replace ( " / \ { MENU=(.*?)(:.*?)? \ }/si " , " \\ 1 " , $str );
2009-01-21 22:04:36 +00:00
if ( isset ( $sc_style [ 'MENU' ][ 'pre' ]) && strpos ( $str , 'ret' ) !== false )
2007-03-06 19:59:36 +00:00
{
echo $sc_style [ 'MENU' ][ 'pre' ];
2006-12-02 04:36:16 +00:00
}
echo " <div style='text-align:center; font-size:14px' class='fborder'><div class='forumheader'><b> " . MENLAN_14 . " " . $menu . " </b></div></div><br /> " ;
$text = " " ;
$sql9 = new db ;
2009-07-07 12:54:47 +00:00
if ( $sql9 -> db_Count ( " menus " , " (*) " , " WHERE menu_location=' $menu ' AND menu_layout = ' $menuLayout ' " ))
2007-03-06 19:59:36 +00:00
{
2006-12-02 04:36:16 +00:00
unset ( $text );
2009-07-07 12:54:47 +00:00
echo $frm -> form_open ( " post " , e_SELF . " ?configure. " . $curLayout , " frm_menu_ " . intval ( $menu ));
2006-12-02 04:36:16 +00:00
2009-07-07 12:54:47 +00:00
$sql9 -> db_Select ( " menus " , " * " , " menu_location=' $menu ' AND menu_layout=' $menuLayout ' ORDER BY menu_order " );
2006-12-02 04:36:16 +00:00
$menu_count = $sql9 -> db_Rows ();
2009-01-21 22:04:36 +00:00
while ( list ( $menu_id , $menu_name , $menu_location , $menu_order , $menu_class , $menu_pages , $menu_path ) = $sql9 -> db_Fetch ( MYSQL_NUM )) {
2006-12-02 04:36:16 +00:00
$menu_name = preg_replace ( " #_menu#i " , " " , $menu_name );
$vis = ( $menu_class || strlen ( $menu_pages ) > 1 ) ? " <span style='color:red'>*</span> " :
" " ;
$caption = " <div style='text-align:center'> { $menu_name } { $vis } </div> " ;
$menu_info = " { $menu_location } . { $menu_order } " ;
$text = " " ;
$conf = '' ;
if ( file_exists ( e_PLUGIN . " { $menu_path } / { $menu_name } _menu_config.php " ))
{
2007-03-06 19:59:36 +00:00
$conf = " config. { $menu_path } . { $menu_name } _menu_config " ;
2006-12-02 04:36:16 +00:00
}
if ( $conf == '' && file_exists ( e_PLUGIN . " { $menu_path } /config.php " ))
{
2007-03-06 19:59:36 +00:00
$conf = " config. { $menu_path } .config " ;
2006-12-02 04:36:16 +00:00
}
$text .= " <select id='menuAct_ $menu_id ' name='menuAct[ $menu_id ]' class='tbox' onchange='this.form.submit()' > " ;
$text .= $frm -> form_option ( MENLAN_25 , TRUE , " " );
$text .= $frm -> form_option ( MENLAN_15 , " " , " deac. { $menu_info } " );
if ( $conf ) {
$text .= $frm -> form_option ( MENLAN_16 , " " , $conf );
}
if ( $menu_order != 1 ) {
$text .= $frm -> form_option ( MENLAN_17 , " " , " inc. { $menu_info } " );
$text .= $frm -> form_option ( MENLAN_24 , " " , " top. { $menu_info } " );
}
if ( $menu_count != $menu_order ) {
$text .= $frm -> form_option ( MENLAN_18 , " " , " dec. { $menu_info } " );
$text .= $frm -> form_option ( MENLAN_23 , " " , " bot. { $menu_info } " );
}
foreach ( $menu_areas as $menu_act ) {
if ( $menu != $menu_act ) {
$text .= $frm -> form_option ( MENLAN_19 . " " . $menu_act , " " , " move. { $menu_info } . " . $menu_act );
}
}
$text .= $frm -> form_option ( MENLAN_20 , " " , " adv. { $menu_info } " );
$text .= $frm -> form_select_close ();
$ns -> tablerender ( $caption , $text );
echo " <div><br /></div> " ;
}
echo $frm -> form_close ();
}
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] " ;
}
}
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
require_once ( " footer.php " );
2009-07-07 12:54:47 +00:00
/*
if ( $CUSTOMPAGES )
{
if ( $menu_act != 'adv' )
{
$text = " <form method='post' action=' " . e_SELF . " ?configure. " . $curLayout . " '><div style='width: 100%'>
< table class = 'fborder' style = '".ADMIN_WIDTH."' >
< tr >
< td class = 'forumheader3' style = 'width: 90%' >
" .MENLAN_30. "
</ td >
< td class = 'forumheader3' style = 'width: 10%; text-align: center;' > " ;
$text .= $frm -> form_select_open ( 'custom_select' , 'onchange="this.form.submit()"' );
if ( $curLayout == '' || $curLayout == 'default_layout' )
{
$text .= $frm -> form_option ( MENLAN_31 , 'selected' , 'default_layout' );
}
else
{
$text .= $frm -> form_option ( MENLAN_31 , FALSE , 'default_layout' );
}
if ( $NEWSHEADER )
{
if ( $curLayout == 'newsheader_layout' )
{
$text .= $frm -> form_option ( MENLAN_32 , 'selected' , 'newsheader_layout' );
}
else
{
$text .= $frm -> form_option ( MENLAN_32 , FALSE , 'newsheader_layout' );
}
}
if ( $CUSTOMPAGES )
{
if ( is_array ( $CUSTOMPAGES ))
{
foreach ( $CUSTOMPAGES as $custom_pages_key => $custom_pages_value )
{
if ( $curLayout == $custom_pages_key )
{
$text .= $frm -> form_option ( $custom_pages_key , 'selected' , $custom_pages_key );
}
else
{
$text .= $frm -> form_option ( $custom_pages_key , FALSE , $custom_pages_key );
}
}
}
else
{
if ( $curLayout == 'custom_layout' )
{
$text .= $frm -> form_option ( MENLAN_33 , 'selected' , 'custom_layout' );
}
else
{
$text .= $frm -> form_option ( MENLAN_33 , FALSE , 'custom_layout' );
}
}
}
$text .= $frm -> form_select_close ();
$text .= " </td>
</ tr >
</ table ></ div >
</ form > " ;
$ns -> tablerender ( MENLAN_29 , $text );
}
}
*/
2006-12-02 04:36:16 +00:00
?>