PEAK XOOPS - Easiestml hack and xoops languages in englishin japanese

Easiestml hack and xoops languages

  • You cannot open a new topic into this forum
  • Guests cannot post into this forum
Previous post - Next post | Parent - Children.1 .2 | Posted on 2005/3/21 11:37
maumed  企霹始   Posts: 9
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.com

PS: Im brazilian, and dont speak english very well.. sorry if its hard to figure out what i mean
Votes:0 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2005/3/26 23:30
maumed  企霹始   Posts: 9
any ideas about that?

[]s
Mauricio
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2005/4/4 16:21
GIJOE  黎扦烦菱   Posts: 4110
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=en

and 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)
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2005/4/5 2:57
maumed  企霹始   Posts: 9
Hi, GIJOE!

this page is stated as "Under construction"... and i cant get absolutely nothing from the japanese version... can you give me some directions, please? what is the "enhanced EMLH"? And can you provide a direct link for download of the hack?

thanx in advance...
Mauricio
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2005/4/5 7:51
nobunobu  惧霹始   Posts: 25
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.
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2005/4/5 8:51
maumed  企霹始   Posts: 9
hi, nobunobu!

thanx for your reply.

but i want to know (if its not to ask so much) if you can tell me exactly what changes you did in common.php... cause theres already some hacks on my site, and some changes in my common.php.

i would be gratefull if you can help me, cause your hack seems to be exactly what i was looking for...

thanx in advance,
Mauricio
Votes:0 Average:0.00
Previous post - Next post | Parent - Children.1 | Posted on 2005/4/5 17:35
GIJOE  黎扦烦菱   Posts: 4110
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'];
Votes:1 Average:0.00
Previous post - Next post | Parent - No child | Posted on 2005/4/6 3:51
maumed  企霹始   Posts: 9
thanx a lot!

ill adjust my common.php right now

[]s
Mauricio
Votes:0 Average:0.00

  Advanced search


Login
Username or e-mail:

Password:

Remember Me

Lost Password?

Register now!