Changeset 858 in ExiteCMS for trunk/includes/core_functions.php
- Timestamp:
- 09/29/07 21:51:40 (5 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
-
. (modified) (1 prop)
-
includes/core_functions.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk
- Property svn:ignore
-
old new 1 1 Copy of config.php 2 config.backup.php 2 3 config.php
-
- Property svn:ignore
-
trunk/includes/core_functions.php
r845 r858 107 107 define ("BASEDIR", strstr(substr(strstr($settings['siteurl'], '://'),3), '/')); 108 108 109 // locale detection - step 1 - check if there's a locale cookie set 110 if (isset($_COOKIE['locale'])) { 111 // check if we (still) support this language. If so, update the locale setting 112 $result = dbquery("SELECT * FROM ".$db_prefix."locale WHERE locale_code = '".$_COOKIE['locale']."' AND locale_active = '1'"); 113 if ($data = dbarray($result)) { 114 $settings['locale'] = $data['locale_name']; 115 define("LOCALESET", $settings['locale']."/"); 116 } 117 } 118 119 // locale detection - step 2 - check the browsers accepted languages 120 if (!defined('LOCALESET') && isset($_SERVER['HTTP_ACCEPT_LANGUAGE']) && !empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) { 121 // check which languages are supported by the users browser 122 $temp = explode(",", $_SERVER['HTTP_ACCEPT_LANGUAGE']); 123 foreach($temp as $lng) { 124 $thislng = explode(";", $lng); 125 // check if we support this language 126 $result = dbquery("SELECT * FROM ".$db_prefix."locale WHERE locale_code = '".$thislng[0]."' AND locale_active = '1'"); 127 if ($data = dbarray($result)) { 128 // if so, set the locale 129 $settings['locale'] = $data['locale_name']; 130 define("LOCALESET", $settings['locale']."/"); 131 break; 132 } 133 } 134 // if not found, loop again on languages only 135 if (!defined('LOCALESET')) { 136 foreach($temp as $lng) { 137 $thislng = explode(";", $lng); 138 $thislng = explode("-", $thislng); 139 // check if we support this language 140 $result = dbquery("SELECT * FROM ".$db_prefix."locale WHERE locale_code = '".$thislng[0]."' AND locale_active = '1'"); 141 if ($data = dbarray($result)) { 142 // if so, set the locale 143 $settings['locale'] = $data['locale_name']; 144 define("LOCALESET", $settings['locale']."/"); 145 break; 146 } 147 } 148 } 149 } 150 151 // locale detection - step 3 - use the website's default 152 if (!defined('LOCALESET')) { 153 define("LOCALESET", $settings['locale']."/"); 154 } 155 109 156 // URL path definitions relative to BASEDIR 110 define("LOCALESET", $settings['locale']."/");111 157 define("ADMIN", BASEDIR."administration/"); 112 158 define("IMAGES", BASEDIR."images/"); … … 144 190 145 191 // Browser window dimensions (assume 1024x768 if no cookies found) 146 define("BROWSER_WIDTH", isset($_COOKIE['width']) ?$_COOKIE['width']:1024);147 define("BROWSER_HEIGHT", isset($_COOKIE['height']) ?$_COOKIE['height']:768);192 define("BROWSER_WIDTH", isset($_COOKIE['width']) ? $_COOKIE['width'] : 1024); 193 define("BROWSER_HEIGHT", isset($_COOKIE['height']) ? $_COOKIE['height'] : 768); 148 194 149 195 // Initialise the $locale array … … 172 218 173 219 // image types we support 174 $imagetypes = array( 175 ".bmp", 176 ".gif", 177 ".iff", 178 ".jpg", 179 ".jpeg", 180 ".png", 181 ".psd", 182 ".tiff", 183 ".wbmp" 184 ); 220 $imagetypes = array(".bmp",".gif",".iff",".jpg",".jpeg",".png",".psd",".tiff",".wbmp"); 185 221 186 222 // image types we can generate a thumbnail from 187 $thumbtypes = array( 188 ".gif", 189 ".jpg", 190 ".jpeg", 191 ".png", 192 ); 223 $thumbtypes = array(".gif",".jpg",".jpeg",".png",); 193 224 194 225 // debug function, handy to print a standard debug text … … 761 792 } 762 793 if ($data['user_status'] == 0) { 763 if (isset($_POST['remember_me'])) { 764 setcookie("remember_me", "yes", time() + 31536000, "/", "", "0"); 765 $cookie_exp = time() + 3600*24*30; 766 } else { 767 setcookie("remember_me", "yes", time() - 7200, "/", "", "0"); 768 $cookie_exp = time() + 60*30; 769 } 794 $cookie_exp = time() + 60*30; 770 795 header("P3P: CP='NOI ADM DEV PSAi COM NAV OUR OTRo STP IND DEM'"); 771 796 setcookie("userinfo", $cookie_value, $cookie_exp, "/", "", "0");
Note: See TracChangeset
for help on using the changeset viewer.
