Από Κunena σε phpbb και πρόβλημα με ελληνικά

Joomla! forum. Joomla! Questions and Answers.

Συντονιστές: WebDev Moderators, Super-Moderators, PHP Moderators

Απάντηση
maxtor233
Δημοσιεύσεις: 3
Εγγραφή: 23 Ιαν 2010 07:36

Από Κunena σε phpbb και πρόβλημα με ελληνικά

Δημοσίευση από maxtor233 » 23 Ιαν 2010 07:40

Καλημέρα σας,

Ακολούθησα όσο γινόταν κατά γράμμα τις οδηγίες από κάποιους που είχαν δοκιμάσει τη διαδικασία της μεταφοράς μηνυμάτων και χρηστών από kunena σε phpbb2 και είχα εν μέρει αποτέλεσμα, αλλά αντιμετωπίζω πρόβλημα με ερωτηματικά.

Κατ' αρχάς, έκανα τα εξής:

1. Εγκατέστησα το phpBB2 2.0.22, όπως αναφέρεται στις οδηγίες, αλλά και την ελληνική γλώσσα την συγκεκριμένης έκδοσης, ενώ εγώ είχα εγκατεστημένο kunena, το οποίο έτσι κι αλλιώς είχε το ίδιο πρόθεμα πινάκων με το fireboard, αλλά και joomla 1.5.15.
2. Ακολούθως, κατέβασα το σκριπτάκι για να γίνει η μεταφορά μηνυμάτων και των users και το αποθήκευσα ως convert.php. Το παραθέτω παρακάτω για όποιον το χρειαστεί:

