Login

mvnForum

mvnForum Homepage Welcome Guest
  Search  
  Index  | Recent Threads  | Unanswered Threads  | List Polls  | Public Albums  | Who's Online  | Help


Quick Go »


No member browsing this thread
Thread Status: Active
Thread Type: Announcement Thread
Total posts in this thread: 24
Posts: 24   Pages: 3   [ Previous Page | 1 2 3 | Next Page ]
Post new Thread
Author
Previous Thread This topic has been viewed 12011 times and has 23 replies Next Thread
Male minhnn
mvnForum Developer
Member's Avatar

Vietnam
Joined: Oct 16, 2002
Post Count: 2956
Status: Offline
Reply to this Post  Reply with Quote 
Re: phpBB to mvnForum converter available

Humm, after convertion, I've some problems with 'Rebuild Post Search Index'

RC4 has problem of rebuilding a lot of posts. This has been fixed in the 1.0 GA dev. Please check out CVS and use the latest CVS version (currently it is in the stable status)

Cheers smile
----------------------------------------
Minh Nguyen
mvnForum Developer
Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com

http://www.DienDanLinux.org
[Jun 9, 2005 7:16:15 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.MyVietnam.net    minhnn_mvn [Link] Report threatening or abusive post: please login first  Go to top 
Female redzara
Stranger




Joined: Apr 10, 2005
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
Re: phpBB to mvnForum converter available

Thanks, I've to try it

I've founded an error in convertion script

In public static void migrateposts(Connection php, Connection mvn, PrintStream ostream) throws SQLException

After :
String MemberID = RS.getString("poster_id");

Add :
if(RS.getInt("poster_id") == -1) {
MemberID="2";
}


If you have previously enable Guest posting

And if you want to convert BBcode & smilies, you can replace function wrapit by:

public static String wrapit(String text)
{
StringBuffer strbuf = new StringBuffer();
strbuf.append('\'');
for(int i=0; i<text.length(); i++)
{
if(text.charAt(i) == '\'' )
// redzara mod
// strbuf.append("\\\'");
strbuf.append("\'\'");
else
strbuf.append(text.charAt(i));
}
strbuf.append('\'');

// redzara add
String result = strbuf.toString();
// correct smilies
// smile
result = result.replaceAll("(.*):\\)(.*)", "$1\\[:\\)\\]$2");
// sad
result = result.replaceAll("(.*):\\((.*)", "$1\\[:\\(\\]$2");
// big grin
result = result.replaceAll("(.*):D(.*)", "$1\\[:D\\]$2");
// laughing
result = result.replaceAll("(.*):lol:(.*)", "$1\\[:\\)\\)\\]$2");
// crying
result = result.replaceAll("(.*):cry:(.*)", "$1\\[:\\(\\(\\]$2");
// wink
result = result.replaceAll("(.*):wink:(.*)", "$1\\[;\\)\\]$2");
// blushing
result = result.replaceAll("(.*):oops:(.*)", "$1\\[:\">\\]$2");
// tongue
result = result.replaceAll("(.*):p(.*)", "$1\\[:p\\]$2");
// cool
result = result.replaceAll("(.*)8\\)(.*)", "$1\\[B-\\)\\]$2");
// confused
result = result.replaceAll("(.*):\\?(.*)", "$1\\[:-/\\]$2");
// shock
result = result.replaceAll("(.*):shock:(.*)", "$1\\[:O\\]$2");
// devil
result = result.replaceAll("(.*):evil:(.*)", "$1\\[>:\\)\\]$2");

// correct BBcodes
// url
result = result.replaceAll("(.*)\\[url\\](.*)\\[/url\\](.*)", "$1\\[url=$2\\]$2\\[/url\\]$3");
// bold
result = result.replaceAll("(.*)\\[b:[0-9,abcdef]*\\](.*)\\[/b:[0-9,abcdef]*\\](.*)", "$1\\[b\\]$2\\[/b\\]$3");
// underline
result = result.replaceAll("(.*)\\[u:[0-9,abcdef]*\\](.*)\\[/u:[0-9,abcdef]*\\](.*)", "$1\\[u\\]$2\\[/u\\]$3");
// italic
result = result.replaceAll("(.*)\\[i:[0-9,abcdef]*\\](.*)\\[/i:[0-9,abcdef]*\\](.*)", "$1\\[i\\]$2\\[/i\\]$3");
// color
result = result.replaceAll("(.*)\\[color=([a-z]*):[0-9,abcdef]*\\](.*)\\[/color:[0-9,abcdef]*\\](.*)", "$1\\[color=$2\\]$3\\[/color\\]$4");
return result;
}

[Jun 10, 2005 1:17:36 PM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male anandh
Newbie




Joined: May 22, 2005
Post Count: 21
Status: Offline
Reply to this Post  Reply with Quote 
Re: phpBB to mvnForum converter available

Hi redzara/minhh :

Looks like redzara is making a lot of fixes for the converter. Has the converter been pulled into the mvnForum CVS already ? It would be great to capture all these changes redzara is making.

_anand
[Jun 17, 2005 5:14:55 PM] Show Printable Version of Post    View Member Profile    Send Private Message    http://www.javareference.com [Link] Report threatening or abusive post: please login first  Go to top 
Male minhnn
mvnForum Developer
Member's Avatar

Vietnam
Joined: Oct 16, 2002
Post Count: 2956
Status: Offline
Reply to this Post  Reply with Quote 
Re: phpBB to mvnForum converter available

Hi redzara/minhh :

Looks like redzara is making a lot of fixes for the converter. Has the converter been pulled into the mvnForum CVS already ? It would be great to capture all these changes redzara is making.

_anand

Hi all,

Thanks for your work on this, and it is in the TODO with high priority to officially support soon smile
----------------------------------------
Minh Nguyen
mvnForum Developer
Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com

http://www.DienDanLinux.org
[Jul 14, 2005 4:54:31 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.MyVietnam.net    minhnn_mvn [Link] Report threatening or abusive post: please login first  Go to top 
Female lizthegrey
Newbie
Member's Avatar

United States
Joined: Jul 13, 2005
Post Count: 24
Status: Offline
Reply to this Post  Reply with Quote 
Re: phpBB to mvnForum converter available

As I found out the hard way, there's an SQL injection vulnerability in this due to lack of escaping of \ to \\.

In Utils.java:
if (text.charAt(i) == '\'') {
strbuf.append("\\\'");
} else if (text.charAt(i) == '\\') {
strbuf.append("\\\\");
} else {
strbuf.append(text.charAt(i));
}


Also, to prevent NPE's:
Insert:
if (text == null) {
return "\'\'";
}


immediately after public static String wrapit(String text).

Hmm, while we're at it, how about if I write in support for [quote="foobar"] so we don't have to strip it out of the bbcode tags? :)
----------------------------------------
[Edit 1 times, last edit by lizthegrey at Jul 29, 2005 1:00:11 AM]
[Jul 29, 2005 12:49:41 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.puzzlepirates.com    elizabeththegrey    elizabeththegrey    82818272 [Link] Report threatening or abusive post: please login first  Go to top 
Female lizthegrey
Newbie
Member's Avatar

United States
Joined: Jul 13, 2005
Post Count: 24
Status: Offline
Reply to this Post  Reply with Quote 
Re: phpBB to mvnForum converter available

Alright. Not tested, and it's 6:30 PM and time for me to go home, but here's a start.

In Utils.java:
// regular quote
result = result.replaceAll("(.*)\\[quote:[0-9,abcdef]*\\](.*)\\[/quote:[0-9,abcdef]*\\](.*)", "$1\\[quote=\\]$2\\[/quote\\]$3");
// fancy quote
result = result.replaceAll("(.*)\\[quote:[0-9,abcdef]*=\\\"(.*)\\\"\\](.*)\\[/quote:[0-9,abcdef]*\\](.*)", "$1\\[quote=\\\"$2\\\"\\]$3\\[/quote\\]$4");


In Migrator.java:
String PostBody = Utils.wrapit(posttextrs.getString("post_text"));


In EnableMVNCodeFilter.java (in myvietnam libraries):
// Deal with fancy shmancy [quote="foobar"] stuff.
input.replaceAll("(.*)\\[quote\\\"(.*)\\\"\\](.*)\\[\\/quote\\](.*)",
"$1" + "<table width='96%' cellspacing='1' cellpadding='3' border='0' align='center'><tr><td>" +
"<span class='genmed'><b>" + "$2" + " wrote:</b></span>" +
"&nbsp;"+
"</td></tr><tr><td class='quote'>" + "$3" +
"</td></tr></table>" + "$4");

while(beginIndex < inputLength) {

[Jul 29, 2005 1:33:06 AM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.puzzlepirates.com    elizabeththegrey    elizabeththegrey    82818272 [Link] Report threatening or abusive post: please login first  Go to top 
Female lizthegrey
Newbie
Member's Avatar

United States
Joined: Jul 13, 2005
Post Count: 24
Status: Offline
Reply to this Post  Reply with Quote 
Re: phpBB to mvnForum converter available

Alright, got a bit more done with a private message convertor, I'll have something to post on that front in about an hour after I've had a chance to sort out the kinks and figure out what some of these mvnforum db fields do and test the final result.
[Aug 5, 2005 10:40:35 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.puzzlepirates.com    elizabeththegrey    elizabeththegrey    82818272 [Link] Report threatening or abusive post: please login first  Go to top 
Female lizthegrey
Newbie
Member's Avatar

United States
Joined: Jul 13, 2005
Post Count: 24
Status: Offline
Reply to this Post  Reply with Quote 
Re: phpBB to mvnForum converter available

Let's give this a try. Running it on my monster database of 30,000 private messages, but it's not throwing errors, a glance at the sql says it's okay.


public static void migrateprivatemessages(Connection php, Connection mvn, PrintStream ostream) throws SQLException

{

Statement Stmt = php.createStatement();

ResultSet RS = Stmt.executeQuery("SELECT privmsgs_id, privmsgs_type, privmsgs_subject, privmsgs_from_userid, privmsgs_to_userid, privmsgs_date, privmsgs_ip, privmsgs_attach_sig, privmsgs_text FROM phpbb_privmsgs " +

"LEFT JOIN phpbb_privmsgs_text " +

"ON phpbb_privmsgs_text.privmsgs_text_id = phpbb_privmsgs.privmsgs_id");



while(RS.next())

{

String MessageSenderID = RS.getString("privmsgs_from_userid");

String MessageSenderName;

String MessageReceiverID = RS.getString("privmsgs_to_userid");

String MessageToList;

String MessageCcList = Utils.wrapit("");

String MessageBccList = Utils.wrapit("");

String MessageTopic = Utils.wrapit(RS.getString("privmsgs_subject"));

String MessageBody = Utils.wrapit(RS.getString("privmsgs_text"));

String MessageType = "0";

String MessageOption = "0";

String MessageStatus = "0";

int MessageRead = RS.getInt("privmsgs_type");

String MessageNotify = "0";

String MessageIcon = Utils.wrapit("");

String MessageAttachCount = "0";

String MessageIP = Utils.wrapit(Utils.HexIPtoString(RS.getString("privmsgs_ip")));

String MessageCreationDate = Utils.wrapit(Utils.DateTimeFromS(RS.getLong("privmsgs_date")));



Statement senderstmt = php.createStatement();

ResultSet senderstmtrs = senderstmt.executeQuery("SELECT username from phpbb_users where user_id=" + MessageSenderID);

if (senderstmtrs.next()) {

MessageSenderName = Utils.wrapit(senderstmtrs.getString("username"));

} else {

MessageSenderName = Utils.wrapit("");

}

senderstmtrs.close();

senderstmt.close();



Statement receiverstmt = php.createStatement();

ResultSet receiverstmtrs = receiverstmt.executeQuery("SELECT username from phpbb_users where user_id=" + MessageReceiverID);

if (receiverstmtrs.next()) {

MessageToList = Utils.wrapit(receiverstmtrs.getString("username"));

} else {

MessageToList = Utils.wrapit("");

}

receiverstmtrs.close();

receiverstmt.close();



String receiverStatement = "insert into mvnforumMessage " +

"(FolderName, MemberID, MessageSenderID, MessageSenderName, " +

"MessageToList, MessageCcList, MessageBccList, MessageTopic, MessageBody, " +

"MessageType, MessageOption, MessageStatus, MessageReadStatus, MessageNotify, " +

"MessageIcon, MessageAttachCount, MessageIP, MessageCreationDate" +

") values ( " +

"'Inbox'" + "," +

MessageReceiverID + "," +

MessageSenderID + "," +

MessageSenderName + "," +

MessageToList + "," +

MessageCcList + "," +

MessageBccList + "," +

MessageTopic + "," +

MessageBody + "," +

MessageType+ "," +

MessageOption + "," +

MessageStatus + "," +

((MessageRead == 1 || MessageRead == 5) ? "0" : "1" ) + "," +

MessageNotify + "," +

MessageIcon + "," +

MessageAttachCount + "," +

MessageIP + "," +

MessageCreationDate + ");";





ostream.println(receiverStatement);

if(mvn != null)

{

PreparedStatement ps = mvn.prepareStatement(receiverStatement);

ps.executeUpdate();

ps.close();

}



String senderStatement = "insert into mvnforumMessage " +

"(FolderName, MemberID, MessageSenderID, MessageSenderName, " +

"MessageToList, MessageCcList, MessageBccList, MessageTopic, MessageBody, " +

"MessageType, MessageOption, MessageStatus, MessageReadStatus, MessageNotify, " +

"MessageIcon, MessageAttachCount, MessageIP, MessageCreationDate" +

") values ( " +

"'Sent'" + "," +

MessageSenderID + "," +

MessageSenderID + "," +

MessageSenderName + "," +

MessageToList + "," +

MessageCcList + "," +

MessageBccList + "," +

MessageTopic + "," +

MessageBody + "," +

MessageType+ "," +

MessageOption + "," +

MessageStatus + "," +

"1" + "," +

MessageNotify + "," +

MessageIcon + "," +

MessageAttachCount + "," +

MessageIP + "," +

MessageCreationDate + ");";





ostream.println(senderStatement);

if(mvn != null)

{

PreparedStatement ps = mvn.prepareStatement(senderStatement);

ps.executeUpdate();

ps.close();

}

}



// Clean up after ourselves

RS.close();

Stmt.close();

}


----------------------------------------
[Edit 1 times, last edit by lizthegrey at Aug 5, 2005 11:14:35 PM]
[Aug 5, 2005 11:12:59 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.puzzlepirates.com    elizabeththegrey    elizabeththegrey    82818272 [Link] Report threatening or abusive post: please login first  Go to top 
Male frank123
Stranger
Member's Avatar


Joined: Nov 14, 2004
Post Count: 11
Status: Offline
Reply to this Post  Reply with Quote 
confused Re: phpBB to mvnForum converter available

curious how the coverter handles vote, as mvmforum doesn't have this function yet, but phpbb has it.
[Jan 4, 2006 2:19:44 AM] Show Printable Version of Post    View Member Profile    Send Private Message [Link] Report threatening or abusive post: please login first  Go to top 
Male minhnn
mvnForum Developer
Member's Avatar

Vietnam
Joined: Oct 16, 2002
Post Count: 2956
Status: Offline
Reply to this Post  Reply with Quote 
Re: phpBB to mvnForum converter available

curious how the coverter handles vote, as mvmforum doesn't have this function yet, but phpbb has it.

Of course, the vote is not converted smile

Cheers,
----------------------------------------
Minh Nguyen
mvnForum Developer
Want a free, open source Java Jsp/Servlet forum, get mvnForum at http://www.mvnForum.com

http://www.DienDanLinux.org
[Jan 4, 2006 2:03:21 PM] Show Printable Version of Post    View Member Profile    Send Private Message    Hidden to Guest    http://www.MyVietnam.net    minhnn_mvn [Link] Report threatening or abusive post: please login first  Go to top 
Posts: 24   Pages: 3   [ Previous Page | 1 2 3 | Next Page ]
Show Printable Version of Thread  Post new Thread