diff --git a/class2.php b/class2.php
index 42812c8ee..73bd7c0b2 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.97 $
-* $Date: 2009-07-05 11:25:10 $
+* $Revision: 1.98 $
+* $Date: 2009-07-06 05:59:42 $
* $Author: e107coders $
*
*/
@@ -417,10 +417,11 @@ else
$pref = $eArrayStorage->ReadArray($PrefCache);
}
+
$e107->set_base_path();
// extract menu prefs
-$menu_pref = unserialize(stripslashes($sysprefs->get('menu_pref')));
+$menu_pref = unserialize(stripslashes($sysprefs->get('menu_pref')));
$sql->db_Mark_Time('(Extracting Core Prefs Done)');
@@ -703,8 +704,9 @@ if (!function_exists('checkvalidtheme'))
if (ADMIN && strpos(e_QUERY, 'themepreview') !== false)
{
list($action, $id) = explode('.', e_QUERY);
- require_once(e_HANDLER.'theme_handler.php');
+ require_once(e_HANDLER.'theme_handler.php');
$themeArray = themeHandler :: getThemes('id');
+
define('PREVIEWTHEME', e_THEME.$themeArray[$id].'/');
define('PREVIEWTHEMENAME', $themeArray[$id]);
define('THEME', e_THEME.$themeArray[$id].'/');
@@ -947,6 +949,7 @@ if(!isset($_E107['no_menus']))
$menu_data['menu_active'] = $eMenuActive;
$menu_data = $eArrayStorage->WriteArray($menu_data, false);
$e107cache->set_sys('menus_'.USERCLASS_LIST.'_'.md5(e_LANGUAGE), $menu_data);
+
unset($menu_data);
}
else
@@ -1000,9 +1003,11 @@ if(!defined('THEME'))
{
checkvalidtheme($pref['sitetheme']);
}
+
+
}
-
+$theme_pref = varset($pref['sitetheme_pref']);
// --------------------------------------------------------------
@@ -1299,7 +1304,7 @@ function get_user_data($uid, $extra = '')
function save_prefs($table = 'core', $uid = USERID, $row_val = '')
{
- global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage;
+ global $pref, $user_pref, $tp, $PrefCache, $sql, $eArrayStorage, $theme_pref;
if ($table == 'core')
{
if ($row_val == '')
@@ -1321,6 +1326,11 @@ function save_prefs($table = 'core', $uid = USERID, $row_val = '')
}
}
}
+ elseif($table == "theme")
+ {
+ $pref['sitetheme_pref'] = $theme_pref;
+ save_prefs();
+ }
else
{
// $_user_pref = $tp -> toDB($user_pref);
diff --git a/e107_admin/menus.php b/e107_admin/menus.php
index e68f36157..f0b64b73a 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.15 $
-| $Date: 2009-07-05 11:57:40 $
+| $Revision: 1.16 $
+| $Date: 2009-07-06 05:59:42 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -262,6 +262,12 @@ if ($menu_act == 'config')
if ($menu_act == "adv")
{
+ showVisibility();
+}
+
+function showVisibility()
+{
+ global $sql,$ns;
require_once(e_HANDLER."userclass_class.php");
$sql->db_Select("menus", "*", "menu_id=".$id);
$row = $sql->db_Fetch();
@@ -295,8 +301,12 @@ if ($menu_act == "adv")
";
$caption = MENLAN_7." ".$row['menu_name'];
$ns->tablerender($caption, $text);
+
+
+
}
+
unset($message);
if ($menu_act == "sv")
diff --git a/e107_admin/theme.php b/e107_admin/theme.php
index 731d5bf5c..d270c71f9 100644
--- a/e107_admin/theme.php
+++ b/e107_admin/theme.php
@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_admin/theme.php,v $
-| $Revision: 1.1.1.1 $
-| $Date: 2006-12-02 04:33:28 $
-| $Author: mcfly_e107 $
+| $Revision: 1.2 $
+| $Date: 2009-07-06 05:59:42 $
+| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -29,9 +29,43 @@ require_once("auth.php");
require_once(e_HANDLER."theme_handler.php");
$themec = new themeHandler;
+$mode = e_QUERY;
+
+if($_POST['selectadmin'])
+{
+ $mode = "admin";
+}
+
+if($_POST['selectmain'])
+{
+ $mode = "main";
+}
+
+$themec -> showThemes($mode);
-$themec -> showThemes();
+function theme_adminmenu()
+{
+ $e107 = &e107::getInstance();
+
+ $var['main']['text'] = TPVLAN_33;
+ $var['main']['link'] = e_SELF;
+
+ $var['admin']['text'] = TPVLAN_34;
+ $var['admin']['link'] = e_SELF."?admin";
+
+ $var['choose']['text'] = TPVLAN_51;
+ $var['choose']['link'] = e_SELF."?choose";
+
+ $var['upload']['text'] = TPVLAN_38;
+ $var['upload']['link'] = e_SELF."?upload";
+
+ $selected = (e_QUERY) ? e_QUERY : "main";
+
+
+ e_admin_menu(TPVLAN_26, $selected, $var);
+}
+
require_once("footer.php");
diff --git a/e107_handlers/theme_handler.php b/e107_handlers/theme_handler.php
index c544260ec..6ab6ba577 100644
--- a/e107_handlers/theme_handler.php
+++ b/e107_handlers/theme_handler.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.15 $
-| $Date: 2009-07-05 11:57:40 $
+| $Revision: 1.16 $
+| $Date: 2009-07-06 05:59:42 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -24,11 +24,15 @@ class themeHandler{
var $themeArray;
var $action;
var $id;
+ var $frm;
/* constructor */
function themeHandler() {
+ require_once(e_HANDLER."form_handler.php");
+ $this->frm = new e_form(); //enable inner tabindex counter
+
if (isset($_POST['upload'])) {
$this -> themeUpload();
}
@@ -39,30 +43,35 @@ class themeHandler{
{
if(strstr($key,"preview"))
{
- $this -> id = str_replace("preview_", "", $key);
+ // $this -> id = str_replace("preview_", "", $key);
+ $this -> id = key($post);
$this -> themePreview();
}
if(strstr($key,"selectmain"))
{
- $this -> id = str_replace("selectmain_", "", $key);
+ // $this -> id = str_replace("selectmain_", "", $key);
+ $this -> id = key($post);
$this -> setTheme();
}
if(strstr($key,"selectadmin"))
{
- $this -> id = str_replace("selectadmin_", "", $key);
+ $this -> id = key($post);
$this -> setAdminTheme();
}
}
if(isset($_POST['submit_adminstyle']))
{
+ $this -> id = $_POST['curTheme'];
$this -> setAdminStyle();
}
if(isset($_POST['submit_style']))
{
+ $this -> id = $_POST['curTheme'];
$this -> setStyle();
+
}
}
@@ -70,7 +79,7 @@ class themeHandler{
function getThemes($mode=FALSE)
{
$themeArray = array();
- $themeArray[0] = ""; // Fix for 'preview theme'.
+
$tloop = 1;
$handle = opendir(e_THEME);
while (false !== ($file = readdir($handle)))
@@ -208,131 +217,123 @@ class themeHandler{
}
}
- function showThemes()
+ function showThemes($mode='main')
{
global $ns, $pref;
+
echo "
\n";
}
-
-
-
- function renderTheme($mode=FALSE, $theme)
+ function renderThemeInfo($theme)
{
- /*
- mode = 0 :: normal
- mode = 1 :: selected site theme
- mode = 2 :: selected admin theme
- */
-
- define("IMAGE_CHECK","
");
-
- global $ns, $pref, $imode;
+ // TO-DO : This SHOULD be loaded by ajax before release.
+ global $pref;
$author = ($theme['email'] ? "".$theme['author']."" : $theme['author']);
$website = ($theme['website'] ? "".$theme['website']."" : "");
$preview = "".($theme['preview'] ? "
" : "
")."";
- $selectmainbutton = ($mode != 1 ? "" : "");
- $selectadminbutton = ($mode != 2 ? "" : "");
- $previewbutton = (!$mode ? " " : "");
- $text = "
-
-
-
-
".TPVLAN_4.": | ".$author." |
" : "";
- $itext .= $website ? "".TPVLAN_5.": | ".$website." |
" : "";
- $itext .= $theme['date'] ? "".TPVLAN_6.": | ".$theme['date']." |
" : "";
- $itext .= "".TPVLAN_49.": |
+ $text = "".TPVLAN_7."
+ ";
+ $text .= $author ? "".TPVLAN_4.": | ".$author." |
" : "";
+ $text .= $website ? "".TPVLAN_5.": | ".$website." |
" : "";
+ $text .= $theme['date'] ? "".TPVLAN_6.": | ".$theme['date']." |
" : "";
+ $text .= "".TPVLAN_49.": |
XHTML ";
- $itext .= ($theme['xhtmlcompliant']) ? IMAGE_CHECK : "X";
- $itext .= " CSS ";
- $itext .= ($theme['csscompliant']) ? IMAGE_CHECK : "X";
- $itext .= " |
";
- if($theme['xhtmlcompliant'] || $theme['xhtmlcompliant'])
-
-
-
-
- $itext .= $theme['info'] ? "".TPVLAN_7.": | ".$theme['info']." |
" : "";
+ $text .= ($theme['xhtmlcompliant']) ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON;
+ $text .= " CSS ";
+ $text .= ($theme['csscompliant']) ? ADMIN_TRUE_ICON : ADMIN_FALSE_ICON;
+ $text .= "";
if($theme['layouts']) // New in 0.8 WORK IN PROGRESS ----
{
$itext .= "
".TPVLAN_50.": |
-
+
";
$itext .= ($mode == 1) ? "Default | " : "";
$itext .= "
@@ -366,7 +367,7 @@ class themeHandler{
$itext .= "
".$val['@attributes']['requiredPlugins']." |
";
- $itext .= ($val['menuPresets']) ? IMAGE_CHECK : " ";
+ $itext .= ($val['menuPresets']) ? ADMIN_TRUE_ICON: " ";
$itext .= " |
";
}
@@ -374,66 +375,220 @@ class themeHandler{
$itext .= " | ";
}
+ $text .= "".TPVLAN_22.": | ";
+ foreach($theme['css'] as $val)
+ {
+ $text .= $val['name']." ";
+ }
+ $text .= " | ";
- $itext .= !$mode ? "".TPVLAN_8.": | ".$previewbutton.$selectmainbutton.$selectadminbutton." | " : "";
+ $text .= $itext." ";
+ $text .= "";
+ return $text;
+ }
+
+ function renderThemeConfig() // process custom theme configuration - TODO.
+ {
+ $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 .= " |
".$val['caption'].": | ".$val['html']." |
";
+ }
+ return $text;
+ }
+ }
+ }
+
+ function setThemeConfig()
+ {
+ $confile = e_THEME.$this->id."/".$this->id."_config.php";
+
+ include($confile);
+ if(function_exists($this->id."_process"))
+ {
+ $text = call_user_func($this->id."_process");
+ }
+
+ return $text;
+ }
+
+ function renderTheme($mode=FALSE, $theme)
+ {
+
+ /*
+ mode = 0 :: normal
+ mode = 1 :: selected site theme
+ mode = 2 :: selected admin theme
+ */
+
+ global $ns, $pref;
- if ($itext) {
- $text .= "";
+
+ $author = ($theme['email'] ? "".$theme['author']."" : $theme['author']);
+ $website = ($theme['website'] ? "".$theme['website']."" : "");
+ $preview = "".($theme['preview'] ? "
" : "
")."";
+
+ $previewbutton = (!$mode ? " " : "");
+
+ $main_icon = ($pref['sitetheme'] != $theme['path']) ? "\n" : ADMIN_TRUE_ICON;
+ $info_icon = "
\n";
+ $preview_icon = "\n";
+ $admin_icon = ($pref['admintheme'] != $theme['path']) ? "\n" : ADMIN_TRUE_ICON;
+
+ $newpreview = "".($theme['preview'] ? "
" : "
")."";
+
+
+ if(!$mode) // Choose a Theme to Install.
+ {
+ // styles NEED to be put into style.css
+
+ $borderStyle = (($pref['sitetheme'] == $theme['path']) || ($pref['admintheme'] == $theme['path'])) ? "border:1px solid black" : "border:1px dotted silver;background-color:#DDDDDD";
+ $text = "
+
".$newpreview."
+
".$theme['name']." ".$theme['version']."
+
\n\n\n".$main_icon.$admin_icon.$info_icon.$preview_icon."\n\n
+
\n".$this->renderThemeInfo($theme)."
+
+
";
+ return $text;
}
- if(array_key_exists("multipleStylesheets", $theme))
+ $this->id = $theme['path'];
+
+ $text = "
+
+ ".$theme['name']." |
+ ".TPVLAN_11." | ".$theme['version']." |
+ $newpreview |
";
+
+ $text .= "".TPVLAN_4.": | ".$author." |
";
+ $text .= "".TPVLAN_5.": | ".$website." |
";
+ $text .= "".TPVLAN_6.": | ".$theme['date']." |
";
+ $text .= "".TPVLAN_49.": |
+ XHTML ";
+ $text .= ($theme['xhtmlcompliant']) ? ADMIN_TRUE_ICON : "X";
+ $text .= " CSS ";
+ $text .= ($theme['csscompliant']) ? ADMIN_TRUE_ICON : "X";
+ $text .= " |
";
+ $text .= "".TPVLAN_7.": | ".$theme['info']." |
+ ";
+
+ if($mode == 1)
{
- if($mode)
- {
- $text .= "";
}
- if($mode == 1)
- {
- $text .= "";
- }
if($mode == 2)
{
@@ -444,29 +599,60 @@ class themeHandler{
$adminstyles = $file -> get_files(e_ADMIN."includes");
- $astext = "\n";
- $text .= "
\n";
+ $text .= "
+
+ ".TPVLAN_41.": |
+ ".$astext." |
+
+ \n";
}
- $text .= "
\n";
+ $text .= $this->renderThemeConfig();
+
+
+ $text .= "
+
+
+ ";
+
+ if($mode == 2) // admin
+ {
+ $mainid = "selectmain[".$theme['id']."]";
+ $text .= $this->frm->admin_button('submit_style', TPVLAN_35, 'update');
+ $text .= $this->frm->admin_button($mainid, TPVLAN_10, 'submit');
+
+ }
+ else // main
+ {
+ $adminid = "selectadmin[".$theme['id']."]";
+ $text .= $this->frm->admin_button('submit_style', TPVLAN_35, 'update');
+ $text .= $this->frm->admin_button($adminid, TPVLAN_32, 'submit');
+ }
+
+ $text .= "";
+
+ $text .= "
+
+
+
+
+ \n";
+
return $text;
}
function themePreview()
{
- echo "\n";
+ echo "\n";
exit;
}
@@ -488,6 +674,8 @@ class themeHandler{
$pref['sitetheme_deflayout'] = $this->findDefault($themeArray[$this -> id]);
$pref['sitetheme_layouts'] = is_array($this->themeArray[$pref['sitetheme']]['layouts']) ? $this->themeArray[$pref['sitetheme']]['layouts'] : array();
+
+
$e107cache->clear_sys();
save_prefs();
@@ -522,6 +710,7 @@ class themeHandler{
save_prefs();
$this->theme_adminlog('02',$pref['admintheme'].', '.$pref['admincss']);
$ns->tablerender("Admin Message", "
".TPVLAN_40." '".$themeArray[$this -> id]."'.
");
+ // $this->showThemes('admin');
}
function setStyle()
@@ -533,8 +722,9 @@ class themeHandler{
$e107cache->clear_sys();
save_prefs();
+ $custom_message = $this -> setThemeConfig();
$this->theme_adminlog('03',$pref['image_preload'].', '.$pref['themecss']);
- $ns->tablerender(TPVLAN_36, "
".TPVLAN_37.".
");
+ $ns->tablerender(TPVLAN_36, "
".TPVLAN_37.".
".$custom_message."
");
}
function setAdminStyle()
@@ -590,6 +780,8 @@ class themeHandler{
{
unset($themeArray);
}
+ $themeArray['path'] = $path;
+
return $themeArray;
}
@@ -631,8 +823,9 @@ class themeHandler{
$lays[$name] = $val;
}
}
- $vars['layouts'] = $lays;
+ $vars['layouts'] = $lays;
+ $vars['path'] = $path;
return $vars;
}
diff --git a/e107_languages/English/admin/lan_theme.php b/e107_languages/English/admin/lan_theme.php
index 0b152e055..8c08f7af9 100644
--- a/e107_languages/English/admin/lan_theme.php
+++ b/e107_languages/English/admin/lan_theme.php
@@ -4,8 +4,8 @@
| e107 website system - Language File.
|
| $Source: /cvs_backup/e107_0.8/e107_languages/English/admin/lan_theme.php,v $
-| $Revision: 1.3 $
-| $Date: 2008-11-17 07:17:23 $
+| $Revision: 1.4 $
+| $Date: 2009-07-06 05:59:42 $
| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -33,7 +33,7 @@ define("TPVLAN_20", "Auto theme upload and extraction is disabled as your themes
define("TPVLAN_21", "This is the currently selected site theme");
-define("TPVLAN_22", "This theme has multiple stylesheets");
+define("TPVLAN_22", "Stylesheets");
define("TPVLAN_23", "default stylesheet");
define("TPVLAN_24", "no information");
define("TPVLAN_25", "To choose which stylesheet to use, please go to preferences and click on 'Theme'.");
@@ -47,8 +47,8 @@ define("TPVLAN_30", "Preload Theme Images:");
define("TPVLAN_31", "This is the currently selected admin theme");
define("TPVLAN_32", "Set As Admin Theme");
-define("TPVLAN_33", "Current Site Theme");
-define("TPVLAN_34", "Current Admin Theme");
+define("TPVLAN_33", "Site Theme Configuration");
+define("TPVLAN_34", "Admin Theme Configuration");
define("TPVLAN_35", "Save options");
define("TPVLAN_36", "Admin Message");
define("TPVLAN_37", "Theme options saved");
@@ -66,6 +66,7 @@ define("TPVLAN_48", "code:");
define("TPVLAN_49", "Compliance");
define("TPVLAN_50", "Layouts");
+define("TPVLAN_51", "Change Theme");
diff --git a/e107_themes/jayya/style.css b/e107_themes/jayya/style.css
index 47dd23439..63b2e4a2c 100644
--- a/e107_themes/jayya/style.css
+++ b/e107_themes/jayya/style.css
@@ -444,7 +444,7 @@ label { cursor: pointer; }
border-color:#aaa #c8c8c8 #c8c8c8 #aaa;
background:#fff;
font:12px arial, helvetica, sans-serif;
- overflow:auto
+ overflow:auto
}
.check-block .checkbox { margin-left: 2px }
.check-block .separator { clear: both; border-bottom: 1px solid #aaa; margin-bottom: 4px; height: 4px }
@@ -641,6 +641,7 @@ button.cancel:focus span {}
button.cancel:active span {}
+
.buttons-bar { padding: 10px 0px; }
.buttons-bar button { margin-right: 10px; }
.buttons-bar button.f-right { margin-right: 0px; }
diff --git a/e107_themes/jayya/theme.php b/e107_themes/jayya/theme.php
index 58f11d3d7..902e87831 100644
--- a/e107_themes/jayya/theme.php
+++ b/e107_themes/jayya/theme.php
@@ -11,9 +11,9 @@
| GNU General Public License (http://gnu.org).
|
| $Source: /cvs_backup/e107_0.8/e107_themes/jayya/theme.php,v $
-| $Revision: 1.6 $
-| $Date: 2009-04-27 10:52:42 $
-| $Author: secretr $
+| $Revision: 1.7 $
+| $Date: 2009-07-06 05:59:42 $
+| $Author: e107coders $
+----------------------------------------------------------------------------+
*/
@@ -29,13 +29,14 @@ include_lan(e_THEME."jayya/languages/".e_LANGUAGE.".php");
$themename = "Jayya";
$themeversion = "1.0";
-$themeauthor = "";
+$themeauthor = "e107devs";
$themedate = "";
$themeinfo = "";
$xhtmlcompliant = TRUE;
$csscompliant = TRUE;
define("THEME_DISCLAIMER", "");
define("IMODE", "lite");
+define("STANDARDS_MODE", TRUE);
// [dont render core style sheet link]
$no_core_css = TRUE;