diff --git a/class2.php b/class2.php
index 6ba2fe5be..0fa04a970 100644
--- a/class2.php
+++ b/class2.php
@@ -9,8 +9,8 @@
* General purpose file
*
* $Source: /cvs_backup/e107_0.8/class2.php,v $
-* $Revision: 1.130 $
-* $Date: 2009-08-17 14:40:23 $
+* $Revision: 1.131 $
+* $Date: 2009-08-19 14:39:57 $
* $Author: secretr $
*
*/
@@ -1082,7 +1082,7 @@ $e107Path = str_replace($e107->base_path, '', e_SELF); // Knock off the initi
if (
(!$isPluginDir && strpos($e107Path, $ADMIN_DIRECTORY) === 0 ) // Core admin directory
|| ($isPluginDir && (strpos(e_PAGE,'admin_') === 0 || strpos($e107Path, 'admin/') !== FALSE)) // Plugin admin file or directory
- || (varsettrue($eplug_admin)) // Admin forced
+ || (varsettrue($eplug_admin) || defsettrue('ADMIN_AREA')) // Admin forced
)
{
$inAdminDir = TRUE;
@@ -1093,15 +1093,19 @@ if (
if(!defined('THEME'))
{
- if ($inAdminDir && varsettrue($pref['admintheme'])&& (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE))
+ //Force USER_AREA added
+ if ($inAdminDir && varsettrue($pref['admintheme']) && !defsettrue('USER_AREA'))
{
+ //We have now e_IFRAME mod and USER_AREA force
+ // && (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE)
+
/* if (strpos(e_SELF, "newspost.php") !== FALSE)
{
define("MAINTHEME", e_THEME.$pref['sitetheme']."/"); MAINTHEME no longer used in core distribution
} */
checkvalidtheme($pref['admintheme']);
}
- elseif (USERTHEME !== false && USERTHEME != 'USERTHEME' && !$inAdminDir)
+ elseif (USERTHEME !== false/* && USERTHEME != 'USERTHEME'*/ && !$inAdminDir)
{
checkvalidtheme(USERTHEME);
}
@@ -1138,13 +1142,14 @@ if(!defined("THEME_LAYOUT"))
}
}
-
+ /* Done via e_IFRAME and USER_AREA force combination, check moved to menu.php
if(strpos(e_SELF.'?'.e_QUERY, $ADMIN_DIRECTORY. 'menus.php?configure')!==FALSE)
{
$menus_equery = explode('.', e_QUERY);
$def = $menus_equery[1];
}
-
+ */
+
if($def) // custom-page layout.
{
define("THEME_LAYOUT",$def);
@@ -1167,23 +1172,21 @@ if(!isset($_E107['no_menus']))
e107::getMenu()->init();
}
-
-
// here we USE the theme
-if ($inAdminDir)
+if($inAdminDir)
{
- if (file_exists(THEME.'admin_theme.php') && (strpos(e_SELF.'?'.e_QUERY, $ADMIN_DIRECTORY. 'menus.php?configure')===FALSE)) // no admin theme when previewing.
- {
- require_once(THEME.'admin_theme.php');
- }
- else
- {
- require_once(THEME.'theme.php');
- }
+ if(file_exists(THEME.'admin_theme.php')&&(strpos(e_SELF.'?'.e_QUERY, $ADMIN_DIRECTORY.'menus.php?configure')===FALSE)) // no admin theme when previewing.
+ {
+ require_once (THEME.'admin_theme.php');
+ }
+ else
+ {
+ require_once (THEME.'theme.php');
+ }
}
else
{
- require_once(THEME.'theme.php');
+ require_once (THEME.'theme.php');
}
@@ -1198,13 +1201,13 @@ $exclude_lan = array('lan_signup.php'); // required for multi-language.
if ($inAdminDir)
{
- e107_include_once(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
- e107_include_once(e_LANGUAGEDIR.'English/admin/lan_'.e_PAGE);
+ e107_include_once(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
+ e107_include_once(e_LANGUAGEDIR.'English/admin/lan_'.e_PAGE);
}
elseif (!in_array('lan_'.e_PAGE,$exclude_lan) && !$isPluginDir)
{
- e107_include_once(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
- e107_include_once(e_LANGUAGEDIR.'English/lan_'.e_PAGE);
+ e107_include_once(e_LANGUAGEDIR.e_LANGUAGE.'/lan_'.e_PAGE);
+ e107_include_once(e_LANGUAGEDIR.'English/lan_'.e_PAGE);
}
if ($pref['anon_post'] ? define('ANON', true) : define('ANON', false));
@@ -1213,8 +1216,8 @@ if (empty($pref['newsposts']) ? define('ITEMVIEW', 15) : define('ITEMVIEW', $pre
if ($pref['antiflood1'] == 1)
{
- define('FLOODPROTECT', TRUE);
- define('FLOODTIMEOUT', max(varset($pref['antiflood_timeout'], 10), 3));
+ define('FLOODPROTECT', TRUE);
+ define('FLOODTIMEOUT', max(varset($pref['antiflood_timeout'], 10), 3));
}
else
{
diff --git a/e107_admin/auth.php b/e107_admin/auth.php
index dab45cc4a..b8508b535 100644
--- a/e107_admin/auth.php
+++ b/e107_admin/auth.php
@@ -9,9 +9,9 @@
* Administration Area Authorization
*
* $Source: /cvs_backup/e107_0.8/e107_admin/auth.php,v $
- * $Revision: 1.10 $
- * $Date: 2009-07-23 15:21:41 $
- * $Author: e107coders $
+ * $Revision: 1.11 $
+ * $Date: 2009-08-19 14:39:56 $
+ * $Author: secretr $
*/
if (!defined('e107_INIT')) { exit; }
@@ -24,8 +24,11 @@ if (ADMIN)
{
define("ADMIN_PAGE", true);
//don't include it if it'a an AJAX call or not wanted
- if(!e_AJAX_REQUEST && !defset('NO_HEADER'))
+ if(!e_AJAX_REQUEST && !defset('e_NOHEADER'))
+ {
require_once(e_ADMIN."header.php");
+ }
+
/*
* FIXME - missing $style for tablerender
* The Solution: parse_admin() without sending it to the browser if it's an ajax call
diff --git a/e107_admin/footer.php b/e107_admin/footer.php
index 588e459ed..60a730f10 100644
--- a/e107_admin/footer.php
+++ b/e107_admin/footer.php
@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/footer.php,v $
-| $Revision: 1.12 $
-| $Date: 2009-07-23 15:21:41 $
-| $Author: e107coders $
+| $Revision: 1.13 $
+| $Date: 2009-08-19 14:39:56 $
+| $Author: secretr $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
@@ -84,7 +84,9 @@ if (ADMIN == TRUE) {
//
// B.2 Send footer template, stop timing, send simple page stats
//
- if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) {
+ //NEW - Iframe mod
+ if (!defsettrue('e_IFRAME'))
+ {
parse_admin($ADMIN_FOOTER);
}
diff --git a/e107_admin/header.php b/e107_admin/header.php
index ea273b29f..f43f71bd0 100644
--- a/e107_admin/header.php
+++ b/e107_admin/header.php
@@ -12,15 +12,19 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/header.php,v $
-| $Revision: 1.43 $
-| $Date: 2009-08-06 22:41:34 $
-| $Author: bugrain $
+| $Revision: 1.44 $
+| $Date: 2009-08-19 14:39:56 $
+| $Author: secretr $
+---------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
-define("ADMIN_AREA",TRUE);
-define("USER_AREA",FALSE);
+if(!defined('ADMIN_AREA'))
+{
+ //avoid PHP warning
+ define("ADMIN_AREA", TRUE);
+}
+define("USER_AREA", FALSE);
$sql->db_Mark_Time('(Header Top)');
//
@@ -201,9 +205,12 @@ echo "\n";
// Wysiwyg JS support on or off.
// your code should run off e_WYSIWYG
-if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html'])) {
+if (varset($pref['wysiwyg'],FALSE) && check_class($pref['post_html']))
+{
define("e_WYSIWYG",TRUE);
-}else{
+}
+else
+{
define("e_WYSIWYG",FALSE);
}
@@ -212,10 +219,10 @@ $hash = md5(serialize(varset($pref['e_jslib'])).serialize(varset($THEME_JSLIB)).
//echo "\n";
echo "\n";
-if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) {
+//if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) {
//echo "\n";
-}
+//}
if (file_exists(THEME.'theme.js')) { echo "\n"; }
if (is_readable(e_FILE.'user.js') && filesize(e_FILE.'user.js')) { echo "\n"; }
@@ -272,22 +279,25 @@ if (isset($eplug_css) && $eplug_css) {
}
echo "\n";
-if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE && isset($pref['admincss']) && $pref['admincss'] && file_exists(THEME.$pref['admincss'])) {
+//NEW - Iframe mod
+if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'] && file_exists(THEME.$pref['admincss']))
+{
$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? THEME_ABS.'admin_'.$pref['admincss'] : THEME_ABS.$pref['admincss'];
echo "\n";
-} else if (isset($pref['themecss']) && $pref['themecss'] && file_exists(THEME.$pref['themecss']))
+}
+elseif (isset($pref['themecss']) && $pref['themecss'] && file_exists(THEME.$pref['themecss']))
{
$css_file = file_exists(THEME.'admin_'.$pref['themecss']) ? THEME_ABS.'admin_'.$pref['themecss'] : THEME_ABS.$pref['themecss'];
echo "\n";
-
}
else
{
$css_file = file_exists(THEME.'admin_style.css') ? THEME_ABS.'admin_style.css' : THEME_ABS.'style.css';
echo "\n";
}
-if (!isset($no_core_css) || !$no_core_css) {
+if (!isset($no_core_css) || !$no_core_css)
+{
echo "\n";
}
@@ -755,9 +765,14 @@ function admin_purge_related($table, $id)
$sql->db_Mark_Time('Parse Admin Header');
-if (strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE) {
+
+//NEW - Iframe mod
+if (!defsettrue('e_IFRAME'))
+{
+ //removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE
parse_admin($ADMIN_HEADER);
}
+
$sql->db_Mark_Time('(End: Parse Admin Header)');
}
diff --git a/e107_admin/menus.php b/e107_admin/menus.php
index db8dcf170..80a6df53d 100644
--- a/e107_admin/menus.php
+++ b/e107_admin/menus.php
@@ -10,11 +10,19 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/menus.php,v $
-| $Revision: 1.32 $
-| $Date: 2009-08-16 16:30:56 $
+| $Revision: 1.33 $
+| $Date: 2009-08-19 14:39:56 $
| $Author: secretr $
+----------------------------------------------------------------------------+
*/
+if(isset($_GET['configure']))
+{
+ //Switch to Front-end
+ define("USER_AREA", true);
+ //Switch to desired layout
+ define('THEME_LAYOUT', $_GET['configure']);
+}
+
require_once("../class2.php");
if (!getperms("2"))
{
@@ -23,7 +31,6 @@ if (!getperms("2"))
}
$e_sub_cat = 'menus';
-
require_once(e_HANDLER."file_class.php");
require_once(e_HANDLER."form_handler.php");
require_once (e_HANDLER.'message_handler.php');
@@ -35,23 +42,22 @@ require_once(e_HANDLER."menumanager_class.php");
$men = new e_menuManager(); // use 1 for dragdrop.
- if(isset($_GET['ajax']))
- {
- $men->menuSaveAjax();
+if(e_AJAX_REQUEST)
+{
+ $men->menuSaveAjax();
exit;
- }
+}
+
+if(isset($_GET['configure']))
+{
+ //No layout parse when in iframe mod
+ define('e_IFRAME', true);
+}
require_once("auth.php");
-
-
-
-
-
if($_POST)
{
- // print_a($_POST);
-// exit;
$e107cache->clear_sys("menus_");
}
@@ -63,7 +69,8 @@ if($_POST)
}
- if (strpos(e_QUERY, 'configure') === FALSE)
+ //BC - configure and dot delimiter deprecated
+ if (!isset($_GET['configure']))
{
$men->menuScanMenus();
$text .= $men->menuRenderMessage();
@@ -71,23 +78,9 @@ if($_POST)
$text .= $men->menuVisibilityOptions();
$text .= $men->menuRenderIframe();
$ns -> tablerender(ADLAN_6." :: ".LAN_MENULAYOUT, $text, 'menus_config');
- // $text .= "";
-
}
else // Within the IFrame.
{
-
-/* echo "
- e_QUERY = ".e_QUERY."
- curLayout = ".$men->curLayout."
- dbLayout = ".$men->dbLayout."
";
-
- print_a($_POST);
- echo "
-
";*/
-
-
-
$men->menuRenderPage();
}
@@ -123,6 +116,7 @@ function headerjs()
if(strpos(e_QUERY, 'configure') !== FALSE )
{
+ //FIXME - proto/scripty already loaded, create and jsmanager handler
$ret = "
@@ -161,7 +155,7 @@ function headerjs()
};
var options = {
editorEnabled : true,
- 'saveurl' : '".e_SELF."?ajax=',
+ 'saveurl' : '".e_SELF."?ajax_used=1',
hoverclass: 'block-hover'
};
diff --git a/e107_handlers/e107_class.php b/e107_handlers/e107_class.php
index 32d7b382e..b9d313e22 100644
--- a/e107_handlers/e107_class.php
+++ b/e107_handlers/e107_class.php
@@ -9,8 +9,8 @@
* e107 Main
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/e107_class.php,v $
- * $Revision: 1.37 $
- * $Date: 2009-08-17 14:40:22 $
+ * $Revision: 1.38 $
+ * $Date: 2009-08-19 14:39:56 $
* $Author: secretr $
*/
@@ -86,6 +86,26 @@ class e107
* @var array
*/
protected static $_plug_config_arr = array();
+
+ /**
+ * Core handlers array
+ * For new/missing handler add
+ * 'class name' => 'filename' pair
+ *
+ * Used to auto-load core handlers
+ *
+ * @see getSingleton()
+ * @see getObject()
+ * @var array
+ */
+ protected static $_known_handlers = array(
+ 'e_form' => 'form_class.php',
+ 'e_upgrade' => 'form_class.php',
+ 'e_jshelper' => 'js_helper.php',
+ 'e_menu' => 'menu_class.php',
+ 'e107plugin' => 'plugin_class.php',
+ 'xmlClass' => 'xml_class.php'
+ );
/**
@@ -213,7 +233,7 @@ class e107
* Retrieve singleton object
*
* @param string $class_name
- * @param string $path optional script path
+ * @param string|boolean $path optional script path
* @param string $regpath additional registry path
* @return Object
*/
@@ -221,12 +241,15 @@ class e107
{
if(true === $path)
{
- //TODO All handler class names in array (lazy loading)
+ if(isset(self::$_known_handlers[$class_name]))
+ {
+ $path = self::getParser()->replaceConstants(self::$_known_handlers[$class_name]);
+ }
}
$id = 'core/e107/singleton/'.$class_name.$regpath;
if(!e107::getRegistry($id))
{
- if(null !== $path && !class_exists($class_name))
+ if($path && is_string($path) && !class_exists($class_name))
{
e107_require_once($path); //no existence/security checks here!
}
diff --git a/e107_handlers/e_parse_class.php b/e107_handlers/e_parse_class.php
index 641722fbd..fb4880f1a 100644
--- a/e107_handlers/e_parse_class.php
+++ b/e107_handlers/e_parse_class.php
@@ -9,9 +9,9 @@
* Text processing and parsing functions
*
* $Source: /cvs_backup/e107_0.8/e107_handlers/e_parse_class.php,v $
-* $Revision: 1.56 $
-* $Date: 2009-08-08 14:14:39 $
-* $Author: marj_nl_fr $
+* $Revision: 1.57 $
+* $Date: 2009-08-19 14:39:57 $
+* $Author: secretr $
*
*/
if (!defined('e107_INIT')) { exit; }
@@ -1188,41 +1188,56 @@ class e_parse
{
if($mode != "")
{
- global $IMAGES_DIRECTORY, $PLUGINS_DIRECTORY, $FILES_DIRECTORY, $THEMES_DIRECTORY,$DOWNLOADS_DIRECTORY,$ADMIN_DIRECTORY;
- $replace_relative = array("",
- SITEURL.$IMAGES_DIRECTORY,
- SITEURL.$THEMES_DIRECTORY,
- $IMAGES_DIRECTORY,
- $PLUGINS_DIRECTORY,
- $FILES_DIRECTORY,
- $THEMES_DIRECTORY,
- $DOWNLOADS_DIRECTORY);
+ global $IMAGES_DIRECTORY, $PLUGINS_DIRECTORY, $FILES_DIRECTORY,
+ $THEMES_DIRECTORY, $DOWNLOADS_DIRECTORY, $ADMIN_DIRECTORY, $HANDLERS_DIRECTORY;
+
+ $e107 = e107::getInstance();
+ //FIXME - replace globals like this $e107->e107_dirs['IMAGES_DIRECTORY']
+
+ $replace_relative = array(
+ "",
+ SITEURL.$IMAGES_DIRECTORY,
+ SITEURL.$THEMES_DIRECTORY,
+ $IMAGES_DIRECTORY,
+ $PLUGINS_DIRECTORY,
+ $FILES_DIRECTORY,
+ $THEMES_DIRECTORY,
+ $DOWNLOADS_DIRECTORY,
+ $HANDLERS_DIRECTORY
+ );
- if($mode == "abs")
+ switch ($mode)
{
- $replace_absolute = array("/",
- e_IMAGE_ABS,
- e_THEME_ABS,
- e_IMAGE_ABS,
- e_PLUGIN_ABS,
- e_FILE_ABS,
- e_THEME_ABS,
- e_DOWNLOAD_ABS
- );
- }
- elseif($mode == "full")
- {
- $replace_absolute = array(SITEURL,
- SITEURL.$IMAGES_DIRECTORY,
- SITEURL.$THEMES_DIRECTORY,
- SITEURL.$IMAGES_DIRECTORY,
- SITEURL.$PLUGINS_DIRECTORY,
- SITEURL.$FILES_DIRECTORY,
- SITEURL.$THEMES_DIRECTORY,
- SITEURL.$DOWNLOADS_DIRECTORY);
+ case 'abs':
+ $replace_absolute = array(
+ $e107->server_path,
+ e_IMAGE_ABS,
+ e_THEME_ABS,
+ e_IMAGE_ABS,
+ e_PLUGIN_ABS,
+ e_FILE_ABS,
+ e_THEME_ABS,
+ e_DOWNLOAD_ABS,
+ e_HANDLER_ABS
+ );
+ break;
+
+ case 'full':
+ $replace_absolute = array(
+ SITEURL,
+ SITEURL.$IMAGES_DIRECTORY,
+ SITEURL.$THEMES_DIRECTORY,
+ SITEURL.$IMAGES_DIRECTORY,
+ SITEURL.$PLUGINS_DIRECTORY,
+ SITEURL.$FILES_DIRECTORY,
+ SITEURL.$THEMES_DIRECTORY,
+ SITEURL.$DOWNLOADS_DIRECTORY,
+ SITEURL.$HANDLERS_DIRECTORY
+ );
+ break;
}
- $search = array("{e_BASE}","{e_IMAGE_ABS}","{e_THEME_ABS}","{e_IMAGE}","{e_PLUGIN}","{e_FILE}","{e_THEME}","{e_DOWNLOAD}");
+ $search = array("{e_BASE}","{e_IMAGE_ABS}","{e_THEME_ABS}","{e_IMAGE}","{e_PLUGIN}","{e_FILE}","{e_THEME}","{e_DOWNLOAD}","{e_HANDLER}");
if (ADMIN)
{
@@ -1270,7 +1285,8 @@ class e_parse
}
function createConstants($url,$mode=0){
- global $IMAGES_DIRECTORY,$PLUGINS_DIRECTORY,$FILES_DIRECTORY,$THEMES_DIRECTORY,$DOWNLOADS_DIRECTORY,$ADMIN_DIRECTORY;
+ global $IMAGES_DIRECTORY, $PLUGINS_DIRECTORY, $FILES_DIRECTORY, $THEMES_DIRECTORY, $DOWNLOADS_DIRECTORY,
+ $ADMIN_DIRECTORY, $HANDLERS_DIRECTORY;
if($mode == 0) // folder name only.
{
@@ -1281,6 +1297,7 @@ class e_parse
"{"."e_THEME"."}"=>$THEMES_DIRECTORY,
"{"."e_DOWNLOAD"."}"=>$DOWNLOADS_DIRECTORY,
"{"."e_ADMIN"."}"=>$ADMIN_DIRECTORY,
+ "{"."e_HANDLER"."}"=>$HANDLERS_DIRECTORY
);
}
elseif($mode == 1) // relative path
@@ -1291,7 +1308,8 @@ class e_parse
"{"."e_FILE"."}"=>e_FILE,
"{"."e_THEME"."}"=>e_THEME,
"{"."e_DOWNLOAD"."}"=>e_DOWNLOAD,
- "{"."e_ADMIN"."}"=>e_ADMIN
+ "{"."e_ADMIN"."}"=>e_ADMIN,
+ "{"."e_HANDLER"."}"=>e_HANDLER
);
}
foreach($tmp as $key=>$val)
diff --git a/e107_handlers/menu_class.php b/e107_handlers/menu_class.php
index cadadeeab..5d9d1e329 100644
--- a/e107_handlers/menu_class.php
+++ b/e107_handlers/menu_class.php
@@ -1,81 +1,98 @@
retrieve_sys("menus_".USERCLASS_LIST."_".md5(e_LANGUAGE.$menu_layout_field));
- $menu_data = e107 :: getArrayStorage()->ReadArray($menu_data);
-
+ $menu_layout_field = THEME_LAYOUT!=e107::getPref('sitetheme_deflayout') ? THEME_LAYOUT : "";
+ $menu_data = e107::getCache()->retrieve_sys("menus_".USERCLASS_LIST."_".md5(e_LANGUAGE.$menu_layout_field));
+ $menu_data = e107::getArrayStorage()->ReadArray($menu_data);
$eMenuArea = array();
// $eMenuList = array();
// $eMenuActive = array(); // DEPRECATED
-
- if (!is_array($menu_data))
+ if(!is_array($menu_data))
{
$menu_qry = 'SELECT * FROM #menus WHERE menu_location > 0 AND menu_class IN ('.USERCLASS_LIST.') AND menu_layout = "'.$menu_layout_field.'" ORDER BY menu_location,menu_order';
- if (e107 :: getDb()->db_Select_gen($menu_qry))
+ if(e107::getDb()->db_Select_gen($menu_qry))
{
- while ($row = e107 :: getDb()->db_Fetch())
+ while($row = e107::getDb()->db_Fetch())
{
$eMenuArea[$row['menu_location']][] = $row;
}
}
-
$menu_data['menu_area'] = $eMenuArea;
-
- $menuData = e107 :: getArrayStorage()->WriteArray($menu_data,false);
- e107 :: getCache()->set_sys('menus_'.USERCLASS_LIST.'_'.md5(e_LANGUAGE.$menu_layout_field),$menuData);
+ $menuData = e107::getArrayStorage()->WriteArray($menu_data, false);
+ e107::getCache()->set_sys('menus_'.USERCLASS_LIST.'_'.md5(e_LANGUAGE.$menu_layout_field), $menuData);
}
else
{
- $eMenuArea = $menu_data['menu_area'];
+ $eMenuArea = $menu_data['menu_area'];
}
$total = array();
- foreach ($eMenuArea as $area => $val)
+ foreach($eMenuArea as $area => $val)
{
- foreach ($val as $row)
+ foreach($val as $row)
{
- if ($this->isVisible($row))
+ if($this->isVisible($row))
{
- $path = str_replace("/","",$row['menu_path']);
- if (!isset ($total[$area]))
+ $path = str_replace("/", "", $row['menu_path']);
+ if(!isset($total[$area]))
{
$total[$area] = 0;
}
@@ -84,97 +101,108 @@ class e_menu
}
}
}
- e107 :: getRender()->eMenuTotal = $total;
+ e107::getRender()->eMenuTotal = $total;
}
-
- private function isVisible($row)
+ /**
+ * Check visibility of a menu against URL
+ *
+ * @param array $row menu data
+ * @return boolean
+ */
+ protected function isVisible($row, $url = '')
{
- $show_menu = TRUE;
-
- if ($row['menu_pages'])
+ if(isset($this->_visibility_cache[$row['id']]))
{
- list($listtype,$listpages) = explode("-",$row['menu_pages'],2);
- $pagelist = explode("|",$listpages);
- $check_url = e_SELF.(e_QUERY ? "?".e_QUERY : '');
-
- switch ($listtype)
+ return $this->_visibility_cache[$row['id']];
+ }
+
+ $show_menu = TRUE;
+ if($row['menu_pages'])
+ {
+ list ($listtype, $listpages) = explode("-", $row['menu_pages'], 2);
+ $pagelist = explode("|", $listpages);
+ $check_url = $url ? $url : e_SELF.(e_QUERY ? "?".e_QUERY : '');
+ switch($listtype)
{
- case '1' : //show menu
-
+ case '1': //show menu
$show_menu = false;
- foreach ($pagelist as $p)
+ foreach($pagelist as $p)
{
- if (substr($p,- 1) === '!')
+ if(substr($p, -1)==='!')
{
- $p = substr($p,0,- 1);
- $show_menu = TRUE;
+ $p = substr($p, 0, -1);
+ $show_menu = true;
break 2;
}
- elseif (strpos($check_url,$p) !== FALSE)
+ elseif(strpos($check_url, $p) !== false)
{
- $show_menu = TRUE;
+ $show_menu = true;
break 2;
}
}
break;
- case '2' : //hide menu
-
- $show_menu = TRUE;
- foreach ($pagelist as $p)
+ case '2': //hide menu
+ $show_menu = true;
+ foreach($pagelist as $p)
{
- if (substr($p,- 1) == '!')
+ if(substr($p, -1)=='!')
{
- $p = substr($p,0,- 1);
- if (substr($check_url,strlen($p) * - 1) == $p)
+ $p = substr($p, 0, -1);
+ if(substr($check_url, strlen($p)*-1)==$p)
{
- $show_menu = FALSE;
+ $show_menu = false;
break 2;
}
}
- elseif (strpos($check_url,$p) !== FALSE)
+ elseif(strpos($check_url, $p) !== false)
{
- $show_menu = FALSE;
+ $show_menu = false;
break 2;
}
}
break;
} //end switch
-
} //endif menu_pages
-
+
+ $this->_visibility_cache[$row['id']] = $show_menu;
return $show_menu;
}
-
+ /**
+ * Render menu area
+ *
+ * @param string $parm
+ * @return string
+ */
public function renderArea($parm = '')
{
- global $sql,$ns,$tp,$sc_style;
+ global $sql, $ns, $tp, $sc_style;
global $error_handler;
- $e107 = e107 :: getInstance();
- $tmp = explode(':',$parm);
- $buffer_output = true; // Default - return all output.
-
- if (isset ($tmp[1]) && $tmp[1] == 'echo')
+ $e107 = e107::getInstance();
+
+ $tmp = explode(':', $parm);
+ $buffer_output = true; // Default - return all output.
+ if(isset($tmp[1])&&$tmp[1]=='echo')
{
$buffer_output = false;
}
- if (!array_key_exists($tmp[0],$this->eMenuActive))
+ if(!array_key_exists($tmp[0], $this->eMenuActive))
{
return;
}
- if ($buffer_output)
+ if($buffer_output)
{
ob_start();
}
- e107 :: getRender()->eMenuArea = $tmp[0];
- foreach ($this->eMenuActive[$tmp[0]] as $row)
+ e107::getRender()->eMenuArea = $tmp[0];
+ foreach($this->eMenuActive[$tmp[0]] as $row)
{
- $this->renderMenu($row['menu_path'],$row['menu_name'],$row['menu_parms']);
+ $this->renderMenu($row['menu_path'], $row['menu_name'], $row['menu_parms']);
}
- e107 :: getRender()->eMenuCount = 0;
- e107 :: getRender()->eMenuArea = null;
- if ($buffer_output)
+ e107::getRender()->eMenuCount = 0;
+ e107::getRender()->eMenuArea = null;
+ if($buffer_output)
{
$ret = ob_get_contents();
ob_end_clean();
@@ -182,59 +210,73 @@ class e_menu
}
}
-
- public function renderMenu($mpath,$mname,$parm = '')
+ /**
+ * Render menu
+ *
+ * @param string $mpath menu path
+ * @param string $mname menu name
+ * @param string $parm menu parameters
+ * @param boolean $return
+ * return string if required
+ */
+ public function renderMenu($mpath, $mname, $parm = '', $return = false)
{
global $sql; // required at the moment.
- global $ns,$tp,$sc_style;
- $e107 = e107 :: getInstance();
-
- if ($error_handler->debug == true)
+ global $ns, $tp, $sc_style;
+ $e107 = e107::getInstance();
+
+ if($return)
+ {
+ ob_start();
+ }
+
+ if($error_handler->debug == true)
{
echo "\n\n";
}
-
- e107 :: getDB()->db_Mark_Time($mname);
-
- if (is_numeric($mpath))
+ e107::getDB()->db_Mark_Time($mname);
+ if(is_numeric($mpath))
{
- $sql->db_Select("page","*","page_id='".$mpath."' ");
+ $sql->db_Select("page", "*", "page_id='".$mpath."' ");
$page = $sql->db_Fetch();
- $caption = $e107->tp->toHTML($page['page_title'],true,'parse_sc, constants');
- $text = $e107->tp->toHTML($page['page_text'],true,'parse_sc, constants');
- e107 :: getRender()->tablerender($caption,$text);
+ $caption = $e107->tp->toHTML($page['page_title'], true, 'parse_sc, constants');
+ $text = $e107->tp->toHTML($page['page_text'], true, 'parse_sc, constants');
+ e107::getRender()->tablerender($caption, $text);
}
else
{
- if (is_readable(e_PLUGIN.$mpath."/languages/".e_LANGUAGE.".php"))
+ if(is_readable(e_PLUGIN.$mpath."/languages/".e_LANGUAGE.".php"))
{
include_once (e_PLUGIN.$mpath."/languages/".e_LANGUAGE.".php");
}
- elseif (is_readable(e_PLUGIN.$mpath."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php"))
+ elseif(is_readable(e_PLUGIN.$mpath."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php"))
{
include_once (e_PLUGIN.$mpath."/languages/".e_LANGUAGE."/".e_LANGUAGE.".php");
}
- elseif (is_readable(e_PLUGIN.$mpath."/languages/English.php"))
+ elseif(is_readable(e_PLUGIN.$mpath."/languages/English.php"))
{
include_once (e_PLUGIN.$mpath."/languages/English.php");
}
- elseif (is_readable(e_PLUGIN.$mpath."/languages/English/English.php"))
+ elseif(is_readable(e_PLUGIN.$mpath."/languages/English/English.php"))
{
include_once (e_PLUGIN.$mpath."/languages/English/English.php");
}
- if (file_exists(e_PLUGIN.$mpath."/".$mname.".php"))
+ if(file_exists(e_PLUGIN.$mpath."/".$mname.".php"))
{
include_once (e_PLUGIN.$mpath."/".$mname.".php");
}
}
-
- e107 :: getDB()->db_Mark_Time("(After ".$mname.")");
- if ($error_handler->debug == true)
+ e107::getDB()->db_Mark_Time("(After ".$mname.")");
+ if($error_handler->debug==true)
{
echo "\n\n";
}
-
+
+ if($return)
+ {
+ $ret = ob_get_contents();
+ ob_end_clean();
+ return $ret;
+ }
}
-
-
}
diff --git a/e107_handlers/menumanager_class.php b/e107_handlers/menumanager_class.php
index a8cfa5495..46f5c24d7 100644
--- a/e107_handlers/menumanager_class.php
+++ b/e107_handlers/menumanager_class.php
@@ -10,9 +10,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_handlers/menumanager_class.php,v $
-| $Revision: 1.5 $
-| $Date: 2009-08-17 15:23:44 $
-| $Author: e107coders $
+| $Revision: 1.6 $
+| $Date: 2009-08-19 14:39:57 $
+| $Author: secretr $
+----------------------------------------------------------------------------+
*/
if (!defined('e107_INIT')) { exit; }
@@ -59,17 +59,16 @@ class e_menuManager {
{
$this->curLayout = $_POST['custom_select'];
}
- elseif($_GET['lay'])
+ elseif(isset($_GET['lay']))
{
$this->curLayout = $_GET['lay'];
}
else
{
- $tmp = explode('.', e_QUERY);
- $this->curLayout = ($tmp[1]) ? $tmp[1] : $pref['sitetheme_deflayout'];
+ $this->curLayout = varsettrue($_GET['configure'], $pref['sitetheme_deflayout']);
}
- $this->dbLayout = ($this->curLayout !=$pref['sitetheme_deflayout']) ? $this->curLayout : ""; //menu_layout is left blank when it's default.
+ $this->dbLayout = ($this->curLayout != $pref['sitetheme_deflayout']) ? $this->curLayout : ""; //menu_layout is left blank when it's default.
if(isset($_POST['menu_id']) || $_GET['id'])
{
@@ -143,13 +142,13 @@ class e_menuManager {
global $ns,$sql;
if(!$url)
{
- $url = e_SELF."?configure.".$this->curLayout;
+ $url = e_SELF."?configure=".$this->curLayout;
}
$cnt = $sql->db_Select("menus", "*", "menu_location > 0 AND menu_layout = '$curLayout' ORDER BY menu_name "); // calculate height to remove vertical scroll-bar.
$text .= "";
-
+
return $text;
}
@@ -290,7 +289,7 @@ class e_menuManager {
$admin_log->log_event('MENU_07',$location.'[!br!]'.$position.'[!br!]'.$this->menuId,E_LOG_INFORMATIVE,'');
}
- if (strpos(e_QUERY, 'configure') === FALSE)
+ if (!isset($_GET['configure']))
{ // Scan plugin directories to see if menus to add
$this->menuScanMenus();
}
@@ -521,7 +520,7 @@ class e_menuManager {
$location = $this->menuActivateLoc;
$menu_count = $sql->db_Count("menus", "(*)", " WHERE menu_location=".$location." AND menu_layout = '".$this->dbLayout."' ");
-
+
foreach($this->menuActivateIds as $sel_mens)
{
//Get info from menu being activated
@@ -529,10 +528,8 @@ class e_menuManager {
{
$row=$sql->db_Fetch();
//If menu is not already activated in that area, add the record.
-
- $query = "SELECT menu_name,menu_path FROM #menus WHERE menu_name='".$row['menu_name']."' AND menu_layout = '".$this->dbLayout."' AND menu_location = ".$location." LIMIT 1 ";
-
- if(!$sql->db_Select_gen($query, $this->debug))
+ //$query = "SELECT menu_name,menu_path FROM #menus WHERE menu_name='".$row['menu_name']."' AND menu_layout = '".$this->dbLayout."' AND menu_location = ".$location." LIMIT 1 ";
+ //if(!$sql->db_Select_gen($query, $this->debug))
{
$insert = array(
@@ -540,7 +537,7 @@ class e_menuManager {
'menu_name' => $row['menu_name'],
'menu_location' => $location,
'menu_order' => $menu_count,
- 'menu_class' => $val['menu_class'],
+ 'menu_class' => $row['menu_class'],
'menu_pages' => '',
'menu_path' => $row['menu_path'],
'menu_layout' => $this->dbLayout,
@@ -732,15 +729,16 @@ class e_menuManager {
{
global $sql, $ns, $HEADER, $FOOTER, $rs, $pref, $tp;
+ //FIXME - XHTML cleanup, front-end standards (elist, forms etc)
echo "";
$this->parseheader($HEADER); // $layouts_str;
-
+
$layout = ($this->curLayout);
$menuPreset = $this->getMenuPreset($layout);
echo "
";
- echo $rs->form_open("post", e_SELF."?configure.".$this->curLayout, "menuActivation");
+ echo $rs->form_open("post", e_SELF."?configure=".$this->curLayout, "menuActivation");
$text = "
";
@@ -782,7 +780,7 @@ class e_menuManager {
{
$menuInf = (strlen($row['menu_path']) > 1) ? ' ('.substr($row['menu_path'],0,-1).')' : '';
$text .= "
- ".$row['menu_name'].$menuInf." |
+ |
".$pdeta." |
\n";
}
@@ -792,7 +790,7 @@ class e_menuManager {
".$row['menu_name']." {$pdeta}
";
- $text .= $this->menuRenderMenu($row,$menu_count);
+ $text .= $this->menuRenderMenu($row, $menu_count);
$text .= "
\n";
}
}
@@ -830,7 +828,7 @@ class e_menuManager {
{
echo "
";
}
- echo "";
+ echo "";
}
@@ -842,7 +840,7 @@ class e_menuManager {
{
global $rs, $pref;
- $text .= "