Invision 1.3.1 with PHP 5 and MySQL 5

From Wiki
Jump to: navigation, search
To make Invision 1.3 works on PHP5 with MySQL 5 a few changes need to be made.

First alter the ibf_sessions table:
ALTER TABLE ibf_sessions CHANGE in_forum in_forum VARCHAR(5);

Open index.php and add these lines right at the very top:

//-- mod_php5 begin
    $HTTP_SERVER_VARS = isset($_SERVER)?$_SERVER:array();
    $HTTP_GET_VARS = isset($_GET)?$_GET:array();
    $HTTP_POST_VARS = isset($_POST)?$_POST:array();
    $HTTP_POST_FILES = isset($_FILES)?$_FILES:array();
    $HTTP_COOKIE_VARS = isset($_COOKIE)?$_COOKIE:array();
    $HTTP_ENV_VARS = isset($_ENV)?$_ENV:array();
    $HTTP_SESSION_VARS = isset($_SESSION)?$_SESSION:array();
//-- mod_php5 end


sources/Boards.php line 72:

Change FROM ibf_forums f, ibf_categories c to this:
FROM (ibf_forums f, ibf_categories c)

IPB 1.2 and 1.3 are still used by a lot of folks because they are still free. But the problem is, the coding for them isn't 100% compatible with the latest versions of PHP and MySQL, and a lot of web hosts are moving to these versions. This article is a collection of all of the changes you need to make to your files to make IPB 1.2 or 1.3 work with PHP5 & MySQL 4.1.

Symptoms of this problem

    * Blank 'My Controls' page
    * Blank 'Profile' page
    * MySQL errors when reporting post
    * MySQL errors on 'The Moderating Team' page

Files affected

    * sources/Profile.php
    * sources/Usercp.php
    * sources/misc/contact_member.php
    * sources/misc/stats.php

Step 1
Open sources/Profile.php
Find:
CODE
   var $parser;

Change To:
CODE
   //var $parser;

Save and upload sources/Profile.php

Step 2
Open sources/Usercp.php
Find:
CODE
   var $parser;

Change To:
CODE
   //var $parser;

Save and upload sources/Usercp.php

Step 3
Open sources/misc/contact_member.php
Find:
CODE
   var $email     = "";
   var $forum     = "";
   var $email     = "";

Change To:
CODE
   //var $email     = "";
   var $forum     = "";
   var $email     = "";

Find:
CODE
 $DB->query("SELECT m.name, m.email, mod.member_id FROM ibf_moderators mod, ibf_members m WHERE mod.forum_id='$fid' and mod.member_id=m.id");

Change To:
CODE
 $DB->query("SELECT m.name, m.email, moder.member_id FROM ibf_moderators moder, ibf_members m WHERE moder.forum_id='$fid' and moder.member_id=m.id");

Save and upload sources/misc/contact_member.php

Step 4
Open sources/misc/stats.php
Find:
CODE
 //--------------------------------------------
    // Do we have any moderators? NORMAL MODS 1st
    //--------------------------------------------
   
    $DB->query("SELECT m2.id, m2.name, m2.email, m2.hide_email, m2.location, m2.aim_name, m2.icq_number,
                       f.id as forum_id, f.read_perms, f.name as forum_name, c.state
                FROM ibf_moderators mod
                  LEFT JOIN ibf_forums f ON(f.id=mod.forum_id)
                  LEFT JOIN ibf_categories c ON(c.id=f.category AND c.state != 0)
                  LEFT JOIN ibf_members m2 ON (mod.member_id=m2.id)
                ");

Change To:
CODE
 //--------------------------------------------
    // Do we have any moderators? NORMAL MODS 1st
    //--------------------------------------------
   
    $DB->query("SELECT m2.id, m2.name, m2.email, m2.hide_email, m2.location, m2.aim_name, m2.icq_number,
                       f.id as forum_id, f.read_perms, f.name as forum_name, c.state
                FROM ibf_moderators moder
                  LEFT JOIN ibf_forums f ON(f.id=moder.forum_id)
                  LEFT JOIN ibf_categories c ON(c.id=f.category AND c.state != 0)
                  LEFT JOIN ibf_members m2 ON (moder.member_id=m2.id)
                ");

Find: (this edit doesn't show up in 1.2, so if that's your version then you should be able to skip this step)
CODE
    //--------------------------------------------
    // Do we have any moderators? GROUP MODS 1st
    //--------------------------------------------
   
    $DB->query("SELECT m.id, m.name, m.email, m.hide_email, m.location, m.aim_name, m.icq_number,
                       f.id as forum_id, f.read_perms, f.name as forum_name, c.state
                FROM ibf_moderators mod
                  LEFT JOIN ibf_forums f ON(f.id=mod.forum_id)
                  LEFT JOIN ibf_categories c ON(c.id=f.category AND c.state != 0)
                  LEFT JOIN ibf_members m ON ((mod.is_group=1 and mod.group_id=m.mgroup))
                ");

Change To:
CODE
    //--------------------------------------------
    // Do we have any moderators? GROUP MODS 1st
    //--------------------------------------------
   
    $DB->query("SELECT m.id, m.name, m.email, m.hide_email, m.location, m.aim_name, m.icq_number,
                       f.id as forum_id, f.read_perms, f.name as forum_name, c.state
                FROM ibf_moderators moder
                  LEFT JOIN ibf_forums f ON(f.id=moder.forum_id)
                  LEFT JOIN ibf_categories c ON(c.id=f.category AND c.state != 0)
                  LEFT JOIN ibf_members m ON ((moder.is_group=1 and moder.group_id=m.mgroup))
                ");

Save and upload sources/misc/stats.php