X-Git-Url: http://git.polytechnique.org/?a=blobdiff_plain;f=classes%2Faddress.php;h=e325d1ef7c83d70558054dbb1a105a27904105ee;hb=e0e01724d7ef7f388307d62639867ea0dbac0fdb;hp=70341961380e6ca36d6f29cce40fa0791324db7f;hpb=3da338db27ff7e09b46cad976342aeb133a60aad;p=platal.git diff --git a/classes/address.php b/classes/address.php index 7034196..e325d1e 100644 --- a/classes/address.php +++ b/classes/address.php @@ -822,13 +822,17 @@ class Address { $where = ''; if (!is_null($pid)) { - $where = XDB::format(' AND pid = {?}', $pid); + $where .= XDB::format(' AND pid = {?}', $pid); } if (!is_null($jobid)) { - $where = XDB::format(' AND jobid = {?}', $jobid); + $where .= XDB::format(' AND jobid = {?}', $jobid); } if (!is_null($groupid)) { - $where = XDB::format(' AND groupid = {?}', $groupid); + $where .= XDB::format(' AND groupid = {?}', $groupid); + } + // Prevent buggy callers from accidentally dropping profile_addresses + if (!$where) { + throw new Exception("Unable to delete all addresses of the given type, the request was too generic"); } XDB::execute('DELETE FROM profile_addresses WHERE type = {?}' . $where . (($deletePrivate) ? '' : ' AND pub IN (\'public\', \'ax\')'),