mirror of
https://github.com/e107inc/e107.git
synced 2025-08-01 20:30:39 +02:00
More theme manager and menu manager refinements
This commit is contained in:
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/menus.php,v $
|
||||
| $Revision: 1.22 $
|
||||
| $Date: 2009-07-09 08:31:37 $
|
||||
| $Revision: 1.23 $
|
||||
| $Date: 2009-07-09 11:37:36 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -35,49 +35,18 @@ if($_POST)
|
||||
$e107cache->clear_sys("menus_");
|
||||
}
|
||||
|
||||
$menus_equery = explode('.', e_QUERY);
|
||||
$curLayout = $menus_equery[1];
|
||||
$tmp = explode('.', e_QUERY);
|
||||
$curLayout = ($tmp[1]) ? $tmp[1] : $pref['sitetheme_deflayout'] ;
|
||||
|
||||
if (isset($_POST['custom_select']))
|
||||
{
|
||||
$curLayout = $_POST['custom_select'];
|
||||
//header("location:".e_SELF."?".$_POST['custom_select']);
|
||||
//exit;
|
||||
}
|
||||
else if (!isset($curLayout))
|
||||
{
|
||||
$curLayout = $pref['sitetheme_deflayout'];
|
||||
}
|
||||
if(isset($_POST['custom_select']))
|
||||
{
|
||||
$curLayout = $_POST['custom_select'];
|
||||
}
|
||||
|
||||
|
||||
/*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 ($curLayout == 'legacyCustom')
|
||||
{
|
||||
$menus_header = $CUSTOMHEADER ? $CUSTOMHEADER : $HEADER;
|
||||
$menus_footer = $CUSTOMFOOTER ? $CUSTOMFOOTER : $FOOTER;
|
||||
}
|
||||
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[$curLayout])) ? $HEADER[$curLayout] : $HEADER;
|
||||
$menus_footer = (is_array($FOOTER) && isset($FOOTER[$curLayout])) ? $FOOTER[$curLayout] : $FOOTER;
|
||||
// Almost the same code as found in templates/header_default.php ---------
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$menus_header = $CUSTOMHEADER[$curLayout] ? $CUSTOMHEADER[$curLayout] : $HEADER;
|
||||
$menus_footer = $CUSTOMFOOTER[$curLayout] ? $CUSTOMFOOTER[$curLayout] : $FOOTER;
|
||||
}
|
||||
*/
|
||||
// Almost the same code as found in templates/header_default.php
|
||||
if(($curLayout == 'legacyCustom' || $curLayout=='legacyDefault') && (isset($CUSTOMHEADER) || isset($CUSTOMFOOTER)) ) // 0.6 themes.
|
||||
{
|
||||
if($curLayout == 'legacyCustom')
|
||||
@@ -99,60 +68,161 @@ else
|
||||
$FOOTER = $FOOTER[$curLayout];
|
||||
}
|
||||
|
||||
if (e_PAGE == 'news.php' && isset($NEWSHEADER))
|
||||
// ------------------------------------------------------------------------
|
||||
|
||||
|
||||
$layouts_str = $HEADER.$FOOTER;
|
||||
|
||||
|
||||
if ($NEWSHEADER)
|
||||
{
|
||||
// parseheader($NEWSHEADER);
|
||||
$layouts_str .= $NEWSHEADER;
|
||||
}
|
||||
else
|
||||
|
||||
$menu_array = parseheader($layouts_str, 'check');
|
||||
|
||||
|
||||
sort($menu_array, SORT_NUMERIC);
|
||||
$menu_check = 'set';
|
||||
foreach ($menu_array as $menu_value)
|
||||
{
|
||||
// parseheader($HEADER);
|
||||
if ($menu_value != $menu_check)
|
||||
{
|
||||
$menu_areas[] = $menu_value;
|
||||
}
|
||||
$menu_check = $menu_value;
|
||||
}
|
||||
|
||||
// Cams Bit ----------- Activate Multiple Menus ---
|
||||
if($_POST['menuActivate'])
|
||||
{
|
||||
menuActivate();
|
||||
|
||||
}
|
||||
|
||||
if($_POST['menuSetCustomPages'])
|
||||
{
|
||||
menuSetCustomPages($_POST['custompages']);
|
||||
}
|
||||
|
||||
if(isset($_POST['menuUsePreset']) && $_POST['curLayout'])
|
||||
{
|
||||
|
||||
menuSetPreset();
|
||||
}
|
||||
|
||||
|
||||
$layouts_str = $HEADER.$FOOTER;
|
||||
$menus_header = $HEADER;
|
||||
$menus_footer = $FOOTER;
|
||||
|
||||
|
||||
if ($NEWSHEADER)
|
||||
{
|
||||
$layouts_str .= $NEWSHEADER;
|
||||
}
|
||||
|
||||
$menu_array = parseheader($layouts_str, 'check');
|
||||
|
||||
|
||||
sort($menu_array, SORT_NUMERIC);
|
||||
$menu_check = 'set';
|
||||
foreach ($menu_array as $menu_value)
|
||||
{
|
||||
if ($menu_value != $menu_check)
|
||||
if (isset($_POST['menuAct']))
|
||||
{
|
||||
$menu_areas[] = $menu_value;
|
||||
foreach ($_POST['menuAct'] as $k => $v)
|
||||
{
|
||||
if (trim($v))
|
||||
{
|
||||
$id = $k;
|
||||
list($menu_act, $location, $position, $newloc) = explode(".", $_POST['menuAct'][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
$menu_check = $menu_value;
|
||||
}
|
||||
|
||||
// Cams Bit ----------- Activate Multiple Menus ---
|
||||
if($_POST['menuActivate'])
|
||||
if ($menu_act == 'config')
|
||||
{
|
||||
if($newloc)
|
||||
{
|
||||
$newloc = ".".$newloc;
|
||||
}
|
||||
$newurl = $PLUGINS_DIRECTORY.$location."/{$position}{$newloc}.php";
|
||||
$newurl = SITEURL.str_replace("//", "/", $newurl);
|
||||
echo "<script type='text/javascript'> top.location.href = '{$newurl}'; </script> ";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($menu_act == "adv")
|
||||
{
|
||||
menuVisibilityOptions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
unset($message);
|
||||
|
||||
if ($menu_act == "sv")
|
||||
{
|
||||
menuSaveVisibility();
|
||||
|
||||
}
|
||||
|
||||
if ($menu_act == "move")
|
||||
{
|
||||
menuMove();
|
||||
}
|
||||
|
||||
if ($menu_act == "deac")
|
||||
{
|
||||
menuDeactivate();
|
||||
}
|
||||
|
||||
if ($menu_act == "bot")
|
||||
{
|
||||
$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} 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}' 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}' 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,'');
|
||||
}
|
||||
|
||||
if (strpos(e_QUERY, 'configure') === FALSE)
|
||||
{ // Scan plugin directories to see if menus to add
|
||||
menuScanMenus();
|
||||
}
|
||||
|
||||
if ($message != "")
|
||||
{
|
||||
echo $ns -> tablerender('Updated', "<div style='text-align:center'><b>".$message."</b></div><br /><br />");
|
||||
}
|
||||
|
||||
|
||||
if (strpos(e_QUERY, 'configure') === FALSE)
|
||||
{
|
||||
$cnt = $sql->db_Select("menus", "*", "menu_location > 0 AND menu_layout = '$curLayout' ORDER BY menu_name "); // calculate height to remove vertical scroll-bar.
|
||||
$text = "<iframe id='menu_iframe' src='".e_SELF."?configure.$curLayout' width='100%' style='width: 100%; height: ".(($cnt*90)+600)."px; border: 0px' frameborder='0' scrolling='auto' ></iframe>";
|
||||
$ns -> tablerender(MENLAN_35, $text, 'menus_config');
|
||||
}
|
||||
else // Within the IFrame.
|
||||
{
|
||||
|
||||
echo menuSelectLayout();
|
||||
menuRenderPage();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
function menuSetPreset()
|
||||
{
|
||||
menuActivate();
|
||||
|
||||
}
|
||||
|
||||
if($_POST['menuSetCustomPages'])
|
||||
{
|
||||
menuSetCustomPages($_POST['custompages']);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
if(isset($_POST['menuUsePreset']) && $_POST['curLayout'])
|
||||
{
|
||||
global $pref;
|
||||
global $pref,$sql,$location,$admin_log;
|
||||
$layout = ($_POST['curLayout'] != $pref['sitetheme_deflayout']) ? $_POST['curLayout'] : "";
|
||||
$menuAreas = getMenuPreset($_POST['curLayout']);
|
||||
|
||||
@@ -178,187 +248,86 @@ if(isset($_POST['menuUsePreset']) && $_POST['curLayout'])
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
// =============
|
||||
|
||||
if (isset($_POST['menuAct']))
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
function menuScanMenus()
|
||||
{
|
||||
foreach ($_POST['menuAct'] as $k => $v)
|
||||
{
|
||||
if (trim($v))
|
||||
{
|
||||
$id = $k;
|
||||
list($menu_act, $location, $position, $newloc) = explode(".", $_POST['menuAct'][$k]);
|
||||
}
|
||||
}
|
||||
}
|
||||
global $sql, $sql2, $menu_areas;
|
||||
|
||||
if ($menu_act == 'config')
|
||||
{
|
||||
if($newloc)
|
||||
{
|
||||
$newloc = ".".$newloc;
|
||||
}
|
||||
$newurl = $PLUGINS_DIRECTORY.$location."/{$position}{$newloc}.php";
|
||||
$newurl = SITEURL.str_replace("//", "/", $newurl);
|
||||
echo "<script type='text/javascript'> top.location.href = '{$newurl}'; </script> ";
|
||||
exit;
|
||||
}
|
||||
|
||||
if ($menu_act == "adv")
|
||||
{
|
||||
menuVisibilityOptions();
|
||||
}
|
||||
|
||||
|
||||
|
||||
unset($message);
|
||||
|
||||
if ($menu_act == "sv")
|
||||
{
|
||||
menuSaveVisibility();
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
if ($menu_act == "move")
|
||||
{
|
||||
menuMove();
|
||||
}
|
||||
|
||||
if ($menu_act == "deac")
|
||||
{
|
||||
menuDeactivate();
|
||||
}
|
||||
|
||||
if ($menu_act == "bot")
|
||||
{
|
||||
$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} 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}' 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}' 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,'');
|
||||
}
|
||||
|
||||
if (strpos(e_QUERY, 'configure') === FALSE)
|
||||
{ // Scan plugin directories to see if menus to add
|
||||
$efile = new e_file;
|
||||
$efile->dirFilter = array('/', 'CVS', '.svn', 'languages');
|
||||
$fileList = $efile->get_files(e_PLUGIN,"_menu\.php$",'standard',2);
|
||||
foreach($fileList as $file)
|
||||
{
|
||||
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']}'");
|
||||
if (file_exists(e_PLUGIN.$parent_dir."/plugin.xml") ||
|
||||
file_exists(e_PLUGIN.$parent_dir."/plugin.php"))
|
||||
{
|
||||
// include(e_PLUGIN.$parent_dir."/plugin.php");
|
||||
if (isset($pref['plug_installed'][$parent_dir]))
|
||||
// if ($sql->db_Select("plugin", "*", "plugin_path='".$eplug_folder."' AND plugin_installflag='1' "))
|
||||
{ // Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed
|
||||
$valid_menu = TRUE; // Whether new or existing, include in list
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Just add the menu anyway
|
||||
$valid_menu = TRUE;
|
||||
}
|
||||
if ($valid_menu)
|
||||
{
|
||||
$menustr .= "&".str_replace(".php", "", $file['fname']);
|
||||
if (!$existing_menu)
|
||||
{ // New menu to add to list
|
||||
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 />";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Reorder all menus into 1...x order
|
||||
if (!is_object($sql2)) $sql2 = new db; // Shouldn't be needed
|
||||
foreach ($menu_areas as $menu_act)
|
||||
{
|
||||
if ($sql->db_Select("menus", "menu_id", "menu_location={$menu_act} ORDER BY menu_order ASC"))
|
||||
$efile = new e_file;
|
||||
$efile->dirFilter = array('/', 'CVS', '.svn', 'languages');
|
||||
$fileList = $efile->get_files(e_PLUGIN,"_menu\.php$",'standard',2);
|
||||
foreach($fileList as $file)
|
||||
{
|
||||
$c = 1;
|
||||
while ($row = $sql->db_Fetch())
|
||||
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']}'");
|
||||
if (file_exists(e_PLUGIN.$parent_dir."/plugin.xml") ||
|
||||
file_exists(e_PLUGIN.$parent_dir."/plugin.php"))
|
||||
{
|
||||
// include(e_PLUGIN.$parent_dir."/plugin.php");
|
||||
if (isset($pref['plug_installed'][$parent_dir]))
|
||||
// if ($sql->db_Select("plugin", "*", "plugin_path='".$eplug_folder."' AND plugin_installflag='1' "))
|
||||
{ // Its a 'new style' plugin with a plugin.php file, or an even newer one with plugin.xml file - only include if plugin installed
|
||||
$valid_menu = TRUE; // Whether new or existing, include in list
|
||||
}
|
||||
}
|
||||
else
|
||||
{ // Just add the menu anyway
|
||||
$valid_menu = TRUE;
|
||||
}
|
||||
if ($valid_menu)
|
||||
{
|
||||
$menustr .= "&".str_replace(".php", "", $file['fname']);
|
||||
if (!$existing_menu)
|
||||
{ // New menu to add to list
|
||||
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 />";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//Reorder all menus into 1...x order
|
||||
if (!is_object($sql2)) $sql2 = new db; // Shouldn't be needed
|
||||
foreach ($menu_areas as $menu_act)
|
||||
{
|
||||
if ($sql->db_Select("menus", "menu_id", "menu_location={$menu_act} ORDER BY menu_order ASC"))
|
||||
{
|
||||
$sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=".$row['menu_id']);
|
||||
$c++;
|
||||
$c = 1;
|
||||
while ($row = $sql->db_Fetch())
|
||||
{
|
||||
$sql2->db_Update("menus", "menu_order={$c} WHERE menu_id=".$row['menu_id']);
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$sql->db_Select("menus", "*", "menu_path NOT REGEXP('[0-9]+') ");
|
||||
while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->db_Fetch(MYSQL_NUM))
|
||||
{
|
||||
if (stristr($menustr, $menu_name) === FALSE)
|
||||
$sql->db_Select("menus", "*", "menu_path NOT REGEXP('[0-9]+') ");
|
||||
while (list($menu_id, $menu_name, $menu_location, $menu_order) = $sql->db_Fetch(MYSQL_NUM))
|
||||
{
|
||||
$sql2->db_Delete("menus", "menu_name='$menu_name'");
|
||||
$message .= "<b>".MENLAN_11." - ".$menu_name."</b><br />";
|
||||
if (stristr($menustr, $menu_name) === FALSE)
|
||||
{
|
||||
$sql2->db_Delete("menus", "menu_name='$menu_name'");
|
||||
$message .= "<b>".MENLAN_11." - ".$menu_name."</b><br />";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo $message;
|
||||
}
|
||||
|
||||
if ($message != "")
|
||||
{
|
||||
echo $ns -> tablerender('Updated', "<div style='text-align:center'><b>".$message."</b></div><br /><br />");
|
||||
}
|
||||
|
||||
|
||||
if (strpos(e_QUERY, 'configure') === FALSE)
|
||||
{
|
||||
$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 = "<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>";
|
||||
echo $ns -> tablerender(MENLAN_35, $text, 'menus_config');
|
||||
}
|
||||
else // Within the IFrame.
|
||||
{
|
||||
|
||||
echo menuSelectLayout();
|
||||
menuRenderPage();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
function menuVisibilityOptions()
|
||||
{
|
||||
global $sql,$ns,$id;
|
||||
global $sql,$ns,$id,$curLayout;
|
||||
require_once(e_HANDLER."userclass_class.php");
|
||||
$sql->db_Select("menus", "*", "menu_id=".$id);
|
||||
$row = $sql->db_Fetch();
|
||||
@@ -393,11 +362,13 @@ function menuVisibilityOptions()
|
||||
</div>";
|
||||
$caption = MENLAN_7." ".$row['menu_name'];
|
||||
$ns->tablerender($caption, $text);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
function menuActivate()
|
||||
{
|
||||
global $sql, $admin_log, $pref;
|
||||
@@ -431,6 +402,11 @@ function menuActivate()
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
|
||||
function menuSetCustomPages($array)
|
||||
{
|
||||
global $pref;
|
||||
@@ -439,6 +415,9 @@ function menuSetCustomPages($array)
|
||||
save_prefs();
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
function getMenuPreset($layout)
|
||||
{
|
||||
global $pref;
|
||||
@@ -470,6 +449,9 @@ function getMenuPreset($layout)
|
||||
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
||||
function checkMenuPreset($array,$name)
|
||||
{
|
||||
if(!is_array($array))
|
||||
@@ -489,10 +471,6 @@ function checkMenuPreset($array,$name)
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// --------------------------------------------------------------------------
|
||||
|
||||
function menuSaveVisibility()
|
||||
@@ -584,9 +562,9 @@ function menuMove()
|
||||
|
||||
function menuRenderPage()
|
||||
{
|
||||
global $sql, $ns, $menus_header, $menus_footer, $frm, $curLayout, $pref, $tp, $menu_areas;
|
||||
global $sql, $ns, $HEADER, $FOOTER, $frm, $curLayout, $pref, $tp, $menu_areas;
|
||||
|
||||
parseheader($menus_header); // $layouts_str;
|
||||
parseheader($HEADER); // $layouts_str;
|
||||
|
||||
$layout = ($curLayout) ? $curLayout : $pref['sitetheme_deflayout'];
|
||||
$menuPreset = getMenuPreset($layout);
|
||||
@@ -653,7 +631,7 @@ function menuRenderPage()
|
||||
echo $frm->form_close();
|
||||
echo "</div>";
|
||||
|
||||
parseheader($menus_footer);
|
||||
parseheader($FOOTER);
|
||||
}
|
||||
|
||||
|
||||
@@ -663,10 +641,10 @@ function menuRenderPage()
|
||||
//------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------//
|
||||
function menuSelectLayout()
|
||||
{
|
||||
global $frm, $curLayout, $menus_equery, $pref, $HEADER, $CUSTOMHEADER, $CUSTOMFOOTER, $CUSTOMPAGES;
|
||||
global $frm, $curLayout, $pref, $HEADER, $CUSTOMHEADER, $CUSTOMFOOTER, $CUSTOMPAGES;
|
||||
|
||||
$text .= "<form method='post' action='".e_SELF."?configure.".$curLayout."'>";
|
||||
$text .= "<div style='color:white;background-color:black;width:99%;left:0px;position:relative;display:block;padding:15px;text-align:center'>".MENLAN_30." ";
|
||||
$text .= "<div style='color:white;background-color:black;width:98%;display:block;padding:15px;text-align:center'>".MENLAN_30." ";
|
||||
$text .= "<select style='color:black' name='custom_select' onchange=\"this.form.submit()\">\n";
|
||||
|
||||
$search = array("_","legacyDefault","legacyCustom");
|
||||
@@ -805,7 +783,7 @@ function parseheader($LAYOUT, $check = FALSE)
|
||||
|
||||
function checklayout($str,$curLayout)
|
||||
{ // Displays a basic representation of the theme
|
||||
global $pref, $menu_areas, $ns, $PLUGINS_DIRECTORY, $frm, $sc_style, $tp, $menu_order, $menus_equery;
|
||||
global $pref, $menu_areas, $ns, $PLUGINS_DIRECTORY, $frm, $sc_style, $tp, $menu_order;
|
||||
|
||||
$menuLayout = ($curLayout != $pref['sitetheme_deflayout']) ? $curLayout : "";
|
||||
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_admin/theme.php,v $
|
||||
| $Revision: 1.2 $
|
||||
| $Date: 2009-07-06 05:59:42 $
|
||||
| $Revision: 1.3 $
|
||||
| $Date: 2009-07-09 11:37:36 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -29,7 +29,7 @@ require_once("auth.php");
|
||||
require_once(e_HANDLER."theme_handler.php");
|
||||
$themec = new themeHandler;
|
||||
|
||||
$mode = e_QUERY;
|
||||
$mode = (e_QUERY) ? e_QUERY :"main" ;
|
||||
|
||||
if($_POST['selectadmin'])
|
||||
{
|
||||
@@ -44,8 +44,11 @@ if($_POST['selectmain'])
|
||||
$themec -> showThemes($mode);
|
||||
|
||||
|
||||
require_once("footer.php");
|
||||
|
||||
function theme_adminmenu()
|
||||
{
|
||||
global $mode;
|
||||
$e107 = &e107::getInstance();
|
||||
|
||||
$var['main']['text'] = TPVLAN_33;
|
||||
@@ -63,10 +66,10 @@ function theme_adminmenu()
|
||||
$selected = (e_QUERY) ? e_QUERY : "main";
|
||||
|
||||
|
||||
e_admin_menu(TPVLAN_26, $selected, $var);
|
||||
e_admin_menu(TPVLAN_26, $mode, $var);
|
||||
}
|
||||
|
||||
require_once("footer.php");
|
||||
|
||||
|
||||
|
||||
|
||||
|
@@ -11,8 +11,8 @@
|
||||
| GNU General Public License (http://gnu.org).
|
||||
|
|
||||
| $Source: /cvs_backup/e107_0.8/e107_handlers/theme_handler.php,v $
|
||||
| $Revision: 1.29 $
|
||||
| $Date: 2009-07-09 08:31:38 $
|
||||
| $Revision: 1.30 $
|
||||
| $Date: 2009-07-09 11:37:36 $
|
||||
| $Author: e107coders $
|
||||
+----------------------------------------------------------------------------+
|
||||
*/
|
||||
@@ -33,12 +33,16 @@ class themeHandler{
|
||||
require_once(e_HANDLER."form_handler.php");
|
||||
$this->frm = new e_form(); //enable inner tabindex counter
|
||||
|
||||
|
||||
|
||||
if (isset($_POST['upload'])) {
|
||||
$this -> themeUpload();
|
||||
}
|
||||
|
||||
$this -> themeArray = $this -> getThemes();
|
||||
|
||||
|
||||
|
||||
foreach($_POST as $key => $post)
|
||||
{
|
||||
if(strstr($key,"preview"))
|
||||
@@ -62,6 +66,7 @@ class themeHandler{
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if(isset($_POST['submit_adminstyle']))
|
||||
{
|
||||
$this -> id = $_POST['curTheme'];
|
||||
@@ -73,7 +78,7 @@ class themeHandler{
|
||||
{
|
||||
$this -> id = $_POST['curTheme'];
|
||||
$this -> setStyle();
|
||||
$this -> SetCustomPages($_POST['custompages']);
|
||||
$this -> SetCustomPages($_POST['custompages']);
|
||||
|
||||
}
|
||||
|
||||
@@ -395,36 +400,59 @@ class themeHandler{
|
||||
return $text;
|
||||
}
|
||||
|
||||
function renderThemeConfig() // process custom theme configuration - TODO.
|
||||
{
|
||||
global $frm;
|
||||
$confile = e_THEME.$this->id."/".$this->id."_config.php";
|
||||
if(is_readable($confile))
|
||||
{
|
||||
include_once($confile);
|
||||
if(function_exists($this->id."_config"))
|
||||
{
|
||||
$var = call_user_func($this->id."_config");
|
||||
foreach($var as $val)
|
||||
{
|
||||
$text .= "<tr><td><b>".$val['caption']."</b>:</td><td colspan='2'>".$val['html']."</td></tr>";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function setThemeConfig()
|
||||
function loadThemeConfig()
|
||||
{
|
||||
$confile = e_THEME.$this->id."/".$this->id."_config.php";
|
||||
|
||||
include($confile);
|
||||
if(is_readable($confile) && !function_exists($this->id."_config"))
|
||||
{
|
||||
include($confile);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function renderThemeConfig() // process custom theme configuration - TODO.
|
||||
{
|
||||
global $frm;
|
||||
|
||||
if(function_exists($this->id."_config"))
|
||||
{
|
||||
$var = call_user_func($this->id."_config");
|
||||
foreach($var as $val)
|
||||
{
|
||||
$text .= "<tr><td><b>".$val['caption']."</b>:</td><td colspan='2'>".$val['html']."</td></tr>";
|
||||
}
|
||||
return $text;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
function renderThemeHelp()
|
||||
{
|
||||
|
||||
if(function_exists($this->id."_help"))
|
||||
{
|
||||
return call_user_func($this->id."_help");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function setThemeConfig()
|
||||
{
|
||||
global $theme_pref;
|
||||
$this -> loadThemeConfig();
|
||||
|
||||
$confile = e_THEME.$this->id."/".$this->id."_config.php";
|
||||
|
||||
if(function_exists($this->id."_process"))
|
||||
{
|
||||
$text = call_user_func($this->id."_process");
|
||||
$text = call_user_func($this->id."_process");
|
||||
}
|
||||
|
||||
return $text;
|
||||
return $text;
|
||||
}
|
||||
|
||||
function renderTheme($mode=FALSE, $theme)
|
||||
@@ -470,6 +498,9 @@ class themeHandler{
|
||||
}
|
||||
|
||||
$this->id = $theme['path'];
|
||||
|
||||
$this->loadThemeConfig(); // load customn theme configuration fieldss.
|
||||
|
||||
$menuPresetCount = 0;
|
||||
foreach($theme['layouts'] as $key=>$val)
|
||||
{
|
||||
@@ -480,8 +511,21 @@ class themeHandler{
|
||||
}
|
||||
|
||||
|
||||
$text = "<div class='block' >
|
||||
$text = "
|
||||
<h2 class='caption'>".$theme['name']."</h2>
|
||||
<div class='admintabs' id='tab-container'>";
|
||||
|
||||
if(function_exists($theme['name']."_help"))
|
||||
{
|
||||
$text .= "
|
||||
<ul class='e-tabs e-hideme' id='core-thememanager-tabs'>
|
||||
<li id='tab-thememanager-configure'><a href='#core-thememanager-configure'>".LAN_CONFIGURE."</a></li>
|
||||
<li id='tab-thememanager-help'><a href='#core-thememanager-help'>".LAN_HELP."</a></li>
|
||||
</ul>";
|
||||
}
|
||||
|
||||
$text .= "
|
||||
<div id='core-thememanager-configure'>
|
||||
<table class='adminlist'>
|
||||
<tr><td colspan='3'></td></tr>
|
||||
<tr><td><b>".TPVLAN_11."</b></td><td>".$theme['version']."</td>
|
||||
@@ -538,13 +582,9 @@ class themeHandler{
|
||||
|
||||
|
||||
|
||||
if($theme['layouts'] && $mode==1) // New in 0.8 ----
|
||||
if(count($theme['layouts'])>1 && $mode==1) // New in 0.8 ----
|
||||
{
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$itext .= "<tr>
|
||||
<td style='vertical-align:top; width:24%'><b>".TPVLAN_50."</b>:</td>
|
||||
<td colspan='2' style='vertical-align:top'>
|
||||
@@ -699,7 +739,13 @@ class themeHandler{
|
||||
|
||||
|
||||
|
||||
</div>\n";
|
||||
</div>
|
||||
|
||||
|
||||
<div id='core-thememanager-help' >".$this->renderThemeHelp()."</div>
|
||||
|
||||
</div>
|
||||
\n";
|
||||
|
||||
return $text;
|
||||
}
|
||||
@@ -718,7 +764,7 @@ class themeHandler{
|
||||
}
|
||||
else
|
||||
{
|
||||
$text .= "<a href='".e_ADMIN."plugin.php'>".$plug."</a> ".ADMIN_FALSE_ICON;
|
||||
$text .= "<a href='".e_ADMIN."plugin.php?avail'>".$plug."</a> ".ADMIN_FALSE_ICON;
|
||||
}
|
||||
$text .= " ";
|
||||
}
|
||||
@@ -809,9 +855,9 @@ class themeHandler{
|
||||
|
||||
$e107cache->clear_sys();
|
||||
save_prefs();
|
||||
$custom_message = $this -> setThemeConfig();
|
||||
$this -> setThemeConfig();
|
||||
$this->theme_adminlog('03',$pref['image_preload'].', '.$pref['themecss']);
|
||||
$ns->tablerender(TPVLAN_36, "<br /><div style='text-align:center;'>".TPVLAN_37.".<br />".$custom_message."</div><br />");
|
||||
$ns->tablerender(TPVLAN_36, "<br /><div style='text-align:center;'>".TPVLAN_37.".<br /></div><br />");
|
||||
}
|
||||
|
||||
function setAdminStyle()
|
||||
|
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
/*
|
||||
* Copyright e107 Inc e107.org, Licensed under GNU GPL (http://www.gnu.org/licenses/gpl.txt)
|
||||
* $Id: lan_admin.php,v 1.18 2009-07-09 02:47:12 e107coders Exp $
|
||||
* $Id: lan_admin.php,v 1.19 2009-07-09 11:37:36 e107coders Exp $
|
||||
*
|
||||
* Admin Language File
|
||||
*/
|
||||
@@ -12,7 +12,7 @@ define("ADLAN_3", "News items List");
|
||||
define("ADLAN_3a", "News Settings");
|
||||
define("ADLAN_4", "Preferences");
|
||||
define("ADLAN_5", "Edit Site Preferences");
|
||||
define("ADLAN_6", "Menus");
|
||||
define("ADLAN_6", "Menu Manager");
|
||||
define("ADLAN_7", "Alter the order of your menus");
|
||||
define("ADLAN_8", "Administrators");
|
||||
define("ADLAN_9", "Add/delete site administrators");
|
||||
@@ -292,5 +292,7 @@ define("LAN_USERCLASS", "Userclass");
|
||||
define("LAN_AUTHOR", "Author");
|
||||
define("LAN_CATEGORY", "Category");
|
||||
|
||||
define("LAN_HELP", "Help");
|
||||
|
||||
|
||||
?>
|
||||
|
Reference in New Issue
Block a user