nième correction de bugs avec les skins.
authorx2000habouzit <x2000habouzit>
Tue, 27 Jan 2004 14:25:03 +0000 (14:25 +0000)
committerx2000habouzit <x2000habouzit>
Tue, 27 Jan 2004 14:25:03 +0000 (14:25 +0000)
htdocs/skins.php
include/xorg.page.inc.php
include/xorg.session.inc.php

index 54177b0..81052dd 100644 (file)
@@ -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);
index 29ab287..27195e0 100644 (file)
@@ -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="") {
index bd9489b..333e8ef 100644 (file)
@@ -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;