X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=plugins%2Finsert.getUserName.php;h=f054e5d7701a6fc17d2cef54212d257cd09fe56b;hb=9a13e83f4b39c7feaba924b724fd43497109481b;hp=ce34a9661fa761c926b46037370c97e9db5a1c3e;hpb=137f046d4f1d3fcfdd077a9ae0c7d7585eb0de3d;p=platal.git diff --git a/plugins/insert.getUserName.php b/plugins/insert.getUserName.php index ce34a96..f054e5d 100644 --- a/plugins/insert.getUserName.php +++ b/plugins/insert.getUserName.php @@ -28,26 +28,8 @@ function smarty_insert_getUsername() return ''; } - $domain = Cookie::v('domain', 'login'); - if ($domain == 'hruid') { - return XDB::fetchOneCell('SELECT hruid - FROM accounts - WHERE uid = {?}', - $id); - } elseif ($domain == 'alias') { - return XDB::fetchOneCell('SELECT email - FROM email_source_account - WHERE uid = {?} AND type = \'alias_aux\'', - $id); - } else { - return XDB::fetchOneCell('SELECT email - FROM email_source_account - WHERE uid = {?} AND type != \'alias_aux\' - ORDER BY NOT FIND_IN_SET(\'bestalias\', flags), MIN(email)', - $id); - } - - return ''; + $user = User::getSilentWithUID($id); + return $user->bestEmail(); } // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: