From: Vincent Zanotti Date: Fri, 10 Apr 2009 17:19:42 +0000 (+0200) Subject: Merge branch 'fusionax' into account X-Git-Tag: xorg/1.0.0~332^2~339 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=2f8bacc215bab9d9e3401e73004574cfb0eb4540;p=platal.git Merge branch 'fusionax' into account Conflicts: Makefile core htdocs/javascript/.gitignore modules/admin.php modules/googleapps.php Signed-off-by: Vincent Zanotti --- 2f8bacc215bab9d9e3401e73004574cfb0eb4540 diff --cc Makefile index ac0c434,232aa1f..a6c1935 --- a/Makefile +++ b/Makefile @@@ -164,10 -161,10 +164,13 @@@ $(MEDAL_THUMBNAILS): $(subst /medals/th JQUERY_PLUGINS=color JQUERY_PLUGINS_PATHES=$(addprefix htdocs/javascript/jquery.,$(addsuffix .js,$(JQUERY_PLUGINS))) +JQUERY_UI=core tabs +JQUERY_UI_PATHES=$(addprefix htdocs/javascript/ui.,$(addsuffix .js,$(JQUERY_UI))) + - jquery: htdocs/javascript/jquery.js htdocs/javascript/jquery.autocomplete.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_UI_PATHES) + # TODO: jquery.autocomplete.js should rather be downloaded from an official source. The issue + # is that the version we use is not available anymore on the Internet, and the latest version + # we could use is not backward compatible with our current code. -jquery: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_PATHES) ++jquery: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_UI_PATHES) htdocs/javascript/jquery.js: DOWNLOAD_SRC = http://jquery.com/src/jquery-latest.min.js htdocs/javascript/jquery.js: diff --cc htdocs/javascript/.gitignore index 3db6c99,7fa306b..da77c0b --- a/htdocs/javascript/.gitignore +++ b/htdocs/javascript/.gitignore @@@ -1,3 -1,3 +1,4 @@@ # jQuery and its plugins are downloaded by the Makefile /jquery.*js +/ui.*js + !/jquery.autocomplete.js diff --cc modules/axletter.php index d3f1aa4,466dcc2..91d96f0 --- a/modules/axletter.php +++ b/modules/axletter.php @@@ -329,12 -337,39 +329,12 @@@ class AXLetterModule extends PLModul } } } - $email = $line[$field]; - if (strpos($email, '@') === false) { - $user = $email; - $domain = $globals->mail->domain2; - } else { - list($user, $domain) = explode('@', $email); - } - if ($domain != $globals->mail->domain && $domain != $globals->mail->domain2 - && $domain != $globals->mail->alias_dom && $domain != $globals->mail->alias_dom2) { - $res = XDB::query("SELECT uid FROM emails WHERE email = {?}", $email); - if ($res->numRows() == 1) { - return $res->fetchOneCell(); - } - return '0'; - } - list($user) = explode('+', $user); - list($user) = explode('_', $user); - if ($domain == $globals->mail->alias_dom || $domain == $globals->mail->alias_dom2) { - $res = XDB::query("SELECT a.id - FROM virtual AS v - INNER JOIN virtual_redirect AS r USING(vid) - INNER JOIN aliases AS a ON (a.type = 'a_vie' - AND r.redirect = CONCAT(a.alias, '@{$globals->mail->domain2}')) - WHERE v.alias = CONCAT({?}, '@{$globals->mail->alias_dom}')", $user); - $id = $res->fetchOneCell(); - return $id ? $id : '0'; - } - $res = XDB::query("SELECT id FROM aliases WHERE alias = {?}", $user); - $id = $res->fetchOneCell(); - return $id ? $id : '0'; + $uf = new UserFilter(new UFC_Email($line[$field])); + $id = $uf->getUIDs(); + return count($id) == 1 ? $id[0] : 0; } - function createHash($line, $key) + function createHash($line, $partial_result, $key) { $hash = implode(time(), $line) . rand(); $hash = md5($hash); diff --cc modules/googleapps.php index de3d668,7b63604..f7796e2 --- a/modules/googleapps.php +++ b/modules/googleapps.php @@@ -196,10 -196,25 +196,23 @@@ class GoogleAppsModule extends PLModul $account = new GoogleAppsAccount($user); $storage = new EmailStorage($user, 'googleapps'); - // Force synchronization of plat/al and Google Apps passwords. - if ($action == 'forcesync' && $account->sync_password) { + // Apply requested actions. + if (Post::has('suspend') && $account->active() && !$account->pending_update_suspension) { + S::assert_xsrf_token(); + $account->suspend(); + $page->trigSuccess('Le compte est en cours de suspension.'); + } else if (Post::has('unsuspend') && $account->suspended() && !$account->pending_update_suspension) { + S::assert_xsrf_token(); + $account->do_unsuspend(); + $page->trigSuccess('Le compte est en cours de réactivation.'); + } else if (Post::has('forcesync') && $account->active() && $account->sync_password) { - $res = XDB::query("SELECT password FROM auth_user_md5 WHERE user_id = {?}", $user->id()); - $account->set_password($res->fetchOneCell()); ++ $account->set_password($user->password()); + $page->trigSuccess('Le mot de passe est en cours de synchronisation.'); + } else if (Post::has('sync') && $account->active()) { - $res = XDB::query("SELECT password FROM auth_user_md5 WHERE user_id = {?}", $user->id()); - $account->set_password($res->fetchOneCell()); + $account->set_password($user->password()); - $page->trigSuccess('Le mot de passe a été synchronisé.'); + $account->set_password_sync(true); + } else if (Post::has('nosync') && $account->active()) { + $account->set_password_sync(false); } // Displays basic account information.