Merge branch 'fusionax' into account
authorVincent Zanotti <vincent.zanotti@m4x.org>
Fri, 10 Apr 2009 17:19:42 +0000 (19:19 +0200)
committerVincent Zanotti <vincent.zanotti@m4x.org>
Fri, 10 Apr 2009 17:19:42 +0000 (19:19 +0200)
Conflicts:
Makefile
core
htdocs/javascript/.gitignore
modules/admin.php
modules/googleapps.php

Signed-off-by: Vincent Zanotti <vincent.zanotti@m4x.org>
1  2 
Makefile
htdocs/javascript/.gitignore
modules/admin.php
modules/axletter.php
modules/email.php
modules/googleapps.php

diff --cc 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: htdocs/javascript/jquery.js htdocs/javascript/jquery.autocomplete.js $(JQUERY_PLUGINS_PATHES) $(JQUERY_UI_PATHES)
 +JQUERY_UI=core tabs
 +JQUERY_UI_PATHES=$(addprefix htdocs/javascript/ui.,$(addsuffix .js,$(JQUERY_UI)))
 +
 -jquery: htdocs/javascript/jquery.js $(JQUERY_PLUGINS_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_UI_PATHES)
  
  htdocs/javascript/jquery.js: DOWNLOAD_SRC = http://jquery.com/src/jquery-latest.min.js
  htdocs/javascript/jquery.js:
@@@ -1,3 -1,3 +1,4 @@@
  # jQuery and its plugins are downloaded by the Makefile
  /jquery.*js
 +/ui.*js
+ !/jquery.autocomplete.js
Simple merge
@@@ -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);
Simple merge
@@@ -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.