Changeset 641

Show
Ignore:
Timestamp:
05/26/05 21:21:26 (3 years ago)
Author:
benoitg
Message:

2005-05-26 Benoit Gr�goire <bock@step.polymtl.ca>

  • Someone moved the fallback gettext functions definition (for when gettext isn't installed) inside the static setCurrentLocale method, completely breaking the system when PHP doesn't have gettext support. This is an untested fix.
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wifidog-auth/ChangeLog

    r638 r641  
     12005-05-26 Benoit Grégoire  <bock@step.polymtl.ca> 
     2        * Someone moved the fallback gettext functions definition (for when gettext isn't installed) inside the static setCurrentLocale method, completely breaking the system when PHP doesn't have gettext support.  This is an untested fix. 
     3         
    142005-05-24 Francois Proulx <francois.proulx@gmail.com> 
    25        * Fixed bug in auth.php to let users go through when the click twice on the login button 
  • trunk/wifidog-auth/wifidog/classes/Locale.php

    r604 r641  
    2727error_reporting(E_ALL); 
    2828 
     29/* Gettext support */ 
     30if (!function_exists('gettext')) 
     31{ 
     32        define('GETTEXT_AVAILABLE', false); 
     33        /* Redefine the gettext functions if gettext isn't installed */ 
     34        function gettext($string) 
     35        { 
     36                return $string; 
     37        } 
     38        function _($string) 
     39        { 
     40                return $string; 
     41        } 
     42} 
     43else 
     44{ 
     45        define('GETTEXT_AVAILABLE', true); 
     46} 
     47 
    2948/** Représente un langage humain, possiblement localisé, tel que fr_CA 
    3049 */ 
     
    5574                { 
    5675                        //$object = new self(DEFAULT_LANG); 
    57             $object = self::getObject(DEFAULT_LANG); 
    58             self::setCurrentLocale($object); 
     76                       $object = self :: getObject(DEFAULT_LANG); 
     77                       self :: setCurrentLocale($object); 
    5978                } 
    6079                else 
    6180                { 
    6281                        //$object = new self($locale_id); 
    63             $object = self::getObject($locale_id); 
    64             self::setCurrentLocale($object); 
     82                       $object = self :: getObject($locale_id); 
     83                       self :: setCurrentLocale($object); 
    6584                } 
    6685                return $object; 
     
    87106                        $retval = false; 
    88107                } 
    89                 /* Gettext support */ 
    90                 if (!function_exists('gettext')) 
    91                 { 
    92                         define('GETTEXT_AVAILABLE', false); 
    93                         /* Redefine the gettext functions if gettext isn't installed */ 
    94                         function gettext($string) 
    95                         { 
    96                                 return $string; 
    97                         } 
    98                         function _($string) 
    99                         { 
    100                                 return $string; 
    101                         } 
    102                 } 
    103                 else 
    104                 { 
    105             if(!defined('GETTEXT_AVAILABLE')) 
    106                 define('GETTEXT_AVAILABLE', true); 
    107                 } 
    108          
     108 
    109109                if (GETTEXT_AVAILABLE) 
    110110                { 
     
    185185        @param string locale Locale in POSIX format (excluding charset), such as fr ou fr_CA: "xx(x)_YY_(n*z)".  Both '_' and '-' are acceptable as separator. 
    186186        */ 
    187         function Locale($p_locale) 
     187        function __construct($p_locale) 
    188188        { 
    189189                //parent :: __construct();