+ // }}}
+ // Profile form {{{
+ if (Env::has('add_profile') || Env::has('del_profile') || Env::has('owner')) {
+ S::assert_xsrf_token();
+ if (Env::i('del_profile', 0) != 0) {
+ XDB::execute('DELETE FROM account_profiles
+ WHERE uid = {?} AND pid = {?}',
+ $user->id(), Env::i('del_profile'));
+ } else if (!Env::blank('new_profile')) {
+ $profile = Profile::get(Env::t('new_profile'));
+ if (!$profile) {
+ $page->trigError('Le profil ' . Env::t('new_profile') . ' n\'existe pas');
+ } else {
+ XDB::execute('INSERT IGNORE INTO account_profiles (uid, pid)
+ VALUES ({?}, {?})',
+ $user->id(), $profile->id());
+ }
+ }
+ XDB::execute('UPDATE account_profiles
+ SET perms = IF(pid = {?}, CONCAT(perms, \',owner\'), REPLACE(perms, \'owner\', \'\'))
+ WHERE uid = {?}',
+ Env::i('owner'), $user->id());
+ }
+
+
+ // }}}
+