'skin' field in 'accounts' corresponds to 'id' in 'skins' and thus should have the...
authorStéphane Jacob <sj@m4x.org>
Thu, 3 Jun 2010 16:14:50 +0000 (18:14 +0200)
committerStéphane Jacob <sj@m4x.org>
Thu, 3 Jun 2010 16:14:50 +0000 (18:14 +0200)
Signed-off-by: Stéphane Jacob <sj@m4x.org>
modules/admin.php
upgrade/account/00_account.sql
upgrade/account/99_insertion.sql

index 6ad3183..3aa7a7c 100644 (file)
@@ -433,10 +433,10 @@ class AdminModule extends PLModule
             if (Post::i('token_access', 0) != ($user->token_access ? 1 : 0)) {
                 $to_update['token'] = Post::i('token_access') ? rand_url_id(16) : null;
             }
-            if (Post::i('skin', 0) != $user->skin) {
-                $to_update['skin'] = Post::i('skin', 0);
+            if (Post::i('skin') != $user->skin) {
+                $to_update['skin'] = Post::i('skin');
                 if ($to_update['skin'] == 0) {
-                    $to_update['skin'] = null;
+                    $to_update['skin'] = 1;
                 }
             }
             if (Post::s('state') != $user->state) {
index 26b0818..65e4608 100644 (file)
@@ -25,7 +25,7 @@ CREATE TABLE accounts (
   display_name varchar(255) default null,
   sex enum('female', 'male') not null default 'male',
   email_format enum('text', 'html') not null default 'html',
-  skin varchar(32) default null,
+  skin tinyint(1) unsigned not null default 1,
   last_version varchar(16) not null,
 
   primary key uid (uid),
index cdfb7a3..d8b920b 100644 (file)
@@ -20,7 +20,7 @@ insert into accounts
             prenom AS display_name,
             IF(FIND_IN_SET('femme', flags), 'female', 'male') AS sex,
             IF(q.core_mail_fmt = 'html', 'html', 'text') AS email_format,
-            q.skin AS skin,
+            IF(q.skin IS NULL OR q.skin = 0, 1, q.skin) AS skin,
             q.last_version AS last_version
        from #x4dat#.auth_user_md5 as u
   left join #x4dat#.auth_user_quick as q on (q.user_id = u.user_id)