Changeset 645

Show
Ignore:
Timestamp:
05/30/05 10:20:40 (3 years ago)
Author:
fproulx
Message:

2005-05-30 Francois Proulx <francois.proulx@gmail.com>

  • Changed language selectbox name so it does not clash with ISF's domain cookie
  • Fixed setlocale algorithm in Locale.php
Files:

Legend:

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

    r643 r645  
     12005-05-30 Francois Proulx <francois.proulx@gmail.com> 
     2        * Changed language selectbox name so it does not clash with ISF's domain cookie 
     3        * Fixed setlocale algorithm in Locale.php 
     4         
    152005-05-29 Francois Proulx <francois.proulx@gmail.com> 
    26        * Missing null check in validate.php 
  • trunk/wifidog-auth/wifidog/classes/Locale.php

    r641 r645  
    8484                } 
    8585                return $object; 
    86  
    8786        } 
    8887 
     
    9493                global $session; 
    9594                $retval = false; 
     95 
     96                // Get new locale ID, assume default if null 
    9697                if ($locale != null) 
    9798                { 
     
    106107                        $retval = false; 
    107108                } 
    108  
     109                                 
    109110                if (GETTEXT_AVAILABLE) 
    110                 { 
     111                {                                        
     112                        // Try to set locale 
    111113                        $current_locale = setlocale(LC_ALL, $locale_id); 
    112                         if (setlocale(LC_ALL, $locale_id) != $locale_id) 
     114                        // Test it against current PHP locale 
     115                        if ($current_locale != $locale_id) 
    113116                        { 
    114117                                echo "Warning: language.php: Unable to setlocale() to ".$locale_id.", return value: $current_locale, current locale: ".setlocale(LC_ALL, 0); 
     118                                $retval = false; 
    115119                        } 
    116  
    117                         bindtextdomain('messages', BASEPATH.'/locale'); 
    118                         bind_textdomain_codeset('messages', 'UTF-8'); 
    119                         textDomain('messages'); 
    120  
    121                         putenv("LC_ALL=".$locale_id); 
    122                         putenv("LANGUAGE=".$locale_id); 
    123                 } 
     120                        else 
     121                        { 
     122                                bindtextdomain('messages', BASEPATH.'/locale'); 
     123                                bind_textdomain_codeset('messages', 'UTF-8'); 
     124                                textDomain('messages'); 
     125         
     126                                putenv("LC_ALL=".$locale_id); 
     127                                putenv("LANGUAGE=".$locale_id); 
     128                                $session->set(SESS_LANGUAGE_VAR, $locale_id); 
     129                                $retval = true; 
     130                        } 
     131                } 
     132                 
    124133                return $retval; 
    125  
    126134        } 
    127135 
  • trunk/wifidog-auth/wifidog/classes/MainUI.php

    r637 r645  
    199199                        $html .= '<form class="language" name="lang_form" method="post" action="'.$_SERVER['REQUEST_URI'].'">'."\n"; 
    200200                        $html .= _("Language:")."\n"; 
    201                         $html .= "<select name='lang' onChange='javascript: document.lang_form.submit();'>"."\n"; 
     201                        $html .= "<select name='wifidog_language' onChange='javascript: document.lang_form.submit();'>"."\n"; 
    202202                        global $AVAIL_LOCALE_ARRAY; //From config file 
    203203                        foreach ($AVAIL_LOCALE_ARRAY as $lang_ids => $lang_names) 
  • trunk/wifidog-auth/wifidog/classes/Style.php

    r553 r645  
    2121  /**@file Style.php 
    2222   * @author Copyright (C) 2004 Technologies Coeus inc. 
     23   * @deprecated 2005-05-30 This file is NOT used anymore, kept until we move 
     24   * SQL stats somewhere else. 
    2325   */ 
    2426  /*Prevent caching*/ 
  • trunk/wifidog-auth/wifidog/include/language.php

    r595 r645  
    44$session = new Session(); 
    55 
    6 if (!empty ($_REQUEST['lang'])) 
     6if (!empty ($_REQUEST['wifidog_language'])) 
    77{ 
    8         Locale::setCurrentLocale(Locale::getObject($_REQUEST['lang'])); 
     8        Locale::setCurrentLocale(Locale::getObject($_REQUEST['wifidog_language'])); 
    99} 
    1010