diff --git a/class2.php b/class2.php
index 4570c3f6e..78d1150c3 100644
--- a/class2.php
+++ b/class2.php
@@ -780,27 +780,30 @@ if (!class_exists('e107table', false))
class e107table
{
- public $eMenuCount = 0;
- public $eMenuArea;
- public $eMenuTotal = array();
- public $eSetStyle;
+ public $eMenuCount = 0;
+ public $eMenuArea;
+ public $eMenuTotal = array();
+ public $eSetStyle;
+ private $themeClass = '';
+ private $adminThemeClass = '';
+ public $frontend = null;
+
+
+ function __construct()
+ {
+ // $this->themeClass = e107::getPref('sitetheme')."_theme"; // disabled at the moment.
+ $this->adminThemeClass = e107::getPref('admintheme')."_admintheme"; // Check for a class.
+ }
/**
- * @param $caption
- * @param $text
- * @param $mode
+ * @param $caption string caption text
+ * @param $text body text
+ * @param $mode unique identifier
* @param $return boolean : return the html instead of echo it.
+ * @return null
*/
- function tablerender($caption, $text, $mode = 'default', $return = false)
+ public function tablerender($caption, $text, $mode = 'default', $return = false)
{
-
- /*
- # Render style table
- # - parameter #1: string $caption, caption text
- # - parameter #2: string $text, body text
- # - return null
- # - scope public
- */
$override_tablerender = e107::getSingleton('override', e_HANDLER.'override_class.php')->override_check('tablerender');
if ($override_tablerender)
@@ -820,8 +823,9 @@ if (!class_exists('e107table', false))
{
$this->eMenuCount++;
}
+
ob_start();
- tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea, 'menuCount'=>$this->eMenuCount, 'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]), 'setStyle'=>$this->eSetStyle));
+ $this->tablestyle($caption, $text, $mode);
$ret=ob_get_contents();
ob_end_clean();
@@ -834,11 +838,50 @@ if (!class_exists('e107table', false))
{
$this->eMenuCount++;
}
- tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]),'setStyle'=>$this->eSetStyle));
+
+ $this->tablestyle($caption, $text, $mode);
return '';
}
}
+
+
+
+
+ /**
+ * Output the styled template.
+ * @param $caption
+ * @param $text
+ * @param $mode
+ */
+ private function tablestyle($caption, $text, $mode)
+ {
+
+ if(class_exists($this->adminThemeClass) && ($this->frontend == false))
+ {
+ $thm = new $this->adminThemeClass();
+ }
+ elseif(class_exists($this->themeClass)) // disabled at the moment.
+ {
+ $thm = new $this->themeClass();
+ }
+
+ if(is_object($thm))
+ {
+ $thm->tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea, 'menuCount'=>$this->eMenuCount, 'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]), 'setStyle'=>$this->eSetStyle));
+ }
+ else
+ {
+ tablestyle($caption, $text, $mode, array('menuArea'=>$this->eMenuArea,'menuCount'=>$this->eMenuCount,'menuTotal'=>varset($this->eMenuTotal[$this->eMenuArea]),'setStyle'=>$this->eSetStyle));
+ }
+
+ }
+
+
}
+
+
+
+
}
//#############################################################
diff --git a/e107_admin/header.php b/e107_admin/header.php
index 3ae3c8e98..bf649ffc4 100644
--- a/e107_admin/header.php
+++ b/e107_admin/header.php
@@ -21,8 +21,10 @@ if (!defined('ADMIN_AREA'))
//avoid PHP warning
define("ADMIN_AREA", TRUE);
}
-define("USER_AREA", FALSE);
-
+if(!defined('USER_AREA'))
+{
+ define("USER_AREA", FALSE);
+}
e107::getDb()->db_Mark_Time('(Header Top)');
// Admin template
@@ -154,13 +156,14 @@ if (isset($pref['del_unv']) && $pref['del_unv'] && $pref['user_reg_veri'] != 2)
//
// HTML 5 default.
-if(!defined('XHTML4'))
+//if(!defined('XHTML4'))
{
echo "\n";
echo "\n";
echo "
\n";
echo "\n";
}
+/*
else // XHTML
{
echo(defined("STANDARDS_MODE") ? "" : "\n")."\n";
@@ -171,6 +174,9 @@ else // XHTML
echo(defined("CORE_LC")) ? "\n" : "";
echo "\n";
}
+ *
+*/
+
echo "\n"; // Works better for iOS but still has some issues.
// echo (defined("VIEWPORT")) ? "\n" : "";
@@ -207,14 +213,14 @@ if (isset($eplug_css) && $eplug_css)
- if(e107::getPref('admincss') == "admin_dark.css")
+ if(e107::getPref('admincss') == "admin_dark.css" && !vartrue($_GET['configure']))
{
$e_js->coreCSS('bootstrap/css/darkstrap.css');
}
//NEW - Iframe mod
-if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'])
+if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'] && !vartrue($_GET['configure']))
{
$css_file = file_exists(THEME.'admin_'.$pref['admincss']) ? 'admin_'.$pref['admincss'] : $pref['admincss'];
//echo "\n";
@@ -223,13 +229,13 @@ if (!defsettrue('e_IFRAME') && isset($pref['admincss']) && $pref['admincss'])
}
elseif (isset($pref['themecss']) && $pref['themecss'])
{
- $css_file = file_exists(THEME.'admin_'.$pref['themecss']) ? 'admin_'.$pref['themecss'] : $pref['themecss'];
+ $css_file = (file_exists(THEME.'admin_'.$pref['themecss']) && !vartrue($_GET['configure'])) ? 'admin_'.$pref['themecss'] : $pref['themecss'];
//echo "\n";
$e_js->themeCSS($css_file);
}
else
{
- $css_file = file_exists(THEME.'admin_style.css') ? 'admin_style.css' : 'style.css';
+ $css_file = (file_exists(THEME.'admin_style.css') && !vartrue($_GET['configure'])) ? 'admin_style.css' : 'style.css';
//echo "\n";
$e_js->themeCSS($css_file);
}
@@ -436,7 +442,7 @@ echo "
\n";
echo getModal();
-echo getAlert();
+// echo getAlert();
function getModal($caption = '', $type='')
{
@@ -529,7 +535,7 @@ if ($e107_popup != 1)
//removed check strpos(e_SELF.'?'.e_QUERY, 'menus.php?configure') === FALSE
parse_admin($ADMIN_HEADER);
}
- else
+ elseif(!vartrue($_GET['configure']))
{
e107::css("inline","body { padding:0px } "); // default padding for iFrame-only.
}
diff --git a/e107_admin/language.php b/e107_admin/language.php
index 61f910b9d..e71093d0a 100644
--- a/e107_admin/language.php
+++ b/e107_admin/language.php
@@ -453,7 +453,7 @@ function multilang_prefs()
//XXX Remove later.
// Enable only for developers - SetEnv E_ENVIRONMENT develop
- if(!isset($_SERVER['E_ENVIRONMENT']) || $_SERVER['E_ENVIRONMENT'] !== 'develop')
+ if(!isset($_SERVER['E_DEV_LANGUAGE']) || $_SERVER['E_DEV_LANGUAGE'] !== 'true')
{
$lanlist = array('English');
$mes->addInfo("Alpha version currently supports only the English language. After most features are stable and English terms are optimized - translation will be possible.");
diff --git a/e107_admin/menus.php b/e107_admin/menus.php
index d91c0c348..837594301 100644
--- a/e107_admin/menus.php
+++ b/e107_admin/menus.php
@@ -23,19 +23,13 @@ if (!getperms("2"))
exit;
}
-//include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
+
+
+
e107::coreLan('menus', true);
e107::coreLan('admin', true);
-// FIXME - quick temporarry fix for missing icons on menu administration. We need different core style to be included (forced) here - e.g. e107_web/css/admin/sprite.css
-if(e_IFRAME) //<-- Check config and delete buttons if modifying
-{
-//e107::js('core','bootstrap/js/bootstrap.min.js');
-//e107::css('core','bootstrap/css/bootstrap.min.css');
- e107::css('url','{e_THEME}/bootstrap/admin_style.css');
-
-}
if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
{
@@ -316,6 +310,391 @@ if(strpos(e_QUERY, 'configure') !== FALSE || vartrue($_GET['enc']))
+if($_SERVER['E_ENV_MENUS'] == 'developer')
+{
+ if(isset($_GET['configure']) || isset($_GET['iframe']))
+ {
+ //No layout parse when in iframe mod
+ define('e_IFRAME', true);
+ }
+ $mn = new e_layout;
+ //e107::js('core','jquery.scoped.js','jquery');
+// e107::css('url',e_THEME.'jayya/style.css');
+ require_once("auth.php");
+ require_once("footer.php");
+ exit;
+}
+
+if($_SERVER['E_ENV_MENUS'] == 'developer')
+{
+ function e_help()
+ {
+ $p = e107::getPref('e_menu_list'); // new storage for xxxxx_menu.php list.
+ $sql = e107::getDb();
+
+ $text = '
+
+ ';
+
+ $text .= "
+
+
";
+
+ foreach($p as $menu => $folder)
+ {
+ $text .= "- ".str_replace("_menu","",$menu)."
";
+ }
+
+ $text .= "
+
+
+
";
+
+ if($sql->select('page','*',"menu_name !='' ORDER BY menu_name"))
+ {
+ $text .= "
";
+ while($row = $sql->fetch())
+ {
+ $text .= "- ".$row['menu_name']."
";
+ }
+
+ $text .= "
";
+ }
+
+ $text .= "
+
+
";
+
+ return array('caption'=>'Menu Items','text'=>$text);
+ }
+}
+
+
+// XXX Menu Manager Re-Write with drag and drop and multi-dimensional array as storage. ($pref)
+// TODO Get Drag & Drop Working with the iFrame
+// TODO Sorting, visibility, parameters and delete.
+
+class e_layout
+{
+ private $menuData = array();
+
+ function __construct()
+ {
+ $pref = e107::getPref();
+ $ns = e107::getRender();
+ $this->convertMenuTable();
+
+
+ if(vartrue($_GET['configure'])) //ie Inside the IFRAME.
+ {
+ $this->curLayout = varsettrue($_GET['configure'], $pref['sitetheme_deflayout']);
+ $this->renderLayout($this->curLayout);
+ }
+ else // Parent - ie. main admin page.
+ {
+
+ // XXX HELP _ i don't work with iFrames.
+
+ e107::js('inline','
+ $(function() {
+ $( "#sortable" ).sortable({
+ revert: true
+ });
+ $( ".draggable" ).draggable({
+ connectToSortable: "#sortable",
+ helper: "clone",
+ revert: "invalid",
+ cursor: "move",
+ // iframeFix: true,
+
+ start: function(ev,ui)
+ {
+ },
+ drag: function(ev,ui)
+ {
+
+ },
+ stop: function(ev, ui)
+ {
+
+ }
+ });
+
+ $( "ul, li" ).disableSelection();
+
+ // Not Working.
+ $("#menu_iframe").load(function(){
+ $("#menu_iframe").contents().find("#sortable").droppable({
+ accept: ".drag",
+ drop: function( event, ui ) {
+ var html = ""+ ui.draggable.html() + "
";
+ //alert(html);
+ $(this).append(html);
+ }
+ });
+
+ });
+
+ });
+ ');
+
+ $this->scanForNew();
+
+ $this->renderInterface();
+ }
+ }
+
+
+ /**
+ * Convert from e107_menu table to $pref format.
+ */
+ function convertMenuTable()
+ {
+ $sql = e107::getDb();
+ $sql->select('menus','*','menu_location !=0 ORDER BY menu_location,menu_order');
+ $data = array();
+
+ while($row = $sql->fetch())
+ {
+ $layout = vartrue($row['menu_layout'],'default');
+ $location = $row['menu_location'];
+ $data[$layout][$location][] = array('name'=>$row['menu_name'],'class'=>$row['menu_class'],'path'=>$row['menu_path'],'pages'=>$row['menu_pages'],'parms'=>$row['menu_parms']);
+ }
+
+ $this->menuData = ($data);
+
+
+ }
+
+
+
+
+
+ /**
+ * Substitute all {MENU=X} and Render output.
+ */
+ private function renderLayout($layout='')
+ {
+
+ global $HEADER,$FOOTER,$style; // included by theme file in class2.
+
+ $tp = e107::getParser();
+
+ $head = preg_replace_callback("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", array($this, 'renderMenuArea'), $HEADER[THEME_LAYOUT]);
+ $foot = preg_replace_callback("/\{MENU=([\d]{1,3})(:[\w\d]*)?\}/", array($this, 'renderMenuArea'), $FOOTER[THEME_LAYOUT]);
+
+ echo $tp->parsetemplate($head);
+ // echo "MAIN CONTENT
";
+ echo $tp->parsetemplate($foot);
+
+ }
+
+
+
+
+
+
+ /**
+ * Render {MENU=X}
+ */
+ private function renderMenuArea($matches)
+ {
+
+ $area = $matches[1];
+
+ // return print_a($this->menuData,true);
+ $text = "";
+
+ return $text;
+ }
+
+
+
+
+ private function renderMenu($row)
+ {
+ // return print_a($row,true);
+ $TEMPLATE = ''; // TODO perhaps a simple counter for the id
+
+ return $TEMPLATE;
+
+ }
+
+
+ /**
+ * Scan Plugin folders for new _menu files.
+ */
+ private function scanForNew()
+ {
+ $fl = e107::getFile();
+ $fl->dirFilter = array('/', 'CVS', '.svn', 'languages');
+ $files = $fl->get_files(e_PLUGIN,"_menu\.php$",'standard',2);
+
+ $data = array();
+
+ foreach($files as $file)
+ {
+ $path = trim(str_replace(e_PLUGIN,"",$file['path']),"/");
+
+ if(e107::isInstalled($path))
+ {
+ $fname = str_replace(".php","",$file['fname']);
+ $data[$fname] = $path;
+ }
+ }
+
+ $config = e107::getConfig('core');
+ $config->set('e_menu_list',$data);
+ $config->save();
+
+ }
+
+
+
+
+ /**
+ * Render the main area with TABS and iframes.
+ */
+ private function renderInterface()
+ {
+ $ns = e107::getRender();
+ $tp = e107::getParser();
+
+ $TEMPL = $this->getHeadFoot();
+
+ $layouts = array_keys($TEMPL['HEADER']);
+
+ $text = '';
+
+ $active = ' class="active" ';
+
+ foreach($layouts as $title)
+ {
+ $text .= '- '.$title.'
';
+ $active = '';
+ }
+
+ $text .= '
';
+ $active = 'active';
+
+ $text .= '
+ ';
+
+ foreach($layouts as $title)
+ {
+ $text .= '
+
+
+
';
+
+ $active = '';
+ }
+
+ $text .= '
';
+
+ // $ns->frontend = false;
+
+ $ns->tablerender("Menu Layout",$text);
+ }
+
+
+
+
+
+
+ private function getHeadFoot($_MLAYOUT=null)
+ {
+ $theme = e107::getPref('sitetheme');
+
+ $H = array();
+ $F = array();
+
+ require(e_THEME.$theme."/theme.php");
+
+
+ if(is_string($HEADER))
+ {
+ $H['default'] = $HEADER;
+ $F['default'] = $FOOTER;
+ }
+ else
+ {
+ $H = $HEADER;
+ $F = $FOOTER;
+ }
+
+
+ // 0.6 / 0.7-1.x
+ if(isset($CUSTOMHEADER) && isset($CUSTOMHEADER))
+ {
+ if(!is_array($CUSTOMHEADER))
+ {
+ $H['legacyCustom'] = $CUSTOMHEADER;
+ $F['legacyCustom'] = $CUSTOMFOOTER;
+ }
+ else
+ {
+ foreach($CUSTOMHEADER as $k=>$v)
+ {
+ $H[$k] = $v;
+ $F[$k] = $v;
+ }
+ }
+ }
+
+ if($_MLAYOUT)
+ {
+ // return array('HEADER'=>$H[$_MLAYOUT], 'FOOTER'=>$F[$_MLAYOUT]);
+ }
+
+
+ return array('HEADER'=>$H, 'FOOTER'=>$F);
+ }
+
+ //$ns = e107::getRender();
+
+}
+
+
+
+
+//include_lan(e_LANGUAGEDIR.e_LANGUAGE.'/admin/lan_'.e_PAGE);
+
+
+// FIXME - quick temporarry fix for missing icons on menu administration. We need different core style to be included (forced) here - e.g. e107_web/css/admin/sprite.css
+if(e_IFRAME) //<-- Check config and delete buttons if modifying
+{
+
+//e107::js('core','bootstrap/js/bootstrap.min.js');
+//e107::css('core','bootstrap/css/bootstrap.min.css');
+ e107::css('url','{e_THEME}/bootstrap/admin_style.css');
+
+}
+
+
+
+
+
$e_sub_cat = 'menus';
@@ -380,6 +759,18 @@ if($_POST)
//FIXME still used in e_HANDLER.menumanager_class.php
+
+
+
+
+
+
+
+
+
+
+
+
if (vartrue($message) != "")
{
echo $ns -> tablerender('Updated', "".$message."
");
@@ -402,6 +793,19 @@ if($_POST)
}
+
+
+
+
+
+
+
+
+
+
+
+
+
// -----------------------------------------------------------------------------
require_once("footer.php");
@@ -409,6 +813,34 @@ require_once("footer.php");
// -----------------------------------------------------------------------
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
function menus_adminmenu()
{
diff --git a/e107_handlers/db_verify_class.php b/e107_handlers/db_verify_class.php
index 3a4ebdffd..34f6c4c01 100644
--- a/e107_handlers/db_verify_class.php
+++ b/e107_handlers/db_verify_class.php
@@ -868,15 +868,19 @@ class db_verify
$prefix .= "lan_".$language."_";
// $mes->addDebug("Retrieving Language Table Data: ".$prefix . $tbl."
");
}
-
- mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1');
+
+ $sql = e107::getDb();
+ $sql->gen('SET SQL_QUOTE_SHOW_CREATE = 1');
+ // mysql_query('SET SQL_QUOTE_SHOW_CREATE = 1');
$qry = 'SHOW CREATE TABLE `' . $prefix . $tbl . "`";
- $z = mysql_query($qry);
+ // $z = mysql_query($qry);
+ $z = $sql->gen($qry);
if($z)
{
- $row = mysql_fetch_row($z);
+ // $row = mysql_fetch_row($z);
+ $row = $sql->fetch(MYSQL_NUM);
//return $row[1];
return stripslashes($row[1]).';'; // backticks needed.
// return str_replace("`", "", stripslashes($row[1])).';';
diff --git a/e107_themes/bootstrap/admin_theme.php b/e107_themes/bootstrap/admin_theme.php
index 1760d23c0..4b4b15f52 100644
--- a/e107_themes/bootstrap/admin_theme.php
+++ b/e107_themes/bootstrap/admin_theme.php
@@ -1,12 +1,9 @@
");
-e107::lan('theme');
+// e107::lan('theme');
e107::js('core','bootstrap/js/bootstrap.min.js');
e107::css('core','bootstrap/css/bootstrap.min.css');
e107::css('core','bootstrap/css/bootstrap-responsive.min.css');
@@ -48,174 +45,170 @@ else
$no_core_css = TRUE;
-function tablestyle($caption, $text, $mode)
+class bootstrap_admintheme
{
- global $style;
-
- $class = '';
-
-
-
- if(is_string($mode) && $mode == 'admin_help') $class = ' '.str_replace('_', '-', $mode);
+ function tablestyle($caption, $text, $mode)
+ {
+ global $style;
+
+ $class = '';
- if($mode == 'e_help')
- {
- $style = 'admin_menu';
- }
- if($mode == 'core-infopanel_latest' || $mode == 'core-infopanel_status')
- {
- //return;
- echo '
-
-
-
-
-
-
- '.$text.'
-
-
-
-
-
- ';
- return;
- }
-
- if($mode == 'personalize')
- {
- echo '
-
-
-
-
- '.$text.'
-
-
-
- ';
+
+
+ if(is_string($mode) && $mode == 'admin_help') $class = ' '.str_replace('_', '-', $mode);
- return;
- }
-
-
-
-
- if($style == 'core-infopanel')
- {
- echo '
-
+ if($mode == 'e_help')
+ {
+ $style = 'admin_menu';
+ }
-
-
-
-
-
- '.$text.'
-
-
-
-
-
- ';
- return;
- }
-
-
- if(deftrue('e_IFRAME'))
- {
- echo '
-
-
+ if($mode == 'core-infopanel_latest' || $mode == 'core-infopanel_status')
+ {
+ //return;
+ echo '
+
+
+
+
+
+
'.$text.'
-
-
- ';
-
- return;
- }
+
+
+
+
+
+ ';
+ return;
+ }
- if(trim($caption) == '')
- {
- $style = 'no_caption';
- }
-
-
- switch(varset($style, 'admin_content'))
- {
-
- case 'admin_menu' :
+ if($mode == 'personalize')
+ {
echo '
+
+
+
+
+ '.$text.'
+
+
+
+ ';
+
+ return;
+ }
+
+
+
+
+ if($style == 'core-infopanel')
+ {
+ echo '
+
+
+
+
+
+
+
+ '.$text.'
+
+
+
+
+
+ ';
+ return;
+ }
+
+
+ if(deftrue('e_IFRAME'))
+ {
+ echo '
+
+ ';
+
+ return;
+ }
+
+ if(trim($caption) == '')
+ {
+ $style = 'no_caption';
+ }
+
+
+ switch(varset($style, 'admin_content'))
+ {
+
+ case 'admin_menu' :
+ echo '
+
+ ';
+ break;
+
+ case 'site_info' :
+ echo '
- ';
- break;
-
- case 'site_info' :
- echo '
-
- ';
- break;
- /*
- case 'admin_content':
- echo '
-
-
'.$caption.'
-
- '.$text.'
+
+
+ '.$text.'
+
-
- ';
- break;
- */
-
- case 'no_caption' :
- echo '
-
-
- '.$text.'
+ ';
+ break;
+ /*
+ case 'admin_content':
+ echo '
+
+
'.$caption.'
+
+ '.$text.'
+
-
- ';
- break;
-
-
- default:
- echo '
-
-
'.$caption.'
-
- '.$text.'
+ ';
+ break;
+ */
+
+ case 'no_caption' :
+ echo '
+
-
- ';
- break;
+ ';
+ break;
+
+
+ default:
+ echo '
+
+
'.$caption.'
+
+ '.$text.'
+
+
+ ';
+ break;
+ }
}
}
+
$HEADER = '';
$FOOTER = '';
-define('ICONMAIL', 'email_16.png');
-define('ICONPRINT', 'print_16.png');
-define('ICONSTYLE', 'border: 0px');
-define('COMMENTLINK', LAN_THEME_2);
-define('COMMENTOFFSTRING', LAN_THEME_1);
-define('PRE_EXTENDEDSTRING', '
');
-define('EXTENDEDSTRING', LAN_THEME_3);
-define('POST_EXTENDEDSTRING', '
');
-define('TRACKBACKSTRING', LAN_THEME_4);
-define('TRACKBACKBEFORESTRING', ' | ');
+/*
$sc_style['NEWSIMAGE']['pre'] = '
';
$sc_style['NEWSIMAGE']['post'] = '
';
@@ -245,4 +238,6 @@ $NEWSSTYLE = '
';
+
+ */
?>
\ No newline at end of file