From: x2000habouzit Date: Tue, 27 Jan 2004 14:25:03 +0000 (+0000) Subject: nième correction de bugs avec les skins. X-Git-Tag: xorg/old~1929 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=1f634a6b614afaa799a61cbdb646120f2aca9fbc;p=platal.git nième correction de bugs avec les skins. --- diff --git a/htdocs/skins.php b/htdocs/skins.php index 54177b0..81052dd 100644 --- a/htdocs/skins.php +++ b/htdocs/skins.php @@ -9,10 +9,11 @@ if (isset($_REQUEST['submit'])) { // formulaire soumis, traitons les donn set_skin(); } -$res = mysql_query("SELECT id,s.skin,s.skin_popup,snapshot,name,s.date,comment,auteur,count(*) AS nb FROM skins AS s +$res = mysql_query("SELECT id,skin_tpl,skin_popup,snapshot,name,s.date,comment,auteur,count(*) AS nb FROM skins AS s LEFT JOIN auth_user_md5 AS a ON s.id=a.skin - WHERE !FIND_IN_SET('cachee',type) AND s.skin != '' + WHERE !FIND_IN_SET('cachee',type) AND skin_tpl != '' GROUP BY id ORDER BY s.date DESC"); +echo mysql_error(); $skins = Array(); while($skins[] = mysql_fetch_assoc($res)); mysql_free_result($res); diff --git a/include/xorg.page.inc.php b/include/xorg.page.inc.php index 29ab287..27195e0 100644 --- a/include/xorg.page.inc.php +++ b/include/xorg.page.inc.php @@ -33,6 +33,8 @@ class XorgPage extends DiogenesCorePage { // si necessaire, c'est *ici* que se fait l'authentification $_no_legacy = true; $this->doAuth(); + if(empty($_SESSION['skin'])) + set_skin(); } function display($append_to_id="") { diff --git a/include/xorg.session.inc.php b/include/xorg.session.inc.php index bd9489b..333e8ef 100644 --- a/include/xorg.session.inc.php +++ b/include/xorg.session.inc.php @@ -226,15 +226,16 @@ function start_connexion ($username, $uid, $identified) { function set_skin() { if(logged()) { - $result = mysql_query("SELECT skin FROM auth_user_md5 WHERE user_id='{$_SESSION['uid']}'"); - if(list($skin) = mysql_fetch_row($result)) { - if ($skin == SKIN_STOCHASKIN_ID) - $sql = " !FIND_IN_SET('cachee',type) order by rand() limit 1"; - else - $sql = "id='$skin'"; - $res = mysql_query("SELECT id,skin,skin_popup FROM skins WHERE $sql"); - list($_SESSION['skin_id'], $_SESSION['skin'], $_SESSION['skin_popup']) = mysql_fetch_row($res); - mysql_free_result($res); + $result = mysql_query("SELECT skin,skin_tpl,skin_popup + FROM auth_user_md5 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'], $_SESSION['skin_popup']) = mysql_fetch_row($result)) { + if ($_SESSION['skin_id'] == SKIN_STOCHASKIN_ID) { + $res = mysql_query("SELECT id,skin,skin_popup FROM skins + WHERE !FIND_IN_SET('cachee',type) order by rand() limit 1"); + list($_SESSION['skin_id'], $_SESSION['skin'], $_SESSION['skin_popup']) = mysql_fetch_row($res); + mysql_free_result($res); + } } else { $_SESSION['skin'] = SKIN_COMPATIBLE; $_SESSION['skin_id'] = SKIN_COMPATIBLE_ID;