IPB 3 to vBulletin and cleaner.php

Collapse
X
 
  • Time
  • Show
Clear All
new posts

  • Loco.M
    commented on 's reply
    Thank you very much, I ran into this problem again.. It's a bit sad it's been 4 years since this was posted yet impex still has this issue...
    Last edited by Loco.M; Fri 17 Oct '14, 12:27pm.

  • The Prohacker
    replied
    We are doing a conversion of IPB3 to vB4 and saw this same issue with quotes. Looking at the code inside of impex/systems/ipb3/007.php line 229 there is a handling for the extended quote tags.
    Code:
            preg_match('#\[[b][/b]quote name=\'(.*)\' date=\'(.*)\' post=\'(.*)\'(.*)\](.*)\[/quote\]#siU', $text, $matches);        
    
            if ($matches[3])                
            {                               
                    $new_id = $this->get_vb_post_id($Db_target, $target_database_type, $target_table_prefix, $matches[3]);    
    
                    $text = str_replace($matches[0], "[[b][/b]QUOTE=" . $matches[1] . ";{$new_id}]" . trim($matches[5]) . "[/QUOTE]", $text);
            }                
            else                
            {                
                    return $text;                
            }
    The problem is that IPB3 stores the single quotes in their htmlentity safe version so this will never find [quote name=' since in the database this is stored as [quote name='..

    I ended up hacking cleaner.php to work with that though. I created a replacement for ' to '. Then I added two lines to the replacement:

    Code:
    $replacer = array(
                            "&[b][/b]#39;"      => "'",
                            ""      => "",
                            ""      => "",
                            ""      => "",
                            ""      => ""
    );
    
    ..........
    
    # Posts
    if($do_posts)
    {
            $posts = $Db_target->query("SELECT postid, pagetext, title FROM " . $targettableprefix . "post");
    
            while ($post = $Db_target->fetch_array($posts))
            {               
                    $text = str_replace(array_keys($replacer), $replacer, $post['pagetext']);
                    $title_text = str_replace(array_keys($replacer), $replacer, $post['title']);
                    // Custom Hack to parse quotes
        preg_match('#\[quote name=\'(.*)\' date=\'(.*)\' post=\'(.*)\'(.*)\](.*)\[/quote\]#siU', $text, $matches);
        $text = str_replace($matches[0], "[[b][/b]QUOTE=" . $matches[1] . "]" . trim($matches[5]) . "[/QUOTE]", $text);
    I didn't care to relate the posts back to the new post id.
    IMO this would be a bug in how vB Impex handles the html entities.

    Leave a comment:


  • Loco.M
    replied
    bump?

    I'm running into this problem too on an IPB 3 to vBulletin 4 import

    Leave a comment:


  • cedivad
    started a topic IPB 3 to vBulletin and cleaner.php

    IPB 3 to vBulletin and cleaner.php

    I'm converting from ipb to vb. Actually i have one problem with quotes, i would convert this:
    [quote name='Rondell' date='11 settembre 2010 - 20:35' timestamp='1284233712&' post='85500']
    into this:
    [quote =Rondell]
    This is what i'm using, however it won't work:
    PHP Code:
    // BACK UP YOUR DATABASE
    $replacer = array(
                
    "/[quote name='(.*)' date='(.*)' timestamp='(.*)' post='(.*)']"    => "[quote=$1]",
                
    ""    => "",
                
    ""    => "",
                
    ""    => "",
                
    ""    => ""
    ); 
    Suggestions?
widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
Working...