Changeset 1665
- Timestamp:
- 08/05/2007 01:25:08 PM (17 months ago)
- Location:
- trunk
- Files:
-
- 6 modified
-
lang/lang-admin.de.inc.php (modified) (1 diff)
-
lang/lang-admin.en.inc.php (modified) (1 diff)
-
lang/lang-admin.it.inc.php (modified) (1 diff)
-
scripts/prepend.inc.php (modified) (2 diffs)
-
scripts/settings.class.php (modified) (4 diffs)
-
setup.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/lang/lang-admin.de.inc.php
r1664 r1665 147 147 "m_clean_url" => "Saubere URLs (mod_rewrite) verwenden? Beispiel: http://example.com/2005/01/firefox", 148 148 "m_metadata" => "Metadaten", 149 "m_language" => "Sprache des Weblogs", 149 150 "m_website" => "Der Name des Weblogs", 150 151 "m_publisher" => "Name des Verfassers der EintrÀge", -
trunk/lang/lang-admin.en.inc.php
r1664 r1665 147 147 "m_clean_url" => "Shall clean URLs (mod_rewrite) be used? Example: http://example.com/2005/01/firefox", 148 148 "m_metadata" => "Metadata", 149 "m_language" => "Language of your weblog", 149 150 "m_website" => "Weblog name", 150 151 "m_publisher" => "Name of the author of the entries", -
trunk/lang/lang-admin.it.inc.php
r1664 r1665 147 147 "m_clean_url" => "Pulire URLs (mod_rewrite) usati? Esempio: http://example.com/2005/01/firefox", 148 148 "m_metadata" => "Metadata", 149 "m_language" => "Lingua del vostro weblog", 149 150 "m_website" => "Nome Weblog", 150 151 "m_publisher" => "Nome dell'autore della nota", -
trunk/scripts/prepend.inc.php
r1663 r1665 11 11 12 12 // need this in every page 13 require_once(JLOG_BASEPATH.'lang'.DIRECTORY_SEPARATOR.'lang. inc.php');13 require_once(JLOG_BASEPATH.'lang'.DIRECTORY_SEPARATOR.'lang.'.JLOG_LANGUAGE.'.inc.php'); 14 14 require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'database.class.php'); 15 15 require_once(JLOG_BASEPATH.'scripts'.DIRECTORY_SEPARATOR.'bbcode.php'); … … 18 18 19 19 // need this only on admincenter 20 if(defined('JLOG_ADMIN')) require_once(JLOG_BASEPATH.'lang'.DIRECTORY_SEPARATOR.'lang-admin. inc.php');20 if(defined('JLOG_ADMIN')) require_once(JLOG_BASEPATH.'lang'.DIRECTORY_SEPARATOR.'lang-admin.'.JLOG_LANGUAGE.'.inc.php'); 21 21 22 22 // connect database -
trunk/scripts/settings.class.php
r1629 r1665 28 28 'JLOG_UPDATE', 29 29 'JLOG_VERSION', 30 'JLOG_LOGIN' 30 'JLOG_LOGIN', 31 'JLOG_LANGUAGE' 31 32 ); 32 33 … … 87 88 $this->d['jlog_db_prefix'] = "jlog_"; 88 89 $this->d['jlog_blogservices'] = "http://rpc.pingomatic.com/"; 90 $this->d['jlog_language'] = JLOG_LANGUAGE; 89 91 } 90 92 … … 102 104 function form_output() { 103 105 # returns the filled form 104 106 105 107 $data = array_htmlspecialchars($this->d); 106 107 108 108 109 if(isset($data['jlog_clean_url']) AND ($data['jlog_clean_url'] === 'true' OR $data['jlog_clean_url'] === '1')) … … 118 119 if(defined("JLOG_ADMIN") AND JLOG_ADMIN === true) $admincenter_password = " ".$this->l['admin']['m_admin_password_admin']; 119 120 else $admincenter_password = ''; 120 121 // do the form 121 122 // get available languages 123 $dir = opendir(dirname(__FILE__).DIRECTORY_SEPARATOR.'..'.DIRECTORY_SEPARATOR.'lang'); 124 $languages = array(); 125 while(($file = readdir($dir)) !== false) { 126 if($file == '.' OR $file == '..') continue; 127 if(!preg_match('/lang\.([a-zA-z0-9]+)\.inc\.php/', $file, $matches)) continue; 128 $languages[] = $matches[1]; 129 } 130 131 // do the form 122 132 $form = " 123 133 <form action='".$_SERVER['PHP_SELF']."' method='post'> 124 134 <fieldset><legend>".$this->l['admin']['m_metadata']."</legend> 135 <p><label for='website'>".$this->l['admin']['m_language']."</label><br /> 136 <select class='userdata' id='language' name='jlog_language'>"; 137 foreach($languages as $lang) { 138 $form .= "<option"; 139 if($lang == JLOG_LANGUAGE) $form .= " selected='selected'"; 140 $form .= ">$lang</option>"; 141 } 142 143 $form .= "</select> 144 </p> 145 125 146 <p><label for='website'>".$this->l['admin']['m_website']."</label><br /> 126 147 <input class='userdata' id='website' name='jlog_website' type='text' size='20' maxlength='255' value='".$this->get_value($data, 'jlog_website')."' /></p> -
trunk/setup.php
r1663 r1665 16 16 define("JLOG_WEBSITE", $_SERVER["HTTP_HOST"]); 17 17 define("JLOG_PATH", dirname("http://".$_SERVER["HTTP_HOST"].$_SERVER["PHP_SELF"])); 18 19 require('.'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.'lang.inc.php'); 20 require('.'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.'lang-admin.inc.php'); 18 19 $dir = opendir('.'.DIRECTORY_SEPARATOR.'lang'); 20 $languages = array(); 21 while(($file = readdir($dir)) !== false) { 22 if($file == '.' OR $file == '..') continue; 23 if(!preg_match('/lang\.([a-zA-z0-9]+)\.inc\.php/', $file, $matches)) continue; 24 $languages[] = $matches[1]; 25 } 26 $lang = getlang($languages, 'de'); 27 define('JLOG_LANGUAGE', $lang); 28 29 require('.'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.'lang.'.$lang.'.inc.php'); 30 require('.'.DIRECTORY_SEPARATOR.'lang'.DIRECTORY_SEPARATOR.'lang-admin.'.$lang.'.inc.php'); 21 31 require('.'.DIRECTORY_SEPARATOR.'scripts'.DIRECTORY_SEPARATOR.'database.class.php'); 22 32 require('.'.DIRECTORY_SEPARATOR.'scripts'.DIRECTORY_SEPARATOR.'general.func.php'); … … 245 255 </html>'; 246 256 } 257 258 function getlang ($allowed, $default) { 259 $string = $_SERVER['HTTP_ACCEPT_LANGUAGE']; 260 if (empty($string)) { 261 return $default; 262 } 263 264 $accepted_languages = preg_split('/,\s*/', $string); 265 266 $cur_l = $default; 267 $cur_q = 0; 268 269 foreach ($accepted_languages as $accepted_language) { 270 $res = preg_match ('/^([a-z]{1,8}(?:-[a-z]{1,8})*)'. 271 '(?:;\s*q=(0(?:\.[0-9]{1,3})?|1(?:\.0{1,3})?))?$/i', $accepted_language, $matches); 272 273 if (!$res) { 274 continue; 275 } 276 277 $lang_code = explode ('-', $matches[1]); 278 279 if (isset($matches[2])) { 280 $lang_quality = (float)$matches[2]; 281 } else { 282 $lang_quality = 1.0; 283 } 284 285 while (count ($lang_code)) { 286 if (in_array (strtolower (join ('-', $lang_code)), $allowed)) { 287 if ($lang_quality > $cur_q) { 288 $cur_l = strtolower (join ('-', $lang_code)); 289 $cur_q = $lang_quality; 290 break; 291 } 292 } 293 array_pop ($lang_code); 294 } 295 } 296 297 return $cur_l; 298 } 247 299 248 300 ?>
