Changeset 1069 in ExiteCMS


Ignore:
Timestamp:
11/06/07 10:37:15 (4 years ago)
Author:
root
Message:

Added the locale_functions include, moved all locale related code from core_functions to the new include

Location:
trunk/includes
Files:
1 added
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/includes/core_functions.php

    r1068 r1069  
    6868define("PATH_ADMIN", PATH_ROOT."administration/"); 
    6969define("PATH_THEMES", PATH_ROOT."themes/"); 
    70 define("PATH_LOCALE", PATH_ROOT."locale/"); 
    7170define("PATH_PHOTOS", PATH_ROOT."images/photoalbum/"); 
    7271define("PATH_IMAGES", PATH_ROOT."images/"); 
     
    130129$settings['siteurl'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=="on") ? "https://" : "http://").$_SERVER['HTTP_HOST'].$settings['siteurl']; 
    131130 
    132 // locale detection - step 1 - check if there's a locale cookie set 
    133 if (isset($_COOKIE['locale'])) { 
    134     // check if we (still) support this language. If so, update the locale setting 
    135     $result = dbquery("SELECT * FROM ".$db_prefix."locale WHERE locale_code = '".$_COOKIE['locale']."' AND locale_active = '1'"); 
    136     if ($data = dbarray($result)) { 
    137         $settings['locale'] = $data['locale_name']; 
    138         define("LOCALESET", $settings['locale']."/"); 
    139     } 
    140 } 
    141  
    142 // locale detection - step 2 - check the browsers accepted languages 
    143 if (!defined('LOCALESET') && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { 
    144     // check which languages are supported by the users browser 
    145     $temp = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']); 
    146     foreach($temp as $lng) { 
    147         $thislng = explode(";", $lng); 
    148         // check if we support this language 
    149         $result = dbquery("SELECT * FROM ".$db_prefix."locale WHERE locale_code = '".$thislng[0]."' AND locale_active = '1'"); 
    150         if ($data = dbarray($result)) { 
    151             // if so, set the locale 
    152             $settings['locale'] = $data['locale_name']; 
    153             define("LOCALESET", $settings['locale']."/"); 
    154             break; 
    155         } 
    156     } 
    157     // if not found, loop again on languages only 
    158     if (!defined('LOCALESET')) { 
    159         foreach($temp as $lng) { 
    160             $thislng = explode(";", $lng); 
    161             $thislng = explode("-", $thislng[0]); 
    162             // check if we support this language 
    163             $result = dbquery("SELECT * FROM ".$db_prefix."locale WHERE locale_code = '".$thislng[0]."' AND locale_active = '1'"); 
    164             if ($data = dbarray($result)) { 
    165                 // if so, set the locale 
    166                 $settings['locale'] = $data['locale_name']; 
    167                 define("LOCALESET", $settings['locale']."/"); 
    168                 break; 
    169             } 
    170         } 
    171     } 
    172 } 
    173  
    174 // locale detection - step 3 - use the website's default 
    175 if (!defined('LOCALESET')) { 
    176     define("LOCALESET", $settings['locale']."/"); 
    177 } 
     131// include the locale functions 
     132require_once PATH_INCLUDES."locale_functions.php"; 
    178133 
    179134// URL path definitions relative to BASEDIR 
     
    217172define("BROWSER_WIDTH", isset($_COOKIE['width']) ? $_COOKIE['width'] : 1024); 
    218173define("BROWSER_HEIGHT", isset($_COOKIE['height']) ? $_COOKIE['height'] : 768); 
    219  
    220 // Initialise the $locale array 
    221 $locale = array(); 
    222  
    223 // Load the global language file 
    224 include PATH_LOCALE.LOCALESET."global.php"; 
    225174 
    226175// load the user functions 
Note: See TracChangeset for help on using the changeset viewer.