1
irmtfan
xoops_getConfigOption( 'language') is wrongly returned
  • 2012/8/13 10:38

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Ok finally after many many investigation i found what is wrong in the xoops header when we change the language in Xlanguage and EMLH

The fact that both modules are failed to load local styles, take me to this point that it should be a bug in xoops 2.5.5
unfortunately we dont have any developer from RTL language countries.
Anyway, I finally found it is because the xoops_getConfigOption('language') function wrongly return the language.

xoops_getConfigOption('language') should be equal to $GLOBALS['xoopsConfig']['language']
but they are different.

so i did a temporary solution like this:
in include/functions.php around line 926:
change the xoops_getConfigOption function like this:
function xoops_getConfigOption($option$type 'XOOPS_CONF')
{
static 
$coreOptions = array();

if (
is_array($coreOptions) && array_key_exists($option$coreOptions)) {
return 
$coreOptions[$option];
}
// START hacked by irmtfan to solve language issue
if ( $option == 'language') {
return 
$GLOBALS['xoopsConfig'][$option];
}
// END hacked by irmtfan to solve language issue

$ret false;
$config_handler =& xoops_gethandler('config');
$configs $config_handler->getConfigsByCat((is_array($type)) ? $type constant($type));
if (
$configs) {
if (isset(
$configs[$option])) {
$ret $configs[$option];
}
}
$coreOptions[$option] = $ret;
return 
$ret;
}


If anybody have better code please contribute.
Now Xlanguage and EMLH can work perfectly. (local stylesheet will be changed based on languages)

bug in the xoops tracker with highest priority:
https://sourceforge.net/tracker/?func=detail&aid=3556902&group_id=41586&atid=430840

2
zyspec
Re: xoops_getConfigOption('language') is wrongly returned
  • 2012/8/13 16:28

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


Sounds like a great find irmtfan! The fix might work under some circumstances but should be fixed properly in the core for the next release. Core developers need to figure out WHY they're different and fix the source of the problem. This could cause problems other places in the core, modules, etc. too if it's just 'patched' here.

There also appears to be a problem if 'type' is passed to this function as an array. The result is that this routine tries to pass the array on to the handler and then execute the 'getConfigsbyCat' method which doesn't know how to handle 'type' as an array. 'getConfigsbyCat' attempts to get the integer value of 'type' (the array), which won't give any meaningful results.

Fortunately this code has all been refactored in 2.6 but we need to get it patched in the 2.5.x series code until then.

3
MACTEP
xoops_getConfigOption ('language') is wrongly returned
  • 2012/8/13 19:45

  • MACTEP

  • Not too shy to talk

  • Posts: 127

  • Since: 2009/4/4 5


Because of the long header corrupted home page.


Resized Image

4
irmtfan
Re: xoops_getConfigOption ('language') is wrongly returned
  • 2012/8/14 6:32

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


zyspec:
thank you for your participation.
IMO this temporary solution is good enough for 2.5.5
Im sure that there is no other function that return the language in 2.5.5.
Also as you said xoops_header, xoops_getConfigOption and all $GLOBALS will be deprecated in 2.6
IMO it is a waste of time for core team to work more on 2.5.5
this is a functional bug not a security bug and just fixed by now.

5
zyspec
Re: xoops_getConfigOption( 'language') is wrongly returned
  • 2012/8/14 12:51

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


irmtfan,

You're right, the core team will need to decide if they want to fix this in the 2.5.x series. As a module developer I hope it's fixed in an upcoming maintenance release - before 2.6. It's not a major architectural change and Xoops 2.6 is 6-9 months away from production level. I'm sure there are others who won't see this in an engish forum thread that need this fixed.

There's an underlying issue that should be looked at to make sure it's not carried forward into the 2.6 series.

6
Mamba
Re: xoops_getConfigOption( 'language') is wrongly returned
  • 2012/8/14 13:08

  • Mamba

  • Moderator

  • Posts: 11366

  • Since: 2004/4/23


Quote:
xoops_getConfigOption('language') should be equal to $GLOBALS['xoopsConfig']['language']
but they are different.

Can you show an example of how they are different?

What it should be, and what it is?

Thanks.
Support XOOPS => DONATE
Use 2.5.10 | Docs | Modules | Bugs

7
irmtfan
Re: xoops_getConfigOption( 'language') is wrongly returned
  • 2012/8/15 4:44

  • irmtfan

  • Module Developer

  • Posts: 3419

  • Since: 2003/12/7


Yes Mamba.
I illustrate the issue for non coders members.
http://www.jadoogaran.org/get_language_xoops255.php
You can download this script and test in any xoops 2.5.5:
http://www.jadoogaran.org/get_language_xoops255.php.zip

As I stated before it is just important for ML websites because single language websites like xoops.org dont need any other language option!!!


Login

Who's Online

222 user(s) are online (115 user(s) are browsing Support Forums)


Members: 0


Guests: 222


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Mar 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits