moderation.php breaking Google SEO redirects
#1
Google SEO partly supports virtual directory structure for urls. Even if no problem is presented using the Combined Styles scheme, the core moderation system gets partly broken.

The reason being the following piece of code within moderation.php:
function moderation_redirect($url, $message="", $title="")
{
 global $mybb;
 if(!empty($mybb->input['url']))
 {
 $url = htmlentities($mybb->input['url']);
 }

 if(my_strpos($url, $mybb->settings['bburl'].'/') !== 0)
 {
 if(my_strpos($url, '/') === 0)
 {
 $url = my_substr($url, 1);
 }
 $url_segments = explode('/', $url);
 $url = $mybb->settings['bburl'].'/'.end($url_segments);
 }

 redirect($url, $message, $title);
}
https://github.com/mybb/mybb/blob/feature/moderation.php#L3528

For whatever reasoning there might be, MyBB breaks the URL in line#3542.

This might not be a bug within MyBB itself but in Google SEO (which doesn't fully supports this feature). However, I lack the ability to benefit behind this code.
Reply
#2
I think this function should be deprecated by using redirect().

I suppose the main reason for it is for the search feature. However, even so there is stuff that makes no sense.
https://github.com/mybb/mybb/blob/dd9606....php#L3282

$return_url = htmlspecialchars_uni($mybb->get_input('url'));
moderation_redirect($return_url, $lang->redirect_customtool_search);

//...

function moderation_redirect($url, $message="", $title="")
{
	global $mybb;
	if(!empty($mybb->input['url']))
	{
		$url = htmlentities($mybb->input['url']);
	}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)