@@ -315,7 +315,7 @@ private function fill_forums()
315315 'topic_title ' => qi::lang ('TEST_TOPIC_TITLE ' , $ topic_cnt ),
316316 );
317317
318- if (defined ( ' PHPBB_31 ' ))
318+ if (qi:: phpbb_branch ( ' 3.1 ' ))
319319 {
320320 $ topic_arr ['topic_posts_approved ' ] = 1 ;
321321
@@ -361,10 +361,10 @@ private function fill_forums()
361361 'post_text ' => $ post_text ,
362362 'post_checksum ' => md5 ($ post_text ),
363363 'bbcode_bitfield ' => $ bbcode_bitfield ,
364- 'bbcode_uid ' => defined ( ' PHPBB_32 ' ) ? gen_rand_string () : $ bbcode_uid ,
364+ 'bbcode_uid ' => qi:: phpbb_branch ( ' 3.2 ' ) ? gen_rand_string () : $ bbcode_uid ,
365365 );
366366
367- if (defined ( ' PHPBB_31 ' ))
367+ if (qi:: phpbb_branch ( ' 3.1 ' ))
368368 {
369369 $ sql_posts [count ($ sql_posts ) - 1 ]['post_visibility ' ] = ITEM_APPROVED ;
370370 }
@@ -377,14 +377,14 @@ private function fill_forums()
377377 $ topic_arr ['topic_time ' ] = $ post_time ;
378378 $ topic_arr ['topic_poster ' ] = $ poster_arr ['user_id ' ];
379379
380- if (defined ( ' PHPBB_31 ' ))
380+ if (qi:: phpbb_branch ( ' 3.1 ' ))
381381 {
382382 $ topic_arr ['topic_visibility ' ] = ITEM_APPROVED ;
383383 }
384384 }
385385 else
386386 {
387- if (defined ( ' PHPBB_31 ' ))
387+ if (qi:: phpbb_branch ( ' 3.1 ' ))
388388 {
389389 $ topic_arr ['topic_posts_approved ' ]++;
390390 $ forum ['forum_posts_approved ' ]++;
@@ -435,8 +435,8 @@ private function fill_forums()
435435 }
436436
437437 $ sql_ary = array (
438- 'forum_posts ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : '' ) => $ forum ['forum_posts ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : '' )],
439- 'forum_topics ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : '' ) => $ forum ['forum_topics ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : '' )],
438+ 'forum_posts ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : '' ) => $ forum ['forum_posts ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : '' )],
439+ 'forum_topics ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : '' ) => $ forum ['forum_topics ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : '' )],
440440 'forum_last_post_id ' => $ forum ['forum_last_post_id ' ],
441441 'forum_last_poster_id ' => $ forum ['forum_last_poster_id ' ],
442442 'forum_last_post_subject ' => $ forum ['forum_last_post_subject ' ],
@@ -445,7 +445,7 @@ private function fill_forums()
445445 'forum_last_poster_colour ' => '' ,
446446 );
447447
448- if (!defined ( ' PHPBB_31 ' ))
448+ if (!qi:: phpbb_branch ( ' 3.1 ' ))
449449 {
450450 $ sql_ary ['forum_topics_real ' ] = $ forum ['forum_topics_real ' ];
451451 }
@@ -609,7 +609,7 @@ private function _create_forums($forum_type, $cnt, $acp_forums, $parent_id = 0)
609609 'forum_last_poster_name ' => '' ,
610610 );
611611
612- if (defined ( ' PHPBB_31 ' ))
612+ if (qi:: phpbb_branch ( ' 3.1 ' ))
613613 {
614614 $ this ->forum_arr [$ forum_data ['forum_id ' ]]['forum_posts_approved ' ] = 0 ;
615615 $ this ->forum_arr [$ forum_data ['forum_id ' ]]['forum_topics_approved ' ] = 0 ;
@@ -633,7 +633,7 @@ private function save_users()
633633 global $ db , $ db_tools , $ config , $ settings ;
634634
635635 // Hash the password.
636- if (defined ( ' PHPBB_31 ' ))
636+ if (qi:: phpbb_branch ( ' 3.1 ' ))
637637 {
638638 global $ passwords_manager ;
639639 $ password = $ passwords_manager ->hash ('123456 ' );
@@ -652,7 +652,7 @@ private function save_users()
652652 $ chunk_cnt = 0 ;
653653 $ sql_ary = array ();
654654
655- if (!defined ( ' PHPBB_31 ' ))
655+ if (!qi:: phpbb_branch ( ' 3.1 ' ))
656656 {
657657 $ tz = new DateTimeZone ($ settings ->get_config ('qi_tz ' , '' ));
658658 $ tz_ary = $ tz ->getTransitions (time ());
@@ -664,7 +664,7 @@ private function save_users()
664664 foreach ($ this ->user_arr as $ user )
665665 {
666666 $ email = $ user ['username_clean ' ] . $ this ->email_domain ;
667- $ sql_ary [] = array (
667+ $ sql_ary [] = array_merge ([
668668 'user_id ' => $ user ['user_id ' ],
669669 'username ' => $ user ['username ' ],
670670 'username_clean ' => $ user ['username_clean ' ],
@@ -684,13 +684,15 @@ private function save_users()
684684 'user_passchg ' => $ user ['user_passchg ' ],
685685 'user_options ' => 230271 ,
686686 'user_full_folder ' => PRIVMSGS_NO_BOX ,
687- 'user_notify_type ' => NOTIFY_EMAIL ,
688687 'user_dateformat ' => 'M jS, ’y, H:i ' ,
689688 'user_sig ' => '' ,
689+ ], !qi::phpbb_branch ('4.0 ' ) ?
690+ ['user_notify_type ' => defined ('NOTIFY_EMAIL ' ) ? NOTIFY_EMAIL : 0 ] :
691+ []
690692 );
691693
692694 $ count = count ($ sql_ary ) - 1 ;
693- if (defined ( ' PHPBB_31 ' ))
695+ if (qi:: phpbb_branch ( ' 3.1 ' ))
694696 {
695697 $ sql_ary [$ count ]['user_timezone ' ] = $ settings ->get_config ('qi_tz ' , '' );
696698 }
@@ -703,7 +705,7 @@ private function save_users()
703705 $ sql_ary [$ count ]['user_dst ' ] = $ qi_dst ;
704706 }
705707
706- if (!defined ( ' PHPBB_33 ' ) || $ db_tools ->sql_column_exists (USERS_TABLE , 'user_email_hash ' ))
708+ if (!qi:: phpbb_branch ( ' 3.3 ' ) || $ db_tools ->sql_column_exists (USERS_TABLE , 'user_email_hash ' ))
707709 {
708710 $ sql_ary [$ count ]['user_email_hash ' ] = phpbb_email_hash ($ email );
709711 }
@@ -780,7 +782,7 @@ private function get_default_forums()
780782
781783 // We are the only ones messing with this database so far.
782784 // So the latest user_id + 1 should be the user id for the first test user.
783- $ sql = 'SELECT forum_id, parent_id, forum_type, forum_posts ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : '' ) . ', forum_topics ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : ', forum_topics_real ' ) . ', forum_last_post_id, forum_last_poster_id, forum_last_post_subject, forum_last_post_time, forum_last_poster_name FROM ' . FORUMS_TABLE ;
785+ $ sql = 'SELECT forum_id, parent_id, forum_type, forum_posts ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : '' ) . ', forum_topics ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : ', forum_topics_real ' ) . ', forum_last_post_id, forum_last_poster_id, forum_last_post_subject, forum_last_post_time, forum_last_poster_name FROM ' . FORUMS_TABLE ;
784786 $ result = $ db ->sql_query ($ sql );
785787
786788 while ($ row = $ db ->sql_fetchrow ($ result ))
@@ -795,16 +797,16 @@ private function get_default_forums()
795797 $ this ->forum_arr [$ row ['forum_id ' ]] = array (
796798 'forum_id ' => $ row ['forum_id ' ],
797799 'parent_id ' => $ row ['parent_id ' ],
798- 'forum_posts ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : '' ) => $ row ['forum_posts ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : '' )],
799- 'forum_topics ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : '' ) => $ row ['forum_topics ' . (defined ( ' PHPBB_31 ' ) ? '_approved ' : '' )],
800+ 'forum_posts ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : '' ) => $ row ['forum_posts ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : '' )],
801+ 'forum_topics ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : '' ) => $ row ['forum_topics ' . (qi:: phpbb_branch ( ' 3.1 ' ) ? '_approved ' : '' )],
800802 'forum_last_post_id ' => $ row ['forum_last_post_id ' ],
801803 'forum_last_poster_id ' => $ row ['forum_last_poster_id ' ],
802804 'forum_last_post_subject ' => $ row ['forum_last_post_subject ' ],
803805 'forum_last_post_time ' => $ row ['forum_last_post_time ' ],
804806 'forum_last_poster_name ' => $ row ['forum_last_poster_name ' ],
805807 );
806808
807- if (!defined ( ' PHPBB_31 ' ))
809+ if (!qi:: phpbb_branch ( ' 3.1 ' ))
808810 {
809811 $ this ->forum_arr [$ row ['forum_id ' ]]['forum_topics_real ' ] = $ row ['forum_topics_real ' ];
810812 }
0 commit comments