|
From: <be...@us...> - 2014-02-27 08:03:02
|
Revision: 12334
http://sourceforge.net/p/xoops/svn/12334
Author: beckmi
Date: 2014-02-27 08:02:54 +0000 (Thu, 27 Feb 2014)
Log Message:
-----------
fixed language auto-detection (Rewarder/Mamba) - need testing
Modified Paths:
--------------
XoopsModules/xlanguage/trunk/xlanguage/docs/changelog.txt
XoopsModules/xlanguage/trunk/xlanguage/include/functions.php
XoopsModules/xlanguage/trunk/xlanguage/include/vars.php
XoopsModules/xlanguage/trunk/xlanguage/xoops_version.php
Modified: XoopsModules/xlanguage/trunk/xlanguage/docs/changelog.txt
===================================================================
--- XoopsModules/xlanguage/trunk/xlanguage/docs/changelog.txt 2014-02-26 02:34:32 UTC (rev 12333)
+++ XoopsModules/xlanguage/trunk/xlanguage/docs/changelog.txt 2014-02-27 08:02:54 UTC (rev 12334)
@@ -1,5 +1,9 @@
xlanguage 3.04:
-------------------
+- fixed language auto-detection (Rewarder/Mamba)
+
+xlanguage 3.04:
+-------------------
- updated POSIX Regex to PCRE (Mamba)
- minor fixes (Mamba)
- fixing generation of configuration file for extended languages
@@ -26,12 +30,12 @@
-------------------
"input" parse improvement, reported by irmtfan @ xoops.org
-xlanguage 2.02
+xlanguage 2.02
-------------------
bugfix for XSS vulnerability
Thanks domifara @ dev.xoops.org
-xlanguage 2.01
+xlanguage 2.01
-------------------
bugfix for nonexisting language
Modified: XoopsModules/xlanguage/trunk/xlanguage/include/functions.php
===================================================================
--- XoopsModules/xlanguage/trunk/xlanguage/include/functions.php 2014-02-26 02:34:32 UTC (rev 12333)
+++ XoopsModules/xlanguage/trunk/xlanguage/include/functions.php 2014-02-27 08:02:54 UTC (rev 12334)
@@ -30,57 +30,60 @@
function xlanguage_convert_encoding($value, $out_charset, $in_charset)
{
- if (is_array($value)) {
- foreach($value as $key => $val){
- $value[$key] = xlanguage_convert_encoding($val, $out_charset, $in_charset);
- }
- }
- else {
- $value = xlanguage_convert_item($value, $out_charset, $in_charset);
- }
- return $value;
+ if (is_array($value)) {
+ foreach ($value as $key => $val) {
+ $value[$key] = xlanguage_convert_encoding($val, $out_charset, $in_charset);
+ }
+ } else {
+ $value = xlanguage_convert_item($value, $out_charset, $in_charset);
+ }
+
+ return $value;
}
function xlanguage_convert_item($value, $out_charset, $in_charset)
{
- if(strtolower($in_charset) == strtolower($out_charset)) {
- return $value;
- }
- $xconv_handler = @xoops_getmodulehandler('xconv', 'xconv', true);
- if(is_object($xconv_handler) &&
- $converted_value = @$xconv_handler->convert_encoding($value, $out_charset, $in_charset)
- ){
- return $converted_value;
- }
- if(XOOPS_USE_MULTIBYTES && function_exists('mb_convert_encoding')) {
- $converted_value = @mb_convert_encoding($value, $out_charset, $in_charset);
- }elseif(function_exists('iconv')) {
- $converted_value = @iconv($in_charset, $out_charset, $value);
- }
- $value = empty($converted_value) ? $value : $converted_value;
+ if (strtolower($in_charset) == strtolower($out_charset)) {
+ return $value;
+ }
+ $xconv_handler = @xoops_getmodulehandler('xconv', 'xconv', true);
+ if (is_object($xconv_handler)
+ && $converted_value = @$xconv_handler->convert_encoding($value, $out_charset, $in_charset)
+ ) {
+ return $converted_value;
+ }
+ if (XOOPS_USE_MULTIBYTES && function_exists('mb_convert_encoding')) {
+ $converted_value = @mb_convert_encoding($value, $out_charset, $in_charset);
+ } elseif (function_exists('iconv')) {
+ $converted_value = @iconv($in_charset, $out_charset, $value);
+ }
+ $value = empty($converted_value) ? $value : $converted_value;
- return $value;
+ return $value;
}
function xlanguage_createConfig()
{
- $xlang_handler=& xoops_getmodulehandler('language', 'xlanguage');
- return $xlang_handler->createConfig();
+ $xlang_handler =& xoops_getmodulehandler('language', 'xlanguage');
+
+ return $xlang_handler->createConfig();
}
function &xlanguage_loadConfig()
{
- $xlang_handler=& xoops_getmodulehandler('language', 'xlanguage');
- $config =& $xlang_handler->loadFileConfig();
- return $config;
+ $xlang_handler =& xoops_getmodulehandler('language', 'xlanguage');
+ $config =& $xlang_handler->loadFileConfig();
+
+ return $config;
}
/**
* Analyzes some PHP environment variables to find the most probable language
* that should be used
*
- * @param string $ string to analyze
- * @param integer $ type of the PHP environment variable which value is $str
+ * @param string $ string to analyze
+ * @param integer $ type of the PHP environment variable which value is $str
+ *
* @global array the list of available translations
* @global string the retained translation keyword
* @access private
@@ -88,196 +91,249 @@
function xlanguage_lang_detect($str = '', $envType = '')
{
global $available_languages;
- $lang='';
-
- if(!empty($available_languages)) {
- foreach ($available_languages AS $key => $value) {
- // $envType = 1 for the 'HTTP_ACCEPT_LANGUAGE' environment variable,
- // 2 for the 'HTTP_USER_AGENT' one
- $expr = $value[0];
- if (strpos($expr, '[-_]') === FALSE) {
- $expr = str_replace('|', '([-_][[:alpha:]]{2,3})?|', $expr);
- }
+ $lang = '';
+
+ if (!empty($available_languages)) {
+ foreach ($available_languages AS $key => $value) {
+ // $envType = 1 for the 'HTTP_ACCEPT_LANGUAGE' environment variable,
+ // 2 for the 'HTTP_USER_AGENT' one
+ $expr = $value[0];
+ if (strpos($expr, '[-_]') === false) {
+ $expr = str_replace('|', '([-_][[:alpha:]]{2,3})?|', $expr);
+ }
// if (($envType == 1 && eregi('^(' . $expr . ')(;q=[0-9]\\.[0-9])?$', $str))
// || ($envType == 2 && eregi('(\(|\[|;[[:space:]])(' . $expr . ')(;|\]|\))', $str))) {
- if (($envType == 1 && preg_match('#^(' . $expr . ')(;q=[0-9]\\.[0-9])?$#i', $str))
- || ($envType == 2 && preg_match('#(\(|\[|;[[:space:]])(' . $expr . ')(;|\]|\))#i', $str))) {
- $lang = $key;
- //if($lang != 'en')
- break;
+ if (($envType == 1 && preg_match('#^(' . $expr . ')(;q=[0-9]\\.[0-9])?$#i', $str))
+ || ($envType == 2 && preg_match('#(\(|\[|;[[:space:]])(' . $expr . ')(;|\]|\))#i', $str))
+ ) {
+ $lang = $key;
+ //if($lang != 'en')
+ break;
+ }
}
}
- }
+
return $lang;
}
function xlanguage_detectLang()
{
- global $available_languages,$_SERVER;
+ global $available_languages, $_SERVER;
- if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
- $HTTP_ACCEPT_LANGUAGE = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
- }
+ if (!empty($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+ $HTTP_ACCEPT_LANGUAGE = $_SERVER['HTTP_ACCEPT_LANGUAGE'];
+ }
- if (!empty($_SERVER['HTTP_USER_AGENT'])) {
- $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
- }
+ if (!empty($_SERVER['HTTP_USER_AGENT'])) {
+ $HTTP_USER_AGENT = $_SERVER['HTTP_USER_AGENT'];
+ }
- $lang = '';
- $xoops_lang ='';
- // 1. try to findout user's language by checking its HTTP_ACCEPT_LANGUAGE
- // variable
- if (empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE)) {
- $accepted = explode(',', $HTTP_ACCEPT_LANGUAGE);
- $acceptedCnt = count($accepted);
- reset($accepted);
- for ($i = 0; $i < $acceptedCnt; $i++) {
- $lang = xlanguage_lang_detect($accepted[$i], 1);
- if(strncasecmp($lang,'en',2)){
- break;
- }
- }
- }
- // 2. try to findout user's language by checking its HTTP_USER_AGENT variable
- if (empty($lang) && !empty($HTTP_USER_AGENT)) {
- $lang = xlanguage_lang_detect($HTTP_USER_AGENT, 2);
- }
- // 3. If we catch a valid language, configure it
- if (!empty($lang)) {
- $xoops_lang = $available_languages[$lang][1];
- }
- return $xoops_lang;
+ $lang = '';
+ $xoops_lang = '';
+ // 1. try to findout user's language by checking its HTTP_ACCEPT_LANGUAGE variable
+
+
+// if (empty($lang) && !empty($HTTP_ACCEPT_LANGUAGE)) {
+// $accepted = explode(',', $HTTP_ACCEPT_LANGUAGE);
+// $acceptedCnt = count($accepted);
+// reset($accepted);
+// for ($i = 0; $i < $acceptedCnt; ++$i) {
+// $lang = xlanguage_lang_detect($accepted[$i], 1);
+// if (strncasecmp($lang, 'en', 2)) {
+// break;
+// }
+// }
+// }
+
+
+
+//This returns the most preferred langauage "q=1"
+ $lang = getPreferredLanguage();
+
+
+ // 2. if not found in HTTP_ACCEPT_LANGUAGE, try to find user's language by checking its HTTP_USER_AGENT variable
+ if (empty($lang) && !empty($HTTP_USER_AGENT)) {
+ $lang = xlanguage_lang_detect($HTTP_USER_AGENT, 2);
+ }
+ // 3. If we catch a valid language, configure it
+ if (!empty($lang)) {
+ $xoops_lang = $available_languages[$lang][1];
+ }
+
+ return $xoops_lang;
}
-function xlanguage_encoding($output){
- global $xlanguage;
- $output = xlanguage_ml($output);
- // escape XML doc
- if(preg_match("/^\<\?[\s]?xml[\s]+version=([\"'])[^\>]+\\1[\s]+encoding=([\"'])[^\>]+\\2[\s]?\?\>/i", $output)){
- return $output;
- }
- $in_charset = $xlanguage["charset_base"];
+function xlanguage_encoding($output)
+{
+ global $xlanguage;
+ $output = xlanguage_ml($output);
+ // escape XML doc
+ if (preg_match("/^\<\?[\s]?xml[\s]+version=([\"'])[^\>]+\\1[\s]+encoding=([\"'])[^\>]+\\2[\s]?\?\>/i", $output)) {
+ return $output;
+ }
+ $in_charset = $xlanguage["charset_base"];
$out_charset = $xlanguage["charset"];
-
- return $output = xlanguage_convert_encoding($output, $out_charset, $in_charset);
+
+ return $output = xlanguage_convert_encoding($output, $out_charset, $in_charset);
}
function xlanguage_ml($s)
{
- global $xoopsConfig;
- global $xlanguage_langs;
-
- if(!isset($xlanguage_langs)){
- $langs =& $GLOBALS["xlanguage_handler"]->getAll(true);
- foreach( array_keys($langs) as $_lang ) {
- $xlanguage_langs[$_lang] = $langs[$_lang]->getVar("lang_code");
- }
- unset($langs);
- }
- if(empty($xlanguage_langs) || count($xlanguage_langs) ==0) return $s;
-
- // escape brackets inside of <code>...</code>
- $patterns[] = '/(\<code>.*\<\/code>)/isU';
-
- // escape brackets inside of <input type="..." value="...">
- $patterns[] = '/(\<input\b(?![^\>]*\btype=([\'"]?)(submit|image|reset|button))[^\>]*\>)/isU';
-
- // escape brackets inside of <textarea></textarea>
- $patterns[] = '/(\<textarea\b[^>]*>[^\<]*\<\/textarea>)/isU';
-
- $s = preg_replace_callback( $patterns , 'xlanguage_ml_escape_bracket' , $s ) ;
-
-
- // create the pattern between language tags
- $pqhtmltags = explode( ',' , preg_quote( XLANGUAGE_TAGS_RESERVED , '/' ) ) ;
- $mid_pattern = '(?:(?!(' . implode( '|' , $pqhtmltags ) . ')).)*' ;
-
- $patterns = array();
- $replaces = array();
- /* */
- if(isset($xlanguage_langs[$xoopsConfig['language']])) {
- $lang = $xlanguage_langs[$xoopsConfig['language']];
- $patterns[] = '/(\[([^\]]*\|)?'.preg_quote($lang).'(\|[^\]]*)?\])('.$mid_pattern.')(\[\/([^\]]*\|)?'.preg_quote($lang).'(\|[^\]]*)?\])/isU';
- $replaces[] = '$4';
- }
- /* */
- foreach( array_keys($xlanguage_langs) as $_lang ) {
- if($_lang == @$xoopsConfig['language']) continue;
- $name = $xlanguage_langs[$_lang];
- $patterns[] = '/(\[([^\]]*\|)?'.preg_quote($name).'(\|[^\]]*)?\])('.$mid_pattern.')(\[\/([^\]]*\|)?'.preg_quote($name).'(\|[^\]]*)?(\]\<br[\s]?[\/]?\>|\]))/isU';
- $replaces[] = '';
- }
- if(!empty($xoopsConfig['language'])){
- $s = preg_replace( '/\[[\/]?[\|]?'.preg_quote($xoopsConfig['language']).'[\|]?\](\<br \/\>)?/i' , '' , $s ) ;
- }
- if(count($replaces)>0){
- $s = preg_replace( $patterns , $replaces , $s ) ;
- }
+ global $xoopsConfig;
+ global $xlanguage_langs;
- return $s ;
+ if (!isset($xlanguage_langs)) {
+ $langs =& $GLOBALS["xlanguage_handler"]->getAll(true);
+ foreach (array_keys($langs) as $_lang) {
+ $xlanguage_langs[$_lang] = $langs[$_lang]->getVar("lang_code");
+ }
+ unset($langs);
+ }
+ if (empty($xlanguage_langs) || count($xlanguage_langs) == 0) {
+ return $s;
+ }
+
+ // escape brackets inside of <code>...</code>
+ $patterns[] = '/(\<code>.*\<\/code>)/isU';
+
+ // escape brackets inside of <input type="..." value="...">
+ $patterns[] = '/(\<input\b(?![^\>]*\btype=([\'"]?)(submit|image|reset|button))[^\>]*\>)/isU';
+
+ // escape brackets inside of <textarea></textarea>
+ $patterns[] = '/(\<textarea\b[^>]*>[^\<]*\<\/textarea>)/isU';
+
+ $s = preg_replace_callback($patterns, 'xlanguage_ml_escape_bracket', $s);
+
+ // create the pattern between language tags
+ $pqhtmltags = explode(',', preg_quote(XLANGUAGE_TAGS_RESERVED, '/'));
+ $mid_pattern = '(?:(?!(' . implode('|', $pqhtmltags) . ')).)*';
+
+ $patterns = array();
+ $replaces = array();
+ /* */
+ if (isset($xlanguage_langs[$xoopsConfig['language']])) {
+ $lang = $xlanguage_langs[$xoopsConfig['language']];
+ $patterns[] = '/(\[([^\]]*\|)?' . preg_quote($lang) . '(\|[^\]]*)?\])(' . $mid_pattern . ')(\[\/([^\]]*\|)?' . preg_quote($lang) . '(\|[^\]]*)?\])/isU';
+ $replaces[] = '$4';
+ }
+ /* */
+ foreach (array_keys($xlanguage_langs) as $_lang) {
+ if ($_lang == @$xoopsConfig['language']) {
+ continue;
+ }
+ $name = $xlanguage_langs[$_lang];
+ $patterns[] = '/(\[([^\]]*\|)?' . preg_quote($name) . '(\|[^\]]*)?\])(' . $mid_pattern . ')(\[\/([^\]]*\|)?' . preg_quote($name) . '(\|[^\]]*)?(\]\<br[\s]?[\/]?\>|\]))/isU';
+ $replaces[] = '';
+ }
+ if (!empty($xoopsConfig['language'])) {
+ $s = preg_replace('/\[[\/]?[\|]?' . preg_quote($xoopsConfig['language']) . '[\|]?\](\<br \/\>)?/i', '', $s);
+ }
+ if (count($replaces) > 0) {
+ $s = preg_replace($patterns, $replaces, $s);
+ }
+
+ return $s;
}
-function xlanguage_ml_escape_bracket( $matches )
+function xlanguage_ml_escape_bracket($matches)
{
- global $xlanguage_langs;
- $ret = $matches[1];
- if(!empty($xlanguage_langs)) {
- $pattern = '/(\[([\/])?('.implode("|",array_map("preg_quote", array_values($xlanguage_langs))).')([\|\]]))/isU';
- $ret = preg_replace($pattern, "[\\2\\3\\4", $ret);
- }
- return $ret;
+ global $xlanguage_langs;
+ $ret = $matches[1];
+ if (!empty($xlanguage_langs)) {
+ $pattern = '/(\[([\/])?(' . implode("|", array_map("preg_quote", array_values($xlanguage_langs))) . ')([\|\]]))/isU';
+ $ret = preg_replace($pattern, "[\\2\\3\\4", $ret);
+ }
+
+ return $ret;
}
-
function xlanguage_select_show($options = null)
{
- include_once XOOPS_ROOT_PATH."/modules/xlanguage/blocks/xlanguage_blocks.php";
- if(empty($options)){
- $options[0] = "images"; // display style: image, text, select
- $options[1] = " "; // delimitor
- $options[2] = 5; // items per line
- }
-
- $block = b_xlanguage_select_show($options);
- $block["tag"] = "xlanguage";
-
- $content = "";
- $i = 1;
- if(!empty($block["display"])) { //mb
- if(in_array($block["display"], array("images", "text"))){
- foreach($block["languages"] as $name => $lang){
- $content .= "<a href=\"".$block["url"].$lang["name"]."\" title=\"".$lang["desc"]."\">";
- if($block["display"] == "images"){
- $content .= "<img src=\"".$lang["image"]."\" alt=\"".$lang["desc"]."\"";
- if($block["selected"] != $lang["name"]){
- $content .= " style=\"MozOpacity: .8; opacity: .8; filter:Alpha(opacity=80);\"";
- }
- $content .= "/>";
- }else{
- $content .= $lang["desc"];
- }
- $content .= "</a>";
- if( ( $i++ % $block["number"] ) == 0){
- $content .= "<br />";
- }
- }
- }else{
- $content .= "<select name=\"".$block["tag"]."\"
- onChange=\"if(this.options[this.selectedIndex].value.length >0 ) { window.document.location=this.options[this.selectedIndex].value;}\"
- >";
- if(!empty($block["languages"])) { //mb
- foreach($block["languages"] as $name => $lang){
- $content .= "<option value=\"".$block["url"].$lang["name"]."\"";
- if($block["selected"] == $lang["name"]){
- $content .= " selected ";
- }
- $content .= "/>".$lang["desc"]."</option>";
- }
- }
- $content .= "</select>";
- }
- }
+ include_once XOOPS_ROOT_PATH . "/modules/xlanguage/blocks/xlanguage_blocks.php";
+ if (empty($options)) {
+ $options[0] = "images"; // display style: image, text, select
+ $options[1] = " "; // delimitor
+ $options[2] = 5; // items per line
+ }
- define("XLANGUAGE_SWITCH_CODE", $content);
- return true;
-}
\ No newline at end of file
+ $block = b_xlanguage_select_show($options);
+ $block["tag"] = "xlanguage";
+
+ $content = "";
+ $i = 1;
+ if (!empty($block["display"])) { //mb
+ if (in_array($block["display"], array("images", "text"))) {
+ foreach ($block["languages"] as $name => $lang) {
+ $content .= "<a href=\"" . $block["url"] . $lang["name"] . "\" title=\"" . $lang["desc"] . "\">";
+ if ($block["display"] == "images") {
+ $content .= "<img src=\"" . $lang["image"] . "\" alt=\"" . $lang["desc"] . "\"";
+ if ($block["selected"] != $lang["name"]) {
+ $content .= " style=\"MozOpacity: .8; opacity: .8; filter:Alpha(opacity=80);\"";
+ }
+ $content .= "/>";
+ } else {
+ $content .= $lang["desc"];
+ }
+ $content .= "</a>";
+ if ((++$i % $block["number"]) == 0) {
+ $content .= "<br />";
+ }
+ }
+ } else {
+ $content .= "<select name=\"" . $block["tag"] . "\"
+ onChange=\"if (this.options[this.selectedIndex].value.length >0) { window.document.location=this.options[this.selectedIndex].value;}\"
+ >";
+ if (!empty($block["languages"])) { //mb
+ foreach ($block["languages"] as $name => $lang) {
+ $content .= "<option value=\"" . $block["url"] . $lang["name"] . "\"";
+ if ($block["selected"] == $lang["name"]) {
+ $content .= " selected ";
+ }
+ $content .= "/>" . $lang["desc"] . "</option>";
+ }
+ }
+ $content .= "</select>";
+ }
+ }
+
+ define("XLANGUAGE_SWITCH_CODE", $content);
+
+ return true;
+}
+
+
+
+function getPreferredLanguage()
+{
+ $langs = array();
+ if (isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
+// break up string into pieces (languages and q factors)
+ preg_match_all(
+ '/([a-z]{1,8}(-[a-z]{1,8})?)\s*(;\s*q\s*=\s*(1|0\.[0-9]+))?/i',
+ $_SERVER['HTTP_ACCEPT_LANGUAGE'],
+ $lang_parse
+ );
+ if (count($lang_parse[1])) {
+ // create a list like "en" => 0.8
+ $langs = array_combine($lang_parse[1], $lang_parse[4]);
+ // set default to 1 for any without q factor
+ foreach ($langs as $lang => $val) {
+ if ($val === '') {
+ $langs[$lang] = 1;
+ }
+ }
+ // sort list based on value
+ arsort($langs, SORT_NUMERIC);
+ }
+ }
+//extract most important (first)
+ foreach ($langs as $lang => $val) {
+ break;
+ }
+//if complex language simplify it
+ if (stristr($lang, "-")) {
+ $tmp = explode("-", $lang);
+ $lang = $tmp[0];
+ }
+ return $lang;
+}
Modified: XoopsModules/xlanguage/trunk/xlanguage/include/vars.php
===================================================================
--- XoopsModules/xlanguage/trunk/xlanguage/include/vars.php 2014-02-26 02:34:32 UTC (rev 12333)
+++ XoopsModules/xlanguage/trunk/xlanguage/include/vars.php 2014-02-27 08:02:54 UTC (rev 12334)
@@ -1,107 +1,117 @@
-<?php
-// $Id$
-// ------------------------------------------------------------------------ //
-// Xlanguage: eXtensible Language Management For Xoops //
-// Copyright (c) 2004 Xoops China Community //
-// <http://www.xoops.org.cn/> //
-// ------------------------------------------------------------------------ //
-// This program is free software; you can redistribute it and/or modify //
-// it under the terms of the GNU General Public License as published by //
-// the Free Software Foundation; either version 2 of the License, or //
-// (at your option) any later version. //
-// //
-// You may not change or alter any portion of this comment or credits //
-// of supporting developers from this source code or any supporting //
-// source code which is considered copyrighted (c) material of the //
-// original comment or credit authors. //
-// //
-// This program is distributed in the hope that it will be useful, //
-// but WITHOUT ANY WARRANTY; without even the implied warranty of //
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
-// GNU General Public License for more details. //
-// //
-// You should have received a copy of the GNU General Public License //
-// along with this program; if not, write to the Free Software //
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
-// ------------------------------------------------------------------------ //
-// Author: D.J.(phppp) ph...@ho... //
-// URL: http://www.xoops.org.cn //
-// ------------------------------------------------------------------------- //
-if(!defined('XLANGUAGE_CONFIG_FILE')) define('XLANGUAGE_CONFIG_FILE', XOOPS_CACHE_PATH.'/xlanguage.php');
-if(!defined('XLANGUAGE_CONFIG_VAR')) define('XLANGUAGE_CONFIG_VAR', 'cached_config');
-if(!defined('XLANGUAGE_LANG_TAG')) define('XLANGUAGE_LANG_TAG', "lang");
-if(!defined('XLANGUAGE_TAGS_RESERVED')) define('XLANGUAGE_TAGS_RESERVED', "</head>,</body>");
-
-/**
- * phpMyAdmin Language Loading File
- */
-
-/**
- * All the supported languages have to be listed in the array below.
- * 1. The key must be the "official" ISO 639 language code and, if required,
- * the dialect code. It can also contains some informations about the
- * charset (see the Russian case).
- * 2. The first of the values associated to the key is used in a regular
- * expression to find some keywords corresponding to the language inside two
- * environment variables.
- * These values contains:
- * - the "official" ISO language code and, if required, the dialect code
- * also ('bu' for Bulgarian, 'fr([-_][[:alpha:]]{2})?' for all French
- * dialects, 'zh[-_]tw' for Chinese traditional...);
- * - the '|' character (it means 'OR');
- * - the full language name.
- * 3. The second values associated to the key is the name of the file to load
- * without the '.php' extension.
- * 4. The last values associated to the key is the language code as defined by
- * the RFC1766.
- *
- * Beware that the sorting order (first values associated to keys by
- * alphabetical reverse order in the array) is important: 'zh-tw' (chinese
- * traditional) must be detected before 'zh' (chinese simplified) for
- * example.
- *
- * When there are more than one charset for a language, we put the -utf-8
- * first.
- */
-$available_languages = array(
- 'ar' => array('ar([-_][[:alpha:]]{2})?|arabic', 'arabic'),
- 'bg' => array('bg|bulgarian', 'bulgarian'),
- 'ca' => array('ca|catalan', 'catalan'),
- 'cs' => array('cs|czech', 'czech'),
- 'da' => array('da|danish', 'danish'),
- 'de' => array('de([-_][[:alpha:]]{2})?|german', 'german'),
- 'el' => array('el|greek', 'greek'),
- 'en' => array('en([-_][[:alpha:]]{2})?|english', 'english'),
- 'es' => array('es([-_][[:alpha:]]{2})?|spanish', 'spanish'),
- 'et' => array('et|estonian', 'estonian'),
- 'fi' => array('fi|finnish', 'finnish'),
- 'fr' => array('fr([-_][[:alpha:]]{2})?|french', 'french'),
- 'gl' => array('gl|galician', 'galician'),
- 'he' => array('he|hebrew', 'hebrew'),
- 'hr' => array('hr|croatian', 'croatian'),
- 'hu' => array('hu|hungarian', 'hungarian'),
- 'id' => array('id|indonesian', 'indonesian'),
- 'it' => array('it|italian', 'italian'),
- 'ja' => array('ja|japanese', 'japanese'),
- 'ko' => array('ko|korean', 'koreano'),
- 'ka' => array('ka|georgian', 'georgian'),
- 'lt' => array('lt|lithuanian', 'lithuanian'),
- 'lv' => array('lv|latvian', 'latvian'),
- 'nl' => array('nl([-_][[:alpha:]]{2})?|dutch', 'dutch'),
- 'no' => array('no|norwegian', 'norwegian'),
- 'pl' => array('pl|polish', 'polish'),
- 'pt-br' => array('pt[-_]br|brazilian portuguese', 'portuguesebr'),
- 'pt' => array('pt([-_][[:alpha:]]{2})?|portuguese', 'portuguese'),
- 'ro' => array('ro|romanian', 'romanian'),
- 'ru' => array('ru|russian', 'russian'),
- 'sk' => array('sk|slovak', 'slovak'),
- 'sq' => array('sq|albanian', 'albanian'),
- 'sr' => array('sr|serbian', 'serbian'),
- 'sv' => array('sv|swedish', 'swedish'),
- 'th' => array('th|thai', 'thai'),
- 'tr' => array('tr|turkish', 'turkish'),
- 'uk' => array('uk|ukrainian', 'ukrainian'),
- 'zh-tw' => array('zh[-_]tw|chinese traditional', 'tchinese'),
- 'zh-cn' => array('zh[-_]cn|chinese simplified', 'schinese'),
- );
-?>
\ No newline at end of file
+<?php
+// $Id$
+// ------------------------------------------------------------------------ //
+// Xlanguage: eXtensible Language Management For Xoops //
+// Copyright (c) 2004 Xoops China Community //
+// <http://www.xoops.org.cn/> //
+// ------------------------------------------------------------------------ //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation; either version 2 of the License, or //
+// (at your option) any later version. //
+// //
+// You may not change or alter any portion of this comment or credits //
+// of supporting developers from this source code or any supporting //
+// source code which is considered copyrighted (c) material of the //
+// original comment or credit authors. //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program; if not, write to the Free Software //
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
+// ------------------------------------------------------------------------ //
+// Author: D.J.(phppp) ph...@ho... //
+// URL: http://www.xoops.org.cn //
+// ------------------------------------------------------------------------- //
+if (!defined('XLANGUAGE_CONFIG_FILE')) {
+ define('XLANGUAGE_CONFIG_FILE', XOOPS_CACHE_PATH . '/xlanguage.php');
+}
+if (!defined('XLANGUAGE_CONFIG_VAR')) {
+ define('XLANGUAGE_CONFIG_VAR', 'cached_config');
+}
+if (!defined('XLANGUAGE_LANG_TAG')) {
+ define('XLANGUAGE_LANG_TAG', "lang");
+}
+if (!defined('XLANGUAGE_TAGS_RESERVED')) {
+ define('XLANGUAGE_TAGS_RESERVED', "</head>,</body>");
+}
+
+/**
+ * phpMyAdmin Language Loading File
+ */
+
+/**
+ * All the supported languages have to be listed in the array below.
+ * 1. The key must be the "official" ISO 639 language code and, if required,
+ * the dialect code. It can also contains some informations about the
+ * charset (see the Russian case).
+ * 2. The first of the values associated to the key is used in a regular
+ * expression to find some keywords corresponding to the language inside two
+ * environment variables.
+ * These values contains:
+ * - the "official" ISO language code and, if required, the dialect code
+ * also ('bu' for Bulgarian, 'fr([-_][[:alpha:]]{2})?' for all French
+ * dialects, 'zh[-_]tw' for Chinese traditional...);
+ * - the '|' character (it means 'OR');
+ * - the full language name.
+ * 3. The second values associated to the key is the name of the file to load
+ * without the '.php' extension.
+ * 4. The last values associated to the key is the language code as defined by
+ * the RFC1766.
+ *
+ * Beware that the sorting order (first values associated to keys by
+ * alphabetical reverse order in the array) is important: 'zh-tw' (chinese
+ * traditional) must be detected before 'zh' (chinese simplified) for
+ * example.
+ *
+ * When there are more than one charset for a language, we put the -utf-8
+ * first.
+ */
+$available_languages = array(
+ 'ar' => array('ar([-_][[:alpha:]]{2})?|arabic', 'arabic'),
+ 'bg' => array('bg|bulgarian', 'bulgarian'),
+ 'ca' => array('ca|catalan', 'catalan'),
+ 'cs' => array('cs|czech', 'czech'),
+ 'da' => array('da|danish', 'danish'),
+ 'de' => array('de([-_][[:alpha:]]{2})?|german', 'german'),
+ 'el' => array('el|greek', 'greek'),
+ 'en' => array('en([-_][[:alpha:]]{2})?|english', 'english'),
+ 'es' => array('es([-_][[:alpha:]]{2})?|spanish', 'spanish'),
+ 'et' => array('et|estonian', 'estonian'),
+ 'fi' => array('fi|finnish', 'finnish'),
+ 'fr' => array('fr([-_][[:alpha:]]{2})?|french', 'french'),
+ 'gl' => array('gl|galician', 'galician'),
+ 'he' => array('he|hebrew', 'hebrew'),
+ 'hr' => array('hr|croatian', 'croatian'),
+ 'hu' => array('hu|hungarian', 'hungarian'),
+ 'id' => array('id|indonesian', 'indonesian'),
+ 'it' => array('it|italian', 'italian'),
+ 'ja' => array('ja|japanese', 'japanese'),
+ 'ko' => array('ko|korean', 'koreano'),
+ 'ka' => array('ka|georgian', 'georgian'),
+ 'lt' => array('lt|lithuanian', 'lithuanian'),
+ 'lv' => array('lv|latvian', 'latvian'),
+ 'nl' => array('nl([-_][[:alpha:]]{2})?|dutch', 'dutch'),
+ 'no' => array('no|norwegian', 'norwegian'),
+ 'pl' => array('pl|polish', 'polish'),
+ 'pt-br' => array('pt[-_]br|brazilian portuguese', 'portuguesebr'),
+ 'pt' => array('pt([-_][[:alpha:]]{2})?|portuguese', 'portuguese'),
+ 'ro' => array('ro|romanian', 'romanian'),
+ 'ru' => array('ru|russian', 'russian'),
+ 'sk' => array('sk|slovak', 'slovak'),
+ 'sq' => array('sq|albanian', 'albanian'),
+ 'sr' => array('sr|serbian', 'serbian'),
+ 'sv' => array('sv|swedish', 'swedish'),
+ 'th' => array('th|thai', 'thai'),
+ 'tr' => array('tr|turkish', 'turkish'),
+ 'uk' => array('uk|ukrainian', 'ukrainian'),
+ 'zh-tw' => array('zh[-_]tw|chinese traditional', 'tchinese'),
+ 'zh-cn' => array('zh[-_]cn|chinese simplified', 'schinese'),
+);
+
+// mb
+$GLOBALS['available_languages'] =& $available_languages;
Modified: XoopsModules/xlanguage/trunk/xlanguage/xoops_version.php
===================================================================
--- XoopsModules/xlanguage/trunk/xlanguage/xoops_version.php 2014-02-26 02:34:32 UTC (rev 12333)
+++ XoopsModules/xlanguage/trunk/xlanguage/xoops_version.php 2014-02-27 08:02:54 UTC (rev 12334)
@@ -27,65 +27,65 @@
// Author: D.J.(phppp) ph...@ho... //
// URL: http://xoops.org.cn //
// ------------------------------------------------------------------------- //
-$modversion['name'] = _MI_XLANGUAGE_NAME;
-$modversion['version'] = 3.04;
-$modversion['description'] = _MI_XLANGUAGE_DESC;
-$modversion['credits'] = "Adi Chiributa - web...@ar...; wjue - http://www.wjue.org; GIJOE - http://www.peak.ne.jp";
-$modversion['author'] = "phppp(D.J.)" ;
-$modversion['help'] = "page=help";
-$modversion['license'] = "GNU GPL";
-$modversion['license_url'] = "www.gnu.org/licenses/gpl-2.0.html/";
-$modversion['official'] = 0;
-$modversion['image'] = "xlanguage_logo.png";
-$modversion['dirname'] = "xlanguage";
+$modversion['name'] = _MI_XLANGUAGE_NAME;
+$modversion['version'] = 3.05;
+$modversion['description'] = _MI_XLANGUAGE_DESC;
+$modversion['credits'] = "Adi Chiributa - web...@ar...; wjue - http://www.wjue.org; GIJOE - http://www.peak.ne.jp";
+$modversion['author'] = "phppp(D.J.)";
+$modversion['help'] = "page=help";
+$modversion['license'] = "GNU GPL";
+$modversion['license_url'] = "www.gnu.org/licenses/gpl-2.0.html";
+$modversion['official'] = 0;
+$modversion['image'] = "xlanguage_logo.png";
+$modversion['dirname'] = basename(dirname(__FILE__));
$modversion['dirmoduleadmin'] = '/Frameworks/moduleclasses/moduleadmin';
-$modversion['icons16'] = '../../Frameworks/moduleclasses/icons/16';
-$modversion['icons32'] = '../../Frameworks/moduleclasses/icons/32';
+$modversion['icons16'] = '../../Frameworks/moduleclasses/icons/16';
+$modversion['icons32'] = '../../Frameworks/moduleclasses/icons/32';
//about
-$modversion['release_date'] = '2012/06/19';
-$modversion["module_website_url"] = "www.xoops.org/";
+$modversion['release_date'] = '2014/02/26';
+$modversion["module_website_url"] = "www.xoops.org/";
$modversion["module_website_name"] = "XOOPS";
-$modversion["module_status"] = "Final";
-$modversion['min_php']='5.2';
-$modversion['min_xoops']="2.5.5";
-$modversion['min_admin']='1.1';
-$modversion['min_db']= array('mysql'=>'5.0.7', 'mysqli'=>'5.0.7');
+$modversion["module_status"] = "Beta 1";
+$modversion['min_php'] = '5.3.7';
+$modversion['min_xoops'] = "2.5.6";
+$modversion['min_admin'] = '1.1';
+$modversion['min_db'] = array('mysql' => '5.0.7', 'mysqli' => '5.0.7');
$modversion['system_menu'] = 1;
$modversion['sqlfile']['mysql'] = "sql/mysql.sql";
-$modversion['tables'][0] = "xlanguage_base";
-$modversion['tables'][1] = "xlanguage_ext";
+$modversion['tables'][0] = "xlanguage_base";
+$modversion['tables'][1] = "xlanguage_ext";
// Admin things
-$modversion['hasAdmin'] = 1;
+$modversion['hasAdmin'] = 1;
$modversion['adminindex'] = "admin/index.php";
-$modversion['adminmenu'] = "admin/menu.php";
+$modversion['adminmenu'] = "admin/menu.php";
// Use smarty
$modversion["use_smarty"] = 1;
//language selection block
-$modversion['blocks'][1]['file'] = "xlanguage_blocks.php";
-$modversion['blocks'][1]['name'] = _MI_XLANGUAGE_BNAME;
+$modversion['blocks'][1]['file'] = "xlanguage_blocks.php";
+$modversion['blocks'][1]['name'] = _MI_XLANGUAGE_BNAME;
$modversion['blocks'][1]['description'] = '';
-$modversion['blocks'][1]['show_func'] = "b_xlanguage_select_show";
-$modversion['blocks'][1]['edit_func'] = "b_xlanguage_select_edit";
-$modversion['blocks'][1]['options'] = "images| |5";
-$modversion["blocks"][1]["template"] = "xlanguage_block.html";
+$modversion['blocks'][1]['show_func'] = "b_xlanguage_select_show";
+$modversion['blocks'][1]['edit_func'] = "b_xlanguage_select_edit";
+$modversion['blocks'][1]['options'] = "images| |5";
+$modversion["blocks"][1]["template"] = "xlanguage_block.html";
-$modversion['releasedate'] = "July 9th, 2006";
-$modversion['status'] = "stable";
+$modversion['releasedate'] = "July 9th, 2006";
+$modversion['status'] = "stable";
$modversion['xoopsversion'] = "2.0+";
-$modversion['author_website'][1]['url'] = "http://xoops.org.cn";
+$modversion['author_website'][1]['url'] = "http://xoops.org.cn";
$modversion['author_website'][1]['name'] = "The Xoops China Community";
-$modversion['author_website'][2]['url'] = "http://xoopsforge.com";
+$modversion['author_website'][2]['url'] = "http://xoopsforge.com";
$modversion['author_website'][2]['name'] = "XForge";
-$modversion['author_email'] = "ph...@ho...";
-$modversion['demo_site_url'] = "http://xoops.org.cn";
-$modversion['demo_site_name'] = "Xoops China";
-$modversion['support_site_url'] = "http://xoopsforge.com";
-$modversion['support_site_name'] = "XForge";
\ No newline at end of file
+$modversion['author_email'] = "ph...@ho...";
+$modversion['demo_site_url'] = "http://xoops.org.cn";
+$modversion['demo_site_name'] = "Xoops China";
+$modversion['support_site_url'] = "http://xoopsforge.com";
+$modversion['support_site_name'] = "XForge";
|