News:

Want to get involved in developing SMF, then why not lend a hand on our github!

Main Menu

[SMF Converter] Yabb - 2.1

Started by JayBachatero, October 24, 2006, 12:07:33 PM

Previous topic - Next topic

vmpre2

OK I am ready to try this again.

One thing I was wondering if people in here could help me with.

First, which version of SMF should I try converting to? 1.1.3?

Second, where are the latest conversion files I need to use? The are scattered through out this thread. Its a little hard to track down which one to use.

Thanks everyone

JayBachatero

You need SMF 1.1.3 and the converter from the first page.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

vmpre2

Thanks Jay

I will get that going today.

When you say that the converter from the first page you mean the first posted one? There have been others posted on different pages.

Sorry for my confusion.

Cheers for all the work you did on this converter. It is really appreciated!

JayBachatero

Yea the first posted one.  If not the last one.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

vmpre2

#304
Great thanks Jay

I am grabbing the converters from here:

http://www.simplemachines.org/community/index.php?topic=122338.msg781367#msg781367

And I am uploading a fresh install of 1.1.3

vmpre2

#305
Doing it now.

I got an

QuoteInternal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator and inform them of the time the error occurred, and anything you might have done that may have caused the error.

Just hit refresh and it started up again.

Currently converting topics.


Now doing the posts


Another Internal error - Hit Refresh


Converting Posts (part 3)

vmpre2

Error while converting attachments.

So this is where I was the last time I tried this. I think I narrowed it down to the fact that I had migrated my YaBB a long time ago and the attachments list got messed up. The attachments prior to the upgrade are not listed in the new attachments log because they were handled differently on the older board around YaBB 1.3.1. I had started the pain process of removing the old attachments (the pre 2.1 board) hoping that it would help the SMF convert get past this error. (All 200+ of them)

Any thoughts?

QuoteConverting posts (part 3)... Successful.
Converting attachments (if the mod is installed)... Unsuccessful!
This query:

    INSERT INTO `mysql-2`.yabb_convert6_attachments
    (ID_ATTACH, size, downloads, filename, ID_MSG, width, height)
    VALUES
    (1, 17454, 0, 'dishDiagram.gif', 4104, 814, 562),
    (2, 43809, 0, 'dish4.jpg', 4107, 633, 466),
    (3, 21179, 0, 'dish2.jpg', 4108, 504, 347),
    (4, 51543, 0, 'future.jpg', 4358, 575, 349),
    (5, 77527, 0, 'turkeymap.jpg', 5847, 697, 439),
    (6, 7802, 0, 'tiara.jpg', 5942, 132, 176),
    (7, 10925, 0, 'december.jpg', 6461, 260, 260),
    (8, 19490, 0, 'november.jpg', 6468, 260, 260),
    (9, 28087, 0, 'DSCF0002b.jpg', 6536, 400, 300),
    (10, 900, 0, 'stargold.gif', 6785, 12, 12),
    (11, 63583, 0, 'geese.jpg', 7206, 981, 368),
    (12, 71148, 0, 'PICT0337.JPG', 8492, 640, 480),
    (13, 37310, 0, 'freepuppy.jpg', 8905, 617, 434),
    (14, 4285, 0, 'Rascal1.jpg', 9237, 147, 145),
    (15, 23996, 0, 'pup.jpg', 9319, 300, 282),
    (16, 24956, 0, 'pup2.jpg', 9321, 300, 474),
    (17, 16094, 0, 'pup3.jpg', 9322, 300, 353),
    (18, 14252, 0, '16452004311105750.jpg', 9323, 300, 234),
    (19, 52563, 0, 'street-with-no-beer.jpg', 9369, 800, 600),
    (20, 15501, 0, 'helmet.gif', 9379, 612, 439),
    (21, 70123, 0, 'PICT0344.JPG', 9397, 640, 480),
    (22, 77680, 0, 'PICT0347.JPG', 9398, 640, 480),
    (23, 70309, 0, 'PICT0348.JPG', 9399, 640, 480),
    (24, 31194, 0, 'sunspotmod.jpg', 9476, 297, 219),
    (25, 9768, 0, 'Tv_abc_dick_clark_newyears.jpg', 9485, 217, 174),
    (26, 288008, 0, 'PICT0408.JPG', 9584, 1024, 768),
    (27, 234042, 0, 'PICT0411.JPG', 9585, 1024, 768),
    (28, 12626, 0, '1732.jpg', 9682, 288, 192),
    (29, 2762, 0, 'champagne_glasses_confetti_sm_wht.gif', 9744, 50, 50),
    (30, 20874, 0, 'ty_photo_of_the_month.jpg', 10148, 327, 167),
    (31, 5930, 0, 'ty.jpg', 10150, 110, 124),
    (32, 13940, 0, 'Carter.jpg', 10153, 133, 200),
    (33, 27618, 0, 'TimnZoe.JPG', 10455, 407, 305),
    (34, 217598, 0, 'NY05_9.jpg', 10480, 500, 337),
    (35, 168749, 0, 'rainmaker.jpg', 10786, 320, 356),
    (36, 78453, 0, 'cute_doodle.jpg', 10788, 320, 240),
    (37, 60734, 0, 'fozzie.gif', 10792, 320, 224),
    (38, 16331, 0, 'Jezebel20A.jpg', 10797, 320, 236),
    (39, 35165, 0, 'myprotector2.jpg', 10816, 300, 288),
    (40, 5878, 0, 'untitled.gif', 10826, 64, 75),
    (41, 5268, 0, 'puggle.jpg', 10827, 120, 160),
    (42, 47180, 0, 'Bentley2.jpg', 10839, 509, 351),
    (43, 35199, 0, 'Bentley.jpg', 10841, 391, 305),
    (44, 74961, 0, 'Zoe.JPG', 10862, 610, 458),
    (45, 2345, 0, 'white.jpg', 11008, 121, 100),
    (46, 23130, 0, 'paige.jpg', 11029, 300, 300),
    (47, 20936, 0, 'paige_2.jpg', 11030, 300, 300),
    (48, 5081, 0, 'bio_Hutson.jpg', 11032, 110, 124),
    (49, 13326, 0, 'pam.jpg', 11033, 76, 105),
    (50, 7292, 0, 'andrew2_109.jpg', 11061, 109, 122),
    (51, 45731, 0, 'Icy.jpg', 11392, 800, 531),
    (52, 18014, 0, 'Bittersweet_Map.gif', 11460, 400, 400),
    (53, 63801, 0, 'Frozen_Tundra.JPG', 11809, 1024, 768),
    (54, 9118, 0, 'jose.jpg', 11826, 160, 180),
    (55, 176110, 0, 'SSLnet.jpg', 12347, 935, 757),
    (56, 70632, 0, '00870018b.jpg', 12842, 500, 359),
    (57, 78824, 0, '00870013b.jpg', 12844, 500, 376),
    (58, 433514, 0, 'DSC00594a.JPG', 13216, 1290, 1105),
    (59, 21548, 0, 'harley.jpg', 13630, 300, 225),
    (60, 90429, 0, '083104042043b.jpg', 13638, 358, 224),
    (61, 90825, 0, 'rdcs034b.jpg', 13647, 500, 374),
    (62, 82518, 0, 'rdcs088b.jpg', 13648, 500, 374),
    (63, 88787, 0, '114-1.JPG', 13650, 583, 438),
    (64, 314614, 0, '2000_Ford_Explorer_003.jpg', 14014, 2448, 1632),
    (65, 35712, 0, 'PICT0478.JPG', 14025, 448, 336),
    (66, 36634, 0, 'PICT0480.JPG', 14026, 448, 336),
    (67, 1629, 0, '58449.gif', 14620, 29, 29),
    (68, 1629, 0, '58449.gif', 14621, 29, 29),
    (69, 1629, 0, '58449.gif', 14622, 29, 29),
    (70, 31987, 0, '03-13-2005_100245PM.JPG', 15539, 452, 283),
    (71, 64868, 0, 'silverstone.jpg', 15690, 570, 368),
    (72, 59909, 0, '2002acura.JPG', 15735, 640, 480),
    (73, 137730, 0, 'neros2.JPG', 15794, 599, 895),
    (74, 176578, 0, 'neros1.JPG', 15795, 598, 893),
    (75, 32588, 0, 'maltipoo.jpg', 15993, 450, 338),
    (76, 22139, 0, 'happy_keester.jpg', 16152, 420, 336),
    (77, 18602, 0, 'SAILOR20JERRY20TATTOO20FLASH.jpg', 16227, 450, 331),
    (78, 20691, 0, 'tattoo_web.JPG', 16547, 336, 448),
    (79, 27809, 0, 'bunny_web.JPG', 16548, 336, 355),
    (80, 55440, 0, 'SSLSatDishGuidelines.pdf', 17056, , ),
    (81, 148330, 0, 'lowresjblj2060a.JPG', 17960, 640, 425),
    (82, 75157, 0, 'lowrestlx151.JPG', 17961, 319, 480),
    (83, 15092, 0, 'MoreLike.JPG', 18182, 316, 312),
    (84, 33435, 0, '6.jpg', 18207, 315, 466),
    (85, 20343, 0, 'baby_n_beer.jpg', 18360, 480, 320),
    (86, 35880, 0, 'girl_bike.jpg', 18361, 500, 337),
    (87, 34508, 0, 'neros.jpg', 18365, 464, 380),
    (88, 62609, 0, 'wackyplanetshop_1840_80664117.jpg', 18598, 247, 260),
    (89, 121, 0, 'starblue.gif', 18732, 9, 10),
    (90, 22468, 0, '4313b7c5964d6be.jpg', 18882, 420, 279),
    (91, 8303, 0, 'aj_tee-shirt_web.jpg', 19472, 120, 160),
    (92, 17855, 0, 'kidclaw.jpg', 19667, 320, 240),
    (93, 16513, 0, 'kidswing.jpg', 19669, 320, 240),
    (94, 20639, 0, 'fountain2.JPG', 20201, 448, 336),
    (95, 207887, 0, 'White_Kitty1.JPG', 21292, 1024, 768),
    (96, 106974, 0, 'Path_to_bike_trail.jpg', 21531, 868, 682),
    (97, 253558, 0, 'Gracie.jpg', 22540, 1548, 1393),
    (98, 81684, 0, 'Hood_Watch.GIF', 23531, 622, 593),
    (99, 46476, 0, 'PICT0674.JPG', 24205, 448, 336),
    (100, 37490, 0, 'PICT0675.JPG', 24206, 448, 336);

