/porte_jeune_place_de_leurope-t3867.
// Rewrite URLs to include the session ID.
function ob_sessrewrite($buffer)
{
global $scripturl, $modSettings, $user_info, $context;
// If $scripturl is set to nothing, or the SID is not defined (SSI?) just quit.
if ($scripturl == '' || !defined('SID'))
return $buffer;
$scripturl1=str_replace("/index.php","",$scripturl);
// Do nothing if the session is cookied, or they are a crawler - guests are caught by redirectexit(). This doesn't work below PHP 4.3.0, because it makes the output buffer bigger.
// !!! smflib
if (empty($_COOKIE) && SID != '' && empty($context['browser']['possibly_robot']) && @version_compare(PHP_VERSION, '4.3.0') != -1 && ($modSettings['seo4smf_enable']!="on"))
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '(?!\?' . preg_quote(SID, '/') . ')(\?)?/', '"' . $scripturl . '?' . SID . '&', $buffer);
// Debugging templates, are we?
elseif (isset($_GET['debug']))
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '(\?)?/', '"' . $scripturl . '?debug;', $buffer);
// This should work even in 4.2.x, just not CGI without cgi.fix_pathinfo.
if (!empty($modSettings['queryless_urls']) && (!$context['server']['is_cgi'] || @ini_get('cgi.fix_pathinfo') == 1) && $context['server']['is_apache'])
{
// Let's do something special for session ids!
if (defined('SID') && SID != '')
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?(?:' . SID . '

((?:board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html?' . SID . '\$2\"'", $buffer);
if ($modSettings['seo4smf_sb_enable'] == "on")
{
$buffer = preg_replace('/<!-- Seo4SMF Social Bookmark -->/', create_sb() , $buffer);
}
if ($modSettings['seo4smf_enable'] == "on")
{
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:board|topic|page)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl1 . '/' . beautify_urls(strtr('\$1', '&;=', '//,')) . '\$2\"'", $buffer);
if ($modSettings['seo4smf_beautify_profiles'] == "on")
{
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?action=profile;u=([^#"]+?)?"/e', "'\"' . \$scripturl1 . '/' . beautify_url_profiles(strtr('\$1', '&;=', '//,')) . '\$2\"'", $buffer);
}
if ($modSettings['seo4smf_beautify_actions'] == "on")
{
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?action=([^#"]+?)?"/e', "'\"' . \$scripturl1 . '/' . beautify_url_action('\$1'). '\$2\"'", $buffer);
}
if ($modSettings['seo4smf_keywords'] == "on")
{
$buffer = preg_replace('<meta name="keywords" content=(.*) />', create_keywords() , $buffer);
}
if ($modSettings['seo4smf_description'] == "on")
{
$buffer = preg_replace('<meta name="description" content=(.*) />', create_description() , $buffer);
}
$buffer = preg_replace('/<a href=\"http:\/\/www.simplemachines.org\/about\/copyright.php\" title=\"Free Forum Software\" target=\"_blank\">SMF © 2006-2007, Simple Machines LLC<\/a>/', '<a href="http://www.simplemachines.org/about/copyright.php" title="Free Forum Software" target="_blank">SMF © 2006-2007, Simple Machines LLC</a><br /> <a href="http://www.webmasterstalks.com" target="blank_">Seo4Smf v0.2 © Webmaster\'s Talks</a>' , $buffer);
$buffer = preg_replace('/<a href=\"http:\/\/www.simplemachines.org\/about\/copyright.php\" title=\"Free Forum Software\" target=\"_blank\">SMF © 2006, Simple Machines LLC<\/a>/', '<a href="http://www.simplemachines.org/about/copyright.php" title="Free Forum Software" target="_blank">SMF © 2006, Simple Machines LLC</a><br /> <a href="http://www.webmasterstalks.com" target="blank_">Seo4Smf v0.2 © Webmaster\'s Talks</a>' , $buffer);
$buffer = preg_replace('/<a href=\"http:\/\/www.simplemachines.org\/about\/copyright.php\" title=\"Free Forum Software\" target=\"_blank\">SMF © 2001-2006, Lewis Media<\/a>/', '<a href="http://www.simplemachines.org/about/copyright.php" title="Free Forum Software" target="_blank">SMF © 2001-2006, Simple Machines, Lewis Media</a><br /> <a href="http://www.webmasterstalks.com" target="blank_">Seo4Smf v0.2 © Webmaster\'s Talks</a>' , $buffer);
}
else
{
$buffer = preg_replace('/"' . preg_quote($scripturl, '/') . '\?((?:board|topic)=[^#"]+?)(#[^"]*?)?"/e', "'\"' . \$scripturl . '/' . strtr('\$1', '&;=', '//,') . '.html\$2\"'", $buffer);
}
}
// Return the changed buffer.
return $buffer;
}
?>