Hi
This is the script I was telling you about via PM. It's originally for converting webbbs to cyboards. In the next post I will have what I used to convert the cyboards over to threads (keep in mind that this is written with a postnuke membership in mind.. Be farwarned, it ain't pretty, but it served my purposes.
Take the two and compare them. Between them you should be able to come up with something.
On another note, the first script was taken from a webbs to phorum script. I thought I saw somewhere a phorum to UBBT script somewhere on the UBB site. You might check that out as well.
If you need further assistance, I'll do what I can. Here's the webbbs2cyboards.php script:
code:
<?php
/*
WebBBS to Cyboard 1.25 Converter
Original script was for converting WebBBS to Phorum
Modified for Cyboards by Mark Summerlin
Thanks to Jason Birch for writing the original for Phorum conversion
Version: 1.0
Applies to:
WebBBS Version 4.33 (and maybe others...)
Cyboard Version 1.25b
This little script pulls the contents of WebBBS
text files and writes them to a SQL file for easy
addition to previously created forum tables. It
resets the ID ordering (starting at 1) and creates
thread numbers.
mysql [parameters] < tablename.sql
Bugz:
- If the parent of a post has been deleted, its
thread will be set it its ID. Not sure how to
work around this one...
- No error checking for files exist (read or write)
*/
// *************** Config ******************
// Be sure to include the trailing slash on these
// directories. The script will crash if you do not.
// Where are the WebBBS files.
$strWebBBSLocation = "./bbs0/";
// Where do you want the output stored?
$strOutputDir = "./testbbs/";
// what is the main table name for the Cyboard?
$strCyboardTable = "board_data";
// ************** End Config ****************
// Set up char month to num month translation array
$aryMonths = array( "January" => "01",
"February" => "02",
"March" => "03",
"April" => "04",
"May" => "05",
"June" => "06",
"July" => "07",
"August" => "08",
"September" => "09",
"October" => "10",
"November" => "11",
"December" => "12"
);
// Initialize an array to hold the input file information
$aryInput[] = array ( 'ID' => 0,
'PREVIOUS' => 0,
'THREAD' => 0
) ;
// Build an array of numeric files in current directory
$dirCurrent = dir("$strWebBBSLocation");
$c = 0;
while ($strTemp = $dirCurrent->read() ) {
if ( (ereg_replace("[^0-9]","",$strTemp) == $strTemp) &&
( !empty ($strTemp) ) ) {
$aryFiles[$c] = (int) $strTemp;
$c++;
}
}
$dirCurrent->close();
// sort the array
sort ($aryFiles);
// set up output names
$strMainFile = $strOutputDir.$strCyboardTable.".sql";
$strCyboardBodies = $strCyboardTable."_bodies";
$strBodiesFile = $strOutputDir.$strCyboardBodies.".sql";
print "Processing WebBBS files into sql statements";
$fpCyboard = fopen($strMainFile, "w");
// Grab contents of files into an array
for ($b=0 ; $b < count($aryFiles); $b++) {
$strFile = $aryFiles[$b];
// Set ID to current record counter
$aryInput[$strFile]['ID'] = $b + 1;
$body = "";
$aryCurrFile = file ($strWebBBSLocation.$strFile);
for ($a = 0; $a < count($aryCurrFile); $a++ ) {
$strLine = $aryCurrFile[$a];
// pull lines into either specified tags or the body
if ( ereg ("^SUBJECT>",$strLine) ||
ereg ("^ADMIN>",$strLine) ||
ereg ("^POSTER>",$strLine) ||
ereg ("^EMAIL>",$strLine) ||
ereg ("^DATE>",$strLine) ||
ereg ("^EMAILNOTICES>",$strLine) ||
ereg ("^IP_ADDRESS>",$strLine) ||
ereg ("^PASSWORD>",$strLine) ||
ereg ("^NEXT>",$strLine) ||
ereg ("^IMAGE>",$strLine) ||
ereg ("^LINKNAME>",$strLine) ||
ereg ("^LINKURL>",$strLine) ) {
$tag = strtolower(trim(substr($strLine,0,strpos($strLine,">"))));
$value = trim(substr($strLine,strpos($strLine,">") + 1,strlen($strLine) - 1));
$$tag = $value;
} elseif ( ereg ("^PREVIOUS>",$strLine) ) {
$value = trim(substr($strLine,strpos($strLine,">") + 1,strlen($strLine) - 1));
$aryInput[$strFile]['PREVIOUS'] = $value;
} else {
$body .= trim($strLine);
}
}
// clean up body to format used by Cyboard
$body = trim(ereg_replace('<P>',"",ereg_replace('<BR>',"\n",$body)));
// attempt to assign threads
if (empty ($aryInput[$strFile]['PREVIOUS'])) {
$aryInput[$strFile]['THREAD'] = $aryInput[$strFile]['ID'];
} else {
$aryInput[$strFile]['THREAD'] = $aryInput[($aryInput[$strFile]['PREVIOUS'])]['THREAD'] ;
$aryInput[$strFile]['PREVIOUS'] = $aryInput[($aryInput[$strFile]['PREVIOUS'])]['ID'] ;
}
// trim IP_ADDRESS to actual IP_ADDRESS.
$ip_address = trim(substr($ip_address,strrpos($ip_address,":")+1,strlen($ip_address)));
// If you care about host names (and don't mind the slowdown) comment this line in:
// $ip_address = gethostbyaddress($ip_address);
// Fix up date format
// Wednesday, 10 February 1999, at 7:52 p.m. --> YYYY-MM-DD HH:MM:SS
$tmpDate = trim(ereg_replace(',','',$date));
list ($junk,$day,$cmon,$year,$junk2,$time,$tod) = explode (" ",$tmpDate);
list ($hour,$minute) = explode (":",$time);
$month = $aryMonths["$cmon"];
if ( substr($tod,0,1) == "p") { $hour += 12; }
// $datestamp = date("Y-m-d H:i:s",mktime($hour,$minute,0,$month,$day,$year));
$datestamp = date("Y-m-d H:i:s",mktime(0,0,$date -18000,1,1,1970));
// ouput values to screen (debug only)
print " .";
// set up and write insert commands to sql files
$id = $aryInput[$strFile]['ID'];
$thread = $aryInput[$strFile]['THREAD'];
if (empty ($thread)) { $thread = $id; }
$parent = $aryInput[$strFile]['PREVIOUS'];
$subject = addslashes($subject);
$body = addslashes(stripslashes($body));
$poster = addslashes($poster);
$linkname = addslashes($linkname);
$email_reply = 'N';
$good = fputs($fpCyboard, "Insert Into $strCyboardTable (id, board, thread, parent, author, email, subject, body, datestamp, ip, host, vipflag, link, linkname, image, locked, sticky, email_replies, hide_email) values ('$id', '1', '$thread', '$parent', '$poster', '$email', '$subject', '$body', '$datestamp', '$ip_address', '', '', '$linkurl', '$linkname', '$image', '0', '0', '0', '0');\n");
}
$null = fclose($fpCyboard);
print "Done!";
?>