×
Kunena 5.2.6 released and Blue eagle 1.6.6 released (25 Jul 2021)

The Kunena team has announce the arrival of Kunena 5.2.6 [K 5.2.6] which is now available for download as a native Joomla extension for J! 3.9.x. This version addresses most of the issues that were discovered in K 5.2 and issues discovered during the development stages of K 5.2.6

Question K 1.0.9 search function php error

More
12 years 5 months ago - 12 years 5 months ago #1 by mraab
Hi,

I am using Kunena 1.0.9 on Joomla 1.5.9 on www.deutscheinmelbourne.net. Using the search function returns the following error:

Fatal error: Call to undefined function mb_substr() in /home/austral/public_html/www.deutscheinmelbourne.net/components/com_kunena/lib/kunena.search.class.php on line 264.

Does anybody have an idea what triggers this error?

Thanks,
Matthias

Deutsche in Melbourne | Deutsche in Perth |
Deutsche in Brisbane |
Last edit: 12 years 5 months ago by mraab.

Please Log in or Create an account to join the conversation.

More
12 years 5 months ago #2 by Matias
It looks like Joomla defines some of mb_* functions, but not them all.

In components/com_kunena/class.kunena.php find:
if (!function_exists('mb_detect_encoding')) {
 
  function mb_detect_encoding($text) {
	$c=0; $b=0;
	$bits=0;
	$len=strlen($text);
	for($i=0; $i<$len; $i++){
		$c=ord($text[$i]);
		if($c > 128){
			if(($c >= 254)) return 'ISO-8859-1';
			elseif($c >= 252) $bits=6;
			elseif($c >= 248) $bits=5;
			elseif($c >= 240) $bits=4;
			elseif($c >= 224) $bits=3;
			elseif($c >= 192) $bits=2;
			else return 'ISO-8859-1';
			if(($i+$bits) > $len) return 'ISO-8859-1';
			while($bits > 1){
				$i++;
				$b=ord($text[$i]);
				if($b < 128 || $b > 191) return 'ISO-8859-1';
				$bits--;
			}
		}
	}
	return 'UTF-8';
 
  }
 
  function mb_convert_encoding($text,$target_encoding,$source_encoding=NULL) {
 
	return $text;
 
  }
  function mb_substr($str, $start, $lenght=NULL, $encoding=NULL) {
	if ($lenght===NULL) $lenght = strlen($str);
	return substr($str, $start, $lenght);
  }
 
}

And replace it with:
if (!function_exists('mb_detect_encoding')) {
 
  function mb_detect_encoding($text) {
	$c=0; $b=0;
	$bits=0;
	$len=strlen($text);
	for($i=0; $i<$len; $i++){
		$c=ord($text[$i]);
		if($c > 128){
			if(($c >= 254)) return 'ISO-8859-1';
			elseif($c >= 252) $bits=6;
			elseif($c >= 248) $bits=5;
			elseif($c >= 240) $bits=4;
			elseif($c >= 224) $bits=3;
			elseif($c >= 192) $bits=2;
			else return 'ISO-8859-1';
			if(($i+$bits) > $len) return 'ISO-8859-1';
			while($bits > 1){
				$i++;
				$b=ord($text[$i]);
				if($b < 128 || $b > 191) return 'ISO-8859-1';
				$bits--;
			}
		}
	}
	return 'UTF-8';
 
  }
 
}
if (!function_exists('mb_convert_encoding')) {
 
  function mb_convert_encoding($text,$target_encoding,$source_encoding=NULL) {
 
	return $text;
 
  }
}
if (!function_exists('mb_substr')) {
 
  function mb_substr($str, $start, $lenght=NULL, $encoding=NULL) {
	if ($lenght===NULL) $lenght = strlen($str);
	return substr($str, $start, $lenght);
  }
 
}

Please Log in or Create an account to join the conversation.

  • Not Allowed: to create new topic.
  • Not Allowed: to reply.
  • Not Allowed: to edit your message.
Time to create page: 0.077 seconds