From c7b88d396a3bd854153e485b4dc0be748a05ca29 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur <eldy@destailleur.fr> Date: Sun, 15 Jan 2012 19:07:01 +0100 Subject: [PATCH] Change to prepare module skincoloreditor --- htdocs/core/lib/admin.lib.php | 6 +++--- htdocs/core/lib/functions2.lib.php | 6 ++++-- htdocs/theme/eldy/style.css.php | 15 ++++++++------- htdocs/user/class/user.class.php | 10 +++++----- 4 files changed, 20 insertions(+), 17 deletions(-) diff --git a/htdocs/core/lib/admin.lib.php b/htdocs/core/lib/admin.lib.php index 5b129935061..1c4e3030add 100644 --- a/htdocs/core/lib/admin.lib.php +++ b/htdocs/core/lib/admin.lib.php @@ -372,7 +372,7 @@ function run_sql($sqlfile,$silent=1,$entity='',$usesavepoint=1,$handler='') * @param int $entity Multi company id, -1 for all entities * @return int <0 if KO, >0 if OK * - * @see dolibarr_get_const, dolibarr_sel_const + * @see dolibarr_get_const, dolibarr_set_const, dol_set_user_param */ function dolibarr_del_const($db, $name, $entity=1) { @@ -406,7 +406,7 @@ function dolibarr_del_const($db, $name, $entity=1) * @param int $entity Multi company id * @return string Valeur de la constante * - * @see dolibarr_del_const, dolibarr_set_const + * @see dolibarr_del_const, dolibarr_set_const, dol_set_user_param */ function dolibarr_get_const($db, $name, $entity=1) { @@ -441,7 +441,7 @@ function dolibarr_get_const($db, $name, $entity=1) * @param int $entity Multi company id (0 means all entities) * @return int -1 if KO, 1 if OK * - * @see dolibarr_del_const, dolibarr_get_const + * @see dolibarr_del_const, dolibarr_get_const, dol_set_user_param */ function dolibarr_set_const($db, $name, $value, $type='chaine', $visible=0, $note='', $entity=1) { diff --git a/htdocs/core/lib/functions2.lib.php b/htdocs/core/lib/functions2.lib.php index cdf2bab0d78..32301ef8a86 100644 --- a/htdocs/core/lib/functions2.lib.php +++ b/htdocs/core/lib/functions2.lib.php @@ -901,6 +901,8 @@ function weight_convert($weight,&$from_unit,$to_unit) * @param user Object user * @param tab Tableau (cle=>valeur) des parametres a sauvegarder * @return int <0 if KO, >0 if OK + * + * @see dolibarr_get_const, dolibarr_set_const, dolibarr_del_const */ function dol_set_user_param($db, $conf, &$user, $tab) { @@ -949,8 +951,8 @@ function dol_set_user_param($db, $conf, &$user, $tab) $db->rollback(); return -1; } - - $user->page_param[$key] = $value; + $user->conf->$key = $value; + //print "key=".$key." user->conf->key=".$user->conf->$key; } } diff --git a/htdocs/theme/eldy/style.css.php b/htdocs/theme/eldy/style.css.php index f1625216123..13699cf4657 100644 --- a/htdocs/theme/eldy/style.css.php +++ b/htdocs/theme/eldy/style.css.php @@ -1,5 +1,5 @@ <?php -/* Copyright (C) 2004-2011 Laurent Destailleur <eldy@users.sourceforge.net> +/* Copyright (C) 2004-2012 Laurent Destailleur <eldy@users.sourceforge.net> * Copyright (C) 2006 Rodolphe Quiedeville <rodolphe@quiedeville.org> * Copyright (C) 2007-2011 Regis Houssin <regis@dolibarr.fr> * Copyright (C) 2011 Philippe Grand <philippe.grand@atoo-net.com> @@ -23,13 +23,13 @@ * \brief File for CSS style sheet Eldy */ -//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled cause need to load personalized language +//if (! defined('NOREQUIREUSER')) define('NOREQUIREUSER','1'); // Not disabled because need to load personalized language //if (! defined('NOREQUIREDB')) define('NOREQUIREDB','1'); // Not disabled to increase speed. Language code is found on url. if (! defined('NOREQUIRESOC')) define('NOREQUIRESOC','1'); -//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled cause need to do translations +//if (! defined('NOREQUIRETRAN')) define('NOREQUIRETRAN','1'); // Not disabled because need to do translations if (! defined('NOCSRFCHECK')) define('NOCSRFCHECK',1); if (! defined('NOTOKENRENEWAL')) define('NOTOKENRENEWAL',1); -if (! defined('NOLOGIN')) define('NOLOGIN',1); +//if (! defined('NOLOGIN')) define('NOLOGIN',1); // Not disabled because need to load user to know its personal theme choices if (! defined('NOREQUIREMENU')) define('NOREQUIREMENU',1); if (! defined('NOREQUIREHTML')) define('NOREQUIREHTML',1); if (! defined('NOREQUIREAJAX')) define('NOREQUIREAJAX','1'); @@ -70,9 +70,10 @@ $img_button=dol_buildpath($path.'/theme/eldy/img/button_bg.png',1); // Example: Ocean: $colred=220;$colgreen=220;$colblue=240; //$conf->global->THEME_ELDY_ENABLE_PERSONALIZED=0; //$user->conf->THEME_ELDY_ENABLE_PERSONALIZED=0; -$colred =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,0,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,0,2))); -$colgreen=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,2,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,2,2))); -$colblue =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,4,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,4,2))); +//var_dump($user->conf->THEME_ELDY_RGB); +$colred =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,0,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($user->conf->THEME_ELDY_RGB,0,2))); +$colgreen=empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,2,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($user->conf->THEME_ELDY_RGB,2,2))); +$colblue =empty($user->conf->THEME_ELDY_ENABLE_PERSONALIZED)?(empty($conf->global->THEME_ELDY_RGB)?235:hexdec(substr($conf->global->THEME_ELDY_RGB,4,2))):(empty($user->conf->THEME_ELDY_RGB)?235:hexdec(substr($user->conf->THEME_ELDY_RGB,4,2))); // Colors $isred=max(0,(2*$colred-$colgreen-$colblue)/2); // 0 - 255 diff --git a/htdocs/user/class/user.class.php b/htdocs/user/class/user.class.php index fa8e4ef0984..ea1be22316c 100644 --- a/htdocs/user/class/user.class.php +++ b/htdocs/user/class/user.class.php @@ -238,19 +238,19 @@ class User extends CommonObject $sql = "SELECT param, value FROM ".MAIN_DB_PREFIX."user_param"; $sql.= " WHERE fk_user = ".$this->id; $sql.= " AND entity = ".$conf->entity; - $result=$this->db->query($sql); - if ($result) + $resql=$this->db->query($sql); + if ($resql) { - $num = $this->db->num_rows($result); + $num = $this->db->num_rows($resql); $i = 0; while ($i < $num) { - $obj = $this->db->fetch_object($result); + $obj = $this->db->fetch_object($resql); $p=$obj->param; if ($p) $this->conf->$p = $obj->value; $i++; } - $this->db->free($result); + $this->db->free($resql); } else { -- GitLab