diff --git a/e107_admin/menus.php b/e107_admin/menus.php index f0b64b73a..c6a080a0d 100644 --- a/e107_admin/menus.php +++ b/e107_admin/menus.php @@ -11,8 +11,8 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/menus.php,v $ -| $Revision: 1.16 $ -| $Date: 2009-07-06 05:59:42 $ +| $Revision: 1.17 $ +| $Date: 2009-07-07 12:54:44 $ | $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -36,44 +36,47 @@ if($_POST) } $menus_equery = explode('.', e_QUERY); +$curLayout = $menus_equery[1]; if (isset($_POST['custom_select'])) { - $menus_equery[1] = $_POST['custom_select']; + $curLayout = $_POST['custom_select']; //header("location:".e_SELF."?".$_POST['custom_select']); //exit; } - else if (!isset($menus_equery[1])) + else if (!isset($curLayout)) { - $menus_equery[1] = ''; + $curLayout = ''; } -if ($menus_equery[1] == '' || $menus_equery[1] == 'default_layout') + + +if ($curLayout == '' || $curLayout == 'default_layout') { $menus_header = is_array($HEADER) ? $HEADER[$pref['sitetheme_deflayout']] : $HEADER; $menus_footer = is_array($FOOTER) ? $FOOTER[$pref['sitetheme_deflayout']] : $FOOTER; } -else if ($menus_equery[1] == 'custom_layout') +else if ($curLayout == 'no_array') { $menus_header = $CUSTOMHEADER ? $CUSTOMHEADER : $HEADER; $menus_footer = $CUSTOMFOOTER ? $CUSTOMFOOTER : $FOOTER; } -else if ($menus_equery[1] == 'newsheader_layout') +else if ($curLayout == 'newsheader_layout') { $menus_header = $NEWSHEADER ? $NEWSHEADER : $HEADER; $menus_footer = $FOOTER; } elseif(is_array($HEADER) || is_array($FOOTER)) // 0.8 themes { - $menus_header = (is_array($HEADER) && isset($HEADER[$menus_equery[1]])) ? $HEADER[$menus_equery[1]] : $HEADER; - $menus_footer = (is_array($FOOTER) && isset($FOOTER[$menus_equery[1]])) ? $FOOTER[$menus_equery[1]] : $FOOTER; + $menus_header = (is_array($HEADER) && isset($HEADER[$curLayout])) ? $HEADER[$curLayout] : $HEADER; + $menus_footer = (is_array($FOOTER) && isset($FOOTER[$curLayout])) ? $FOOTER[$curLayout] : $FOOTER; } else { - $menus_header = $CUSTOMHEADER[$menus_equery[1]] ? $CUSTOMHEADER[$menus_equery[1]] : $HEADER; - $menus_footer = $CUSTOMFOOTER[$menus_equery[1]] ? $CUSTOMFOOTER[$menus_equery[1]] : $FOOTER; + $menus_header = $CUSTOMHEADER[$curLayout] ? $CUSTOMHEADER[$curLayout] : $HEADER; + $menus_footer = $CUSTOMFOOTER[$curLayout] ? $CUSTOMFOOTER[$curLayout] : $FOOTER; } @@ -130,31 +133,41 @@ foreach ($menu_array as $menu_value) // Cams Bit ----------- Activate Multiple Menus --- if($_POST['menuActivate']) { - foreach ($_POST['menuActivate'] as $k => $v) - { - if (trim($v)) - { - $location = $k; - } - } + menuActivate(); - $menu_count = $sql->db_Count("menus", "(*)", " WHERE menu_location=".$location); +} + +if($_POST['menuSetCustomPages']) +{ + menuSetCustomPages($_POST['custompages']); +} + +function menuActivate() +{ + global $sql, $admin_log, $pref; + + $location = key($_POST['menuActivate']); + echo "LAYOUT= ".$_POST['curLayout'] ; + $layout = ($_POST['curLayout'] != $pref['sitetheme_deflayout']) ? $_POST['curLayout'] : ""; + + $menu_count = $sql->db_Count("menus", "(*)", " WHERE menu_location=".$location." AND menu_layout = '$layout' "); foreach($_POST['menuselect'] as $sel_mens) { //Get info from menu being activated - if($sql->db_Select("menus", 'menu_name, menu_path' , 'menu_id = '.$sel_mens)) + if($sql->db_Select("menus", 'menu_name, menu_path' , "menu_id = ".$sel_mens." ")) { $row=$sql->db_Fetch(); //If menu is not already activated in that area, add the record. - if(!$sql->db_Select('menus', 'menu_id', "menu_name='{$row['menu_name']}' AND menu_location = $location")) + + if(!$sql->db_Update('menus', "menu_order='{$menu_count}', menu_location = ".$location." WHERE menu_name='".$row['menu_name']."' AND menu_layout = '$layout' LIMIT 1 ",TRUE)) { $qry = " INSERT into #menus - (`menu_name`, `menu_location`, `menu_order`, `menu_pages`, `menu_path`) - VALUES ('{$row['menu_name']}', {$location}, {$menu_count}, '', '{$row['menu_path']}') + (`menu_name`, `menu_location`, `menu_order`, `menu_pages`, `menu_path`, `menu_layout`) + VALUES ('{$row['menu_name']}', {$location}, {$menu_count}, '', '{$row['menu_path']}', '{$layout}') "; - $sql->db_Select_gen($qry); + $sql->db_Select_gen($qry,TRUE); $admin_log->log_event('MENU_01',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$menu_count.'[!br!]'.$row['menu_path'],E_LOG_INFORMATIVE,''); $menu_count++; } @@ -162,6 +175,13 @@ if($_POST['menuActivate']) } } +function menuSetCustomPages($array) +{ + global $pref; + $key = key($array); + $pref['sitetheme_custompages'][$key] = $array[$key]; + save_prefs(); +} function getMenuPreset($layout) { @@ -175,7 +195,6 @@ function getMenuPreset($layout) $temp = $pref['sitetheme_layouts'][$layout]['menuPresets']['area']; - foreach($temp as $key=>$val) { $iD = $val['@attributes']['id']; @@ -185,10 +204,8 @@ function getMenuPreset($layout) 'menu_location' => $iD, 'menu_order' => $k, 'menu_name' => $v['@attributes']['name']."_menu", - 'menu_class' => $v['@attributes']['userclass'] + 'menu_class' => intval(constant(trim($v['@attributes']['userclass']))) ); - - } } @@ -216,22 +233,38 @@ function checkMenuPreset($array,$name) -if(isset($_POST['menuUsePreset']) && $_POST['menuPreset']) +if(isset($_POST['menuUsePreset']) && $_POST['curLayout']) { - $layout = $_POST['menuPreset']; - $menuAreas = getMenuPreset($layout); + global $pref; + $layout = ($_POST['curLayout'] != $pref['sitetheme_deflayout']) ? $_POST['curLayout'] : ""; + $menuAreas = getMenuPreset($_POST['curLayout']); - - - $sql->db_Update("menus", "menu_location='0' "); // Clear All existing. + $sql->db_Update("menus", "menu_location='0' WHERE menu_layout = '$layout' "); // Clear All existing. foreach($menuAreas as $val) { - if(!$sql->db_Update("menus", "menu_class='".$val['menu_class']."', menu_order = ".$val['menu_order'].", menu_location='".$val['menu_location']."' WHERE menu_name='".$val['menu_name']."' LIMIT 1")) + + if($sql->db_Select("menus", 'menu_name, menu_path' , "menu_name = '".$val['menu_name']."' LIMIT 1")) { - // echo "it failed "; - } + $row=$sql->db_Fetch(); + + 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 ",TRUE)) + { + $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}') + "; + $sql->db_Select_gen($qry,TRUE); + $admin_log->log_event('MENU_01',$row['menu_name'].'[!br!]'.$location.'[!br!]'.$menu_count.'[!br!]'.$row['menu_path'],E_LOG_INFORMATIVE,''); + + } + } + + } + + } // ============= @@ -275,7 +308,7 @@ function showVisibility() $menu_pages = substr($row['menu_pages'], 2); $menu_pages = str_replace("|", "\n", $menu_pages); $text = "
-
+ "; @@ -640,23 +592,27 @@ else // Within the IFrame. parseheader($menus_footer); } + + + + //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// function layout_list() { - global $frm, $menus_equery, $pref,$HEADER, $CUSTOMHEADER, $CUSTOMFOOTER, $CUSTOMPAGES; + global $frm, $curLayout, $menus_equery, $pref, $HEADER, $CUSTOMHEADER, $CUSTOMFOOTER, $CUSTOMPAGES; - $text .= ""; + $text .= ""; $text .= "
".MENLAN_30." "; - $text .= $frm->form_select_open('custom_select', 'onchange="this.form.submit()"'); - + // $text .= $frm->form_select_open('custom_select', 'onchange="this.form.submit()"'); + $text .= "
"; + else + { + $custPages = $pref['sitetheme_custompages'][$curLayout]; + } + + $text .= "
Displays on these pages: + +
"; } $text .= ""; @@ -713,6 +692,7 @@ function layout_list() //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// function parseheader($LAYOUT, $check = FALSE) { + global $curLayout; // $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 ); @@ -729,7 +709,7 @@ function parseheader($LAYOUT, $check = FALSE) } else { - checklayout($tmp[$c]); + checklayout($tmp[$c],$curLayout); } } else @@ -746,10 +726,12 @@ function parseheader($LAYOUT, $check = FALSE) } } -function checklayout($str) +function checklayout($str,$curLayout) { // Displays a basic representation of the theme global $pref, $menu_areas, $ns, $PLUGINS_DIRECTORY, $frm, $sc_style, $tp, $menus_equery; + $menuLayout = ($curLayout != $pref['sitetheme_deflayout']) ? $curLayout : ""; + if (strstr($str, "LOGO")) { echo $tp -> parseTemplate("{LOGO}"); @@ -805,12 +787,12 @@ function checklayout($str) echo "
".MENLAN_14." ".$menu."

"; $text = " "; $sql9 = new db; - if ($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' ")) + if ($sql9->db_Count("menus", "(*)", " WHERE menu_location='$menu' AND menu_layout = '$menuLayout' ")) { unset($text); - echo $frm->form_open("post", e_SELF."?configure.".$menus_equery[1], "frm_menu_".intval($menu)); + echo $frm->form_open("post", e_SELF."?configure.".$curLayout, "frm_menu_".intval($menu)); - $sql9->db_Select("menus", "*", "menu_location='$menu' ORDER BY menu_order"); + $sql9->db_Select("menus", "*", "menu_location='$menu' AND menu_layout='$menuLayout' ORDER BY menu_order"); $menu_count = $sql9->db_Rows(); while (list($menu_id, $menu_name, $menu_location, $menu_order, $menu_class, $menu_pages, $menu_path) = $sql9->db_Fetch(MYSQL_NUM)) { $menu_name = preg_replace("#_menu#i", "", $menu_name); @@ -873,4 +855,83 @@ function checklayout($str) } //------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------// require_once("footer.php"); + + + + /* + if ($CUSTOMPAGES) + { + if ($menu_act != 'adv') + { + $text = "
+
@@ -367,30 +400,30 @@ if ($menu_act == "deac") if ($menu_act == "bot") { - $menu_count = $sql->db_Count("menus", "(*)", " WHERE menu_location='{$location}' "); - $sql->db_Update("menus", "menu_order=".($menu_count+1)." WHERE menu_order='{$position}' AND menu_location='{$location}' "); - $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_location='{$location}' AND menu_order > {$position}"); + $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' "); $admin_log->log_event('MENU_06',$location.'[!br!]'.$position.'[!br!]'.$id,E_LOG_INFORMATIVE,''); } if ($menu_act == "top") { - $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_location='{$location}' AND menu_order < {$position}"); + $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_location='{$location}' AND menu_order < {$position} AND menu_layout = '$curLayout' "); $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,''); } if ($menu_act == "dec") { - $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_order='".($position+1)."' AND menu_location='{$location}' "); - $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_id='{$id}' AND menu_location='{$location}' "); + $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' "); $admin_log->log_event('MENU_08',$location.'[!br!]'.$position.'[!br!]'.$id,E_LOG_INFORMATIVE,''); } if ($menu_act == "inc") { - $sql->db_Update("menus", "menu_order=menu_order+1 WHERE menu_order='".($position-1)."' AND menu_location='{$location}' "); - $sql->db_Update("menus", "menu_order=menu_order-1 WHERE menu_id='{$id}' AND menu_location='{$location}' "); + $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' "); $admin_log->log_event('MENU_07',$location.'[!br!]'.$position.'[!br!]'.$id,E_LOG_INFORMATIVE,''); } @@ -425,9 +458,11 @@ if (strpos(e_QUERY, 'configure') === FALSE) $menustr .= "&".str_replace(".php", "", $file['fname']); if (!$existing_menu) { // New menu to add to list - $sql->db_Insert("menus", " 0, '{$file['fname']}', 0, 0, 0, '' ,'{$file['path']}'"); - // Could do admin logging here - but probably not needed - $message .= "".MENLAN_10." - ".$file['fname']."
"; + if($sql->db_Insert("menus", " 0, '{$file['fname']}', 0, 0, 0, '' ,'{$file['path']}', ''")) + { + // Could do admin logging here - but probably not needed + $message .= "".MENLAN_10." - ".$file['fname']."
"; + } } } } @@ -466,102 +501,38 @@ if ($message != "") if (strpos(e_QUERY, 'configure') === FALSE) { - $cnt = $sql->db_Select("menus", "*", "menu_location='1' ORDER BY menu_name "); // calculate height to remove vertical scroll-bar. + $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; - $text = ""; + $text = ""; echo $ns -> tablerender(MENLAN_35, $text, 'menus_config'); } else // Within the IFrame. { + echo layout_list(); - /* - if ($CUSTOMPAGES) - { - if ($menu_act != 'adv') - { - $text = "
- - - - - -
- ".MENLAN_30." - "; + menuRenderPage(); - $text .= $frm->form_select_open('custom_select', 'onchange="this.form.submit()"'); +} - if ($menus_equery[1] == '' || $menus_equery[1] == 'default_layout') - { - $text .= $frm->form_option(MENLAN_31, 'selected', 'default_layout'); - } - else - { - $text .= $frm->form_option(MENLAN_31, FALSE, 'default_layout'); - } +// =----------------------------------------------------------------------------- - if ($NEWSHEADER) - { - if ($menus_equery[1] == '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 ($menus_equery[1] == $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 ($menus_equery[1] == 'custom_layout') - { - $text .= $frm->form_option(MENLAN_33, 'selected', 'custom_layout'); - } - else - { - $text .= $frm->form_option(MENLAN_33, FALSE, 'custom_layout'); - } - } - } +function menuRenderPage() +{ + global $sql, $ns, $menus_header, $menus_footer, $frm, $curLayout, $pref, $tp, $menu_areas; - $text .= $frm->form_select_close(); + parseheader($menus_header); // $layouts_str; - $text .= "
- "; - - $ns->tablerender(MENLAN_29, $text); - } - } -*/ - - parseheader($menus_header); $layouts_str; - - $layout = ($menus_equery[1]) ? $menus_equery[1] : $pref['sitetheme_deflayout']; + $layout = ($curLayout) ? $curLayout : $pref['sitetheme_deflayout']; $menuPreset = getMenuPreset($layout); echo "
"; - echo $frm->form_open("post", e_SELF."?configure.".$menus_equery[1], "menuActivation"); + echo $frm->form_open("post", e_SELF."?configure.".$curLayout, "menuActivation"); $text = ""; - $sql->db_Select("menus", "menu_name, menu_id, menu_pages", "1 GROUP BY menu_name ORDER BY menu_name ASC"); + $sql->db_Select("menus", "menu_name, menu_id, menu_pages", "1 GROUP BY menu_name ORDER BY menu_name ASC"); $text .= ""; $text .= " - - + + \n"; } $text .= "
".MENLAN_36."......".MENLAN_37."
"; @@ -587,36 +558,13 @@ else // Within the IFrame. $text .= "
".$row['menu_name']." ".$pdeta." ".$row['menu_name']." ".$pdeta." 
"; -/* $text .= "";*/ - // $text .= "

