All pastes #392337 Raw Edit

JayBachatero

public php v1 · immutable
·published 2007-03-12 20:19 UTC
rendered paste body
	$str = urldecode($_SERVER['REQUEST_URI']);	if (preg_match('~(categories|forum)/(.*?)$~', $str, $matches) && !empty($modSettings['smfbb_enable_pretty']))	{		// Clean it.		$name = str_replace(array(' ', '+'), '_', $matches[2]);		$name = $smfFunc['htmlspecialchars']($name, ENT_QUOTES);		if ($matches[1] == 'categories')			// Does this category exists?			$request = $smfFunc['db_query']('', "				SELECT id_cat				FROM {$smfbb_prefix}categories				WHERE cat_name_pretty = '$name'", __FILE__, __LINE__);		elseif ($matches[1] == 'forum' && !is_numeric($matches[1]))		       // Is there a board with this name?		       $request = $smfFunc['db_query']('', "		       		SELECT id_forum		       		FROM {$smfbb_prefix}forums		       		WHERE forum_name_pretty = '$name'", __FILE__, __LINE__);		elseif ($matches[1] == 'forum' && is_numeric($matches[1]))       		       $id = (int) $matches[2];		else			$id = 0;		// Do we have a result?		if (isset($request) && $smfFunc['db_num_results']($request) == 1)		{			list ($id) = $smfFunc['db_fetch_row']($request);			$smfFunc['db_free_result']($request);		}		// Did we match anything?		if (!empty($id))		{			$_GET = array(				'action' => $match[1],				'id' => $id,			);			$_REQUEST = $_POST + $_GET;		}	}	unset($str, $matches);