From 4e20296b1a77fa0faa3570af49b1c6e2263faa3a Mon Sep 17 00:00:00 2001 From: x2000habouzit Date: Tue, 23 Nov 2004 11:32:34 +0000 Subject: [PATCH] config proof of concept : skins --- include/xorg.globals.inc.php.in | 4 ++-- include/xorg.globals/core.inc.php | 42 +++++++++++++++++++++++++++++++++++++++ include/xorg.inc.php | 5 +---- include/xorg/session.inc.php | 16 +++++++-------- 4 files changed, 52 insertions(+), 15 deletions(-) create mode 100644 include/xorg.globals/core.inc.php diff --git a/include/xorg.globals.inc.php.in b/include/xorg.globals.inc.php.in index cc0d63b..be192e3 100644 --- a/include/xorg.globals.inc.php.in +++ b/include/xorg.globals.inc.php.in @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.globals.inc.php.in,v 1.5 2004-11-23 11:10:41 x2000habouzit Exp $ + $Id: xorg.globals.inc.php.in,v 1.6 2004-11-23 11:32:34 x2000habouzit Exp $ ***************************************************************************/ require_once("diogenes.core.globals.inc.php"); @@ -78,7 +78,7 @@ class XorgGlobals extends DiogenesCoreGlobals if ($c == 'global') { global $$key; $$key = $val; - } elseif ($c == 'core') { + } elseif ($c == 'core' && isset($this->$key)) { $this->$key=$val; } else { $this->$c->$key = $val; diff --git a/include/xorg.globals/core.inc.php b/include/xorg.globals/core.inc.php new file mode 100644 index 0000000..5714ffd --- /dev/null +++ b/include/xorg.globals/core.inc.php @@ -0,0 +1,42 @@ +core = new CoreConfig; + +// vim:set et sw=4 sts=4 sws=4 foldmethod=marker: +?> diff --git a/include/xorg.inc.php b/include/xorg.inc.php index 800a9c9..648bf24 100644 --- a/include/xorg.inc.php +++ b/include/xorg.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: xorg.inc.php,v 1.3 2004-11-22 21:40:47 x2000habouzit Exp $ + $Id: xorg.inc.php,v 1.4 2004-11-23 11:32:34 x2000habouzit Exp $ ***************************************************************************/ function microtime_float() @@ -39,9 +39,6 @@ define("PERMS_EXT", "ext"); define("PERMS_USER", "user"); define("PERMS_ADMIN", "admin"); -define('SKIN_COMPATIBLE','default.tpl'); -define('SKIN_COMPATIBLE_ID',1); - define('SKINNED', 0); define('NO_SKIN', 1); diff --git a/include/xorg/session.inc.php b/include/xorg/session.inc.php index d1e1e19..e966cc3 100644 --- a/include/xorg/session.inc.php +++ b/include/xorg/session.inc.php @@ -18,7 +18,7 @@ * Foundation, Inc., * * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * *************************************************************************** - $Id: session.inc.php,v 1.3 2004-11-22 20:11:42 x2000habouzit Exp $ + $Id: session.inc.php,v 1.4 2004-11-23 11:32:34 x2000habouzit Exp $ ***************************************************************************/ require_once("diogenes.core.session.inc.php"); @@ -340,21 +340,19 @@ function start_connexion ($uid, $identified) function set_skin() { global $globals; - if (logged()) { + if (logged() && $globals->core->skin_enable) { $result = $globals->db->query("SELECT skin,skin_tpl FROM auth_user_quick AS a INNER JOIN skins AS s ON a.skin=s.id WHERE user_id='{$_SESSION['uid']}' AND skin_tpl != ''"); if (!(list($_SESSION['skin_id'], $_SESSION['skin']) = mysql_fetch_row($result))) { - $_SESSION['skin'] = SKIN_COMPATIBLE; - $_SESSION['skin_id'] = SKIN_COMPATIBLE_ID; + $_SESSION['skin'] = $globals->core->skin_tpl; + $_SESSION['skin_id'] = $globals->core->skin_id; } mysql_free_result($result); - } - - if (!logged()) { - $_SESSION['skin'] = SKIN_COMPATIBLE; - $_SESSION['skin_id'] = SKIN_COMPATIBLE_ID; + } else { + $_SESSION['skin'] = $globals->core->skin_tpl; + $_SESSION['skin_id'] = $globals->core->skin_id; } } -- 2.1.4