".MENLAN_38.""; $text .= "

"; foreach ($menu_areas as $menu_act) { @@ -624,11 +572,15 @@ else // Within the IFrame. } - if(is_array($pref['sitetheme_layouts'][$layout]['menuPresets'])) + if($layout) { - $text .= "toJS(MENLAN_41)."')\" />

\n"; // Use Menu Presets - $text .= ""; - } + if(isset($pref['sitetheme_layouts'][$layout]['menuPresets'])) + { + $text .= "toJS(MENLAN_41)."')\" />

\n"; // Use Menu Presets + $text .= ""; + } + $text .= ""; + } $text .= "
+ + + + +
+ ".MENLAN_30." + "; + + $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 .= "
+ "; + + $ns->tablerender(MENLAN_29, $text); + } + } +*/ ?> \ No newline at end of file diff --git a/e107_admin/sql/core_sql.php b/e107_admin/sql/core_sql.php index 87574c78e..b657ff454 100644 --- a/e107_admin/sql/core_sql.php +++ b/e107_admin/sql/core_sql.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/sql/core_sql.php,v $ -| $Revision: 1.17 $ -| $Date: 2009-06-29 21:26:58 $ -| $Author: e107steved $ +| $Revision: 1.18 $ +| $Date: 2009-07-07 12:54:47 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ header("location:../index.php"); @@ -292,6 +292,7 @@ CREATE TABLE menus ( menu_class varchar(255) NOT NULL default '0', menu_pages text NOT NULL, menu_path varchar(100) NOT NULL default '', + menu_layout varchar(100) NOT NULL default '', PRIMARY KEY (menu_id) ) TYPE=MyISAM; # -------------------------------------------------------- diff --git a/e107_admin/update_routines.php b/e107_admin/update_routines.php index 0d272e355..98cc84025 100644 --- a/e107_admin/update_routines.php +++ b/e107_admin/update_routines.php @@ -11,9 +11,9 @@ | GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_admin/update_routines.php,v $ -| $Revision: 1.38 $ -| $Date: 2009-06-29 21:26:58 $ -| $Author: e107steved $ +| $Revision: 1.39 $ +| $Date: 2009-07-07 12:54:46 $ +| $Author: e107coders $ +----------------------------------------------------------------------------+ */ @@ -244,7 +244,7 @@ function update_706_to_800($type='') // List of changed DB tables (defined in core_sql.php) // (primarily those which have changed significantly; for the odd field write some explicit code - it'll run faster) - $changed_tables = array('user', 'dblog','admin_log', 'userclass_classes', 'banlist'); + $changed_tables = array('user', 'dblog','admin_log', 'userclass_classes', 'banlist', 'menus'); // List of changed DB tables from core plugins (defined in pluginname_sql.php file) diff --git a/e107_themes/templates/header_default.php b/e107_themes/templates/header_default.php index 2f7456d57..f82a4ed06 100644 --- a/e107_themes/templates/header_default.php +++ b/e107_themes/templates/header_default.php @@ -6,8 +6,8 @@ | Released under the terms and conditions of the GNU General Public License (http://gnu.org). | | $Source: /cvs_backup/e107_0.8/e107_themes/templates/header_default.php,v $ -| $Revision: 1.30 $ -| $Date: 2009-07-05 21:20:30 $ +| $Revision: 1.31 $ +| $Date: 2009-07-07 12:54:47 $ | $Author: e107coders $ +-----------------------------------------------------------------------------------------------+ */ @@ -445,55 +445,73 @@ if ($e107_popup != 1) { // // M: Send top of body for custom pages and for news // - $def = varset($pref['sitetheme_deflayout']); - if(is_array($HEADER) && isset($HEADER[$def]) && isset($FOOTER[$def])) + +// ---------- New in 0.8 ------------------------------------------------------- + $def = ""; // no custom pages found yet. + + function checkCustomPages($urlBits) // Function for checking URL matches. + { + if(is_array($urlBits)) return FALSE; + + $tpages = explode(" ",$urlBits); + foreach($tpages as $kpage) + { + if ($kpage && (strstr(e_SELF, $kpage) || strstr(e_SELF."?".e_QUERY,$kpage))) + { + return TRUE; + } + } + } + + if(is_array($pref['sitetheme_custompages'])) // check if we match a page in layout custompages. + { + foreach($pref['sitetheme_custompages'] as $layout=>$cusPages) + { + if(checkCustomPages($cusPages)) + { + $def = ($layout) ? $layout : "no_array"; + break; + } + } + } + + if(!$def) // no custompage match, so load the default. + { + $def = varset($pref['sitetheme_deflayout']); // default layout. + } + + // The Above should be put into Class2, so it can interact with the menu loading. + + + if($def && is_array($HEADER) && isset($HEADER[$def]) && isset($FOOTER[$def])) // 0.8 themes - we always use $HEADER and $FOOTER. { $HEADER = $HEADER[$def]; $FOOTER = $FOOTER[$def]; } - - if(isset($CUSTOMPAGES)) + elseif($def && $def != "no_array" && (isset($CUSTOMHEADER[$def]) || isset($CUSTOMHEADER[$def]))) // 0.7 themes { - if (is_array($CUSTOMPAGES)) - { - foreach ($CUSTOMPAGES as $cust_key => $cust_value) - { - $custompage[$cust_key] = explode(' ', $cust_value); - } - } - else - { - $custompage['no_array'] = explode(' ', $CUSTOMPAGES); - } + $HEADER = ($CUSTOMHEADER[$def]) ? $CUSTOMHEADER[$def] : $HEADER; + $FOOTER = ($CUSTOMFOOTER[$def]) ? $CUSTOMFOOTER[$def] : $FOOTER; + } + elseif($def && (isset($CUSTOMHEADER) || isset($CUSTOMFOOTER)) ) // 0.6 themes. + { + $HEADER = ($CUSTOMHEADER) ? $CUSTOMHEADER : $HEADER; + $FOOTER = ($CUSTOMFOOTER) ? $CUSTOMFOOTER : $FOOTER; + } + + if (e_PAGE == 'news.php' && isset($NEWSHEADER)) + { + parseheader($NEWSHEADER); } else { - $custompage['no_array'] = array(); + parseheader($HEADER); } - $ph = FALSE; - if (e_PAGE == 'news.php' && isset($NEWSHEADER)) { - parseheader($NEWSHEADER); - } else { - $full_query = e_SELF."?".e_QUERY."!"; - foreach ($custompage as $key_extract => $cust_extract) { - foreach ($cust_extract as $key => $kpage) { - if ($kpage && (strstr(e_SELF, $kpage) || strstr($full_query,$kpage))) { - $ph = TRUE; - if ($key_extract=='no_array') { - $cust_header = $CUSTOMHEADER ? $CUSTOMHEADER : $HEADER; - $cust_footer = $CUSTOMFOOTER ? $CUSTOMFOOTER : $FOOTER; - } else { - $cust_header = $CUSTOMHEADER[$key_extract] ? $CUSTOMHEADER[$key_extract] : $HEADER; - $cust_footer = $CUSTOMFOOTER[$key_extract] ? $CUSTOMFOOTER[$key_extract] : $FOOTER; - } - break; - } - } - } - parseheader(($ph ? $cust_header : $HEADER)); - } + unset($def); + +// ----------------------------------------------------------------------------- // // N: Send other top-of-body HTML