X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Fgroup.php;h=e3f3b62025eccd17cd1fbf98db5f59e4a5584770;hb=ccc951d9ef4b747cf4c5b08d52e6f8938338f6de;hp=ce93e92add4571ea02baaf76ae513613bada57c5;hpb=00ca0ad5370df5be4a0272364fb16a4385ffabfe;p=platal.git diff --git a/classes/group.php b/classes/group.php index ce93e92..e3f3b62 100644 --- a/classes/group.php +++ b/classes/group.php @@ -73,13 +73,13 @@ class Group public function iterMembers($extra_cond = null, $sort = null, $limit = null) { - $uf = getMembersFilter($extra_cond, $sort); + $uf = $this->getMembersFilter($extra_cond, $sort); return $uf->iterUsers($limit); } public function iterAdmins($extra_cond = null, $sort = null, $limit = null) { - $uf = getAdminsFilter($extra_cond, $sort); + $uf = $this->getAdminsFilter($extra_cond, $sort); return $uf->iterUsers($limit); } @@ -93,15 +93,15 @@ class Group return null; } - static public function get($id) + static public function get($id, $can_be_shortname = true) { if (!$id) { return null; } - if (is_int($id) || ctype_digit($id)) { - $where = XDB::format('id = {?}', $id); + if (!$can_be_shortname) { + $where = XDB::format('a.id = {?}', $id); } else { - $where = XDB::format('diminutif = {?}', $id); + $where = XDB::format('a.diminutif = {?}', $id); } $res = XDB::query('SELECT a.*, d.nom AS domnom, FIND_IN_SET(\'wiki_desc\', a.flags) AS wiki_desc, @@ -110,6 +110,9 @@ class Group LEFT JOIN group_dom AS d ON d.id = a.dom WHERE ' . $where); if ($res->numRows() != 1) { + if ($can_be_shortname && (is_int($id) || ctype_digit($id))) { + return Group::get($id, false); + } return null; } return new Group($res->fetchOneAssoc());