Xaraya error in module configuration

maravizzo
maravizzo's picture

Joined: 2005-09-11
Posts: 49
Posted: Tue, 2005-09-20 16:22

Hi,
I've installed G2 (the last release) in Xaraya rc3.
G2 appears correctly among the Xaraya modules, then I go to "Modify Config" to tell xaraya where is installed G2, but when I click on "Update Configuartion" I get this error message:

System Error
At: /home/web/www.domain.com/public_html/modules/gallery2/xaradmin/updateconfig.php (Line: 51) mb_ereg_replace(): mbregex compile err: premature end of regular expression

This is the line 51 of updateconfig.php:
$g2RelativeUrl = trim(ereg_replace("[\]", "//", $path['g2-relative-url']));

In my case xaraya is in Document Root: www.domain.com/index.php. G2 is installed in www.domain.com/gallery2/main.php. The relative path I type is "gallery2/"

Any idea of what's wrong?
thank you
Matteo

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-09-20 16:43

hmm, weird. never seen this before and never seen a regexp expression break on one install and not on all.

Quote:
mb_ereg_replace(): mbregex compile err:

never seen a mb_ereg error/notice either. mb is for multibyte characters. obviously it uses mb_ functions instead of normal ereg functions in your case.

but obviously, you're not the first user to have a problem with the mb_ functions:
http://www.google.com/search?hl=en&q=mb_ereg_replace%28%29%3A+mbregex+compile+err%3A&btnG=Google+Search

maybe if i use preg_ instead of ereg_, it will work. oh wait, i don't need regexp here:

try replacing:
$g2RelativeUrl = trim(ereg_replace("[\]", "//", $path['g2-relative-url'])); with
$g2RelativeUrl = trim(str_replace('\', '/', $path['g2-relative-url'])); and let me know if it works

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Tue, 2005-09-20 16:54

wait, better replace the whole section with:

		// first replace all '\' by '/'
		$g2RelativeUrl = trim(str_replace("\\", "/", $path['g2-relative-url']));
		// then remove any trailing '/' if there is one and add a '/'
		$g2RelativeUrl = preg_replace('|/$|', '', $g2RelativeUrl);
		$g2RelativeUrl = $g2RelativeUrl . '/';
		// remove './' from the beginning
		$g2RelativeUrl = preg_replace('|^\./|', '', $g2RelativeUrl);
		// if the path is absolute, don't accept it.
		if (preg_match('|^/|', $g2RelativeUrl)) {
 
maravizzo
maravizzo's picture

Joined: 2005-09-11
Posts: 49
Posted: Wed, 2005-09-21 09:22

Thank you very much valiant!
I don't know what preg_ and ereg_ are at all, but with your replacement everything works perfectly :)
Ciao
Matteo

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-09-21 12:37

thanks for letting me know. now in cvs.