Caused the error:

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' ),
    (81, 148330, 0, 'lowresjblj2060a.JPG', 17960, 640, 4

vmpre2

Alrighty,

Removed all of the older attached files and tried the converter again.

No go. Still getting the same error.

I am really suck at this point. Would really appreciate any help.

Quote
Converting posts (part 3)... Successful.
Converting attachments (if the mod is installed)... Unsuccessful!
This query:

    INSERT INTO `smf_db`.yabb_convert6_attachments
    (ID_ATTACH, size, downloads, filename, ID_MSG, width, height)
    VALUES
    (1, 80278, 0, 'Chihuhua_In_Costume.JPG', 30175, 336, 404),
    (2, 21780, 0, 'ATT030042.jpg', 30200, 600, 450),
    (3, 21870, 0, 'ATT03005.jpg', 30201, 600, 450),
    (4, 23475, 0, 'ATT030072.jpg', 30202, 600, 450),
    (5, 21216, 0, 'ATT03006.jpg', 30203, 600, 450),
    (6, 21399, 0, 'ATT03010.jpg', 30204, 600, 450),
    (7, 20445, 0, 'ATT03011.jpg', 30205, 600, 450),
    (8, 20408, 0, 'ATT03012.jpg', 30206, 600, 450),
    (9, 30637, 0, 'coffeecupchi.jpg', 30210, 343, 236),
    (10, 18475, 0, 'redneck_hottub.jpg', 30277, 400, 296),
    (11, 82264, 0, 'navy1.jpg', 30336, 800, 600),
    (12, 126530, 0, 'timbeer.jpg', 30364, 782, 519),
    (13, 39085, 0, 'boobs.jpg', 30365, 350, 336),
    (14, 77198, 0, 'wedding.jpg', 30371, 796, 540),
    (15, 8928, 0, 'sslnet_policy.rtf', 30415, , ),
    (16, 29228, 0, 'pumpkin.jpg', 30508, 278, 469),
    (17, 355861, 0, 'cell2.jpg', 30916, 736, 599),
    (18, 90767, 0, 'car1.jpg', 30958, 892, 602),
    (19, 81039, 0, 'car2.jpg', 30959, 894, 602),
    (20, 32884, 0, 'moose1.jpg', 30960, 547, 378),
    (21, 37010, 0, 'moose2.jpg', 30961, 550, 370),
    (22, 20046, 0, 'anna_kournikova_37.jpg', 30990, 385, 575),
    (23, 19981, 0, 'perfectwoman.jpg', 31051, 245, 330),
    (24, 126023, 0, 'LUCKYSTRIKESOX.jpg', 31231, 400, 500),
    (25, 48341, 0, 'BestHalloweenCostumeEver.jpg', 31241, 450, 335),
    (26, 4268, 0, 'thigh.gif', 31246, 90, 90),
    (27, 18697, 0, 'calf.gif', 31248, 190, 166),
    (28, 16617, 0, 'Spiderman.jpg', 31433, 400, 300),
    (29, 48152, 0, 'baseballpunch.jpg', 31478, 400, 450),
    (30, 39806, 0, 'kids.jpg', 31535, 450, 600),
    (31, 39365, 0, 'Wrigley.JPG', 31794, 640, 480),
    (32, 123067, 0, 'jphoneymoon.JPG', 31803, 640, 479),
    (33, 36691, 0, 'PICT0761.JPG', 32058, 336, 448),
    (34, 113426, 0, 'DSCN0262.jpg', 32064, 640, 478),
    (35, 100830, 0, 'DSCN0261.jpg', 32065, 528, 480),
    (36, 66922, 0, 'DSCN0263.jpg', 32066, 640, 241),
    (37, 132685, 0, 'DSCN0264.jpg', 32067, 386, 640),
    (38, 120729, 0, 'DSCN0265.jpg', 32068, 397, 640),
    (39, 101236, 0, 'DSCN0267.jpg', 32069, 640, 478),
    (40, 124921, 0, 'DSCN0270.jpg', 32070, 480, 618),
    (41, 1375, 0, 'patrocks.gif', 32102, 70, 46),
    (42, 363316, 0, 'dogs_001.jpg', 32407, 804, 475),
    (43, 49173, 0, 'BaseballsRevenge.jpg', 32419, 340, 455),
    (44, 59491, 0, 'untitled.JPG', 32537, 550, 520),
    (45, 1834, 0, 'cherrygraphic.gif', 32899, 105, 85),
    (46, 4387, 0, 'Hopefully_My_guys_-_Nemo_and_Spike.JPG', 32905, 160, 114),
    (47, 4392, 0, 'Penny_and_Nemo_from_above_001.JPG', 32906, 160, 90),
    (48, 29534, 0, 'gold_gym.jpg', 32928, 360, 481),
    (49, 118548, 0, 'Kittens.JPG', 32969, 640, 480),
    (50, 63488, 0, 'mushroom.jpg', 33237, 480, 711),
    (51, 720698, 0, 'IMG_1725.jpg', 33433, 1600, 1200),
    (52, 26439, 0, 'baby_guiness.JPG', 33442, 219, 469),
    (53, 61642, 0, 'JL.jpg', 33705, 227, 344),
    (54, 46394, 0, 'fav-rey3.jpg', 33862, 454, 512),
    (55, 38469, 0, 'fav-rey2.jpg', 33863, 500, 425),
    (56, 101031, 0, 'Pandora_and_Salem.jpg', 33951, 1410, 984),
    (57, 5131, 0, 'Lizzy.jpg', 33955, 100, 100),
    (58, 11329, 0, 'car1_001.jpg', 33967, 800, 600),
    (59, 22705, 0, 'car2_001.jpg', 33969, 800, 600),
    (60, 24626, 0, 'car3.jpg', 33970, 800, 600),
    (61, 20533, 0, 'car4.jpg', 33971, 800, 600),
    (62, 6081, 0, 'Lizzy2.jpg', 34283, 160, 120),
    (63, 635139, 0, 'Doggies1.jpg', 34503, 800, 531),
    (64, 676916, 0, 'doggies2.jpg', 34504, 800, 531),
    (65, 17742, 0, 'no_poop_zone.jpg', 34590, 165, 174),
    (66, 19958, 0, 'pick_up_city.jpg', 34591, 165, 175),
    (67, 16972, 0, '23_11_56.gif', 34740, 83, 83),
    (68, 7634, 0, 'begging.gif', 34795, 227, 315),
    (69, 17128, 0, 'Tide.jpg', 34848, 748, 451),
    (70, 95898, 0, 'whitesoxfans05.jpg', 35036, 760, 451),
    (71, 88022, 0, 'doorball.jpg', 35058, 480, 480),
    (72, 38825, 0, 'Luke_and_Gypsi.jpg', 35303, 448, 336),
    (73, 47475, 0, 'Luke.jpg', 35305, 448, 336),
    (74, 30155, 0, 'Gypsi.jpg', 35306, 448, 336),
    (75, 561595, 0, 'lawn.jpg', 35328, 800, 531),
    (76, 97199, 0, 'Misc_August_05_009.jpg', 35516, 640, 480),
    (77, 13027, 0, 'morningside.jpg', 36242, 300, 200),
    (78, 37729, 0, 'Copy_of_Found_Cat_002.jpg', 36880, 448, 336),
    (79, 41258, 0, 'Found_Cat_001.jpg', 36881, 448, 336),
    (80, 37729, 0, 'Copy_of_Found_Cat_002_001.jpg', 36882, 448, 336),
    (81, 37729, 0, 'Copy_of_Found_Cat_002_002.jpg', 36883, 448, 336),
    (82, 144421, 0, 'Sargent.jpg', 37050, 1024, 682),
    (83, 30239, 0, 'TheUg.JPG', 37660, 350, 458),
    (84, 13730, 0, 'BigUgly2.JPG', 37661, 459, 195),
    (85, 23150, 0, 'BigUgly.JPG', 37662, 351, 460),
    (86, 26480, 0, 'Lucy.jpg', 37847, 600, 438),
    (87, 81343, 0, 'yuckboob.JPG', 38033, 512, 384),
    (88, 81974, 0, 'Nala_056.jpg', 38501, 720, 576),
    (89, 62909, 0, 'Nala_047.jpg', 38509, 512, 384),
    (90, 327109, 0, 'Mia-bella_018_2.jpg', 38918, 1736, 1096),
    (91, 321567, 0, 'Galaxy_2006.JPG', 38971, 700, 525),
    (92, 16354, 0, 'PICT0406_001.JPG', 38991, 448, 336),
    (93, 38701, 0, 'PICT0306.JPG', 38992, 448, 336),
    (94, 45694, 0, 'frustation.jpg', 39271, 236, 359),
    (95, 74386, 0, '23524987.jpg', 39274, 467, 425),
    (96, 261532, 0, 'ajmb.gif', 39278, 600, 675),
    (97, 14826, 0, 'Image2.jpg', 39295, 211, 301),
    (98, 334152, 0, 'Cubs_Sox_Fans_posters_outside.pdf', 39389, , ),
    (99, 112878, 0, 'Cubs_Sox_Reasons1.pdf', 39390, , ),
    (100, 162749, 0, 'Baby_pics_011-_revised.JPG', 39409, 1536, 1152);

Caused the error:

    You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' ),
    (16, 29228, 0, 'pumpkin.jpg', 30508, 278, 469),

JayBachatero

Post the yabb21_to_smf.php file that you are using.
Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Stallyon

I keep getting this error (as well as many others that fixed on retry):

Quote
Notice: Undefined offset: 0 in /home/username/public_html/forum/yabb21_to_smf.php on line 2004

Warning: array_keys() [function.array-keys]: The first argument should be an array in /home/username/public_html/forum/yabb21_to_smf.php on line 2004

Warning: implode() [function.implode]: Bad arguments. in /home/username/public_html/forum/yabb21_to_smf.php on line 2004
Unsuccessful!
This query:
INSERT INTO `username_forum`.smf_members
()
VALUES ('ocsiocsi', '1f3a8471c55ef8be99c8791760e0dab3', 'ocsiocsi', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1155765367', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('octo', '45e0403fb8d2f101becbf74ed2e0b1bc', 'octo', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1183372873', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('Octonion2006', 'c98b95b25dccb3fef744c09e0823103a', 'Octonion2006', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1158877791', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('octopus', 'b75dee1da738312269123f1bd4f25e7d', 'octopus', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1184962343', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('octopus8888', 'b75dee1da738312269123f1bd4f25e7d', 'octopus8888', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '0', '1154255856', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('octopus99', 'ec9d404b58f168eea20a797b288b9f61', 'octopus99', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1160303106', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('(removed email)', 'adf4661fe6715ed47954193e68b63036', '(removed email)', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '0', '1175834593', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('oddblob', 'f35a6a19be69e913c41f584fbac16e30', 'oddblob', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '0', '1176019310', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('odddna', '0eda241fc65ccf35d9743309ac395215', 'odddna', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '0', '1151587876', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('oddi', 'd68e84140e6956552ce2dd8edc2dd627', 'oddi', '(removed email)', '', '', '', '0', '0', '', '', '', '', '1', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1182116829', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('oddjohn', '2469c12ad712ef35e0792dd239e318f4', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1182895075', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('oden666', 'd9420f48073079d2c8b693cdc8d35260', 'oden666', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1179218933', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('odenson', 'e0557497c0f1427589d9a08fe5f22be6', 'odenson', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1154999274', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', ''),
('odgirl', 'd25922edb7ab92c0ca31328cbdcbd42f', 'odgirl', '(removed email)', '', '', '', '0', '0', '', '', '', '', '', 'I Love YaBB!', 'blank.gif', '', '', '', '1', '1163650098', '0', '0', '0', '', '', '', '', '', '', '', '', '', '', '', '', '', '');
Caused the error:

Column count doesn't match value count at row 1
Kris Bell
Dahulu Tim Penerjemah Bahasa Indonesia (Former Indonesian Translation Team)
stallyon@bigpond.com

Tidak menerima pesan pribadi (PM) jika tidak diminta (no unsolicited private messages)

Attention: Spelling errors in this message are the product of a poor school system. Pay teachures more than athleets.

vmpre2

#310
Well, I cant seem to attach a file...do I have to have a certain number of posts?

Not sure if this is a good idea but...here is a copy paste of the file contents.  :-[



<?php
/**********************************************************************************
* yabb21_to_smf.php                                                               *
***********************************************************************************
* SMF: Simple Machines Forum                                                      *
* Open-Source Project Inspired by Zef Hemel ([email protected])                    *
* =============================================================================== *
* Software Version:           SMF 1.1                                             *
* Software by:                Simple Machines (http://www.simplemachines.org)     *
* Copyright 2006 by:          Simple Machines LLC (http://www.simplemachines.org) *
*           2001-2006 by:     Lewis Media (http://www.lewismedia.com)             *
* Support, News, Updates at:  http://www.simplemachines.org                       *
***********************************************************************************
* This program is free software; you may redistribute it and/or modify it under   *
* the terms of the provided license as published by Simple Machines LLC.          *
*                                                                                 *
* This program is distributed in the hope that it is and will be useful, but      *
* WITHOUT ANY WARRANTIES; without even any implied warranty of MERCHANTABILITY    *
* or FITNESS FOR A PARTICULAR PURPOSE.                                            *
*                                                                                 *
* See the "license.txt" file for details of the Simple Machines license.          *
* The latest version can always be found at http://www.simplemachines.org.        *
**********************************************************************************/

$convert_data = array(
'name' => 'YaBB 2.1',
'version' => 'SMF 1.1',
'flatfile' => true,
'settings' => array('/Paths.pl''/Variables/Paths.pl'),
'parameters' => array(
array(
'id' => 'db_purge',
'type' => 'checked',
'label' => 'Clear current SMF posts and members during conversion.',
),
),
);

if (!
function_exists('convert_query'))
{
if (file_exists(dirname(__FILE__) . '/convert.php'))
header('Location: http://' . (empty($_SERVER['HTTP_HOST']) ? $_SERVER['SERVER_NAME'] . (empty($_SERVER['SERVER_PORT']) || $_SERVER['SERVER_PORT'] == '80' '' ':' $_SERVER['SERVER_PORT']) : $_SERVER['HTTP_HOST']) . (strtr(dirname($_SERVER['PHP_SELF']), '\\''/') == '/' '' strtr(dirname($_SERVER['PHP_SELF']), '\\''/')) . '/convert.php?convert_script=' basename(__FILE__));
else
{
echo '<html>
<head>
<title>Unable to continue!</title>
</head>
<body>
<h1>Sorry, this file can\'t work alone</h1>

<p>Please download convert.php from <a href="http://www.simplemachines.org/">www.simplemachines.org</a> and use it.  This file should be in the same directory as it.</p>
</body>
</html>'
;
}

exit;
}

if (empty(
$preparsing))
{
// Memory, please!!
@ini_set('memory_limit''128M');

function load_converter_settings()
{
global $yabb;

if (isset($_SESSION['convert_parameters']['db_purge']))
$_SESSION['purge'] = !empty($_SESSION['convert_parameters']['db_purge']);

if (!isset($_POST['path_from']) || (!file_exists($_POST['path_from'] . '/Paths.pl') && !file_exists($_POST['path_from'] . '/Variables/Paths.pl')))
return;

if (file_exists($_POST['path_from'] . '/Paths.pl'))
$data file($_POST['path_from'] . '/Paths.pl');
else
$data file($_POST['path_from'] . '/Variables/Paths.pl');
foreach ($data as $line)
{
$line trim($line);
if (empty($line) || substr($line01) == '#')
continue;

if (preg_match('~\$([^ =]+?)\s*=\s*[q]?([\^"\']?)(.+?)\\2;~'$line$match) != 0)
$yabb[$match[1]] = $match[2] == '^' addslashes($match[3]) : $match[3];
}

$paths = array('boarddir''boardsdir''datadir''memberdir''sourcedir''vardir''facesdir''uploaddir');
foreach ($paths as $path)
$yabb[$path] = fixRelativePath($yabb[$path], $_POST['path_from']);

// In some cases $boarddir is not parsed causing the paths to be incorrect.
foreach ($paths as $path)
if (substr($yabb[$path], 09) == '$boarddir')
$yabb[$path] = str_replace('$boarddir'$yabb['boarddir'], $yabb[$path]);

$data file($yabb['vardir'] . '/Settings.pl');
foreach ($data as $line)
{
$line trim($line);
if (empty($line) || substr($line01) == '#')
continue;

if (preg_match('~\$([^ =]+?)\s*=\s*[q]?([\^"\']?)(.+?)\\2;~'$line$match) != 0)
$yabb[$match[1]] = $match[2] == '^' addslashes($match[3]) : $match[3];
}
}

function convertStep1()
{
global $to_prefix$yabb;

echo 'Converting membergroups...';

$knownGroups = array();
$extraGroups = array();
$newbie false;

$groups file($yabb['vardir'] . '/membergroups.txt');
foreach ($groups as $i => $group)
{
if (preg_match('~^\$Group\{\'(Administrator|Global Moderator|Moderator)\'\} = [\'|"]([^|]*)\|(\d*)\|([^|]*)\|([^|]*)~'$group$match) != 0)
{
$match addslashes_recursive($match);
$ID_GROUP $match[1] == 'Administrator' : ($match[1] == 'Global Moderator' 3);
$knownGroups[] = "$ID_GROUP, SUBSTRING('$match[2]', 1, 80), SUBSTRING('$match[5]', 1, 20), '-1', SUBSTRING('$match[3]#$match[4]', 1, 255)";
}
elseif (preg_match('~\$Post\{\'(\d+)\'\} = [\'|"]([^|]*)\|(\d*)\|([^|]*)\|([^|]*)~'$group$match) != 0)
{
$match addslashes_recursive($match);
$extraGroups[] = "SUBSTRING('$match[2]', 1, 80), SUBSTRING('$match[5]', 1, 20), " max(0$match[3]) . ", SUBSTRING('$match[3]#$match[4]', 1, 255)";

if ($match[3] < 1)
$newbie true;
}
elseif (preg_match('~\$NoPost\[(\d+)\] = [\'|"]([^|]*)\|(\d*)\|([^|]*)\|([^|]*)~'$group$match) != 0)
{
$match addslashes_recursive($match);
$extraGroups[] = "SUBSTRING('$match[2]', 1, 80), SUBSTRING('$match[5]', 1, 20), 0, SUBSTRING('$match[3]#$match[4]', 1, 255)";
}
}

if (!empty($_SESSION['purge']))
{
convert_query("
DELETE FROM 
{$to_prefix}permissions
WHERE ID_GROUP > " 
. ($newbie 4));
convert_query("
DELETE FROM 
{$to_prefix}membergroups
WHERE ID_GROUP > " 
. ($newbie 4));
}

if (!empty($knownGroups))
{
convert_query("
REPLACE INTO 
{$to_prefix}membergroups
(ID_GROUP, groupName, onlineColor, minPosts, stars)
VALUES (" 
implode("),
("
$knownGroups) . ")");
}

if (!empty($extraGroups))
{
convert_query("
REPLACE INTO 
{$to_prefix}membergroups
(groupName, onlineColor, minPosts, stars)
VALUES (" 
implode("),
("
$extraGroups) . ")");
}
}

function convertStep2()
{
global $to_prefix$yabb;

echo 'Converting members...';

if ($_GET['substep'] == && !empty($_SESSION['purge']))
{
convert_query("
TRUNCATE 
{$to_prefix}members");
}
if ($_GET['substep'] == 0)
{
// Get rid of the primary key... we have to resort anyway.
$knownKeys = array(
'PRIMARY' => 'DROP PRIMARY KEY',
);
$alterColumns = array(
'ID_MEMBER' => 'CHANGE COLUMN ID_MEMBER ID_MEMBER mediumint(8) unsigned NOT NULL default 0',
);
alterTable('members'$knownKeys''$alterColumns);
}

pastTime(0);

$request convert_query("
SELECT ID_GROUP, groupName
FROM 
{$to_prefix}membergroups
WHERE ID_GROUP != 3"
);
$groups = array('Administrator' => 1'Global Moderator' => 2'Moderator' => 0);
while ($row mysql_fetch_assoc($request))
$groups[$row['groupName']] = $row['ID_GROUP'];
mysql_free_result($request);

$file_n 0;
$dir dir($yabb['memberdir']);
$block = array();
$text_columns = array(
'memberName' => 80,
'lngfile' => 255,
'realName' => 255,
'buddy_list' => 255,
'pm_ignore_list' => 255,
'messageLabels' => 65534,
'passwd' => 64,
'emailAddress' => 255,
'personalText' => 255,
'websiteTitle' => 255,
'websiteUrl' => 255,
'location' => 255,
'ICQ' => 255,
'AIM' => 16,
'YIM' => 32,
'MSN' => 255,
'timeFormat' => 80,
'signature' => 255,
'avatar' => 255,
'usertitle' => 255,
'memberIP' => 255,
'memberIP2' => 255,
'secretQuestion' => 255,
'secretAnswer' => 64,
'validation_code' => 10,
'additionalGroups' => 255,
'smileySet' => 48,
'passwordSalt' => 5,
);
while ($entry $dir->read())
{
if ($_GET['substep'] < 0)
break;
if ($file_n++ < $_GET['substep'])
continue;
if (strrchr($entry'.') != '.vars' && strrchr($entry'.') != '.dat')
continue;

$name substr($entry0strrpos($entry'.'));

$userData file($yabb['memberdir'] . '/' $entry);
if (count($userData) < 3)
continue;

$data = array();
foreach ($userData as $i => $v)
{
$userData[$i] = trim($userData[$i]);

if (strrchr($entry'.') == '.vars' && preg_match('~^\'([^\']+)\',"([^"]+)"~'$userData[$i], $match) != 0)
$data[$match[1]] = $match[2];

}

// Is it an invalid user?
if (empty($data))
continue;

if (strrchr($entry'.') != '.vars')
{
$userData array_pad($userData31'');
$data = array(
'password' => $userData[0],
'realname' => $userData[1],
'email' => $userData[2],
'webtitle' => $userData[3],
'weburl' => $userData[4],
'signature' => $userData[5],
'postcount' => $userData[6],
'position' => $userData[7],
'icq' => $userData[8],
'aim' => $userData[9],
'yim' => $userData[10],
'gender' => $userData[11],
'usertext' => $userData[12],
'userpic' => $userData[13],
'regdate' => $userData[14],
'location' => $userData[15],
'bday' => $userData[16],
'hidemail' => $userData[19],
'msn' => $userData[20],
'lastonline' => $userData[23],
'im_ignorelist' => $userData[26],
'im_notify' => $userData[27],
// !!! 'cathide' => $userData[30],
// !!! 'postlayout' => $userData[31],
);
}

$row = array(
'memberName' => substr(htmlspecialchars(trim($name)), 080),
'passwd' => strlen($data['password']) == 22 bin2hex(base64_decode($data['password'])) : md5($data['password']),
'realName' => htmlspecialchars($data['realname']),
'emailAddress' => htmlspecialchars($data['email']),
'websiteTitle' => isset($data['website']) ? htmlspecialchars($data['webtitle']) : '',
'websiteUrl' => isset($data['weburl']) ? htmlspecialchars($data['weburl']) : '',
'signature' => isset($data['signature']) ? str_replace(array('&amp;&amp;''&amp;lt;''&amp;gt;'), array('<br />''<''>'), strtr($data['signature'], array('\'' => '&#38;#039;'))) : '',
'posts' => (int) $data['postcount'],
'ID_GROUP' => isset($data['position']) && isset($groups[$data['position']]) ? $groups[$data['position']] : 0,
'ICQ' => isset($data['icq']) ? htmlspecialchars($data['icq']) : '',
'AIM' => isset($data['aim']) ? substr(htmlspecialchars($data['aim']), 016) : '',
'YIM' => isset($data['yim']) ? substr(htmlspecialchars($data['yim']), 032) : '',
'MSN' => isset($data['msn']) ? htmlspecialchars($data['msn']) : '',
'gender' => isset($data['gender']) ? ($data['gender'] == 'Male' : ($data['gender'] == 'Female' 0)) : '',
'personalText' => isset($data['usertext']) ? htmlspecialchars($data['usertext']) : '',
'avatar' => $data['userpic'],
'dateRegistered' => parse_time($data['regdate']),
'location' => isset($data['location']) ? htmlspecialchars($data['location']) : '',
'birthdate' => isset($data['bday']) ? ($data['bday'] == '' || strtotime($data['bday']) == '0001-01-01' strftime('%Y-%m-%d'strtotime($data['bday']))) : '',
'hideEmail' => isset($data['hidemail']) && $data['hidemail'] == 'checked' '1' '0',
'lastLogin' => isset($data['lastonline']) ? $data['lastonline'] : '',
'pm_email_notify' => empty($data['im_notify']) || trim($data['im_notify']) == '' '0' '1',
'karmaGood' => 0,
'karmaBad' => 0,
);

// Make sure these columns have a value and don't exceed max width.
foreach ($text_columns as $text_column => $max_size)
$row[$text_column] = isset($row[$text_column]) ? substr($row[$text_column], 0$max_size) : '';

if ($row['birthdate'] == '0001-01-01' && parse_time($data['bday'], false) != 0)
$row['birthdate'] = strftime('%Y-%m-%d'parse_time($data['bday'], false));

if (file_exists($yabb['memberdir'] . '/' substr($entry0, -4) . '.karma'))
{
$karma = (int) implode(''file($yabb['memberdir'] . '/' substr($entry0, -4) . '.karma'));
$row['karmaGood'] = $karma $karma 0;
$row['karmaBad'] = $karma ? -$karma 0;
}

$block[] = addslashes_recursive($row);

if (count($block) > 100)
{
doBlock('members'$block);
pastTime($file_n);
}
}
$dir->close();

doBlock('members'$block);

pastTime(-1);

// Part 2: Now we get to resort the members table!
if ($_GET['substep'] >= -1)
{
convert_query("
ALTER TABLE 
{$to_prefix}members
ORDER BY ID_MEMBER = 0, dateRegistered"
);
pastTime(-2);
}
if ($_GET['substep'] >= -2)
{
$knownKeys = array(
'PRIMARY' => 'ADD PRIMARY KEY (ID_MEMBER)',
);
$alterColumns = array(
'ID_MEMBER' => 'CHANGE COLUMN ID_MEMBER ID_MEMBER mediumint(8) unsigned NOT NULL auto_increment',
);
alterTable('members'$knownKeys''$alterColumnstrue);

pastTime(-3);
}
if ($_GET['substep'] >= -3)
{
convert_query("
ALTER TABLE 
{$to_prefix}members
ORDER BY ID_MEMBER"
);
}
}

function convertStep3()
{
global $to_prefix$yabb;

echo 'Converting settings...';

$temp file($yabb['vardir'] . '/reservecfg.txt');
$settings = array(
'allow_guestAccess' => isset($yabb['guestaccess']) ? (int) $yabb['guestaccess'] : 0,
'news' => addslashes(strtr(implode(''file($yabb['vardir'] . '/news.txt')), array("\r" => ''))),
'cookieTime' => !empty($yabb['Cookie_Length']) && $yabb['Cookie_Length'] > ? (int) $yabb['Cookie_Length'] : 60,
'requireAgreement' => !empty($yabb['RegAgree']) ? 0,
'registration_method' => !empty($yabb['emailpassword']) ? 0,
'send_validation_onChange' => !empty($yabb['emailnewpass']) ? 0,
'send_welcomeEmail' => !empty($yabb['emailwelcome']) ? 0,
'mail_type' => empty($yabb['mailtype']) ? 1,
'smtp_host' => isset($yabb['smtp_server']) ? $yabb['smtp_server'] : '',
'smtp_username' => !empty($yabb['smtp_auth_required']) && isset($yabb['authuser']) ? $yabb['authuser'] : '',
'smtp_password' => !empty($yabb['smtp_auth_required']) && isset($yabb['authpass']) ? $yabb['authpass'] : '',
'defaultMaxTopics' => !empty($yabb['maxdisplay']) ? (int) $yabb['maxdisplay'] : 20,
'defaultMaxMessages' => !empty($yabb['maxmessagedisplay']) ? (int) $yabb['maxmessagedisplay'] : 15,
'max_messageLength' => !empty($yabb['MaxMessLen']) ? (int) $yabb['MaxMessLen'] : 10000,
'max_signatureLength' => (int) $yabb['MaxSigLen'],
'spamWaitTime' => (int) $yabb['timeout'],
'hotTopicPosts' => isset($yabb['HotTopic']) ? (int) $yabb['HotTopic'] : 15,
'hotTopicVeryPosts' => isset($yabb['VeryHotTopic']) ? (int) $yabb['VeryHotTopic'] : 25,
'avatar_max_width_external' => (int) $yabb['userpic_width'],
'avatar_max_height_external' => (int) $yabb['userpic_height'],
'avatar_max_width_upload' => (int) $yabb['userpic_width'],
'avatar_max_height_upload' => (int) $yabb['userpic_height'],
'reserveWord' => trim($temp[0]) == 'checked' '1' '0',
'reserveCase' => trim($temp[1]) == 'checked' '1' '0',
'reserveUser' => trim($temp[2]) == 'checked' '1' '0',
'reserveName' => trim($temp[3]) == 'checked' '1' '0',
'reserveNames' => addslashes(strtr(implode(''file($yabb['vardir'] . '/reserve.txt')), array("\r" => ''))),
);

$setString '';
foreach ($settings as $var => $val)
$setString .= "
('
$var', SUBSTRING('$val', 1, 65534)),";

convert_query("
REPLACE INTO 
{$to_prefix}settings
(variable, value)
VALUES" 
substr($setString0, -1));
}

function convertStep4()
{
global $to_prefix$yabb;

if ($_GET['substep'] == && !empty($_SESSION['purge']))
{
convert_query("
TRUNCATE 
{$to_prefix}personal_messages");
convert_query("
TRUNCATE 
{$to_prefix}pm_recipients");
}
if ($_GET['substep'] == 0)
{
// Set the keys and columns to alter.
$knownKeys = array(
'PRIMARY' => 'DROP PRIMARY KEY',
);
$knownColumns = array(
'temp_toName' => 'ADD COLUMN temp_toName tinytext',
);
$alterColumns = array(
'ID_PM' => 'CHANGE COLUMN ID_PM ID_PM int(10) unsigned NOT NULL default 0',
);
alterTable('personal_messages'$knownKeys$knownColumns$alterColumns);
}

echo 'Converting personal messages...';

$names = array();

$file_n 0;
$dir dir($yabb['memberdir']);
$block = array();
while ($entry $dir->read())
{
if ($_GET['substep'] < 0)
break;
if ($file_n++ < $_GET['substep'])
continue;
if (strrchr($entry'.') != '.msg')
continue;

$userData file($yabb['memberdir'] . '/' $entry);
foreach ($userData as $i => $v)
{
$userData[$i] = explode('|'rtrim($userData[$i]));
if (count($userData[$i]) <= || empty($userData[$i]))
continue;

if (substr($userData[$i][3], -10) == '#nosmileys')
$userData[$i][3] = substr($userData[$i][3], 0, -10);

$row = array(
'fromName' => substr(htmlspecialchars($userData[$i][0]), 0255),
'subject' => substr($userData[$i][1], 0255),
'msgtime' => $userData[$i][2],
'body' => substr($userData[$i][3], 065534),
'ID_MEMBER_FROM' => 0,
'deletedBySender' => 1,
'temp_toName' => htmlspecialchars(substr($entry0, -4)),
);

$names[strtolower(addslashes($row['fromName']))][] = &$row['ID_MEMBER_FROM'];

$block[] = addslashes_recursive($row);
}

if (count($block) > 100)
{
$result convert_query("
SELECT ID_MEMBER, memberName
FROM 
{$to_prefix}members
WHERE memberName IN ('" 
implode("', '"array_keys($names)) . "')
LIMIT " 
count($names));
while ($row mysql_fetch_assoc($result))
foreach ($names[strtolower(addslashes($row['memberName']))] as $k => $v)
$names[strtolower(addslashes($row['memberName']))][$k] = $row['ID_MEMBER'];
mysql_free_result($result);
$names = array();

doBlock('personal_messages'$block);
pastTime($file_n);
}
}
$dir->close();

if (!empty($block))
{
$result convert_query("
SELECT ID_MEMBER, memberName
FROM 
{$to_prefix}members
WHERE memberName IN ('" 
implode("', '"array_keys($names)) . "')
LIMIT " 
count($names));
while ($row mysql_fetch_assoc($result))
{
foreach ($names[strtolower(addslashes($row['memberName']))] as $k => $v)
$names[strtolower(addslashes($row['memberName']))][$k] = $row['ID_MEMBER'];
}
mysql_free_result($result);
$names = array();

doBlock('personal_messages'$block);
}

pastTime(-1);

// Part 2: Now we get to resort the personal messages table!
if ($_GET['substep'] >= -1)
{
convert_query("
ALTER TABLE 
{$to_prefix}personal_messages
ORDER BY ID_PM = 0, msgtime"
);

pastTime(-2);
}
if ($_GET['substep'] >= -2)
{
$knownKeys = array(
'PRIMARY' => 'ADD PRIMARY KEY (ID_PM)',
);
$alterColumns = array(
'ID_PM' => 'CHANGE COLUMN ID_PM ID_PM int(10) unsigned NOT NULL auto_increment',
);
alterTable('personal_messages'$knownKeys''$alterColumnstrue);

pastTime(-3);
}
if ($_GET['substep'] >= -3)
{
convert_query("
INSERT IGNORE INTO 
{$to_prefix}pm_recipients
(ID_PM, ID_MEMBER, labels, is_read)
SELECT pm.ID_PM, mem.ID_MEMBER, -1 AS labels, 1 AS is_read
FROM (
{$to_prefix}personal_messages AS pm, {$to_prefix}members AS mem)
WHERE mem.memberName = pm.temp_toName
AND pm.temp_toName != ''"
);

pastTime(-4);
}
if ($_GET['substep'] >= -4)
{
$knownColumns = array(
'temp_toName' => 'DROP temp_toName',
);
alterTable('personal_messages'''$knownColumnsfalsetrue);

pastTime(-5);
}
if ($_GET['substep'] >= -5)
{
convert_query("
ALTER TABLE 
{$to_prefix}personal_messages
ORDER BY ID_PM"
);
}
}

function convertStep5()
{
global $to_prefix$yabb;

echo 'Converting boards and categories...';

if ($_GET['substep'] == && !empty($_SESSION['purge']))
{
convert_query("
TRUNCATE 
{$to_prefix}categories");
convert_query("
TRUNCATE 
{$to_prefix}boards");
convert_query("
TRUNCATE 
{$to_prefix}moderators");
}
if ($_GET['substep'] == 0)
{
// Handle the categories table and columns
$knownColumns = array(
'tempID' => 'ADD COLUMN tempID tinytext',
);
alterTable('categories'''$knownColumns);

// Use the $knownColumns frm before and add tempCatID then alter boards table.
$knownColumns += array(
'tempCatID' => 'ADD COLUMN tempCatID tinytext',
);
alterTable('boards'''$knownColumns);

// Drop the primary key for moderators
$knownKeys = array(
'PRIMARY' => 'DROP PRIMARY KEY',
);
alterTable('moderators'$knownKeys);
}

$request convert_query("
SELECT ID_GROUP, groupName
FROM 
{$to_prefix}membergroups
WHERE ID_GROUP != 3"
);
$groups = array('Administrator' => 1'Global Moderator' => 2'Moderator' => 0);
while ($row mysql_fetch_assoc($request))
$groups[$row['groupName']] = $row['ID_GROUP'];
mysql_free_result($request);

$cat_data file($yabb['boardsdir'] . '/forum.master');
$cat_order = array();
$cats = array();
$boards = array();
foreach ($cat_data as $line)
{
if (preg_match('~^\$board\{\'(.+?)\'\} = ([^|]+)~'$line$match) != 0)
$boards[$match[1]] = trim($match[2], '"');
elseif (preg_match('~^\$catinfo\{\'(.+?)\'\} = ([^|]+?)\|([^|]*?)\|([^|]+?);~'$line$match) != 0)
{
$match[3] = explode(','$match[3]);
if (trim($match[3][0]) == '')
$cat_groups array_merge($groups, array(20, -1));
else
{
$cat_groups = array(2);
foreach ($match[3] as $group)
{
if (isset($groups[trim($group)]))
$cat_groups[] = $groups[trim($group)];
}
}

// Make the tempCatID lowercase
$match[1] = strtolower(trim($match[1]));

$cats[$match[1]]['name'] = trim($match[2], '"');
$cats[$match[1]]['groups'] = implode(','$cat_groups);
$cats[$match[1]]['canCollapse'] = !empty($match[4]);
}
elseif (preg_match('~^@categoryorder = qw\((.+?)\);~'$line$match) != 0)
$cat_order array_flip(explode(' '' 'strtolower(trim($match[1]))));
}

$cat_rows = array();
foreach ($cats as $tempID => $cat)
{
$tempID strtolower(trim($tempID));
$row = array(
'name' => str_replace(array('qq~''qw~'), ''substr($cat['name'], 0255)),
'catOrder' => @$cat_order[$tempID],
'tempID' => $tempID,
);
$cat_rows[] = addslashes_recursive($row);
}
doBlock('categories'$cat_rows);

$board_data file($yabb['boardsdir'] . '/forum.control');
$boardOrder 1;
$moderators = array();
$board_rows = array();
foreach ($board_data as $line)
{
list ($tempCatID$tempID, , $description$mods, , , , , $doCountPosts, , , $is_recycle) = explode('|'rtrim($line));
// !!! is_recycle -> set recycle board?

// Set lower case since case matters in PHP
$tempCatID strtolower(trim($tempCatID));

$row = array(
'name' => str_replace(array('qq~''qw~'), ''substr($boards[$tempID], 0255)),
'description' => substr($description0255),
'countPosts' => empty($doCountPosts),
'boardOrder' => $boardOrder++,
'memberGroups' => $cats[$tempCatID]['groups'],
'tempID' => $tempID,
'tempCatID' => $tempCatID,
);

$board_rows[] = addslashes_recursive($row);

$moderators[$tempID] = preg_split('~(, | |,)~'$mods);
}
doBlock('boards'$board_rows);

$result convert_query("
SELECT ID_CAT, tempID
FROM 
{$to_prefix}categories
WHERE tempID != ''"
);
while ($row mysql_fetch_assoc($result))
{
convert_query("
UPDATE 
{$to_prefix}boards
SET ID_CAT = 
$row[ID_CAT]
WHERE tempCatID = '
$row[tempID]'");
}
mysql_free_result($result);

foreach ($moderators as $boardid => $names)
{
$result convert_query("
SELECT ID_BOARD
FROM 
{$to_prefix}boards
WHERE tempID = '
$boardid'
LIMIT 1"
);
list ($ID_BOARD) = mysql_fetch_row($result);
mysql_free_result($result);

convert_query("
INSERT INTO 
{$to_prefix}moderators
(ID_BOARD, ID_MEMBER)
SELECT 
$ID_BOARD, ID_MEMBER
FROM 
{$to_prefix}members
WHERE memberName IN ('" 
implode("', '"addslashes_recursive($names)) . "')
LIMIT " 
count($names));
}

pastTime(-1);
if ($_GET['substep'] >= -1)
{
$knownColumns = array(
'tempID' => 'DROP COLUMN tempID',
);
alterTable('categories'''$knownColumns''falsetrue);

pastTime(-2);
}
if ($_GET['substep'] >= -2)
{
$knownColumns = array(
'tempCatID' => 'DROP COLUMN tempCatID',
);
alterTable('boards'''$knownColumns''falsetrue);

pastTime(-3);
}
if ($_GET['substep'] >= -3)
{
$knownKeys = array(
'PRIMARY' => 'ADD PRIMARY KEY (ID_BOARD, ID_MEMBER)',
);
alterTable('moderators'$knownKeys''''true);
}
}

function convertStep6()
{
global $to_prefix$yabb;

if ($_GET['substep'] == && !empty($_SESSION['purge']))
{
convert_query("
TRUNCATE 
{$to_prefix}log_boards");
convert_query("
TRUNCATE 
{$to_prefix}log_mark_read");
convert_query("
TRUNCATE 
{$to_prefix}log_topics");
}
if ($_GET['substep'] == 0)
{
$knownKeys = array(
'PRIMARY' => 'DROP PRIMARY KEY',
);
$knownColumns = array(
'tempID' => 'ADD COLUMN tempID int(10) unsigned NOT NULL default 0',
);
alterTable('log_topics'$knownKeys$knownColumns);
}

echo 'Converting mark read data...';

$result convert_query("
SELECT ID_BOARD, tempID
FROM 
{$to_prefix}boards");
$boards = array();
while ($row mysql_fetch_assoc($result))
$boards[$row['tempID']] = $row['ID_BOARD'];
mysql_free_result($result);

$file_n 0;
$dir dir($yabb['memberdir']);
$mark_read_block = array();
$boards_block = array();
$topics_block = array();
while ($entry $dir->read())
{
if ($_GET['substep'] < 0)
break;
if ($file_n++ < $_GET['substep'])
continue;
if (strrchr($entry'.') != '.log')
continue;

$result convert_query("
SELECT ID_MEMBER
FROM 
{$to_prefix}members
WHERE memberName = '" 
substr($entry0, -4) . "'
LIMIT 1"
);
list ($ID_MEMBER) = mysql_fetch_row($result);
mysql_free_result($result);

$logData file($yabb['memberdir'] . '/' $entry);
foreach ($logData as $log)
{
$parts array_pad(explode('|'$log), 3'');
if (trim($parts[0]) == '')
continue;

$row = array();
$row['ID_MEMBER'] = $ID_MEMBER;

if (is_numeric(trim($parts[0])) && trim($parts[0]) > 10000)
{
$row['tempID'] = trim($parts[0]);
$topics_block[] = $row;
}
else
{
if (substr(trim($parts[0]), -6) == '--mark' && isset($boards[substr(trim($parts[0]), 0, -6)]))
{
$row['ID_BOARD'] = $boards[substr(trim($parts[0]), 0, -6)];
$mark_read_block[] = $row;
}
elseif (isset($boards[trim($parts[0])]))
{
$row['ID_BOARD'] = $boards[trim($parts[0])];
$boards_block[] = $row;
}
}
}

// Because of the way steps are done, we have to flush all of these at once, or none.
if (count($mark_read_block) > 250 || count($boards_block) > 250 || count($topics_block) > 250)
{
doBlock('log_mark_read'$mark_read_block);
doBlock('log_boards'$boards_block);
doBlock('log_topics'$topics_block);

pastTime($file_n);
}
}
$dir->close();

doBlock('log_mark_read'$mark_read_block);
doBlock('log_boards'$boards_block);
doBlock('log_topics'$topics_block);

}

function convertStep7()
{
global $to_prefix$yabb;

if ($_GET['substep'] == && !empty($_SESSION['purge']))
{
convert_query("
TRUNCATE 
{$to_prefix}topics");
}
if ($_GET['substep'] == 0)
{
$knownKeys = array(
'PRIMARY' => 'DROP PRIMARY KEY',
'poll' => 'DROP INDEX poll',
'firstMessage' => 'DROP INDEX firstMessage',
'lastMessage' => 'DROP INDEX lastMessage',
);
$knownColumns = array(
'tempID' => 'ADD COLUMN tempID int(10) unsigned NOT NULL default 0'
);
$alterColumns = array(
'ID_TOPIC' => 'CHANGE COLUMN ID_TOPIC ID_TOPIC mediumint(8) unsigned NOT NULL default 0',
);
alterTable('topics'$knownKeys$knownColumns$alterColumns);
}

echo 'Converting topics (part 1)...';

$result convert_query("
SELECT ID_BOARD, tempID
FROM 
{$to_prefix}boards
WHERE tempID != ''"
);
$boards = array();
while ($row mysql_fetch_assoc($result))
$boards[$row['tempID']] = $row['ID_BOARD'];
mysql_free_result($result);

$data_n 0;
$block = array();
foreach ($boards as $boardname => $ID_BOARD)
{
if ($_GET['substep'] < 0)
break;
if (!file_exists($yabb['boardsdir'] . '/' $boardname '.txt'))
continue;

$topicListing file($yabb['boardsdir'] . '/' $boardname '.txt');
foreach ($topicListing as $topicData)
{
if ($data_n++ < $_GET['substep'])
continue;

$topicInfo explode('|'rtrim($topicData));
$tempID = (int) $topicInfo[0];

if (!file_exists($yabb['datadir'] . '/' $tempID '.txt'))
continue;

$views = @file($yabb['datadir'] . '/' $tempID '.ctb');
$views $views[2] - 1;

$block[] = array(
'tempID' => $tempID,
'ID_BOARD' => (int) $ID_BOARD,
'isSticky' => isset($topicInfo[8]) && strpos($topicInfo[8], 's') !== false 0,
'locked' => isset($topicInfo[8]) && strpos($topicInfo[8], 'l') !== false 0,
'numViews' => $views,
);

if (count($block) > 100)
{
doBlock('topics'$block);
pastTime($data_n);
}
}
}

doBlock('topics'$block);

pastTime(-1);

if ($_GET['substep'] >= -1)
{
convert_query("
UPDATE 
{$to_prefix}topics
SET tempID = ID_TOPIC
WHERE tempID = 0"
);

pastTime(-2);
}
if ($_GET['substep'] >= -2)
{
convert_query("
ALTER TABLE 
{$to_prefix}topics
ORDER BY ID_TOPIC = 0, tempID"
);

pastTime(-3);
}
if ($_GET['substep'] >= -3)
{
$knownKeys = array(
'PRIMARY' => 'ADD PRIMARY KEY (ID_TOPIC)',
);
$alterColumns = array(
'ID_TOPIC' => 'CHANGE COLUMN ID_TOPIC ID_TOPIC mediumint(8) unsigned NOT NULL auto_increment',
);
alterTable('topics'$knownKeys''$alterColumnstrue);

pastTime(-4);
}
if ($_GET['substep'] >= -4)
{
convert_query("
ALTER TABLE 
{$to_prefix}topics
ORDER BY ID_TOPIC"
);
}
}

function convertStep8()
{
global $to_prefix$yabb;

if ($_GET['substep'] == 0)
{
$knownColumns = array(
'tempID' => 'DROP COLUMN tempID',
);
alterTable('boards'''$knownColumns''falsetrue);
}

echo 'Converting topics (part 2)...';

$request convert_query("
SELECT COUNT(*)
FROM 
{$to_prefix}topics
WHERE tempID != ID_TOPIC"
);
list ($topicCount) = mysql_fetch_row($request);
mysql_free_result($request);

while ($_GET['substep'] <= $topicCount)
{
pastTime($_GET['substep']);

$result convert_query("
SELECT ID_TOPIC, tempID
FROM 
{$to_prefix}topics
WHERE tempID != ID_TOPIC
LIMIT 
$_GET[substep], 150");
while ($row mysql_fetch_assoc($result))
{
convert_query("
UPDATE 
{$to_prefix}log_topics
SET ID_TOPIC = 
$row[ID_TOPIC]
WHERE tempID = 
$row[tempID]");
}

$_GET['substep'] += 150;

mysql_free_result($result);
}

pastTime(-1);

if ($_GET['substep'] >= -1)
{
convert_query("
DELETE FROM 
{$to_prefix}log_topics
WHERE ID_TOPIC = 0 OR ID_MEMBER = 0"
);

pastTime(-2);
}
if ($_GET['substep'] >= -2)
{
$knownKeys = array(
'PRIMARY' => 'ADD PRIMARY KEY (ID_TOPIC, ID_MEMBER)',
);
$knownColumns = array(
'tempID' => 'DROP COLUMN tempID',
);
alterTable('log_topics'$knownKeys$knownColumns''truetrue);
}
}

function convertStep9()
{
global $to_prefix$yabb;

if ($_GET['substep'] == && !empty($_SESSION['purge']))
{
convert_query("
TRUNCATE 
{$to_prefix}log_notify");
}

echo 'Converting notifications...';

$request convert_query("
SELECT COUNT(*)
FROM 
{$to_prefix}topics
WHERE tempID != ID_TOPIC"
);
list ($count) = mysql_fetch_row($request);
mysql_free_result($request);

while ($_GET['substep'] < $count)
{
pastTime($_GET['substep']);

$result convert_query("
SELECT ID_TOPIC, tempID
FROM 
{$to_prefix}topics
WHERE tempID != ID_TOPIC
LIMIT 
$_GET[substep], 150");
while ($row mysql_fetch_assoc($result))
{
if (!file_exists($yabb['datadir'] . '/' $row['tempID'] . '.mail'))
continue;

$list file($yabb['datadir'] . '/' $row['tempID'] . '.mail');
foreach ($list as $k => $v)
list ($list[$k]) = explode('|'htmlspecialchars(addslashes(rtrim($v))));

convert_query("
INSERT IGNORE INTO 
{$to_prefix}log_notify
(ID_TOPIC, ID_MEMBER)
SELECT 
$row[ID_TOPIC], ID_MEMBER
FROM 
{$to_prefix}members
WHERE memberName IN ('" 
implode("', '"$list) . "')
LIMIT " 
count($list));
}

$_GET['substep'] += 50;
if (mysql_num_rows($result) < 50)
break;

mysql_free_result($result);
}
}

function convertStep10()
{
global $to_prefix$yabb;

if ($_GET['substep'] == && !empty($_SESSION['purge']))
{
convert_query("
TRUNCATE 
{$to_prefix}messages");
convert_query("
TRUNCATE 
{$to_prefix}attachments");
}
if ($_GET['substep'] == 0)
{
$knownKeys = array(
'PRIMARY' => 'DROP PRIMARY KEY',
'topic' => 'DROP INDEX topic',
'ID_BOARD' => 'DROP INDEX ID_BOARD',
'ID_TOPIC' => 'DROP INDEX ID_TOPIC',
'ID_MEMBER' => 'DROP INDEX ID_MEMBER',
);
$alterColumns = array(
'ID_MSG' => 'CHANGE COLUMN ID_MSG ID_MSG int(10) unsigned NOT NULL default 0',
);

// Do we have attachments?
if (isset($yabb['uploaddir']))
$knownColumns = array(
'temp_filename' => "ADD COLUMN temp_filename tinytext NOT NULL default ''",
);
else
$knownColumns = array();

alterTable('messages'$knownKeys$knownColumns$alterColumns);
}

echo 'Converting posts (part 1 - this may take some time)...';

$block = array();
while (true)
{
$result convert_query("
SELECT ID_TOPIC, tempID, ID_BOARD
FROM 
{$to_prefix}topics
WHERE tempID != ID_TOPIC
LIMIT 
$_GET[substep], 100");
while ($topic mysql_fetch_assoc($result))
{
$messages file($yabb['datadir'] . '/' $topic['tempID'] . '.txt');
if (empty($messages))
{
convert_query("
DELETE FROM 
{$to_prefix}topics
WHERE ID_TOPIC = 
$topic[ID_TOPIC]
LIMIT 1"
);

pastTime($_GET['substep']);
continue;
}

foreach ($messages as $message)
{
if (trim($message) == '')
continue;

$message array_pad(explode('|'$message), 12'');
foreach ($message as $k => $v)
$message[$k] = rtrim($v);

if (substr($message[8], -10) == '#nosmileys')
$message[8] = substr($message[8], 0, -10);

$row = array(
'ID_TOPIC' => $topic['ID_TOPIC'],
'ID_BOARD' => $topic['ID_BOARD'],
'subject' => substr($message[0], 0255),
'posterName' => substr(htmlspecialchars($message[4] == 'Guest' trim($message[1]) : trim($message[4])), 0255),
'posterEmail' => substr(htmlspecialchars($message[2]), 0255),
'posterTime' => $message[3],
'icon' => substr($message[5], 016),
'posterIP' => substr($message[7], 0255),
'body' => substr(preg_replace('~\[quote author=.+? link=.+?\]~i''[quote]'$message[8]), 065534),
'smileysEnabled' => empty($message[9]),
'modifiedTime' => $message[10],
'modifiedName' => substr($message[11], 0255),
);

if (isset($yabb['uploaddir']))
{
if (isset($message[12]) && file_exists($yabb['uploaddir'] . '/' $message[12]))
$row['temp_filename'] = $message[12];
else
$row['temp_filename'] = '';
}

$block[] = addslashes_recursive($row);

if (count($block) > 100)
doBlock('messages'$block);
}

doBlock('messages'$block);
pastTime(++$_GET['substep']);
}

if (mysql_num_rows($result) < 100)
break;

mysql_free_result($result);
}

doBlock('messages'$block);
}

function convertStep11()
{
global $to_prefix$yabb;

if ($_GET['substep'] == 0)
{
mysql_query("
ALTER TABLE 
{$to_prefix}messages
ORDER BY posterTime"
);
}

echo 'Converting posts (part 2)...';

$request convert_query("
SELECT @msg := IFNULL(MAX(ID_MSG), 0)
FROM 
{$to_prefix}messages");
mysql_free_result($request);

while (true)
{
pastTime($_GET['substep']);

mysql_query("
UPDATE 
{$to_prefix}messages
SET ID_MSG = (@msg := @msg + 1)
WHERE ID_MSG = 0
LIMIT 150"
);

$_GET['substep'] += 150;
if (mysql_affected_rows() < 150)
break;
}

pastTime(-1);

if ($_GET['substep'] >= -1)
{
$knownKeys = array(
'PRIMARY' => 'ADD PRIMARY KEY (ID_MSG)',
);
$alterColumns = array(
'ID_MSG' => 'CHANGE COLUMN ID_MSG ID_MSG int(10) unsigned NOT NULL auto_increment',
);
alterTable('messages'$knownKeys''$alterColumnstrue);
}
}

function convertStep12()
{
global $to_prefix$yabb;

echo 'Converting posts (part 3)...';

while (true)
{
$result convert_query("
SELECT m.ID_MSG, mem.ID_MEMBER
FROM (
{$to_prefix}messages AS m, {$to_prefix}members AS mem)
WHERE m.posterName = mem.memberName
AND m.ID_MEMBER = 0
LIMIT 250"
);
$numRows mysql_num_rows($result);

while ($row mysql_fetch_assoc($result))
convert_query("
UPDATE 
{$to_prefix}messages
SET ID_MEMBER = 
$row[ID_MEMBER]
WHERE ID_MSG = 
$row[ID_MSG]");
mysql_free_result($result);

// We need a time out.
sleep(5);

if ($numRows 1)
break;
else
pastTime(12);
}
}

function convertStep13()
{
global $to_prefix$yabb;

echo 'Converting attachments (if the mod is installed)...';

if (!isset($yabb['uploaddir']))
return;

$result convert_query("
SELECT value
FROM 
{$to_prefix}settings
WHERE variable = 'attachmentUploadDir'
LIMIT 1"
);
list ($attachmentUploadDir) = mysql_fetch_row($result);
mysql_free_result($result);

// Danger, Will Robinson!
if ($yabb['uploaddir'] == $attachmentUploadDir)
return;

$result convert_query("
SELECT MAX(ID_ATTACH)
FROM 
{$to_prefix}attachments");
list ($ID_ATTACH) = mysql_fetch_row($result);
mysql_free_result($result);

$ID_ATTACH++;

while (true)
{
pastTime($_GET['substep']);

$setString '';

$result convert_query("
SELECT ID_MSG, temp_filename
FROM 
{$to_prefix}messages
WHERE temp_filename != ''
LIMIT 
$_GET[substep], 100");
while ($row mysql_fetch_assoc($result))
{
$size filesize($yabb['uploaddir'] . '/' $row['temp_filename']);
$filename getAttachmentFilename($row['temp_filename'], $ID_ATTACH);

// Is this an image???
$attachmentExtension strtolower(substr(strrchr($row['temp_filename'], '.'), 1));
if (!in_array($attachmentExtension, array('jpg''jpeg''gif''png')))
$attachmentExtention '';

if (strlen($filename) <= 255 &&  copy($yabb['uploaddir'] . '/' $row['temp_filename'], $attachmentUploadDir '/' $filename))
{
// Set the default empty values.
$width 0;
$height 0;

// Is an an image?
if (!empty($attachmentExtension))
list ($width$height) = getimagesize($yabb['uploaddir'] . '/' $row['temp_filename']);

$setString .= "
(
$ID_ATTACH$size, 0, '" addslashes($row['temp_filename']) . "', $row[ID_MSG]$width$height),";

$ID_ATTACH++;
}
}

if ($setString != '')
convert_query("
INSERT INTO 
{$to_prefix}attachments
(ID_ATTACH, size, downloads, filename, ID_MSG, width, height)
VALUES" 
substr($setString0, -1));

$_GET['substep'] += 100;
if (mysql_num_rows($result) < 100)
break;

mysql_free_result($result);
}

pastTime(-1);

if ($_GET['substep'] >= -1)
{
$knownColumns = array(
'temp_filename' => 'DROP COLUMN temp_filename'
);
alterTable('messages'''$knownColumns''falsetrue);
}
}

function convertStep14()
{
global $to_prefix$yabb;

echo 'Cleaning up (part 1)...';

if ($_GET['substep'] <= 0)
{
$knownKeys = array(
'topic' => 'ADD UNIQUE INDEX topic (ID_TOPIC, ID_MSG)'
);
alterTable('messages'$knownKeys''true);

pastTime(1);
}
if ($_GET['substep'] <= 1)
{
$knownKeys = array(
'ID_BOARD' => 'ADD UNIQUE INDEX ID_BOARD (ID_BOARD, ID_MSG)',
);
alterTable('messages'$knownKeys''true);

pastTime(2);
}
if ($_GET['substep'] <= 2)
{
$knownKeys = array(
'ID_TOPIC' => 'ADD KEY ID_TOPIC (ID_TOPIC)',
);
alterTable('messages'$knownKeys''true);

pastTime(3);
}
if ($_GET['substep'] <= 3)
{
$knownKeys = array(
'ID_MEMBER' => 'ADD UNIQUE INDEX ID_MEMBER (ID_MEMBER, ID_MSG)',
);
alterTable('messages'$knownKeys''true);

}
}

function convertStep15()
{
global $to_prefix$yabb;

echo 'Cleaning up (part 2)...';

while ($_GET['substep'] >= 0)
{
pastTime($_GET['substep']);

$result convert_query("
SELECT t.ID_TOPIC, MIN(m.ID_MSG) AS ID_FIRST_MSG, MAX(m.ID_MSG) AS ID_LAST_MSG
FROM (
{$to_prefix}topics AS t, {$to_prefix}messages AS m)
WHERE m.ID_TOPIC = t.ID_TOPIC
GROUP BY t.ID_TOPIC
LIMIT 
$_GET[substep], 150");
while ($row mysql_fetch_assoc($result))
{
$result2 convert_query("
SELECT ID_MEMBER
FROM 
{$to_prefix}messages
WHERE ID_MSG = 
$row[ID_LAST_MSG]
LIMIT 1"
);
list ($row['ID_MEMBER_UPDATED']) = mysql_fetch_row($result2);
mysql_free_result($result2);

$result2 convert_query("
SELECT ID_MEMBER
FROM 
{$to_prefix}messages
WHERE ID_MSG = 
$row[ID_FIRST_MSG]
LIMIT 1"
);
list ($row['ID_MEMBER_STARTED']) = mysql_fetch_row($result2);
mysql_free_result($result2);

convert_query("
UPDATE 
{$to_prefix}topics
SET ID_FIRST_MSG = '
$row[ID_FIRST_MSG]', ID_LAST_MSG = '$row[ID_LAST_MSG]',
ID_MEMBER_STARTED = '
$row[ID_MEMBER_STARTED]', ID_MEMBER_UPDATED = '$row[ID_MEMBER_UPDATED]'
WHERE ID_TOPIC = 
$row[ID_TOPIC]
LIMIT 1"
);
}

$_GET['substep'] += 150;
if (mysql_num_rows($result) < 150)
break;

mysql_free_result($result);
}

if ($_GET['substep'] > -1)
{
$knownKeys = array(
'lastMessage' => 'ADD UNIQUE INDEX lastMessage (ID_LAST_MSG, ID_BOARD)',
);
alterTable('topics'$knownKeys''true);

pastTime(-2);
}
if ($_GET['substep'] > -2)
{
$knownKeys = array(
'firstMessage' => 'ADD UNIQUE INDEX firstMessage (ID_FIRST_MSG, ID_BOARD)',
);
alterTable('topics'$knownKeys''true);
}
}

function convertStep16()
{
global $to_prefix$yabb;

// If set remove the old data
if ($_GET['substep'] == && !empty($_SESSION['purge']))
{
convert_query("
TRUNCATE 
{$to_prefix}polls");
convert_query("
TRUNCATE 
{$to_prefix}poll_choices");
convert_query("
TRUNCATE 
{$to_prefix}log_polls");
}

// Drop the indexes to prevent Dup keys errors
if ($_GET['substep'] == 0)
{
$knownKeys = array(
'PRIMARY' => 'DROP PRIMARY KEY',
);
$knownColumns = array(
'tempID' => 'ADD tempID int(10) unsigned NOT NULL default 0',
);
$alterColumns = array(
'ID_POLL' => 'CHANGE COLUMN ID_POLL ID_POLL MEDIUMINT(8) unsigned NOT NULL default 0',
);
alterTable('polls'$knownKeys$knownColumns$alterColumns);
alterTable('poll_choices'$knownKeys);
}

echo 'Converting polls and poll choices...';

$file_n 0;
$dir dir($yabb['datadir']);
$pollQuestionsBlock = array();
$pollChoicesBlock = array();
while ($entry $dir->read())
{
if ($_GET['substep'] < 0)
break;
if ($file_n++ < $_GET['substep'])
continue;
if (strrchr($entry'.') != '.poll')
continue;

$pollData file($yabb['datadir'] . '/' $entry);

$ID_POLL substr($entry0strrpos($entry'.'));

foreach ($pollData as $i => $v)
{
$pollData[$i] = explode('|'rtrim($pollData[$i]));

// Is this the poll option/question?  If so set the data.
if (count($pollData[$i]) > 3)
{
$pollQuestions = array(
'question' => substr(htmlspecialchars($pollData[$i][0]), 0255),
'votingLocked' => (int) $pollData[$i][1],

vmpre2

Here is the rest of the file:



'maxVotes' => (int) $pollData[$i][8],
'expireTime' => 0,
'hideResults' => (int) $pollData[$i][7],
'changeVote' => 0,
'ID_MEMBER' => 0,
'posterName' => empty($pollData[$i][3]) ? 'Guest' : substr(htmlspecialchars($pollData[$i][3]), 0, 255),
'tempID' => (int) $ID_POLL,
);
$pollQuestionsBlock[] = addslashes_recursive($pollQuestions);
}

// Are these the choices?
if (count($pollData[$i]) == 2)
{
$pollChoices = array(
'ID_POLL' => $ID_POLL,
'ID_CHOICE' => $i - 1, // Make sure to subtract the first row since that's the question
'label' => $pollData[$i][1],
'votes' => (int) $pollData[$i][0],
);
$pollChoicesBlock[] = addslashes_recursive($pollChoices);
}
}

// Since we are basing this off questions lets put the number of rows to a lower ammount since it will be more with the choices
if (count($file_n) > 50)
{
// Set the ID_TOPIC
$topics = array();
foreach ($pollQuestionsBlock as $question)
$topics[] = $question['tempID'];

// Select the members
$request = convert_query("
SELECT ID_MEMBER_STARTED AS ID_MEMBER, tempID, ID_TOPIC
FROM {$to_prefix}topics
WHERE tempID IN (" . implode(',', $topics) . ")");

while ($row = mysql_fetch_assoc($request))
{
// Assign ID_POLL ID_MEMBER to the pollQuestion
foreach ($pollQuestionsBlock as $keyID => $questions)
{
if (isset($pollQuestionsBlock[$keyID]['ID_MEMBER']) && $pollQuestionsBlock[$keyID]['ID_MEMBER'] == $row['ID_MEMBER'])
$pollQuestionsBlock[$keyID]['ID_MEMBER'] = $row['ID_MEMBER'];
}
// Assign ID_POLL to the choices
foreach ($pollChoicesBlock as $keyID => $choices)
{
foreach ($choices as $key => $choice)
if ($key == 'ID_POLL' && $choice == $row['tempID'])
$pollChoicesBlock[$keyID]['ID_POLL'] = $row['ID_TOPIC'];
}
}
mysql_free_result($request);

doBlock('polls', $pollQuestionsBlock);
doBlock('poll_choices', $pollChoicesBlock);

// Increase the time
pastTime($file_n);
}
}
$dir->close();

if (!empty($pollQuestionsBlock) && !empty($pollChoicesBlock))
{
$topics = array();
foreach ($pollQuestionsBlock as $question)
$topics[] = $question['tempID'];

// Select the members
$request = convert_query("
SELECT ID_MEMBER_STARTED AS ID_MEMBER, tempID, ID_TOPIC
FROM {$to_prefix}topics
WHERE tempID IN (" . implode(',', $topics) . ")");

while ($row = mysql_fetch_assoc($request))
{
// Assign ID_POLL ID_MEMBER to the pollQuestion
foreach ($pollQuestionsBlock as $keyID => $questions)
{
if (isset($pollQuestionsBlock[$keyID]['ID_MEMBER']) && $pollQuestionsBlock[$keyID]['ID_MEMBER'] == $row['tempID'])
$pollQuestionsBlock[$keyID]['ID_MEMBER'] = $row['ID_MEMBER'];
}
// Assign ID_POLL to the choices
foreach ($pollChoicesBlock as $keyID => $choices)
{
foreach ($choices as $key => $choice)
if ($key == 'ID_POLL' && $choice == $row['tempID'])
$pollChoicesBlock[$keyID]['ID_POLL'] = $row['ID_TOPIC'];
}
}
mysql_free_result($request);

doBlock('polls', $pollQuestionsBlock);
doBlock('poll_choices', $pollChoicesBlock);
}

pastTime(-1);

if ($_GET['substep'] >= -1)
{
$knownKeys = array(
'PRIMARY' => 'ADD PRIMARY KEY (ID_POLL)',
);
$alterColumns = array(
'ID_POLL' => 'CHANGE COLUMN ID_POLL ID_POLL MEDIUMINT(8) unsigned NOT NULL auto_increment',
);
alterTable('polls', $knownKeys, '', $alterColumns, true, true);
}
}

function convertStep17()
{
global $to_prefix;

echo 'Converting polls and poll choices (part 2)...';

while (true)
{
pastTime($_GET['substep']);

$request = convert_query("
SELECT p.ID_POLL, t.ID_TOPIC
FROM ({$to_prefix}polls AS p, {$to_prefix}topics AS t)
WHERE p.tempID = t.tempID
LIMIT $_GET[substep], 200");

while ($row = mysql_fetch_assoc($request))
{
convert_query("
UPDATE {$to_prefix}topics
SET ID_POLL = $row[ID_POLL]
WHERE ID_TOPIC = $row[ID_TOPIC]");
convert_query("
UPDATE {$to_prefix}poll_choices
SET ID_POLL = $row[ID_POLL]
WHERE ID_POLL = $row[ID_TOPIC]");
}

$_GET['substep'] += 200;
if (mysql_num_rows($request) < 200)
break;

mysql_free_result($request);
}
}

function convertStep18()
{
global $to_prefix, $yabb;

echo 'Converting poll votes...';

$file_n = 0;
$dir = dir($yabb['datadir']);
$pollVotesBlock = array();
$members = array();
$pollIdsBlock = array();
while ($entry = $dir->read())
{
if ($_GET['substep'] < 0)
break;
if ($file_n++ < $_GET['substep'])
continue;
if (strrchr($entry, '.') != '.polled')
continue;

$pollVotesData = file($yabb['datadir'] . '/' . $entry);
$ID_POLL = substr($entry, 0, strrpos($entry, '.'));

$pollIdsBlock[] = $ID_POLL;
// Get the data from each line/
foreach ($pollVotesData as $i => $votes)
{
$pollVotesData[$i] = explode('|', rtrim($pollVotesData[$i]));

// We just need the memberName and ID_CHOICE here.
if (count($pollVotesData) > 2)
{
// Set the members.
$members[] = $pollVotesData[$i][1];

// Set the other poll data
$pollVotes = array(
'ID_POLL' => 0,
'ID_MEMBER' => 0,
'ID_CHOICE' => $pollVotesData[$i][2],
'tempID' => $ID_POLL,
'memberName' => trim($pollVotesData[$i][1])
);

$pollVotesBlock[] = addslashes_recursive($pollVotes);
}
}

// Now time to insert the votes.
if (count($pollVotesBlock) > 50)
{
$request = convert_query("
SELECT ID_MEMBER, memberName
FROM {$to_prefix}members
WHERE memberName IN ('" . implode("','", $members) . "')");

// Asssign the ID_MEMBER to the poll.
while ($row = mysql_fetch_assoc($request))
{
foreach ($pollVotesBlock as $key => $avlue)
{
if (isset($pollVotesBlock[$key]['memberName']) && $pollVotesBlock[$key]['memberName'] == $row['memberName'])
{
// Assign ID_MEMBER
$pollVotesBlock[$key]['ID_MEMBER'] = $row['ID_MEMBER'];

// Now lets unset memberName since we don't need it any more
unset($pollVotesBlock[$key]['memberName'], $pollVotesBlock[$key]['memberName']);
}
}
}

// Get the ID_POLL form the temp ID
$request = convert_query("
SELECT ID_POLL, tempID
FROM {$to_prefix}polls
WHERE tempID IN (" . implode(',', $pollIdsBlock) . ")");

// Assign the ID_POLL
while ($row = mysql_fetch_assoc($request))
{
foreach ($pollVotesBlock as $key => $value)
{
if (isset($pollVotesBlock[$key]['tempID']) && $pollVotesBlock[$key]['tempID'] == $row['tempID'])
{
$pollVotesBlock[$key]['ID_POLL'] = $row['ID_POLL'];
unset($pollVotesBlock[$key]['tempID'], $pollVotesBlock[$key]['tempID']);
}
}
}

// Lets unset the remaining memberNames
foreach ($pollVotesBlock as $key => $value)
{
if (isset($pollVotesBlock[$key]['memberName']))
unset($pollVotesBlock[$key]['memberName'], $pollVotesBlock[$key]['memberName']);
}

doBlock('log_polls', $pollVotesBlock);

// Some time has passed so do something
pastTime($file_n);
}
}
$dir->close();

if (!empty($members))
{
$request = convert_query("
SELECT ID_MEMBER, memberName
FROM {$to_prefix}members
WHERE memberName IN ('" . implode("','", $members) . "')");

// Asssign the ID_MEMBER to the poll.
while ($row = mysql_fetch_assoc($request))
{
foreach ($pollVotesBlock as $key => $avlue)
{
if (isset($pollVotesBlock[$key]['memberName']) && $pollVotesBlock[$key]['memberName'] == $row['memberName'])
{
// Assign ID_MEMBER
$pollVotesBlock[$key]['ID_MEMBER'] = $row['ID_MEMBER'];

// Now lets unset memberName since we don't need it any more
unset($pollVotesBlock[$key]['memberName'], $pollVotesBlock[$key]['memberName']);
}
}
}
}

if (!empty($pollIdsBlock))
{
// Get the ID_POLL form the temp ID
$request = convert_query("
SELECT ID_POLL, tempID
FROM {$to_prefix}polls
WHERE tempID IN (" . implode(',', $pollIdsBlock) . ")");

// Assign the ID_POLL
while ($row = mysql_fetch_assoc($request))
{
foreach ($pollVotesBlock as $key => $value)
{
if (isset($pollVotesBlock[$key]['tempID']) && $pollVotesBlock[$key]['tempID'] == $row['tempID'])
{
// Assign the ID_POLL
$pollVotesBlock[$key]['ID_POLL'] = $row['ID_POLL'];

// We don't need you any more so...BYE!!!
unset($pollVotesBlock[$key]['tempID'], $pollVotesBlock[$key]['tempID']);
}
}
}
}

// Lets unset the remaining memberNames
foreach ($pollVotesBlock as $key => $value)
{
if (isset($pollVotesBlock[$key]['memberName']))
unset($pollVotesBlock[$key]['memberName'], $pollVotesBlock[$key]['memberName']);
}

// Do the remaining block
if (!empty($pollVotesBlock))
doBlock('log_polls', $pollVotesBlock);

pastTime(-1);

// Remove the temp column from the table and put the primary key back.
if ($_GET['substep'] >= -1)
{
$knownKeys = array(
'PRIMARY' => 'ADD PRIMARY KEY (ID_POLL, ID_CHOICE)',
);
alterTable('poll_choices', $knownKeys, '', '', true);

pastTime(-2);
}
if ($_GET['substep'] >= -2)
{
$knownKeys = array(
'poll' => 'ADD UNIQUE INDEX poll (ID_POLL, ID_TOPIC)',
);
alterTable('messages', $knownKeys, '', true);

pastTime(-3);
}
if ($_GET['substep'] >= -3)
{
$knownColumns = array(
'tempID' => 'DROP COLUMN tempID'
);
alterTable('topics', '', $knownColumns, '', false, true);

pastTime(-4);
}
if ($_GET['substep'] >= -4)
{
$knownColumns = array(
'tempID' => 'DROP COLUMN tempID',
);
alterTable('polls', '', $knownColumns, '', true, true);
}
}

function fixRelativePath($path, $cwd_path)
{
// Fix the . at the start, clear any duplicate slashes, and fix any trailing slash...
return addslashes(preg_replace(array('~^\.([/\\\]|$)~', '~[/]+~', '~[\\\]+~', '~[/\\\]$~'), array($cwd_path . '$1', '/', '\\', ''), $path));
}

function parse_time($field, $use_now = true)
{
$field = trim(str_replace(array(' um ', ' de ', ' en ', ' la ', ' om '), ' at ', $field));

if ($field == '')
$field = $use_now ? time() : 0;
elseif (strtotime($field) != -1)
$field = strtotime($field);
elseif (preg_match('~(\d\d)/(\d\d)/(\d\d)(.*?)(\d\d)\:(\d\d)\:(\d\d)~i', $field, $matches) != 0)
$field = strtotime("$matches[5]:$matches[6]:$matches[7] $matches[1]/$matches[2]/$matches[3]");
else
$field = $use_now ? time() : 0;

return $field;
}

function doBlock($table, &$block)
{
global $to_prefix;

if (empty($block))
return;

// If converting mark as read data make the insert be ignore into
if ($table == 'log_mark_read' || $table == 'log_boards' || $table == 'log_topics' || $table == 'log_polls')
$ignore = ' IGNORE ';
else
$ignore = '';

if ($table == 'members')
{
$block_names = array();
foreach ($block as $i => $row)
$block_names[$row['memberName']] = $i;

$request = convert_query("
SELECT memberName
FROM {$to_prefix}members
WHERE memberName IN ('" . implode("', '", array_keys($block_names)) . "')
LIMIT " . count($block_names));
while ($row = mysql_fetch_assoc($request))
{
if (isset($block_names[$row['memberName']]))
unset($block[$block_names[$row['memberName']]]);
}
mysql_free_result($request);

if (empty($block))
return;

unset($block_names);
}

$insert_block = array();
foreach ($block as $row)
$insert_block[] = '\'' . implode('\', \'', $row) . '\'';

convert_query("
INSERT $ignore INTO {$to_prefix}$table
(" . implode(', ', array_keys($block[0])) . ")
VALUES (" . implode("),
(", $insert_block) . ")");

$block = array();
}
}

?>


vmpre2

BTW, the yabb21_to_smf.php file that I am using is right from here:

http://www.simplemachines.org/community/index.php?topic=122338.msg781367#msg781367

Thanks for looking into this and your help. I really appreciate it very much!

Stallyon

OK I fixed the above error by reinstalling SMF without UTF8 Unicode support, but now I get the following error:


Converting...
Converting members... Unsuccessful!
This query:
ALTER TABLE `username_forum`.smf_members
ORDER BY ID_MEMBER = 0, dateRegistered;
Caused the error:

You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '= 0, dateRegistered' at line 2


I have PHP 5.2.3 MySQL 5.0.45 and Apache 2.2.4
I am converting a large YaBB 2.1 forum to SMF 1.1.3 using the converter downloaded freshly from the simplemachines.org website.
Kris Bell
Dahulu Tim Penerjemah Bahasa Indonesia (Former Indonesian Translation Team)
stallyon@bigpond.com

Tidak menerima pesan pribadi (PM) jika tidak diminta (no unsolicited private messages)

Attention: Spelling errors in this message are the product of a poor school system. Pay teachures more than athleets.

redone

I see you submitted a support ticket. We will try to resolve this for you via the ticket system.


Stallyon

Thanks! I resolved this one by changing this code (thanks SleePy!):


convert_query("
ALTER TABLE {$to_prefix}members
ORDER BY ID_MEMBER =0, dateRegistered");


to this:


convert_query("
ALTER TABLE {$to_prefix}members
ORDER BY ID_MEMBER, dateRegistered");


and also changed it for {$to_prefix}personal_messages and {$to_prefix}topics as well.

This error is in regards to MySQL 5.0.45 and how it handles queries.
Kris Bell
Dahulu Tim Penerjemah Bahasa Indonesia (Former Indonesian Translation Team)
stallyon@bigpond.com

Tidak menerima pesan pribadi (PM) jika tidak diminta (no unsolicited private messages)

Attention: Spelling errors in this message are the product of a poor school system. Pay teachures more than athleets.

Stallyon

Alas, I now have another error about duplicate entries while converting topics. :( I also will try solve this through the ticket system.
Kris Bell
Dahulu Tim Penerjemah Bahasa Indonesia (Former Indonesian Translation Team)
stallyon@bigpond.com

Tidak menerima pesan pribadi (PM) jika tidak diminta (no unsolicited private messages)

Attention: Spelling errors in this message are the product of a poor school system. Pay teachures more than athleets.

Stallyon

Nevermind ... Decided to give SMF the flick and stick with YaBB 2.1. Support here is too slow, even for Charter Member's support ticket system.
Kris Bell
Dahulu Tim Penerjemah Bahasa Indonesia (Former Indonesian Translation Team)
stallyon@bigpond.com

Tidak menerima pesan pribadi (PM) jika tidak diminta (no unsolicited private messages)

Attention: Spelling errors in this message are the product of a poor school system. Pay teachures more than athleets.

vmpre2

Any ideas on how to get past this error?

Thanks!

JayBachatero

Follow me on Twitter

"HELP!!! I've fallen and I can't get up"
This moment has been brought to you by LifeAlert

Advertisement: