X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=modules%2Fprofile%2Fdecos.inc.php;h=9d4634787c21ff7d35a40cb6bc06e0cd152f357c;hb=5660032ac785d410f90e3f5b0d6948dc90b0cfea;hp=85d2a869bf67abaaa72bd37714731533faad8f67;hpb=acc9be56f2cc773f7e684f9cd3201141bc126ee2;p=platal.git diff --git a/modules/profile/decos.inc.php b/modules/profile/decos.inc.php index 85d2a86..9d46347 100644 --- a/modules/profile/decos.inc.php +++ b/modules/profile/decos.inc.php @@ -1,6 +1,6 @@ pid()); $value = array(); while (list($id, $grade) = $res->next()) { $value[$id] = array('grade' => $grade, @@ -63,7 +63,7 @@ class ProfileDeco implements ProfileSetting if ($val['valid']) { XDB::execute("DELETE FROM profile_medals_sub WHERE uid = {?} AND mid = {?}", - S::i('uid'), $id); + $page->pid(), $id); } else { $req = MedalReq::get_request(S::i('uid'), $id); if ($req) { @@ -78,6 +78,7 @@ class ProfileDeco implements ProfileSetting if (!isset($orig[$id]) || $orig[$id]['grade'] != $val['grade']) { $req = new MedalReq(S::user(), $id, $val['grade']); $req->submit(); + sleep(1); } } } @@ -97,20 +98,20 @@ class ProfileDecos extends ProfilePage protected function _fetchData() { - $res = XDB::query("SELECT profile_medals_pub - FROM auth_user_quick - WHERE user_id = {?}", - S::i('uid')); + $res = XDB::query("SELECT medals_pub + FROM profiles + WHERE pid = {?}", + $this->pid()); $this->values['medals_pub'] = $res->fetchOneCell(); } protected function _saveData() { if ($this->changed['medals_pub']) { - XDB::execute("UPDATE auth_user_quick - SET profile_medals_pub = {?} - WHERE user_id = {?}", - $this->values['medals_pub'], S::i('uid')); + XDB::execute("UPDATE profiles + SET medals_pub = {?} + WHERE pid = {?}", + $this->values['medals_pub'], $this->pid()); } }