phpBB 2.0.6 to phpBB 2.0.7 Code Changes



These are the Changes from phpBB 2.0.6 to phpBB 2.0.7 summed up into a little Mod. This might be very helpful if you want to update your Board and have installed a bunch of Mods. Then it's normally easier to apply the Code Changes than to install all Mods again.

When you find a 'AFTER, ADD'-Statement, the Code have to be added after the last line quoted in the 'FIND'-Statement.
When you find a 'BEFORE, ADD'-Statement, the Code have to be added before the first line quoted in the 'FIND'-Statement.
When you find a 'REPLACE WITH'-Statement, the Code quoted in the 'FIND'-Statement have to be replaced completely with the quoted Code in the 'REPLACE WITH'-Statement.
When you find a 'DELETE'-Statement, the Code have to be deleted.

After you have finished this tutorial, you have to upload the update_to_207.php file, execute it and then delete it from your webspace.

Ok, lets start:


  • groupcp.php




  1. FIND - Line 140
    2.0.6 Code:


    if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
    {
       $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];



    AFTER, ADD
    2.0.7 Code:


       $mode = htmlspecialchars($mode);




  2. FIND - Line 594
    2.0.6 Code:


                      $sql_in .= ( ( $sql_in != '' ) ? ', ' : '' ) . $members[$i];



    REPLACE WITH
    2.0.7 Code:


                      $sql_in .= ( ( $sql_in != '' ) ? ', ' : '' ) . intval($members[$i]);



  • includes/auth.php




  1. FIND - Line 174
    2.0.6 Code:


             }
             while( $row = $db->sql_fetchrow($result) );
          }



    AFTER, ADD
    2.0.7 Code:


          $db->sql_freeresult($result);



  • includes/bbcode.php




  1. FIND - Line 108
    2.0.6 Code:


       $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\5', $bbcode_tpl['url4']);



    REPLACE WITH
    2.0.7 Code:


       $bbcode_tpl['url4'] = str_replace('{DESCRIPTION}', '\\3', $bbcode_tpl['url4']);




  2. FIND - Line 201
    2.0.6 Code:


       $patterns[] = "#\[url\]([\w]+?://.*?[^ \"\n\r\t<]*?)\[/url\]#is";
       $replacements[] = $bbcode_tpl['url1'];

       // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
       $patterns[] = "#\[url\]((www|ftp)\.([\w\-]+\.)*?[\w\-]+\.[a-z]{2,4}(:?[0-9]*?/[^ \"\n\r\t<]*)?)\[/url\]#is";
       $replacements[] = $bbcode_tpl['url2'];

       // [url=xxxx://www.phpbb.com]phpBB[/url] code..
       $patterns[] = "#\[url=([\w]+?://.*?[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";
       $replacements[] = $bbcode_tpl['url3'];

       // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
       $patterns[] = "#\[url=((www|ftp)\.([\w\-]+\.)*?[\w\-]+\.[a-z]{2,4}(:?[0-9]*?/[^ \"\n\r\t<]*)?)\](.*?)\[/url\]#is";



    REPLACE WITH
    2.0.7 Code:


       $patterns[] = "#\[url\]([\w]+?://[^ \"\n\r\t<]*?)\[/url\]#is";
       $replacements[] = $bbcode_tpl['url1'];

       // [url]www.phpbb.com[/url] code.. (no xxxx:// prefix).
       $patterns[] = "#\[url\]((www|ftp)\.[^ \"\n\r\t<]*?)\[/url\]#is";
       $replacements[] = $bbcode_tpl['url2'];

       // [url=xxxx://www.phpbb.com]phpBB[/url] code..
       $patterns[] = "#\[url=([\w]+?://[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";
       $replacements[] = $bbcode_tpl['url3'];

       // [url=www.phpbb.com]phpBB[/url] code.. (no xxxx:// prefix).
       $patterns[] = "#\[url=((www|ftp)\.[^ \"\n\r\t<]*?)\](.*?)\[/url\]#is";




  3. FIND - Line 624
    2.0.6 Code:


       $ret = preg_replace("#(^|[\n ])([\w]+?://.*?[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);

       // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
       // Must contain at least 2 dots. xxxx contains either alphanum, or "-"
       // zzzz is optional.. will contain everything up to the first space, newline,
       // comma, double quote or <.
       $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\-]+\.[\w\-.\~]+(?:/[^ \"\t\n\r<]*)?)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);



    REPLACE WITH
    2.0.7 Code:


       $ret = preg_replace("#(^|[\n ])([\w]+?://[^ \"\n\r\t<]*)#is", "\\1<a href=\"\\2\" target=\"_blank\">\\2</a>", $ret);

       // matches a "www|ftp.xxxx.yyyy[/zzzz]" kinda lazy URL thing
       // Must contain at least 2 dots. xxxx contains either alphanum, or "-"
       // zzzz is optional.. will contain everything up to the first space, newline,
       // comma, double quote or <.
       $ret = preg_replace("#(^|[\n ])((www|ftp)\.[^ \"\t\n\r<]*)#is", "\\1<a href=\"http://\\2\" target=\"_blank\">\\2</a>", $ret);



  • includes/functions_search.php




  1. FIND - Line 243
    2.0.6 Code:


             $sql = "INSERT IGNORE INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)



    REPLACE WITH
    2.0.7 Code:


             $sql = "INSERT INTO " . SEARCH_MATCH_TABLE . " (post_id, word_id, title_match)



  • includes/topic_review.php




  1. FIND - Line 54
    2.0.6 Code:


          {
             message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
          }



    AFTER, ADD
    2.0.7 Code:


          $db->sql_freeresult($result);




  2. FIND - Line 211
    2.0.6 Code:


       {
          message_die(GENERAL_MESSAGE, 'Topic_post_not_exist', '', __LINE__, __FILE__, $sql);
       }



    AFTER, ADD
    2.0.7 Code:


       $db->sql_freeresult($result);



  • includes/usercp_register.php




  1. FIND - Line 748
    2.0.6 Code:


       $avatar_category = ( !empty($HTTP_POST_VARS['avatarcategory']) ) ? $HTTP_POST_VARS['avatarcategory'] : '';



    REPLACE WITH
    2.0.7 Code:


       $avatar_category = ( !empty($HTTP_POST_VARS['avatarcategory']) ) ? htmlspecialchars($HTTP_POST_VARS['avatarcategory']) : '';



  • index.php




  1. FIND - Line 122
    2.0.6 Code:


    }

    while( $category_rows[] = $db->sql_fetchrow($result) );



    AFTER, ADD
    2.0.7 Code:


    $db->sql_freeresult($result);




  2. FIND - Line 174
    2.0.6 Code:


       {
          $forum_data[] = $row;
       }



    AFTER, ADD
    2.0.7 Code:


       $db->sql_freeresult($result);




  3. FIND - Line 202
    2.0.6 Code:


          {
             $new_topic_data[$topic_data['forum_id']][$topic_data['topic_id']] = $topic_data['post_time'];
          }



    AFTER, ADD
    2.0.7 Code:


          $db->sql_freeresult($result);




  4. FIND - Line 228
    2.0.6 Code:


       {
          $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '">' . $row['username'] . '</a>';
       }



    AFTER, ADD
    2.0.7 Code:


       $db->sql_freeresult($result);




  5. FIND - Line 248
    2.0.6 Code:


       {
          $forum_moderators[$row['forum_id']][] = '<a href="' . append_sid("groupcp.$phpEx?" . POST_GROUPS_URL . "=" . $row['group_id']) . '">' . $row['group_name'] . '</a>';
       }



    AFTER, ADD
    2.0.7 Code:


       $db->sql_freeresult($result);



  • login.php




  1. FIND - Line 86
    2.0.6 Code:


                      $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";



    REPLACE WITH
    2.0.7 Code:


                      $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : "index.$phpEx";




  2. FIND - Line 96
    2.0.6 Code:


                   $redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : '';



    REPLACE WITH
    2.0.7 Code:


                   $redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : '';




  3. FIND - Line 111
    2.0.6 Code:


             $redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "";



    REPLACE WITH
    2.0.7 Code:


             $redirect = ( !empty($HTTP_POST_VARS['redirect']) ) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : "";




  4. FIND - Line 132
    2.0.6 Code:


             $url = (!empty($HTTP_POST_VARS['redirect'])) ? $HTTP_POST_VARS['redirect'] : $HTTP_GET_VARS['redirect'];



    REPLACE WITH
    2.0.7 Code:


             $url = (!empty($HTTP_POST_VARS['redirect'])) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : htmlspecialchars($HTTP_GET_VARS['redirect']);




  5. FIND - Line 142
    2.0.6 Code:


          $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? $HTTP_POST_VARS['redirect'] : "index.$phpEx";



    REPLACE WITH
    2.0.7 Code:


          $url = ( !empty($HTTP_POST_VARS['redirect']) ) ? htmlspecialchars($HTTP_POST_VARS['redirect']) : "index.$phpEx";



  • memberlist.php




  1. FIND - Line 272
    2.0.6 Code:


          $i++;
       }
       while ( $row = $db->sql_fetchrow($result) );



    AFTER, ADD
    2.0.7 Code:


       $db->sql_freeresult($result);




  2. FIND - Line 292
    2.0.6 Code:



          $pagination = generate_pagination("memberlist.$phpEx?mode=$mode&order=$sort_order", $total_members, $board_config['topics_per_page'], $start). ' ';
       }



    AFTER, ADD
    2.0.7 Code:


       $db->sql_freeresult($result);



  • modcp.php




  1. FIND - Line 83
    2.0.6 Code:


    if ( isset($HTTP_POST_VARS['mode']) || isset($HTTP_GET_VARS['mode']) )
    {
       $mode = ( isset($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];



    AFTER, ADD
    2.0.7 Code:


       $mode = htmlspecialchars($mode);



  • posting.php




  1. FIND - Line 38
    2.0.6 Code:


          $$var = ( !empty($HTTP_POST_VARS[$param]) ) ? $HTTP_POST_VARS[$param] : $HTTP_GET_VARS[$param];



    REPLACE WITH
    2.0.7 Code:


          $$var = ( !empty($HTTP_POST_VARS[$param]) ) ? htmlspecialchars($HTTP_POST_VARS[$param]) : htmlspecialchars($HTTP_GET_VARS[$param]);




  2. FIND - Line 224
    2.0.6 Code:


    if ( $result = $db->sql_query($sql) )
    {
       $post_info = $db->sql_fetchrow($result);



    AFTER, ADD
    2.0.7 Code:


       $db->sql_freeresult($result);




  3. FIND - Line 279
    2.0.6 Code:


                }
                while ( $row = $db->sql_fetchrow($result) );
             }



    AFTER, ADD
    2.0.7 Code:


             $db->sql_freeresult($result);




  4. FIND - Line 402
    2.0.6 Code:


          }

          $notify_user = ( $db->sql_fetchrow($result) ) ? TRUE : $userdata['user_notify'];



    AFTER, ADD
    2.0.7 Code:


          $db->sql_freeresult($result);




  5. FIND - Line 477
    2.0.6 Code:


             if ( !($result = $db->sql_query($sql)) )
             {
                message_die(GENERAL_ERROR, 'Could not obtain user vote data for this topic', '', __LINE__, __FILE__, $sql);
             }

             if ( !($row = $db->sql_fetchrow($result)) )



    REPLACE WITH
    2.0.7 Code:


             if ( !($result2 = $db->sql_query($sql)) )
             {
                message_die(GENERAL_ERROR, 'Could not obtain user vote data for this topic', '', __LINE__, __FILE__, $sql);
             }

             if ( !($row = $db->sql_fetchrow($result2)) )




  6. FIND - Line 506
    2.0.6 Code:


             {
                $message = $lang['Already_voted'];
             }



    AFTER, ADD
    2.0.7 Code:


             $db->sql_freeresult($result2);




  7. FIND - Line 508
    2.0.6 Code:


          else
          {
             $message = $lang['No_vote_option'];
          }



    AFTER, ADD
    2.0.7 Code:


          $db->sql_freeresult($result);



  • privmsg.php




  1. FIND - Line 61
    2.0.6 Code:


    if ( isset($HTTP_POST_VARS['folder']) || isset($HTTP_GET_VARS['folder']) )
    {
       $folder = ( isset($HTTP_POST_VARS['folder']) ) ? $HTTP_POST_VARS['folder'] : $HTTP_GET_VARS['folder'];



    AFTER, ADD
    2.0.7 Code:


       $folder = htmlspecialchars($folder);




  2. DELETE - Line 73
    2.0.6 Code:


    // session id check
    if (!empty($HTTP_POST_VARS['sid']) || !empty($HTTP_GET_VARS['sid']))
    {
       $sid = (!empty($HTTP_POST_VARS['sid'])) ? $HTTP_POST_VARS['sid'] : $HTTP_GET_VARS['sid'];
    }
    else
    {
       $sid = '';
    }





  3. FIND - Line 96
    2.0.6 Code:


    if ( !empty($HTTP_POST_VARS['mode']) || !empty($HTTP_GET_VARS['mode']) )
    {
       $mode = ( !empty($HTTP_POST_VARS['mode']) ) ? $HTTP_POST_VARS['mode'] : $HTTP_GET_VARS['mode'];



    AFTER, ADD
    2.0.7 Code:


       $mode = htmlspecialchars($mode);



  • search.php




  1. FIND - Line 685
    2.0.6 Code:


          if ( intval($search_id) )



    REPLACE WITH
    2.0.7 Code:


          $search_id = intval($search_id);
          if ( $search_id )



  • templates/subSilver/index_body.tpl




  1. FIND - Line 94
    2.0.6 Code:


       <td width="20" align="center"><img src="templates/subSilver/images/folder_new.gif" alt="{L_NEW_POSTS}"/></td>
       <td><span class="gensmall">{L_NEW_POSTS}</span></td>
       <td>  </td>
       <td width="20" align="center"><img src="templates/subSilver/images/folder.gif" alt="{L_NO_NEW_POSTS}" /></td>
       <td><span class="gensmall">{L_NO_NEW_POSTS}</span></td>
       <td>  </td>
       <td width="20" align="center"><img src="templates/subSilver/images/folder_lock.gif" alt="{L_FORUM_LOCKED}" /></td>



    REPLACE WITH
    2.0.7 Code:


       <td width="20" align="center"><img src="templates/subSilver/images/folder_new_big.gif" alt="{L_NEW_POSTS}"/></td>
       <td><span class="gensmall">{L_NEW_POSTS}</span></td>
       <td>  </td>
       <td width="20" align="center"><img src="templates/subSilver/images/folder_big.gif" alt="{L_NO_NEW_POSTS}" /></td>
       <td><span class="gensmall">{L_NO_NEW_POSTS}</span></td>
       <td>  </td>
       <td width="20" align="center"><img src="templates/subSilver/images/folder_locked_big.gif" alt="{L_FORUM_LOCKED}" /></td>



  • viewforum.php




  1. FIND - Line 243
    2.0.6 Code:


       $topic_days = ( !empty($HTTP_POST_VARS['topicdays']) ) ? $HTTP_POST_VARS['topicdays'] : $HTTP_GET_VARS['topicdays'];



    REPLACE WITH
    2.0.7 Code:


       $topic_days = ( !empty($HTTP_POST_VARS['topicdays']) ) ? intval($HTTP_POST_VARS['topicdays']) : intval($HTTP_GET_VARS['topicdays']);



  • viewtopic.php




  1. FIND - Line 317
    2.0.6 Code:


       $post_days = ( !empty($HTTP_POST_VARS['postdays']) ) ? $HTTP_POST_VARS['postdays'] : $HTTP_GET_VARS['postdays'];



    REPLACE WITH
    2.0.7 Code:


       $post_days = ( !empty($HTTP_POST_VARS['postdays']) ) ? intval($HTTP_POST_VARS['postdays']) : intval($HTTP_GET_VARS['postdays']);




  2. FIND - Line 360
    2.0.6 Code:


       $post_order = (!empty($HTTP_POST_VARS['postorder'])) ? $HTTP_POST_VARS['postorder'] : $HTTP_GET_VARS['postorder'];



    REPLACE WITH
    2.0.7 Code:


       $post_order = (!empty($HTTP_POST_VARS['postorder'])) ? htmlspecialchars($HTTP_POST_VARS['postorder']) : htmlspecialchars($HTTP_GET_VARS['postorder']);