thanx a lot!
ill adjust my common.php right now
[]s
Mauricio
make diff.
That's all.
*** common.php Tue Mar 29 05:32:52 2005
--- common.php.nobunobu Mon Apr 4 16:32:26 2005
***************
*** 119,146 ****
$xoopsConfig['xoops_url'] = XOOPS_URL;
$xoopsConfig['root_path'] = XOOPS_ROOT_PATH."/";
-
- // #################### Include site-wide lang file ##################
- if ( file_exists(XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/global.php") ) {
- include_once XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/global.php";
- } else {
- include_once XOOPS_ROOT_PATH."/language/english/global.php";
- }
-
- // ################ Include page-specific lang file ################
- if (isset($xoopsOption['pagetype']) && false === strpos($xoopsOption['pagetype'], '.')) {
- if ( file_exists(XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/".$xoopsOption['pagetype'].".php") ) {
- include_once XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/".$xoopsOption['pagetype'].".php";
- } else {
- include_once XOOPS_ROOT_PATH."/language/english/".$xoopsOption['pagetype'].".php";
- }
- }
- $xoopsOption = array();
-
- if ( !defined("XOOPS_USE_MULTIBYTES") ) {
- define("XOOPS_USE_MULTIBYTES",0);
- }
-
/**#@+
* Host abstraction layer
*/
--- 119,124 ----
***************
*** 263,268 ****
--- 241,308 ----
$xoopsUserIsAdmin = $xoopsUser->isAdmin();
}
}
+ /**
+ * Modify for The Easiest MultiLanguag Hack Enhancement for XOOPS by nobunobu
+ * Original is XOOPS Multilanguages by marcan
+ * Set the languages files, language cookie, etc...
+ **/
+
+ // Validation to be sure that no malicious code is include in sel_lang
+ function validateLanguage($easiestml_lang = '')
+ {
+ include_once XOOPS_ROOT_PATH."/class/xoopslists.php";
+ $easiestml_langs = explode(',', EASIESTML_LANGS);
+ $idx = array_search($easiestml_lang, $easiestml_langs);
+ $easiestml_langnames = explode(',', EASIESTML_LANGNAMES);
+ $easiestml_langname = $easiestml_langnames[$idx];
+ $lang_available = XoopsLists::getLangList();
+
+ If ( ($easiestml_langname != '') && (in_array($easiestml_langname, $lang_available)) ) {
+ return $easiestml_langname;
+ }
+ return false;
+ }
+
+ // If user just switched language, do the change
+ if ((!empty($_GET['easiestml_lang'])) && ($easiestml_langname = validateLanguage($_GET['easiestml_lang']))) {
+ $xoopsConfig['language'] = $easiestml_langname;
+
+ // Save this preference in a cookie, for when user is not logged in yet
+ $xoops_cookie_path = defined('XOOPS_COOKIE_PATH') ? XOOPS_COOKIE_PATH : preg_replace( '?http://[^/]+(/.*)$?' , "$1" , XOOPS_URL ) ;
+ if( $xoops_cookie_path == XOOPS_URL ) $xoops_cookie_path = '/' ;
+ setcookie('easiestml_langname', $easiestml_langname, time() + EASIESTML_COOKIELIFETIME, $xoops_cookie_path, '' , 0);
+
+ unset($_GET['easiestml_lang']);
+ $_SERVER['QUERY_STRING'] = preg_replace('/(^|&)easiestml_lang\=.*$/','',$_SERVER['QUERY_STRING']);
+ $_SERVER['argv'][0] = preg_replace('/(^|&)easiestml_lang\=.*$/','',$_SERVER['argv'][0]);;
+ } else {
+ // The user is anonymous, retreive the selected language from the cookie
+ if ((isset($_COOKIE['easiestml_langname'])) && ($_COOKIE['easiestml_langname'] > '')) {
+ $xoopsConfig['language'] = $_COOKIE['easiestml_langname'];
+ }
+ /** End of The Easiest ML enhancement Hack by nobunobu **/
+ }
+
+ // #################### Include site-wide lang file ##################
+ if ( file_exists(XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/global.php") ) {
+ include_once XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/global.php";
+ } else {
+ include_once XOOPS_ROOT_PATH."/language/english/global.php";
+ }
+
+ // ################ Include page-specific lang file ################
+ if (isset($xoopsOption['pagetype']) && false === strpos($xoopsOption['pagetype'], '.')) {
+ if ( file_exists(XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/".$xoopsOption['pagetype'].".php") ) {
+ include_once XOOPS_ROOT_PATH."/language/".$xoopsConfig['language']."/".$xoopsOption['pagetype'].".php";
+ } else {
+ include_once XOOPS_ROOT_PATH."/language/english/".$xoopsOption['pagetype'].".php";
+ }
+ }
+ $xoopsOption = array();
+
+ if ( !defined("XOOPS_USE_MULTIBYTES") ) {
+ define("XOOPS_USE_MULTIBYTES",0);
+ }
if (!empty($_POST['xoops_theme_select']) && in_array($_POST['xoops_theme_select'], $xoopsConfig['theme_set_allowed'])) {
$xoopsConfig['theme_set'] = $_POST['xoops_theme_select'];
$_SESSION['xoopsUserTheme'] = $_POST['xoops_theme_select'];
Hi maumed!
I'm sorry ,could not provide any English information with my "EMLH enhancement".
I'm trying to add a switching XOOPS Langauage file function to EMLH.
Please come to my site
Nobu Nobu XOOPS and download common.php file.
If you use XOOPS 2.0.9.x, you can try nobunobu's "enhanced EMLH".
go to
http://www.kowa.org/modules/pukiwiki/354.html?easiestml_lang=enand get common.php.
Then overwrite it as include/common.php.
(nobunobu's hacked common.php is based on 2.0.9.3 with my autologin-hack)
Hi GIJOE
Congrats for your hack, its the best - and easiest! - multilanguage hack ive ever seen.
Id like to know if theres a way to set the site lang (ie., the language xoops use for the modules) by clicking the flags of lmimg tag...
Is it possible?
Thanx in advance,
Mauricio
http://www.reikieafins.comPS: Im brazilian, and dont speak english very well.. sorry if its hard to figure out what i mean