Κώδικας: Επιλογή όλων

    <?php
    /*
    Fireboard 1.0.x to phbBB2 2.0.x converter
    Based on the phpbb2tosb.php script by Olle Johansson http&#58;//mambo.theyard.org/ and from Marcos Osorno http&#58;//www.blort.com
    Based upon updated script from http&#58;//www.phpbb.com/community/viewtopic.php?f=10&t=371271&p=2026820

    * Tested on&#58; phpBB 2.0.22, Joomla 1.0.13 w/ Fireboard 1.0.3, PHP 5.2.3, MySQL 5.0.45
    * Tested by executing from within the phpBB directory
    * Will DESTROY all the data in your phpBB db and replace it with SB data! Does not append!

    -------------Config---------------------*/
    //MySQL Database host - usually 'localhost'
        $host='localhost';

    //MySQL Database user
       $user='*****';

    //MySQL Database password
       $pass='*****';

    //MySQL Database name
       $db='*****';

    // Mambo database prefix
        $mosConfig_dbprefix = "jos_";

    // phpBB2 database prefix
        $phpbb_dbprefix = "phpbb_";

    // Temp DB prefix used for temporary tables in the script
    // set this to a prefix you are NOT using on your mySQL db
        $temp_dbprefix = "temp_";
    /* ---------------------------------------*/
        define&#40;"BBCODE_UID_LEN", 10&#41;;
        $bbcode_on = 'true';

        ini_set&#40;"magic_quotes_gpc", "1"&#41;;
        set_magic_quotes_runtime &#40; 0 &#41;;

       echo "<?xml version=\"1.0\"?>";
       echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http&#58;//www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">";
       echo "<html xmlns=\"http&#58;//www.w3.org/1999/xhtml\">";
       echo "<head>";
       echo "<title>Importing data from Fireboard</title>";
       echo "<meta http-equiv=\"Content-Type\" content=\"text/html; iso-8859-1\" />";
       echo "</head>";
       echo "<body>";
       echo "<h1>Importing data from Fireboard</h1>"; flush&#40;&#41;;

    //Connect to and select Database
        echo "Connecting to Database...\n"; flush&#40;&#41;;
        $lnk = mysql_connect&#40;$host, $user, $pass&#41; or die &#40;'Not connected&#58; ' . mysql_error&#40;&#41;&#41;;
        mysql_select_db&#40;$db, $lnk&#41; or die&#40;'Error&#58; '.mysql_error&#40;&#41;&#41;;
        echo "OK\n"; flush&#40;&#41;;

    // PHPBB Categories > Forums > Topics > Posts > Posts Text

    // Part One - Populate Categories
        echo "<br />Populating Categories...\n"; flush&#40;&#41;;
    // Import the main categories
    // Prune those Fireboard categories which have a parent
    // Multiply the ordering by 10 to conform to phpbb2 format
    // if fb_categories.parent = 0 then category is a phpbb cateogory

    //clear phpbb categories table
        $query = "TRUNCATE TABLE &#123;$phpbb_dbprefix&#125;categories";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

    // if fb_categories.parent = 0 then category is a category
        $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;categories &#40;cat_id, cat_title, cat_order&#41;
               SELECT id, name, ordering*10
               FROM &#123;$mosConfig_dbprefix&#125;fb_categories
               WHERE &#123;$mosConfig_dbprefix&#125;fb_categories.parent = '0'
               ORDER by ordering";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

    //Count Rows Inserted
       $query = "SELECT COUNT&#40;*&#41;
               FROM &#123;$phpbb_dbprefix&#125;categories;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        list&#40;$count&#41; = mysql_fetch_row&#40;$result&#41;;
        echo "<br />Inserted $count Rows... OK"; flush&#40;&#41;;

    // clear phpbb forums table
        $query = "TRUNCATE TABLE &#123;$phpbb_dbprefix&#125;forums";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

    // Part Two - Populate Forums
    // phpbb2 considers category header messages as forums
    // these are indicated in sb by setting fb_messages.id=sb_messages.thread
    // the actual messages can be detected by seeing that fb_messages.parent != 0
       echo "<br />Populating Forums...\n"; flush&#40;&#41;;
        $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;forums &#40;forum_id, cat_id, forum_name, forum_desc, forum_status, forum_order, forum_posts, forum_topics, forum_last_post_id, prune_next, prune_enable, auth_view, auth_read, auth_post, auth_reply, auth_edit,auth_delete, auth_sticky, auth_announce, auth_vote, auth_pollcreate, auth_attachments&#41;
               SELECT id, parent, name, description, 0, ordering, c.posts, b.topics, d.last, NULL, 0, 0, 1, 1, 1, 1, 1, 3, 3, 1, 1, 0
               FROM &#123;$mosConfig_dbprefix&#125;fb_categories
               LEFT JOIN &#40;SELECT catid, COUNT&#40;*&#41; AS topics FROM &#123;$mosConfig_dbprefix&#125;fb_messages WHERE id=thread GROUP BY catid&#41; b
               ON &#123;$mosConfig_dbprefix&#125;fb_categories.id=b.catid
               LEFT JOIN &#40;SELECT catid, COUNT&#40;*&#41; AS posts FROM &#123;$mosConfig_dbprefix&#125;fb_messages GROUP BY catid&#41; c
               ON &#123;$mosConfig_dbprefix&#125;fb_categories.id=c.catid
               LEFT JOIN &#40;SELECT catid, MAX&#40;id&#41; AS last FROM &#123;$mosConfig_dbprefix&#125;fb_messages GROUP BY catid&#41; d
               ON &#123;$mosConfig_dbprefix&#125;fb_categories.id=d.catid
               WHERE parent != 0
               GROUP BY id;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

    //Count Rows Inserted
       $query = "SELECT COUNT&#40;*&#41;
               FROM &#123;$phpbb_dbprefix&#125;forums;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        list&#40;$count&#41; = mysql_fetch_row&#40;$result&#41;;
        echo "<br />Inserted $count Rows... OK"; flush&#40;&#41;;

    // Part Three - Populate Topics
    // if fb_messages.parent = 0 then messages is a topic
       echo "<br />Populating Topics...\n"; flush&#40;&#41;;
        $query = "TRUNCATE TABLE &#123;$phpbb_dbprefix&#125;topics";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

           // Some messages still had the single quote in them without a \
        // which was causing import problems so we
        // removed the single quote and replaced it with HTML for the quote
       // Run a query taking simple board messages and finding which are topics by thread=id then merge with count table above
        // also subtract one from the reply count because it counts itself under this algorithm
        $query = "SELECT m.id, m.catid, m.userid, m.subject, m.time, m.hits, reply - 1 AS reply, locked, '0', '0', c.min, c.max, '0'
               FROM &#123;$mosConfig_dbprefix&#125;fb_messages AS m
               JOIN &#40;SELECT thread, MIN&#40;id&#41; AS min, MAX&#40;id&#41; as max, COUNT&#40;id&#41; as reply
               FROM &#123;$mosConfig_dbprefix&#125;fb_messages GROUP BY thread&#41; c
               WHERE m.thread=m.id AND m.parent=0 AND c.thread=m.thread";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

        while &#40; $row = mysql_fetch_object&#40; $result &#41; &#41; &#123;
          $subject = stripslashes&#40; $row->subject &#41;;
          $subject = preg_replace &#40;'/\'/', '\\\'', $subject&#41;;
          $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;topics&#40;topic_id, forum_id, topic_poster, topic_title, topic_time,topic_views, topic_replies, topic_status, topic_vote, topic_type,topic_first_post_id, topic_last_post_id, topic_moved_id&#41;VALUES &#40;'$row->id', '$row->catid', '$row->userid', '$subject', '$row->time','$row->hits', '$row->reply', '$row->locked', '0', '','$row->min', '$row->max', '0'&#41;";
          $updateresult = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        &#125;
        mysql_free_result&#40;$result&#41;;

    //Count Rows Inserted
       $query = "SELECT COUNT&#40;*&#41;
               FROM &#123;$phpbb_dbprefix&#125;topics;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        list&#40;$count&#41; = mysql_fetch_row&#40;$result&#41;;
        echo "<br />Inserted $count Rows... OK\n"; flush&#40;&#41;;

    // Part Four - Populate Messages Table
        echo "<br />Populating Posts...\n"; flush&#40;&#41;;
        $query = "TRUNCATE TABLE &#123;$phpbb_dbprefix&#125;posts";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

        $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;posts &#40;post_id, topic_id, forum_id, poster_id, post_time, poster_ip, post_username, enable_bbcode, enable_html, enable_smilies, enable_sig, post_edit_time, post_edit_count&#41;
               SELECT id, thread, catid, userid, time, HEX&#40;INET_ATON&#40;ip&#41;&#41;, name, 1, 0, topic_emoticon, 1, NULL, 0 FROM &#123;$mosConfig_dbprefix&#125;fb_messages";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

       $query = "SELECT COUNT&#40;*&#41; FROM &#123;$phpbb_dbprefix&#125;posts;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        list&#40;$count&#41; = mysql_fetch_row&#40;$result&#41;;
        echo "<br />Inserted $count Rows... OK"; flush&#40;&#41;;

    //Populate Messages_Text Table
        echo "<br />Populating Post Text & Converting Fireboard Syntax to phhBB Syntax... &#40;This may take a while&#41;\n"; flush&#40;&#41;;
        $query = "TRUNCATE TABLE &#123;$phpbb_dbprefix&#125;posts_text";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

       $query = "SELECT m.id, m.subject, t.message
               FROM &#123;$mosConfig_dbprefix&#125;fb_messages_text AS t, &#123;$mosConfig_dbprefix&#125;fb_messages AS m WHERE m.id = t.mesid";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

    // uses phpbb's bbcode encoder to make a uid for each message
    // which is required for the bbcode to work in phpbb
        while &#40; $row = mysql_fetch_object&#40; $result &#41; &#41; &#123;
          $bbcode_uid = &#40; $bbcode_on &#41; ? make_bbcode_uid&#40;&#41; &#58; '';
          $message = prep &#40; $row->message&#41;;
          $message = fixquotes &#40;$message&#41;;
          $subject = stripslashes&#40; $row->subject &#41;;
          $subject = preg_replace &#40;'/\'/', '\\\'', $subject&#41;;
          $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;posts_text &#40;post_id, bbcode_uid, post_subject, post_text&#41;
                  VALUES &#40;'$row->id','$bbcode_uid', '$subject', '$message'&#41;";
           $updateresult = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        &#125;
        mysql_free_result&#40;$result&#41;;

    //Count Rows Inserted
       $query = "SELECT COUNT&#40;*&#41; FROM &#123;$phpbb_dbprefix&#125;posts_text;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        list&#40;$count&#41; = mysql_fetch_row&#40;$result&#41;;
        echo "<br />Inserted $count Rows... OK\n"; flush&#40;&#41;;

    //Populate Users Table , Note user_sig_bbcode_uid is a radom, md5 checksum
        echo "<br />Populating Users Table From Joomla...\n";
        $query = "TRUNCATE TABLE &#123;$phpbb_dbprefix&#125;users";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

        $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;users &#40;user_id, user_active, username, user_password, user_session_time, user_lastvisit, user_regdate, user_level, user_dateformat, user_email&#41;
               SELECT id,
                CASE block
                   WHEN 0 THEN 1
                   ELSE 0 END,
                username,
                password,
                UNIX_TIMESTAMP&#40;lastvisitDate&#41;,
                UNIX_TIMESTAMP&#40;lastvisitDate&#41;,
                UNIX_TIMESTAMP&#40;registerDate&#41;,
                CASE gid
                   WHEN 25 THEN 1
                   WHEN 24 THEN 1
                   ELSE 0 END,
                   'd M Y H&#58;i',
                   email
             FROM &#123;$mosConfig_dbprefix&#125;users ORDER by id;";
       $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

       $query = "SELECT COUNT&#40;*&#41; FROM &#123;$phpbb_dbprefix&#125;users;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        list&#40;$count&#41; = mysql_fetch_row&#40;$result&#41;;
        echo "<br />Inserted $count Users... OK\n"; flush&#40;&#41;;

    //Update Info From Fireboard
       echo "<br />Updating Users Table From Fireboard...\n";
        $query = "UPDATE &#123;$phpbb_dbprefix&#125;users, &#123;$mosConfig_dbprefix&#125;fb_users
               SET user_posts=posts, user_avatar=avatar, user_icq=ICQ, user_website=websitename, user_from=location, user_sig=signature, user_aim=AIM, user_yim=YIM, user_msnm=MSN, user_interests=personalText
               WHERE user_id=userid;";
       $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

    // uses phpbb's bbcode encoder to make a uid for each message
    // which is required for the bbcode to work in phpbb
    // clean up bbcode in signatures and ad bbcode_uid
        $query = "SELECT user_id, user_sig
               FROM &#123;$phpbb_dbprefix&#125;users
               ORDER BY user_id;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

        while &#40; $row = mysql_fetch_object&#40; $result &#41; &#41; &#123;
          $bbcode_uid = &#40; $bbcode_on &#41; ? make_bbcode_uid&#40;&#41; &#58; '';
          $signature = prep &#40; $row->user_sig&#41;;
        //  $signature = preg_replace &#40;'/\'/', '\\\'', $signature&#41;;
          $query = "UPDATE &#123;$phpbb_dbprefix&#125;users
                  SET user_sig='$signature', user_sig_bbcode_uid='$bbcode_uid'
                  WHERE user_id=$row->user_id";
          $updateresult = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        &#125;
        mysql_free_result&#40;$result&#41;;

       $query = "SELECT COUNT&#40;*&#41; FROM &#123;$phpbb_dbprefix&#125;users;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        list&#40;$count&#41; = mysql_fetch_row&#40;$result&#41;;

    //Clean up avatar, only for off site avatar, Onsite Avatars will be deleted
        echo "<br />Updated $count Users... OK\n"; flush&#40;&#41;;
        $query = "UPDATE &#123;$phpbb_dbprefix&#125;users
               SET user_avatar_type = 3
               WHERE user_avatar LIKE 'http&#58;//%';";
       $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

       $query = "UPDATE &#123;$phpbb_dbprefix&#125;users
               SET user_avatar_type = 0, user_avatar = NULL
               WHERE user_avatar NOT LIKE 'http&#58;//%';";
       $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

       // create a group for each user
       echo "<br />Updating Users Groups...\n"; flush&#40;&#41;;
        $query = "TRUNCATE TABLE &#123;$phpbb_dbprefix&#125;groups";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

        $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;groups &#40;group_id, group_type, group_name, group_description, group_moderator, group_single_user&#41;
               SELECT user_id, '1', '', 'Personal User', '0', '1'
               FROM &#123;$phpbb_dbprefix&#125;users ORDER BY user_id";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

    // have each user join their own group
        $query = "TRUNCATE TABLE &#123;$phpbb_dbprefix&#125;user_group";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;user_group &#40;group_id, user_id, user_pending&#41;
               SELECT user_id, user_id, '0'
               FROM &#123;$phpbb_dbprefix&#125;users
               ORDER BY user_id";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        echo "OK\n"; flush&#40;&#41;;

    //insert ranks
       echo "<br />Inserting User Ranks...\n"; flush&#40;&#41;;
        $query = "TRUNCATE TABLE &#123;$phpbb_dbprefix&#125;ranks";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;
        $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;ranks &#40;rank_id, rank_title, rank_min, rank_special, rank_image&#41; SELECT rank_id, rank_title, rank_min, rank_special, rank_image
               FROM &#123;$mosConfig_dbprefix&#125;fb_ranks
               ORDER BY rank_id";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

        echo "OK\n"; flush&#40;&#41;;
        echo "<br />Complete...\n"; flush&#40;&#41;;

       echo "</body>";
       echo "</html>"; flush&#40;&#41;;

        //--- Function to prepare strings for MySQL storage ---/
        function prep&#40;$s&#41; &#123;
        // Insert bbcode_uid necessary for bbcode to be recognized by phpbb2
            global $bbcode_uid;

            // <strong> </strong>
            $s = preg_replace&#40;'/\&#91;b\&#93;/', '&#91;b&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;\/b\&#93;/', '&#91;/b&#58;'.$bbcode_uid.'&#93;', $s&#41;;

            // <em> </em>
            $s = preg_replace&#40;'/\&#91;i\&#93;/', '&#91;i&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;\/i\&#93;/', '&#91;/i&#58;'.$bbcode_uid.'&#93;', $s&#41;;

            // <u> </u>
            $s = preg_replace&#40;'/\&#91;u\&#93;/', '&#91;u&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;\/u\&#93;/', '&#91;/u&#58;'.$bbcode_uid.'&#93;', $s&#41;;

            // quote
            $s = preg_replace&#40;'/\&#91;quote\&#93;/', '&#91;quote&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;\/quote\&#93;/', '&#91;/quote&#58;'.$bbcode_uid.'&#93;', $s&#41;;

            // url with &quot;
            $s = preg_replace&#40;'/\&#91;url=\\\&quot\;&#40;.*?&#41;\\\&quot\;\&#93;&#40;.*?&#41;/', '&#91;url=\\1&#93;\\2', $s&#41;;

            // image
            $s = preg_replace&#40;'/\&#91;img&#40;.*?&#41;\&#93;&#40;.*?&#41;\&#91;\/img&#40;.*?&#41;\&#93;/si', '&#91;img&#58;'.$bbcode_uid.'&#93;'.'\\2&#91;/img&#58;'.$bbcode_uid.'&#93;', $s&#41;;

            // color
            $s = preg_replace&#40;'/\&#91;color=&#40;.*?&#41;\&#93;/', '&#91;color=\\1&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;\/color\&#93;/', '&#91;/color&#58;'.$bbcode_uid.'&#93;', $s&#41;;

            // size fb uses size 1 to 5,  phpbb2 uses size 1 to 29; will use 1 = 7, 2=9, 3=12, 4=18, 5=24
            $s = preg_replace&#40;'/\&#91;size=1\&#93;/', '&#91;size=7&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;size=2\&#93;/', '&#91;size=9&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;size=3\&#93;/', '&#91;size=12&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;size=4\&#93;/', '&#91;size=18&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;size=5\&#93;/', '&#91;size=24&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;\/size\&#93;/', '&#91;/size&#58;'.$bbcode_uid.'&#93;', $s&#41;;

            // code
            $s = preg_replace&#40;'/\&#91;code&#40;.*?&#41;\&#93;/','&#91;code&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;\/code&#40;.*?&#41;\&#93;/', '&#91;/code&#58;'.$bbcode_uid.'&#93;', $s&#41;;

            // lists
            $s = preg_replace&#40;'/\&#91;ul\&#93;/', '&#91;list&#58;'.$bbcode_uid.'&#93;', $s&#41;;
          $s = preg_replace&#40;'/\&#91;\/ul\&#93;/', '&#91;/list&#58;u&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;ol\&#93;/', '&#91;list=1&#58;'.$bbcode_uid.'&#93;', $s&#41;;
          $s = preg_replace&#40;'/\&#91;\/ol\&#93;/', '&#91;/list&#58;o&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;li\&#93;/', '&#91;*&#58;'.$bbcode_uid.'&#93;', $s&#41;;
            $s = preg_replace&#40;'/\&#91;\/li\&#93;/', '', $s&#41;;

            return $s;
        &#125;

    // fixed the quotes.
       function fixquotes&#40;$q&#41; &#123;
            global $bbcode_uid;
          $q = preg_replace&#40;'/\&#91;b&#58;'.$bbcode_uid.'\&#93;&#40;.*?&#41; wrote&#58;\&#91;\/b&#58;'.$bbcode_uid.'\&#93;\r\n\&#91;quote&#58;'.$bbcode_uid.'\&#93;/', '&#91;quote&#58;'.$bbcode_uid.'="\\1"&#93;', $q &#41;;
          return $q;
        &#125;

    // function taken from phpbb2 functions file Unique ID for this message..
        function make_bbcode_uid&#40;&#41;
        &#123;
                $uid = md5&#40;mt_rand&#40;&#41;&#41;;
                $uid = substr&#40;$uid, 0, BBCODE_UID_LEN&#41;;
                return $uid;
        &#125;

    //last minute accounts to be added note phpbb2admin password is "admn" Besure to remove once you have tested the  site.
       $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;users &#40;user_id, user_active, username, user_password, user_session_time, user_session_page, user_lastvisit, user_regdate, user_level, user_posts, user_timezone, user_style, user_lang, user_dateformat, user_new_privmsg, user_unread_privmsg, user_last_privmsg, user_login_tries, user_last_login_try, user_emailtime, user_viewemail, user_attachsig, user_allowhtml, user_allowbbcode, user_allowsmile, user_allowavatar, user_allow_pm, user_allow_viewonline, user_notify, user_notify_pm, user_popup_pm, user_rank, user_avatar, user_avatar_type, user_email, user_icq, user_website, user_from, user_sig, user_sig_bbcode_uid, user_aim, user_yim, user_msnm, user_occ, user_interests, user_actkey, user_newpasswd&#41; VALUES
             &#40;-1, 0, 'Anonymous', '', 0, 0, 0, 0, 0, 0, 0.00, NULL, '', '', 0, 0, 0, 0, 0, NULL, 0, 0, 1, 1, 1, 1, 0, 1, 0, 1, 0, NULL, '', 0, '', '', '', '', '', NULL, '', '', '', '', '', '', ''&#41;,
             &#40;2, 1, 'phpbb2admin', '21232f297a57a5a743894a0e4a801fc3', 1198282415, 0, 1198282415, 0, 1, 1, 0.00, 1, 'english', 'd M Y h&#58;i a', 0, 0, 0, 0, 0, NULL, 1, 0, 0, 1, 1, 1, 1, 1, 0, 1, 1, 1, '', 0, 'admin@yourdomain.com', '', '', '', '', NULL, '', '', '', '', '', '', ''&#41;;";
        $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

       $query = "INSERT INTO &#123;$phpbb_dbprefix&#125;user_group &#40;group_id, user_id, user_pending&#41; VALUES
             &#40;1, -1, 0&#41;,
             &#40;2, 2, 0&#41;;";
       $result = mysql_query&#40;$query&#41; or die&#40;"<br />Invalid query&#58;<br />$query<br />" . mysql_error&#40;&#41;&#41;;

    ?>
