iTrader and vBSEO Error

shortiee4

New Member
Hello all.

I have vBSEO installed on my forum along with iTrader. I'm using vB 3.7.3 Patch Level 1, vBSEO 3.2.0 Gold, and iTrader 2.1.0 (Interim Release).

If anyone knows how to get iTrader to verify the links in the rewritten vBSEO format, please respond. I know its possible, I've seen sites using both addons together before.

Thank you.
 
I sort of solved the problem.

In functions_itrader.php which is in your includes folder once iTrader is installed.

You can change the function itrader_checkurl to always return true. So all urls are valid.

Find:
PHP:
function itrader_checkurl($dealurl)
{
	global $vbulletin;

	// Make it all lowercase and decode potential & characters.	
	$parsedurl = parse_url(html_entity_decode(strtolower($dealurl)));

	// If it can't be parsed then something is seriously wrong so bypass the rest of the checks.
	if($parsedurl !== false)
	{
		// Make sure they put a 'http://' in there.
		if($parsedurl['scheme'] != 'http')
		{
			return false;
		}

		// We want to do some detailed URL checking.
		if($vbulletin->options['itrader_stricturl'])
		{
			// Make sure the submitted host can be found somewhere in the forum url.
			if(!strpos(strtolower($vbulletin->options['bburl']),$parsedurl['host']))
			{
				return false;
			}

			// Find the threadid or postid.
			$pieces = explode('&',$parsedurl['query']);
			foreach ($pieces as $piece)
			{
				$check = explode('=',$piece);
				if ($check[0] == 't' OR $check[0] == 'p')
				{
					// The queries are different but all the checks are the same.
					if ($check[0] == 't')
					{
						$result = $vbulletin->db->query_first("SELECT postuserid, forumid
																FROM " . TABLE_PREFIX . "thread AS thread
																WHERE threadid = " . intval($check[1]) . "
						");
					}
					else
					{
						$result = $vbulletin->db->query_first("SELECT postuserid, forumid
																FROM " . TABLE_PREFIX . "post AS post
																LEFT JOIN " . TABLE_PREFIX . "thread AS thread ON (thread.threadid = post.threadid)
																WHERE postid = " . intval($check[1]) . "
						");
					}

					if ($result['postuserid'] != $vbulletin->GPC['userid'] AND $result['postuserid'] != $vbulletin->userinfo['userid'])
					{
						// One of the two people in the deal should be the thread creator.
						return false;
					}

					if ($vbulletin->options['itrader_forumsurl'])
					{
						$forums = explode(',', $vbulletin->options['itrader_forumsurl']);
						if(!in_array($result['forumid'],$forums))
						{
							// Thread doesn't match up with the list of forumids in the admincp.
							return false;
						}
					}
					
					// Passed All The Tests! Woohoo!
					return true;
				} // found thread or post
			} // foreach

			// None of the piece matched!
			return false;
		}
		else
		{
			// It passed the http:// check and skipped strict checking.
			return true;
		}
	} // Failed the baisc parse_url function
	return false;
}

Change To:

PHP:
function itrader_checkurl($dealurl)
{
	return true;
}

Kind of a hack way to fix it but it sure works :)
 
Back
Top