From: Stéphane Jacob Date: Mon, 3 Oct 2011 18:50:02 +0000 (+0200) Subject: Only performs seach if pids where found. X-Git-Tag: xorg/1.1.4~101 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=235e0e235d4d546e105433236fb3f424f4a3e5d6;p=platal.git Only performs seach if pids where found. Signed-off-by: Stéphane Jacob --- diff --git a/include/userset.inc.php b/include/userset.inc.php index 62b5a02..1ff19ec 100644 --- a/include/userset.inc.php +++ b/include/userset.inc.php @@ -429,13 +429,15 @@ class AddressesView implements PlView $csv = fopen('php://output', 'w'); fputcsv($csv, array('adresses'), ';'); - $res = XDB::query('SELECT pd.public_name, pa.postalText - FROM profile_addresses AS pa - INNER JOIN profile_display AS pd ON (pd.pid = pa.pid) - WHERE pa.type = \'home\' AND pa.pub IN (\'public\', \'ax\') AND FIND_IN_SET(\'mail\', pa.flags) AND pa.pid IN {?} - GROUP BY pa.pid', $pids); - foreach ($res->fetchAllAssoc() as $item) { - fputcsv($csv, $item, ';'); + if (!empty($pids)) { + $res = XDB::query('SELECT pd.public_name, pa.postalText + FROM profile_addresses AS pa + INNER JOIN profile_display AS pd ON (pd.pid = pa.pid) + WHERE pa.type = \'home\' AND pa.pub IN (\'public\', \'ax\') AND FIND_IN_SET(\'mail\', pa.flags) AND pa.pid IN {?} + GROUP BY pa.pid', $pids); + foreach ($res->fetchAllAssoc() as $item) { + fputcsv($csv, $item, ';'); + } } fclose($csv); exit();