phpBB 2.0.15 Update

All updates to the site will be posted here.

Moderator: CricketMX Forum Moderators

phpBB 2.0.15 Update

Postby battye » Sun May 08, 2005 4:46 am

phpBB has released 2.0.15, the "summer needs to be hot" release. CricketMX.com has already updated, if your forum is still running 2.0.14, follow the instructions listed below to upgrade. If you run 2.0.13 or lower visit http://www.phpbb.com for more code changes and other upgrade methods.

phpBB 2.0.14 to phpBB 2.0.15 Code Changes

These are the Changes from phpBB 2.0.14 to phpBB 2.0.15 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.

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

  • admin/admin_forums.php
  1. FIND - Line 236
    Code: Select all

       if( $mode == "addforum" )
       {
          list($cat_id) = each($HTTP_POST_VARS['addforum']);


    AFTER, ADD
    Code: Select all

          $cat_id = intval($cat_id);

  • admin/admin_smilies.php
  1. FIND - Line 450
    Code: Select all

             $smile_code = ( isset($HTTP_POST_VARS['smile_code']) ) ? $HTTP_POST_VARS['smile_code'] : $HTTP_GET_VARS['smile_code'];
             $smile_url = ( isset($HTTP_POST_VARS['smile_url']) ) ? $HTTP_POST_VARS['smile_url'] : $HTTP_GET_VARS['smile_url'];
             $smile_emotion = ( isset($HTTP_POST_VARS['smile_emotion']) ) ? $HTTP_POST_VARS['smile_emotion'] : $HTTP_GET_VARS['smile_emotion'];


    AFTER, ADD
    Code: Select all

             $smile_code = trim($smile_code);
             $smile_url = trim($smile_url);
             $smile_emotion = trim($smile_emotion);

  • admin/pagestart.php
  1. FIND - Line 62
    Code: Select all

       redirect("index.$phpEx?sid=" . $userdata['session_id']);
    }



    AFTER, ADD
    Code: Select all

    if (!$userdata['session_admin'])
    {
       redirect(append_sid("login.$phpEx?redirect=admin/&admin=1", true));
    }


  • db/postgres7.php
  1. FIND - Line 126
    Code: Select all

             $query = preg_replace('#(.*WHERE.*)(username|user_email|ban_email) = \'(.*)\'#ise', "\"\\1LOWER(\\2) = '\" . strtolower('\\3') . \"'\"", $query);


    REPLACE WITH
    Code: Select all

    //         $query = preg_replace('#(.*WHERE.*)(username|user_email|ban_email) = \'(.*)\'#ise', "\"\\1LOWER(\\2) = '\" . strtolower('\\3') . \"'\"", $query);

  • groupcp.php
  1. FIND - Line 340
    Code: Select all

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


    REPLACE WITH
    Code: Select all

             if ( !($row = $db->sql_fetchrow($result)) || $row['is_auth_mod'] == 0 )

  • includes/bbcode.php
  1. FIND - Line 127
    Code: Select all

    {
       global $lang, $bbcode_tpl;



    AFTER, ADD
    Code: Select all

       $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1:", $text);


  2. FIND - Line 197
    Code: Select all

       // [img]image_url_here[/img] code..
       // This one gets first-passed..
       $patterns[] = "#\[img:$uid\](.*?)\[/img:$uid\]#si";


    REPLACE WITH
    Code: Select all

       // [img]image_url_here[/img] code..
       // This one gets first-passed..
       $patterns[] = "#\[img:$uid\]([^?].*?)\[/img:$uid\]#i";

  3. FIND - Line 210
    Code: Select all

       // [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";


    REPLACE WITH
    Code: Select all

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

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

  4. FIND - Line 619
    Code: Select all

    */
    function make_clickable($text)
    {


    AFTER, ADD
    Code: Select all

       $text = preg_replace('#(script|about|applet|activex|chrome):#is', "\\1&#058;", $text);

  • includes/sessions.php
  1. FIND - Line 27
    Code: Select all

    function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0)


    REPLACE WITH
    Code: Select all

    function session_begin($user_id, $user_ip, $page_id, $auto_create = 0, $enable_autologin = 0, $admin = 0)

  2. FIND - Line 158
    Code: Select all

          SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login
          WHERE session_id = '" . $session_id . "'
             AND session_ip = '$user_ip'";
       if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
       {
          $session_id = md5(uniqid($user_ip));

          $sql = "INSERT INTO " . SESSIONS_TABLE . "
             (session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in)
             VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login)";


    REPLACE WITH
    Code: Select all

          SET session_user_id = $user_id, session_start = $current_time, session_time = $current_time, session_page = $page_id, session_logged_in = $login, session_admin = $admin
          WHERE session_id = '" . $session_id . "'
             AND session_ip = '$user_ip'";
       if ( !$db->sql_query($sql) || !$db->sql_affectedrows() )
       {
          list($sec, $usec) = explode(' ', microtime());
          mt_srand((float) $sec + ((float) $usec * 100000));
          $session_id = md5(uniqid(mt_rand(), true));

          $sql = "INSERT INTO " . SESSIONS_TABLE . "
             (session_id, session_user_id, session_start, session_time, session_ip, session_page, session_logged_in, session_admin)
             VALUES ('$session_id', $user_id, $current_time, $current_time, '$user_ip', $page_id, $login, $admin)";

  3. FIND - Line 180
    Code: Select all

       {// ( $userdata['user_session_time'] > $expiry_time && $auto_create ) ? $userdata['user_lastvisit'] : (
          $last_visit = ( $userdata['user_session_time'] > 0 ) ? $userdata['user_session_time'] : $current_time;



    AFTER, ADD
    Code: Select all

          if (!$admin)
          {

  4. FIND - Line 189
    Code: Select all


          $userdata['user_lastvisit'] = $last_visit;

          $sessiondata['autologinid'] = ( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '';


    REPLACE WITH
    Code: Select all

          }

          $userdata['user_lastvisit'] = $last_visit;

          $sessiondata['autologinid'] = (!$admin) ? (( $enable_autologin && $sessionmethod == SESSION_METHOD_COOKIE ) ? $auto_login_key : '') : $sessiondata['autologinid'];

  5. FIND - Line 204
    Code: Select all

       $userdata['session_page'] = $page_id;
       $userdata['session_start'] = $current_time;
       $userdata['session_time'] = $current_time;


    AFTER, ADD
    Code: Select all

       $userdata['session_admin'] = $admin;

  6. FIND - Line 294
    Code: Select all

                   $sql = "UPDATE " . SESSIONS_TABLE . "
                      SET session_time = $current_time, session_page = $thispage_id


    REPLACE WITH
    Code: Select all

                   // A little trick to reset session_admin on session re-usage
                   $update_admin = (!defined('IN_ADMIN') && $current_time - $userdata['session_time'] > ($board_config['session_length']+60)) ? ', session_admin = 0' : '';

                   $sql = "UPDATE " . SESSIONS_TABLE . "
                      SET session_time = $current_time, session_page = $thispage_id$update_admin

  • includes/smtp.php
  1. FIND - Line 109
    Code: Select all

       if( !$socket = fsockopen($board_config['smtp_host'], 25, $errno, $errstr, 20) )


    REPLACE WITH
    Code: Select all

       if( !$socket = @fsockopen($board_config['smtp_host'], 25, $errno, $errstr, 20) )

  • includes/usercp_viewprofile.php
  1. FIND - Line 36
    Code: Select all

    }
    $profiledata = get_userdata($HTTP_GET_VARS[POST_USERS_URL]);



    AFTER, ADD
    Code: Select all

    if (!$profiledata)
    {
       message_die(GENERAL_MESSAGE, $lang['No_user_id_specified']);
    }


  • language/lang_english/lang_main.php
  1. FIND - Line 1021
    Code: Select all

    $lang['An_error_occured'] = 'An Error Occurred';
    $lang['A_critical_error'] = 'A Critical Error Occurred';



    AFTER, ADD
    Code: Select all

    $lang['Admin_reauthenticate'] = 'To administer the board you must re-authenticate yourself.';


  • login.php
  1. FIND - Line 55
    Code: Select all

       if( ( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) ) && !$userdata['session_logged_in'] )


    REPLACE WITH
    Code: Select all

       if( ( isset($HTTP_POST_VARS['login']) || isset($HTTP_GET_VARS['login']) ) && (!$userdata['session_logged_in'] || isset($HTTP_POST_VARS['admin'])) )

  2. FIND - Line 80
    Code: Select all

                   $session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin);


    REPLACE WITH
    Code: Select all

                   $admin = (isset($HTTP_POST_VARS['admin'])) ? 1 : 0;
                   $session_id = session_begin($row['user_id'], $user_ip, PAGE_INDEX, FALSE, $autologin, $admin);

  3. FIND - Line 162
    Code: Select all

       if( !$userdata['session_logged_in'] )


    REPLACE WITH
    Code: Select all

       if( !$userdata['session_logged_in'] || (isset($HTTP_GET_VARS['admin']) && $userdata['session_logged_in'] && $userdata['user_level'] == ADMIN))

  4. FIND - Line 211
    Code: Select all


          make_jumpbox('viewforum.'.$phpEx, $forum_id);
          $template->assign_vars(array(
             'USERNAME' => $username,

             'L_ENTER_PASSWORD' => $lang['Enter_password'],


    REPLACE WITH
    Code: Select all

          $s_hidden_fields .= (isset($HTTP_GET_VARS['admin'])) ? '<input type="hidden" name="admin" value="1" />' : '';

          make_jumpbox('viewforum.'.$phpEx, $forum_id);
          $template->assign_vars(array(
             'USERNAME' => $username,

             'L_ENTER_PASSWORD' => (isset($HTTP_GET_VARS['admin'])) ? $lang['Admin_reauthenticate'] : $lang['Enter_password'],

  • viewtopic.php
  1. FIND - Line 1110
    Code: Select all

          $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace('#\b(" . $highlight_match . ")\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $message . '<'), 1, -1));


    REPLACE WITH
    Code: Select all

          $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace('#\b(" . str_replace('\\', '\\\\', $highlight_match) . ")\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $message . '<'), 1, -1));

  • admin/admin_ug_auth.php
  1. FIND - Line 553
    Code: Select all

          message_die(GENERAL_MESSAGE, $message);
       }
    }
    else if ( ( $mode == 'user' && ( isset($HTTP_POST_VARS['username']) || $user_id ) ) || ( $mode == 'group' && $group_id ) )


    BEFORE, ADD
    Code: Select all


          $sql = 'SELECT user_id FROM ' . USER_GROUP_TABLE . "
             WHERE group_id = $group_id";
          $result = $db->sql_query($sql);

          $group_user = array();
          while ($row = $db->sql_fetchrow($result))
          {
             $group_user[$row['user_id']] = $row['user_id'];
          }
          $db->sql_freeresult($result);

          $sql = "SELECT ug.user_id, COUNT(auth_mod) AS is_auth_mod
             FROM " . AUTH_ACCESS_TABLE . " aa, " . USER_GROUP_TABLE . " ug
             WHERE ug.user_id IN (" . implode(', ', $group_user) . ")
                AND aa.group_id = ug.group_id
                AND aa.auth_mod = 1
             GROUP BY ug.user_id";
          if ( !($result = $db->sql_query($sql)) )
          {
             message_die(GENERAL_ERROR, 'Could not obtain moderator status', '', __LINE__, __FILE__, $sql);
          }

          while ($row = $db->sql_fetchrow($result))
          {
             if ($row['is_auth_mod'])
             {
                unset($group_user[$row['user_id']]);
             }
          }
          $db->sql_freeresult($result);

          if (sizeof($group_user))
          {
             $sql = "UPDATE " . USERS_TABLE . "
                SET user_level = " . USER . "
                WHERE user_id IN (" . implode(', ', $group_user) . ")";
             if ( !($result = $db->sql_query($sql)) )
             {
                message_die(GENERAL_ERROR, 'Could not update user level', '', __LINE__, __FILE__, $sql);
             }
          }

  • includes/usercp_register.php
  1. FIND - Line 414
    Code: Select all

             if (strtolower($username) != strtolower($userdata['username']))


    REPLACE WITH
    Code: Select all

             if (strtolower($username) != strtolower($userdata['username']) || $mode == 'register')

CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14270
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe

Postby battye » Sat May 14, 2005 11:37 am

Make sure you make the following change to retain administrator priviledges when edting certain permissions:

FIND (around line 546)
WHERE user_id IN (" . implode(', ', $group_user) . ")";

REPLACE WITH
WHERE user_id IN (" . implode(', ', $group_user) . ") AND user_level = " . MOD;
CricketMX.com.. home of bat's, rat's and other farmyard animals...
My articles: view all articles by battye

"OK, life [as you chose to define it] repeats until there are no more lessons to be learned." - nrnoble (June 12, 2005)
"the new forum looks awesome, it's getting bigger & better" - p2p-sharing-rules (11 Jan, 2008)
"Looks like CMX is not only getting bigger...but, also getting better!!" - moongirl (14 Dec, 2007)
User avatar
battye
Site Admin
Site Admin
 
Posts: 14270
Joined: Sun Jan 11, 2004 8:26 am
Location: Victoria Falls, Zimbabwe


Return to Updates

Who is online

Users browsing this forum: No registered users and 1 guest

cron