Changeset 1069 in ExiteCMS
- Timestamp:
- 11/06/07 10:37:15 (4 years ago)
- Location:
- trunk/includes
- Files:
-
- 1 added
- 1 edited
-
core_functions.php (modified) (3 diffs)
-
locale_functions.php (added)
Legend:
- Unmodified
- Added
- Removed
-
trunk/includes/core_functions.php
r1068 r1069 68 68 define("PATH_ADMIN", PATH_ROOT."administration/"); 69 69 define("PATH_THEMES", PATH_ROOT."themes/"); 70 define("PATH_LOCALE", PATH_ROOT."locale/");71 70 define("PATH_PHOTOS", PATH_ROOT."images/photoalbum/"); 72 71 define("PATH_IMAGES", PATH_ROOT."images/"); … … 130 129 $settings['siteurl'] = ((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS']=="on") ? "https://" : "http://").$_SERVER['HTTP_HOST'].$settings['siteurl']; 131 130 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 132 require_once PATH_INCLUDES."locale_functions.php"; 178 133 179 134 // URL path definitions relative to BASEDIR … … 217 172 define("BROWSER_WIDTH", isset($_COOKIE['width']) ? $_COOKIE['width'] : 1024); 218 173 define("BROWSER_HEIGHT", isset($_COOKIE['height']) ? $_COOKIE['height'] : 768); 219 220 // Initialise the $locale array221 $locale = array();222 223 // Load the global language file224 include PATH_LOCALE.LOCALESET."global.php";225 174 226 175 // load the user functions
Note: See TracChangeset
for help on using the changeset viewer.
