Changeset 1278
- Timestamp:
- 08/04/07 19:25:41 (5 years ago)
- Location:
- trunk/wifidog-auth
- Files:
-
- 3 modified
-
CHANGELOG (modified) (1 diff)
-
wifidog/classes/Locale.php (modified) (1 diff)
-
wifidog/classes/Security.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/wifidog-auth/CHANGELOG
r1277 r1278 1 1 # $Id$ 2 2007-08-05 Damien Raude-Morvan <drazzib@drazzib.com> 3 * Security.php : A permission can be acquired by a user via multiples roles, this means 4 that, for the moment, we have to use DISTINCT to check if a user had correct permission 5 (otherwise the SQL request is invalid : subrequest return more than one line). 6 * Locale.php : If the browser send Accept-Value header without any quality (i.e. q=x.y) 7 we have to use order of the locales to select between them (and don't use a rand() number). 8 2 9 2007-06-04 Benoit Grégoire <bock@step.polymtl.ca> 3 10 * Portugese (from portugal) translation contributed by MiguelCMA -
trunk/wifidog-auth/wifidog/classes/Locale.php
r1246 r1278 173 173 174 174 $browser_preferences = array(); 175 // $appendIdx help differentiation between same quality locales 176 // first locale in string get better quality than next 177 $appendIdx = 9999; 175 178 foreach(explode(',', empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? DEFAULT_LANG : $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) { 176 179 //echo $lang."\n"; 177 180 if (preg_match('/^\s*([a-z_-]+).*?(?:;\s*q=([0-9.]+))?/i', $lang.';q=1.0', $split)) { 178 $browser_preferences[sprintf('%f%d', $split[2], rand(0,9999))] = strtolower($split[1]);181 $browser_preferences[sprintf('%f%d', $split[2], $appendIdx)] = strtolower($split[1]); 179 182 } 183 $appendIdx--; 180 184 } 181 185 -
trunk/wifidog-auth/wifidog/classes/Security.php
r1270 r1278 89 89 $table = strtolower($objectClass).'_stakeholders'; 90 90 $permissionIdStr = $db->escapeString($permission->getId()); 91 $sqlSelect = "SELECT permission_id FROM $table JOIN role_has_permissions USING (role_id) WHERE user_id='{$user->getId()}' $objectSqlAnd AND permission_id = '$permissionIdStr'";91 $sqlSelect = "SELECT DISTINCT permission_id FROM $table JOIN role_has_permissions USING (role_id) WHERE user_id='{$user->getId()}' $objectSqlAnd AND permission_id = '$permissionIdStr'"; 92 92 if($operator == 'OR') { 93 93 $first?$sql .= " ($sqlSelect)\n":$sql .= ", ($sqlSelect)\n";
