Show
Ignore:
Timestamp:
08/04/07 19:25:41 (5 years ago)
Author:
drazzib
Message:

2007-08-05 Damien Raude-Morvan <drazzib@…>

  • Security.php : A permission can be acquired by a user via multiples roles, this means that, for the moment, we have to use DISTINCT to check if a user had correct permission (otherwise the SQL request is invalid : subrequest return more than one line).
  • Locale.php : If the browser send Accept-Value header without any quality (i.e. q=x.y) we have to use order of the locales to select between them (and don't use a rand() number).
Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/wifidog-auth/wifidog/classes/Locale.php

    r1246 r1278  
    173173 
    174174                $browser_preferences = array(); 
     175                // $appendIdx help differentiation between same quality locales 
     176                // first locale in string get better quality than next 
     177                $appendIdx = 9999; 
    175178                foreach(explode(',', empty($_SERVER['HTTP_ACCEPT_LANGUAGE']) ? DEFAULT_LANG : $_SERVER['HTTP_ACCEPT_LANGUAGE']) as $lang) { 
    176179                        //echo $lang."\n"; 
    177180                        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]); 
    179182                        } 
     183                        $appendIdx--; 
    180184                } 
    181185