From fcdbb3bf4e23ea3a35d214add918a3b720029520 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Thu, 3 Jun 2010 18:14:50 +0200 Subject: [PATCH] 'skin' field in 'accounts' corresponds to 'id' in 'skins' and thus should have the same type take the same values. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- modules/admin.php | 6 +++--- upgrade/account/00_account.sql | 2 +- upgrade/account/99_insertion.sql | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/admin.php b/modules/admin.php index 6ad3183..3aa7a7c 100644 --- a/modules/admin.php +++ b/modules/admin.php @@ -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) { diff --git a/upgrade/account/00_account.sql b/upgrade/account/00_account.sql index 26b0818..65e4608 100644 --- a/upgrade/account/00_account.sql +++ b/upgrade/account/00_account.sql @@ -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), diff --git a/upgrade/account/99_insertion.sql b/upgrade/account/99_insertion.sql index cdfb7a3..d8b920b 100644 --- a/upgrade/account/99_insertion.sql +++ b/upgrade/account/99_insertion.sql @@ -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) -- 2.1.4