Merge remote branch 'origin/xorg/maint' into xorg/master
[platal.git] / modules / admin / homonyms.inc.php
index c672ec4..0d22b94 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 /***************************************************************************
- *  Copyright (C) 2003-2010 Polytechnique.org                              *
+ *  Copyright (C) 2003-2011 Polytechnique.org                              *
  *  http://opensource.polytechnique.org/                                   *
  *                                                                         *
  *  This program is free software; you can redistribute it and/or modify   *
  *  59 Temple Place, Suite 330, Boston, MA  02111-1307  USA                *
  ***************************************************************************/
 
-function select_if_homonyme(PlUser &$user) {
+function select_if_homonyme(PlUser $user) {
     return XDB::fetchOneCell("SELECT  a.alias
                                 FROM  aliases AS a
-                               WHERE  a.id = {?} AND a.expire != ''",
+                               WHERE  a.uid = {?} AND a.expire != ''",
                              $user->id());
 }
 
-function send_warning_homonyme(PlUser &$user, $loginbis) {
+function send_warning_homonyme(PlUser $user, $loginbis) {
     global $globals;
     $cc = "support+homonyme@" . $globals->mail->domain;
     $FROM = "\"Support Polytechnique.org\" <$cc>";
@@ -38,7 +38,7 @@ function send_warning_homonyme(PlUser &$user, $loginbis) {
     $mymail->sendTo($user);
 }
 
-function send_robot_homonyme(PlUser &$user, $loginbis) {
+function send_robot_homonyme(PlUser $user, $loginbis) {
     global $globals;
     $cc = "support+homonyme@" . $globals->mail->domain;
     $FROM = "\"Support Polytechnique.org\" <$cc>";
@@ -50,11 +50,11 @@ function send_robot_homonyme(PlUser &$user, $loginbis) {
     $mymail->sendTo($user);
 }
 
-function switch_bestalias(PlUser &$user, $loginbis) {
+function switch_bestalias(PlUser $user, $loginbis) {
     // check if loginbis was the bestalias
     $bestailas = XDB::fetchOneCell("SELECT  alias
                                       FROM  aliases
-                                     WHERE  id = {?} AND FIND_IN_SET('bestalias', flags)",
+                                     WHERE  uid = {?} AND FIND_IN_SET('bestalias', flags)",
                                    $user->id());
     if ($bestalias && $bestalias != $loginbis) {
         return false;
@@ -63,13 +63,13 @@ function switch_bestalias(PlUser &$user, $loginbis) {
     // select the shortest alias still alive
     $newbest = XDB::fetchOneCell("SELECT  alias
                                     FROM  aliases
-                                   WHERE  id = {?} AND alias != {?} AND expire IS NULL
+                                   WHERE  uid = {?} AND alias != {?} AND expire IS NULL
                                 ORDER BY  LENGTH(alias)
                                    LIMIT  1", $user->id(), $loginbis);
     // change the bestalias flag
     XDB::execute("UPDATE  aliases
                      SET  flags = (flags & (255 - 1)) | IF(alias = {?}, 1, 0)
-                   WHERE  id = {?}", $newbest, $user->id());
+                   WHERE  uid = {?}", $newbest, $user->id());
     return $newbest;
 }