Changeset 1082 in ExiteCMS


Ignore:
Timestamp:
11/07/07 18:09:49 (4 years ago)
Author:
root
Message:

Added characterset and system locale information to the locales table
removed hardcoded dateformat and datesequence (locale info needs to be used)

Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • themes/PLi-Fusion/PLiTheme/php-files/themes/PLiTheme/templates/templates/_header.tpl

    r964 r1082  
    2222<head> 
    2323    <title>{$settings.sitename}</title> 
    24     <meta http-equiv='Content-Type' content='text/html; charset={$locale.charset}' /> 
     24    <meta http-equiv='Content-Type' content='text/html; charset={$settings.charset}' /> 
    2525    <meta name='description' content='{$settings.description}' /> 
    2626    <meta name='keywords' content='{$settings.keywords}' /> 
     
    3939            editor_deselector:'textbox', 
    4040            theme:'advanced', 
    41             language:'en', 
     41            language:'{/literal}{$settings.locale_code}{literal}', 
    4242            entities:'60,lt,62,gt', 
    4343            document_base_url:'{/literal}{$settings.siteurl}{literal}', 
     
    6767            mode:'textareas', 
    6868            theme:'simple', 
    69             language:'en', 
     69            language:'{/literal}{$settings.locale_code}{literal}', 
    7070            convert_newlines_to_brs:'true', 
    7171            force_br_newlines:'true', 
  • themes/PLi-Fusion/PLiThemeCentered/php-files/themes/PLiThemeCentered/templates/templates/_header.tpl

    r964 r1082  
    2222<head> 
    2323    <title>{$settings.sitename}</title> 
    24     <meta http-equiv='Content-Type' content='text/html; charset={$locale.charset}' /> 
     24    <meta http-equiv='Content-Type' content='text/html; charset={$settings.charset}' /> 
    2525    <meta name='description' content='{$settings.description}' /> 
    2626    <meta name='keywords' content='{$settings.keywords}' /> 
     
    3939            editor_deselector:'textbox', 
    4040            theme:'advanced', 
    41             language:'en', 
     41            language:'{/literal}{$settings.locale_code}{literal}', 
    4242            entities:'60,lt,62,gt', 
    4343            document_base_url:'{/literal}{$settings.siteurl}{literal}', 
     
    6767            mode:'textareas', 
    6868            theme:'simple', 
    69             language:'en', 
     69            language:'{/literal}{$settings.locale_code}{literal}', 
    7070            convert_newlines_to_brs:'true', 
    7171            force_br_newlines:'true', 
  • trunk/files/locales/English.main.global.php

    r1081 r1082  
    66Web: http://www.php-fusion.co.uk 
    77*/ 
    8  
    9 // Full & Short Months 
    10 $locale['months'] = "&nbsp|January|February|March|April|May|June|July|August|September|October|November|December"; 
    11 $locale['shortmonths'] = "&nbsp|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sept|Oct|Nov|Dec"; 
    128 
    139// Standard User Levels 
  • trunk/files/locales/English.main.user_fields.php

    r1080 r1082  
    2222$locale['u021'] = "AOL IM:"; 
    2323$locale['u022'] = "Max. filesize: %s / Max. size: %ux%u pixels"; 
    24 $locale['u023'] = "( Server timezone is <b>%s</b> )"; 
     24$locale['u023'] = "( We are on <b>%s</b> )"; 
    2525$locale['u024'] = "Hide side-panels when reading:"; 
    2626$locale['u025'] = "Country:"; 
  • trunk/includes/locale_functions.php

    r1081 r1082  
    5858if (!defined('LOCALESET')) define("LOCALESET", $settings['locale']."/"); 
    5959 
    60 // define the website server locale (if not defined) 
    61 if (!isset($settings['unix_locale'])) $settings['unix_locale'] = "en_US"; 
    62  
    63 // set system locales 
    64 setlocale(LC_TIME, $settings['unix_locale']); // *nix Server (TODO: Windows may differ) 
    65  
    66 // define the website characterset (if not defined) 
    67 if (!isset($settings['charset'])) $settings['charset'] = "iso-8859-1"; 
    68  
    6960// define the website location (country) (if not defined) 
    7061if (!isset($settings['country'])) $settings['country'] = "??"; 
    7162 
    72 // get the locale code, we need this in several places 
     63// get locales information, we need this in several places 
    7364if (dbtable_exists($db_prefix."locale")) { 
    74     $result = dbquery("SELECT locale_code FROM ".$db_prefix."locale WHERE locale_name = '".$settings['locale']."'"); 
    75     if ($dbrows($result)) { 
     65    $result = dbquery("SELECT * FROM ".$db_prefix."locale WHERE locale_name = '".$settings['locale']."'"); 
     66    if (dbrows($result)) { 
    7667        $data = dbarray($result); 
    7768        $settings['locale_code'] = $data['locale_code']; 
     69        $settings['charset'] = $data['locale_charset']; 
     70        $settings['locales'] = $data['locale_locale']; 
    7871    } 
    7972} 
     73// if we couldn't find it, use some default values 
    8074if (!isset($settings['locale_code'])) $settings['locale_code'] = "en"; 
     75if (!isset($settings['charset'])) $settings['charset'] = "iso-8859-1"; 
     76if (!isset($settings['locales'])) $settings['locales'] = "en_US|en_GB|english|eng"; 
    8177 
    82 // Date info (TODO: need to find a better solution for this) 
    83 if (!isset($settings['dateformat'])) $settings['dateformat'] = "mm-dd-yyyy"; 
    84 if (!isset($settings['datesequence'])) $settings['datesequence'] = array("M", "D", "Y"); 
     78// set the locale for strfime() 
     79setlocale(LC_TIME, explode("|", $settings['locales'])); 
    8580 
    8681// Initialise the $locale array 
  • trunk/includes/templates/main.edit_profile.tpl

    r1081 r1082  
    114114        <tr> 
    115115        <td class='tbl'> 
    116             {$locale.u010} ( {$settings.dateformat} ) 
     116            {$locale.u010} 
    117117        </td> 
    118118            <td class='tbl'> 
    119                 {foreach from=$settings.datesequence item=field} 
    120                 {if $field == "D"} 
     119                <select name='user_year' class='textbox'> 
     120                    <option>&nbsp;</option> 
     121                    {section name=y start=1900 loop=$smarty.now|date_format:"%Y"} 
     122                        <option{if $smarty.section.y.index == $user_year} selected="selected"{/if}>{$smarty.section.y.index}</option> 
     123                    {/section} 
     124                </select> 
     125                <select name='user_month' class='textbox'> 
     126                    <option>&nbsp;</option> 
     127                    {section name=m start=1 loop=13} 
     128                        <option{if $smarty.section.m.index == $user_month} selected="selected"{/if}>{$smarty.section.m.index}</option> 
     129                    {/section} 
     130                </select> 
    121131                <select name='user_day' class='textbox'> 
    122132                    <option>&nbsp;</option> 
     
    125135                    {/section} 
    126136                </select> 
    127                 {elseif $field == "M"} 
    128                 <select name='user_month' class='textbox'> 
    129                     <option>&nbsp;</option> 
    130                     {section name=m start=1 loop=13} 
    131                         <option{if $smarty.section.m.index == $user_month} selected="selected"{/if}>{$smarty.section.m.index}</option> 
    132                     {/section} 
    133                 </select> 
    134                 {elseif $field == "Y"} 
    135                 <select name='user_year' class='textbox'> 
    136                     <option>&nbsp;</option> 
    137                     {section name=y start=1900 loop=$smarty.now|date_format:"%Y"} 
    138                         <option{if $smarty.section.y.index == $user_year} selected="selected"{/if}>{$smarty.section.y.index}</option> 
    139                     {/section} 
    140                 </select> 
    141                 {/if} 
    142                 {/foreach} 
    143                 <span class='small2'>({$locale.dateformat})</span> 
     137                <span class='small2'>(yyyy/mm/dd)</span> 
    144138            </td> 
    145139        </tr> 
  • trunk/includes/templates/main.register.tpl

    r1081 r1082  
    122122                <td class='tbl'> 
    123123                    {$locale.u010} 
    124                     <span class='small2'>( {$settings.dateformat} )</span> 
     124                    <span class='small2'>( yyyy/mm/dd )</span> 
    125125                </td> 
    126126                <td class='tbl'>} 
    127                     {foreach from=$settings.datesequence item=field} 
    128                     {if $field == "D"} 
     127                    <select name='user_year' class='textbox'> 
     128                        <option> </option> 
     129                        {section name=y start=1900 loop=$smarty.now|date_format:"%Y"} 
     130                            <option{if $smarty.section.y.index == $user_year} selected{/if}>{$smarty.section.y.index}</option> 
     131                        {/section} 
     132                    </select> 
     133                    <select name='user_month' class='textbox'> 
     134                        <option> </option> 
     135                        {section name=m start=1 loop=13} 
     136                            <option{if $smarty.section.m.index == $user_month} selected{/if}>{$smarty.section.m.index}</option> 
     137                        {/section} 
     138                    </select> 
    129139                    <select name='user_day' class='textbox'> 
    130140                        <option> </option> 
     
    133143                        {/section} 
    134144                    </select> 
    135                     {elseif $field == "M"} 
    136                     <select name='user_month' class='textbox'> 
    137                         <option> </option> 
    138                         {section name=m start=1 loop=13} 
    139                             <option{if $smarty.section.m.index == $user_month} selected{/if}>{$smarty.section.m.index}</option> 
    140                         {/section} 
    141                     </select> 
    142                     {elseif $field == "Y"} 
    143                     <select name='user_year' class='textbox'> 
    144                         <option> </option> 
    145                         {section name=y start=1900 loop=$smarty.now|date_format:"%Y"} 
    146                             <option{if $smarty.section.y.index == $user_year} selected{/if}>{$smarty.section.y.index}</option> 
    147                         {/section} 
    148                     </select> 
    149                     {/if} 
    150                     {/foreach} 
    151145                </td> 
    152146            </tr> 
  • trunk/profile.php

    r1071 r1082  
    6767    // user level 
    6868    $data['user_level'] = getuserlevel($data['user_level']); 
     69    // user's birthday (using the current locale for the month name) 
    6970    if ($data['user_birthdate'] != "0000-00-00") { 
    70         $months = explode("|", $locale['months']); 
    71         $user_birthdate = explode("-", $data['user_birthdate']); 
    72         $data['user_birthdate'] = $months[number_format($user_birthdate['1'])]." ".number_format($user_birthdate['2'])." ".$user_birthdate['0']; 
     71        $birthdate = explode("-", $data['user_birthdate']); 
     72        $data['user_birthdate'] = strftime(nl_langinfo(D_FMT), mktime(1,0,0,$birthdate[1],$birthdate[2],$birthdate[0])) 
     73        } 
    7374    } else { 
    7475        $data['user_birthdate'] = $locale['u048']; 
Note: See TracChangeset for help on using the changeset viewer.