Vanilla 1.1.5 is a product of Lussumo. More Information: Documentation, Community Support.
Help keep Vanilla free:<?php
/*
Description: Redirects urls from phpBB to their Vanilla counterparts. The script
assumes you have migrated your phpBB database with a migrator that leaves the
"legacy" phpBB IDs in the Vanilla database. It also requires that you redirect
your old traffic to this file. The following two .htaccess lines should do the
trick:
RewriteRule ^viewforum.php /phpbbredirect.php [NC,QSA,L]
RewriteRule ^viewtopic.php /phpbbredirect.php [NC,QSA,L]
This script is known to handle mod_rewrite url-writing as well as having the
Vanilla forum live in a subdirectory. On errors it should fail nicely.
I'm sure this could be done more elegantly as an add-on, but this works for me
so I'm calling this project "done." :-) Please feel free to improve on this
code; I hereby release it into the public domain.
Cheers,
Luke
*/
include("appg/settings.php");
$Configuration['SELF_URL'] = 'redirect.php';
include("appg/init_ajax.php");
include($Configuration['LIBRARY_PATH'].'Vanilla/Vanilla.Functions.php');
$PhpBBForumID = ForceIncomingInt('f', 0);
$PhpBBTopicID = ForceIncomingInt('t', 0);
$PhpBBPostID = ForceIncomingInt('p', 0);
$PhpBBUserID = ForceIncomingInt('u', 0);
if ($PhpBBForumID > 0) {
$s = $Context->ObjectFactory->NewContextObject($Context, 'SqlBuilder');
$s->SetMainTable('Category', '');
$s->AddSelect(array('phpBBforumid', 'CategoryID'), '');
$s->AddWhere('', 'phpBBforumid', '', $PhpBBForumID, '=');
$ResultSet = $Context->Database->Select($s, 'PhpBBRedirector', 'SpaghettiCode', 'Error looking up CategoryID.');
$Row = $Context->Database->GetRow($ResultSet);
$CategoryID = $Row['CategoryID'];
if (!($CategoryID > 0)) {
header("location: ".GetUrl($Configuration, "index.php"));
die();
}
header("location: ".GetUrl($Context->Configuration, 'index.php', '', 'CategoryID', $CategoryID));
die();
}
if (($PhpBBTopicID > 0) || ($PhpBBPostID > 0)) {
$s = $Context->ObjectFactory->NewContextObject($Context, 'SqlBuilder');
if ($PhpBBTopicID > 0) {
$s->SetMainTable('Discussion', '');
$s->AddSelect(array('phpBBtopicid', 'DiscussionID'), '');
$s->AddWhere('', 'phpBBtopicid', '', $PhpBBTopicID, '=');
} else {
$s->SetMainTable('Comment', '');
$s->AddSelect(array('phpBBpostid', 'DiscussionID'), '');
$s->AddWhere('', 'phpBBpostid', '', $PhpBBPostID, '=');
}
$ResultSet = $Context->Database->Select($s, 'PhpBBRedirector', 'SpaghettiCode', 'Error looking up DiscussionID.');
$Row = $Context->Database->GetRow($ResultSet);
$DiscussionID = $Row['DiscussionID'];
if (!($DiscussionID > 0)) {
header("location: ".GetUrl($Configuration, "index.php"));
die();
}
$DiscussionManager = $Context->ObjectFactory->NewContextObject($Context, 'DiscussionManager');
$Discussion = $DiscussionManager->GetDiscussionById($DiscussionID);
header("location: ".GetUnreadQuerystring($Discussion, $Configuration));
die();
}
/*
* Theoretically, one could catch phpBB's "profile.php?mode=viewprofile&u=__"
* links and redirect those too, using much the same idea. But I'll leave
* that as an exercise to the reader. :-)
*/
// if ($PhpBBUserID > 0) {
// }
// If all else fails...
header("location: ".GetUrl($Configuration, "index.php"));
die();
?>
1 to 2 of 2