** Όπου υπάρχουν αστεράκια, μπαίνουν τα στοιχεία της εκάστοτε database

3. Το έτρεξα μέσα από το root της phpBB, το οποίο είχα ονομάσει forum και η διαδικασία ήταν επιτυχής, αφού έλαβα το παρακάτω μήνυμα:
Importing data from Fireboard
Connecting to Database... OK
Populating Categories...
Inserted 4 Rows... OK
Populating Forums...
Inserted 19 Rows... OK
Populating Topics...
Inserted 112 Rows... OK
Populating Posts...
Inserted 206 Rows... OK
Populating Post Text & Converting Fireboard Syntax to phhBB Syntax... (This may take a while)
Inserted 206 Rows... OK
Populating Users Table From Joomla...
Inserted 244 Users... OK
Updating Users Table From Fireboard...
Updated 244 Users... OK
Updating Users Groups... OK
Inserting User Ranks... OK
Complete...
Αν και όλα τέλεια μέχρι εδώ, μόλις μπήκα στο forum, απογοητεύτηκα, καθώς όπου υπήρχαν ελληνικά εμφάνιζε ερωτηματικά (?????????). Τσέκαρα τη βάση και είχε collation utf8_general_ci, όπως επίσης και όλοι οι πίνακες της phpBB. Δοκίμασα να γράψω ελληνικά στο forum και ενώ στο μήνυμα τα γράμματα εμφανίστηκαν όντως ελληνικά, αμέσως μετά τη δημοσίευση ο τίτλος του topic και μόνο αυτός άλλαξε σε αλαμπουρνέζικα (#%566757#8778878#7887#7899#98#).

Να σημειώσω ότι με το που τελείωσε ο converter, η γλώσσα του forum άλλαξε σε αγγλικά και τα ελληνικά δεν πέρναγαν με τίποτα παρ' ότι ήταν επιλεγμένα στις ρυθμίσεις, ενώ είχα και πρόβλημα εισόδου στο forum με τους χρήστες που είχαν περαστεί, καθώς δεν αναγνωρίζονταν τα passwords.

Αμέσως μετά, διέγραψα την εγκατάσταση και τα έκανα όλα από την αρχή, με collation βάσης utf8_bin και αποθηκεύοντας το convert.php επίσης σε utf8 without ΒΟΜ. Δυστυχώς, το αποτέλεσμα ήταν το ίδιο. Τι μπορώ να κάνω για να σώσω την κατάσταση και τον κόπο μου;

Άβαταρ μέλους
mechpanos
Honorary Member
Δημοσιεύσεις: 1709
Εγγραφή: 20 Μαρ 2003 00:59
Τοποθεσία: Athens - Pyrgos
Επικοινωνία:

Από Κunena σε phpbb και πρόβλημα με ελληνικά

Δημοσίευση από mechpanos » 23 Ιαν 2010 09:27

Χμ... Βασικά η 2 έκδοση του phpbb είναι πλέον ξεπερασμενη, καθώς τώρα υπάρχει η 3.0.15. Αυτήν θα πρέπει να βάλεις!
Τώρα, εσύ θέλεις οπωσδήποτε να κάνεις την μεταφορά, εγώ στο www.paniliakos.net είχα πάντα ξεχωριστές εγκαταστάσεις γιατί όταν είχα ξεκινήσει δεν είχα ψαχτεί με cms, όταν δε έβαλα mambo και αργότερα joomla, καμία "γέφυρα" δεν μου δούλεψε όπως έπρεπε οπότε ακόμα και σήμερα έχω κρατήσει τις ξεχωριστές εγκαταστάσεις...
Πάντως από ότι είχα ασχοληθεί τελευταία, το phpbb από την 3 έκδοση και μετά μπορεί να συνδεθεί με joomla και προς αυτή την κατεύθυνση να κινηθείς! Αν δεν υπάρχει τώρα σκριπτάκι άμεσης μεταφοράς, δοκίμασε με ενδιάμεση πχ σε smf ή άλλο forum και από εκεί σε phpbb 3.0.15...
Πύργος θεός Πανηλειακός!!

maxtor233
Δημοσιεύσεις: 3
Εγγραφή: 23 Ιαν 2010 07:36

Από Κunena σε phpbb και πρόβλημα με ελληνικά

Δημοσίευση από maxtor233 » 24 Ιαν 2010 00:41

Το προσπάθησα αυτό, αλλά ο converter του smf μου βγάζει σφάλμα για λάθος Path του kunena.

Εγώ βάζω αυτά:
Path to SMF:/home/www/user/site.gr/www/smf
Path to Kunena 1.5:/home/www/user/site.gr/www/components/com_kunena

Και μου πετάει μήνυμα:
Unable to find the settings for Kunena 1.5. Please double check the path and try again.
Αν γνωρίζεις κάτι επ' αυτού, ή κάποιος άλλος, παρακαλώ πείτε μου γιατί δεν ξέρω τι άλλο να κάνω..

Απάντηση

Επιστροφή στο “Joomla! γενικά”

Μέλη σε σύνδεση

Μέλη σε αυτήν τη Δ. Συζήτηση: Δεν υπάρχουν εγγεγραμμένα μέλη και 0 επισκέπτες