So I'm switching a forum from SMF to vBulletin and the ONLY issue I need to resolve is 301 redirecting all the OLD links to the corresponding page on the NEW forum.
vBulletin staff wrote a script that is designed to parse the old link structure and relate it to the new link structure. It was written to work with phpBB, IPB and some others but there is no SMF support.
So... I need to customize it which - surprise, surprise - I can't do. Anyone mind helping me on this?
Here is the URL structure for the SMF forum I was using:
So using this information to "parse" the urls, you need to customize the following script (which works in conjunction with a database). This is the first "basic" chunk that needs customizing which I can do... but probably need to know it for the next part:
And this is example of the code for PHPBB2 which needs to be converted/altered/customized to work with the SMF links:
I know I'm "reaching" with this but all people on VB.org/com are tarded and won't answer me and I'm kind of in need so I figured it can't hurt to ask. For a PHP whiz I imagine it wouldn't even take that long.
In the famous words of someone else on this forum who I forget so I cannot name:
Discuss
vBulletin staff wrote a script that is designed to parse the old link structure and relate it to the new link structure. It was written to work with phpBB, IPB and some others but there is no SMF support.
So... I need to customize it which - surprise, surprise - I can't do. Anyone mind helping me on this?
Here is the URL structure for the SMF forum I was using:
Code:
Forums look like this:
http://mysite.com/index.php?board=5.0
Threads look like this:
http://mysite.com/index.php/topic,775.0.html
Posts look like this:
http://mysite.com/index.php/topic,54...2.html#msg3252
So using this information to "parse" the urls, you need to customize the following script (which works in conjunction with a database). This is the first "basic" chunk that needs customizing which I can do... but probably need to know it for the next part:
Code:
// System
#Currently supported : 'phpBB2' 'ubb.threads' 'vb3' 'ipb2'
$old_system = 'phpBB2';
// Domain
// Example :: http://www.example.com/phpBB/
$old_folder = 'phpBB/'; // With trailing slash
$old_ext_type = '.php'; // Including preceding dot
$standard_404 = 'http://www.example.com/not_found.html'; // The usual 404 that this script replaces
// Example :: www.example.com/vBulletin/
$new_domain = 'example';
$new_folder = 'vBulletin/'; // With trailing slash
$ext_type = '.php'; // File extension type that vBulletin is using, i.e. index.php including the preceding dot
And this is example of the code for PHPBB2 which needs to be converted/altered/customized to work with the SMF links:
Code:
#############################################################################################################################
#
# Customise below this line to match your URL's and/or remove the systems you don't need
#
#############################################################################################################################
$old_id = 0;
$action_code = 0;
$action = null;
$sql = null;
$page = null;
$postcount = null;
// Get the file names and types
switch ($old_system)
{
case 'phpBB2' :
$old_forum_script = "viewforum{$old_ext_type}?f=";
$old_thread_script = "viewtopic{$old_ext_type}?t=";
$old_post_script = "viewtopic{$old_ext_type}?p=";
$old_user_script = "profile{$old_ext_type}?mode=viewprofile&u="; // Append userid
break;
case 'ubb.threads' :
$old_forum_script = "postlist{$old_ext_type}?"; // postlist.php?Cat=&Board=beadtechniques -- have to try to do it on title
$old_thread_script = "showflat{$old_ext_type}?"; // Cat=&Board=beadtechniques&Number=74690&page=0&view=collapsed&sb=5&o=&fpart=1Greg Go for Number=XX
$old_post_script = "showthreaded{$old_ext_type}?"; // ubbthreads/showthreaded.php?Cat=&Board=othertopics&Number=79355&page=0&view=collapsed&sb=5&o=&fpart=1 -- going to thread link, not post, meh
$old_user_script = "showprofile{$old_ext_type}"; // ubbthreads/showprofile.php?Cat=&User=SaraSally&Board=isgbannounce&what=ubbthreads&page=0&view=collapsed&sb=5&o -- username
break;
case 'vb3' :
$old_forum_script = "forumdisplay{$old_ext_type}?f=";
$old_thread_script = "showthread{$old_ext_type}?p=";
$old_post_script = "showpost{$old_ext_type}?p=";
$old_user_script = "member{$old_ext_type}?u=";
break;
case 'ipb2' : // Single file controller, these are here for refrence, the preg_match finds the actual type during the matching
$old_forum_script = "showforum="; // index.php?showforum=X
$old_thread_script = "index.php?showtopic=";
$old_post_script = "index.php?"; // index.php?s=&showtopic=209664&view=findpost&p=XXXXXXXX
$old_user_script = "index.php?showuser="; // index.php?showuser=XXXXX
break;
default :
// No valid system entered
die('No valid system entered');
}
// It's for the old forum
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}") === 0)
{
switch ($old_system)
{
case 'phpBB2' :
// It's a forum link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_forum_script}") === 0)
{
$action = 'forum';
$old_id = intval(substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?f=')+3));
$sql = "SELECT forumid FROM {$tableprefix}forum WHERE importforumid={$old_id}";
}
// It's a thread link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_thread_script}") === 0)
{
$action = 'thread';
if( preg_match("/&/", $_SERVER['REQUEST_URI']) )
{
$old_id = intval(substr(substr($_SERVER['REQUEST_URI'], 2), 0, strpos(substr($_SERVER['REQUEST_URI'], 2), '&')));
$sql = "SELECT threadid FROM {$tableprefix}thread WHERE importthreadid={$old_id}";
}
else
{
$old_id = intval(substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?t=')+3));
$sql = "SELECT threadid FROM {$tableprefix}thread WHERE importthreadid={$old_id}";
}
}
// It's a post link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_post_script}") === 0)
{
$action = 'post';
if( preg_match("/&/", $_SERVER['REQUEST_URI']) )
{
$old_id = intval(substr(substr($_SERVER['REQUEST_URI'], 2), 0, strpos(substr($_SERVER['REQUEST_URI'], 2), '&')));
$sql = "SELECT postid FROM {$tableprefix}post WHERE importpostid={$old_id}";
}
else
{
$old_id = intval(substr($_SERVER['REQUEST_URI'], strpos($_SERVER['REQUEST_URI'], '?p=')+3));
$sql = "SELECT postid FROM {$tableprefix}post WHERE importpostid={$old_id}";
}
}
// It's a user link
if (strpos($_SERVER['REQUEST_URI'], "/{$old_folder}{$old_user_script}") === 0)
{
$action = 'user';
// Cuts 12 out of this : profile.php?mode=viewprofile&u=12&sid=f646e2a0948e0244ba82cef12c3b93d8
$old_id = intval(substr(substr($_SERVER['REQUEST_URI'], 19), 0, strpos(substr($_SERVER['REQUEST_URI'], 19), '&')));
$sql = "SELECT userid FROM {$tableprefix}user WHERE importuserid={$old_id}";
}
I know I'm "reaching" with this but all people on VB.org/com are tarded and won't answer me and I'm kind of in need so I figured it can't hurt to ask. For a PHP whiz I imagine it wouldn't even take that long.
In the famous words of someone else on this forum who I forget so I cannot name:
Discuss