Jump to content


Upgrading forums to IPB 3.2


17 replies to this topic

#1 Pete

    Newbie

  • Active Member
  • Pip
  • 21 posts

Posted 20 July 2011 - 04:06 PM

Hi guys

So IPB3.2 has been released since this morning and inevitably they've changed enough code to stop it working with IPBWI ;)

I've made a start on making IPBWI compatible again on a test installation, and so far I can get the examples working (well, visible without any nasty PHP error messages - the examples all need testing as logging out works but logging in doesn't for example).

Changes to make to get the examples working are:

lib/ips_wrapper.inc.php

on line 30 change this:
$this->loggedIn					= (bool) $this->lang->memberData['member_id'];
to this:
$this->loggedIn					= (bool) $this->memberData['member_id'];

on line 95 change this:
return $this->lang->memberData;
to this:
return $this->memberData;

ipbwi.inc.php
comment out lines 83 and 84 to look like this:
//$this->board['version']			= $this->caches['app_cache']['core']['app_version'];
//$this->board['version_long']	= $this->caches['app_cache']['core']['app_long_version'];

I wasn't sure how resolve the error with trying to load the app version from the cache, but commenting out those lines gets rid of the error message so it's a start ;)

Now if I can get the login script working then that's fixed a lot of the things my sites would actually need from IPB via IPBWI :)

#2 Matthias Reuter

    Forensklave

  • Admin
  • PipPipPipPipPipPipPipPip
  • 9232 posts
  • Gender:Male
  • Location:Hamburg / Germany

Posted 21 July 2011 - 08:51 AM

thx peter, I'll check the v3.2 in august and make IPBWI compatible again. For this time, I recommend using your hotfix.

Please do not upgrade your forum on live environment to IP.board 3.2 until I've released a patch for IPBWI and IPBWI for WordPress. Otherwise you are doing that on your own risk!

#3 Pete

    Newbie

  • Active Member
  • Pip
  • 21 posts

Posted 21 July 2011 - 02:39 PM

It doesn't help too much Matthias I'm afraid - you can't login and various other things in the examples are a bit broken.

The majority of it seems to work, but I'm going to keep digging into the code and see if I can get more of it working though :)

The biggest issue seems to be that a lot of stuff in the cache has been made private so I'm not sure but it looks like IPBWI is having trouble reading from and writing to the cache which probably affects a lot of stuff.

Oh yeah, and definitely don't upgrade your forums just yet if you use IPBWI - I'm doing all of this on a test installation and wouldn't recommend upgrading just yet.

#4 Pete

    Newbie

  • Active Member
  • Pip
  • 21 posts

Posted 21 July 2011 - 04:19 PM

Got logins working.

In the member_login.php file in the examples folder, change the field names and variables for username and password to begin with ips_ so in otherwords username would become ips_username.

Full file looks like this now:

<?php
	/**
     * @desc			This file is only an example for loading IPBWI. Feel free to copy
     * 					this code to your own website files.
     * @copyright		2007-2010 IPBWI development team
     * @package			liveExample
     * @author			Matthias Reuter ($LastChangedBy: matthias $)
     * @license			http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License
     * @version			$LastChangedDate: 2008-09-19 18:49:53 +0000 (Fr, 19 Sep 2008) $
     * @since			2.0
     * @link			http://ipbwi.com
     * @ignore
     */
	ini_set('display_errors',1);
	error_reporting(E_ALL);
	// Initialization
	$pageTitle = 'Member Login';
	require_once('../site/modules/IPBWI/ipbwi.inc.php');
define('IGNORE_AUTH_KEY', TRUE);
	if(isset($_POST['action']) && $_POST['action'] == 'login'){
		if(empty($_POST['ips_username'])){
			$ipbwi->addSystemMessage('Error', 'You have to type an username.');
		}elseif(empty($_POST['ips_password'])){
			$ipbwi->addSystemMessage('Error', 'You have to type a password.');
		}else{
			if(isset($_POST['setcookie'])){
				$setCookie	= true;
			}else{
				$setCookie	= false;
			}
			if(isset($_POST['anonlogin'])){
				$anonLogin	= true;
			}else{
				$anonLogin	= false;
			}
			$ipbwi->member->login($_POST['ips_username'],$_POST['ips_password'],$setCookie,$anonLogin);
		}
	}

	require_once('lib/php/includes.inc.php');
	echo $header;

	// Error Output
	echo $ipbwi->printSystemMessages();
?>
		<h2>Login-Form</h2>
<?php
	if($ipbwi->member->isLoggedIn()){
?>
		<p>Your are already logged in</p>
<?php
	}else{
?>
		<form action="member_login.php" method="post">
			<table>
				<tr>
					<td>
						<table>
							<tr><td>username</td><td><input style="width:200px;" type="text" name="ips_username" /></td></tr>
							<tr><td>password</td><td><input style="width:200px;" type="password" name="ips_password" /></td></tr>
						</table>
					</td><td>
						<table>
							<tr><td>remember login</td><td><input type="checkbox" name="setcookie" value="1" checked="checked" /></td></tr>
							<tr><td>anonymous login</td><td><input type="checkbox" name="anonlogin" value="1" /></td></tr>
						</table>
					</td>
				</tr>
				<tr><td colspan="2"><input type="submit" name="login" value="Login" /></td></tr>
			</table>
			<input type="hidden" name="action" value="login" />
		</form>
<?php
	}
echo $footer;
?>

Going to work on profile information later on as at present it doesn't retrieve it for some reason.

Edited by Pete, 21 July 2011 - 04:20 PM.


#5 Pete

    Newbie

  • Active Member
  • Pip
  • 21 posts

Posted 21 July 2011 - 04:42 PM

Turns out it was retrieving the info, just couldn't display the dates when viewing a member profile on my XAMPP installation.

Change the following lines to get all things like last_login, last_visit etc to work:

Around line 435 of ipbwi.ioc.php change this:
if($dateFormat){
	$timeStamp = strftime($dateFormat, $timeStamp);
}

to this:
if($dateFormat){
     $timeStamp = strftime(str_replace('%T', '%H:%M:%S', $dateFormat), $timeStamp);
 }

Hey presto, it displays dates again (probably wouldn't be a problem on a Linux server, but my testing server is Windows based).

As I mentioned though, the $ipbwi->member->info() function does grab all of the data, the above issue meant it just wasn't outputting the formatted dates.

#6 MariuszT

    Rookie

  • Active Member
  • 7 posts

Posted 22 July 2011 - 11:23 AM

Matthias, August is a little too late. It can not be this month?

#7 neen

    ReConnecter

  • Active Member
  • PipPip
  • 50 posts

Posted 22 July 2011 - 07:16 PM

Chances are I'll be taking a look at this myself over the next few weeks, and I should have a patch out pretty soon... However, it will most likely be applied to my PHP 5.3 branch on github, and most likely not the official version of the code. However, I'll see if I can't get a patch for that together that resolves all the issues.

#8 neen

    ReConnecter

  • Active Member
  • PipPip
  • 50 posts

Posted 23 July 2011 - 10:01 AM

Alright, I've updated my github repository with the fixes I've found are needed so far to make IPBWI work with IPB 3.2. You can find my PHP 5.3+ only branch here. You can find the regular version here.

Please note: most of the examples have not been updated to work with my PHP 5.3+ branch. The examples in the regular version of the code should be working, barring any other patches that need to be made.

#9 Matthias Reuter

    Forensklave

  • Admin
  • PipPipPipPipPipPipPipPip
  • 9232 posts
  • Gender:Male
  • Location:Hamburg / Germany

Posted 24 July 2011 - 06:39 PM

View PostMariuszT, on 22 July 2011 - 11:23 AM, said:

Matthias, August is a little too late. It can not be this month?

I'll give my best to release as soon as possible, but the IPBWI stands for stable releases, so please wait with upgrading on live environment until I've released a tested patch or do it on your own risk.

#10 Pete

    Newbie

  • Active Member
  • Pip
  • 21 posts

Posted 26 July 2011 - 09:43 PM

Adding and editing topics was a bit broken - it basically wasn't saving the first post ID when creating a topic. There was also an issue editing it as there's now a post cacahe table that wasn't there a few IPB versions ago. I also added seo forename and last name to the topic table (no idea why there's even a last name field in the topic table as there's nowhere to enter it in the software ;)).

On line 89 of topics.inc.php change this:
$this->ipbwi->ips_wrapper->DB->query('INSERT INTO '.$this->ipbwi->board['sql_tbl_prefix'].'topics (title, description, state, posts, starter_id, start_date, last_poster_id, last_post, starter_name, last_poster_name, views, forum_id, approved, author_mode, pinned) VALUES ("'.$title.'", "'.$desc.'", "open", "0", "'.$postAuthorID.'", "'.$time.'", "'.$postAuthorID.'", "'.$time.'", "'.$postName.'", "'.$postName.'", "0", "'.$forumID.'", "'.($preview ? '0' : '1').'", "1", "0")');

to this:
$this->ipbwi->ips_wrapper->DB->query('INSERT INTO '.$this->ipbwi->board['sql_tbl_prefix'].'topics (title, description, state, posts, starter_id, start_date, last_poster_id, last_post, starter_name, last_poster_name, views, forum_id, approved, author_mode, pinned, poll_state, last_vote, seo_last_name, seo_first_name) VALUES ("'.$title.'", "'.$desc.'", "open", "0", "'.$postAuthorID.'", "'.$time.'", "'.$postAuthorID.'", "'.$time.'", "'.$postName.'", "'.$postName.'", "0", "'.$forumID.'", "'.($preview ? '0' : '1').'", "1", "0", "0", "0", "' . $this->ipbwi->member->myInfo['members_seo_name'] . '", "' . $this->ipbwi->member->myInfo['members_seo_name'] . '")');

After this on line 101:
$this->ipbwi->ips_wrapper->DB->query('INSERT INTO '.$this->ipbwi->board['sql_tbl_prefix'].'posts (author_id, author_name, use_emo, use_sig, ip_address, post_date, post, queued, topic_id, new_topic, icon_id, post_htmlstate) VALUES ("'.$postAuthorID.'", "'.$postName.'", "'.($useEmo ? 1 : 0).'", "'.($useSig ? 1 : 0).'", "'.$_SERVER['REMOTE_ADDR'].'", "'.$time.'", "'.$post.'", "0", "'.$topicID.'", "1", "0", "'.$this->ipbwi->ips_wrapper->parser->parse_html.'")');

Add this:
$postID = $this->ipbwi->ips_wrapper->DB->getInsertId();
$this->ipbwi->ips_wrapper->DB->query('UPDATE '.$this->ipbwi->board['sql_tbl_prefix'].'topics SET topic_firstpost ="'.$postID.'" WHERE tid="'.$topicID.'"');

After this on line 236:
$this->ipbwi->ips_wrapper->DB->query('UPDATE '.$this->ipbwi->board['sql_tbl_prefix'].'posts SET edit_time="'.$edited.'", post="'.$post.'", edit_name="'.$edit.'", post_edit_reason="'.$reason.'", use_emo="'.($useEmo ? 1 : 0).'", use_sig="'.($useSig ? 1 : 0).'" WHERE pid="'.$row['topic_firstpost'].'"');

Add this:
$this->ipbwi->ips_wrapper->DB->query('UPDATE '.$this->ipbwi->board['sql_tbl_prefix'].'content_cache_posts SET cache_content ="'.$post.'", cache_updated="'.$edit.'" WHERE cache_content_id="'.$row['topic_firstpost'].'"');

These edits fixed it enough for what I was doing, but someone with more time will have to check the tables and see if there's anything else I missed (I know for a fact that topic status isn't saved to the DB even though IPBWI seems to try and set it correctly).

#11 Pete

    Newbie

  • Active Member
  • Pip
  • 21 posts

Posted 26 July 2011 - 10:38 PM

Noticed another minor problem - with the new post cache table you'll need to edit the topic->delete function as follows.

After this on line 267:
$this->ipbwi->ips_wrapper->DB->query('DELETE FROM '.$this->ipbwi->board['sql_tbl_prefix'].'posts WHERE topic_id = "'.intval($topicID).'"');

add this:
$this->ipbwi->ips_wrapper->DB->query('DELETE FROM '.$this->ipbwi->board['sql_tbl_prefix'].'content_cache_posts WHERE cache_content_id = "'.$info['topic_firstpost'].'"');

There is an issue that needs addressing with the topic->delete function - currently if a topic is deleted, member's post counts aren't amended! This should be looked at for the next version (I'd guess it would be a case of checking if posts increase a member's post count for the forum first, and if they are then iterating through posts in the topic, reducing the post count per post depending on who posted it).

#12 Pete

    Newbie

  • Active Member
  • Pip
  • 21 posts

Posted 28 July 2011 - 01:36 PM

In fact, topic deletion is now so complicated in IP Board that IPBWI needs to do even more than it does now.

It basically needs to do everything covered by the function _deleteTopicPermanent on line 1764 in admin/applications/forums/modules_public/moderate/moderate.php

Fortunately, I worked out the easiest way to do it - get IPB to do the delete :)

In lib/topic.inc.php, find:
public function delete($topicID){

and replace the entire function with this:
public function delete($topicID){
if($this->info($topicID)){
			$classToLoad		= IPSLib::loadLibrary( IPSLib::getAppDir( 'forums' ) . '/sources/classes/moderate.php', 'moderatorLibrary', 'forums' );
			$moderatorLibrary	= new $classToLoad( $this->ipbwi->ips_wrapper->registry );
			if ($moderatorLibrary->topicDeleteFromDB($topicID)) {	
				return true;
			}else{
				return false;
			}
		}
}

Mathias - I see you already did some code this way (as using IPB's own functions) in the ips_wrapper.inc.php file - are you planning to handle more things this way in future? It seems a bit easier maybe :)

P.S. This way also updates board stats and post counts etc.

Edited by Pete, 28 July 2011 - 01:52 PM.


#13 Matthias Reuter

    Forensklave

  • Admin
  • PipPipPipPipPipPipPipPip
  • 9232 posts
  • Gender:Male
  • Location:Hamburg / Germany

Posted 29 July 2011 - 01:06 PM

View PostPete, on 28 July 2011 - 01:36 PM, said:

Mathias - I see you already did some code this way (as using IPB's own functions) in the ips_wrapper.inc.php file - are you planning to handle more things this way in future? It seems a bit easier maybe :)

yep, that's the plan :)

#14 satov

    Rookie

  • Active Member
  • 2 posts

Posted 03 August 2011 - 01:45 PM

Hello guys,

Can you please check if user creation is working with IPB 3.2
Mine is stopped working, but I'm not sure is it because of IPB update or something else.

I mean $ipbwi->member->create() call.

Edited by satov, 03 August 2011 - 01:56 PM.


#15 satov

    Rookie

  • Active Member
  • 2 posts

Posted 03 August 2011 - 03:11 PM

Have found, what the problem...
The error was:
	[tos] => Array
    	(
        	[0] => You must agree to the registration terms.
    	)

So the temporary solution is to disable T&C check in the forum\admin\applications\core\modules_public\global\register.php

Comment the line 1715:
// 	$form_errors['tos']	= array( $this->lang->words['must_agree_to_terms'] );
User creation is now working again.

Edited by satov, 03 August 2011 - 03:11 PM.


#16 Scholesy

    Rookie

  • Active Member
  • 3 posts

Posted 14 August 2011 - 12:41 PM

Hi all,

I don't know if this was obvious or something, but I just could not login until I fixed this lines :

In lib/member.inc.php :

Line ~1030, find this :

$this->ipbwi->ips_wrapper->request['username'] = $user;

Replace it by :

$this->ipbwi->ips_wrapper->request['ips_username'] = $user;

Line ~1034, find this :

$this->ipbwi->ips_wrapper->request['password'] = $pw;

Replace it by :

$this->ipbwi->ips_wrapper->request['ips_password'] = $pw;

I know that this is quite the same thing Pete explained here, but still, I was not able to figure it out without half an hour of intensive work :) Maybe the fact that the changes were done in the example file, I don't know.

Also, I had to deactivate the external login handler as it was just throwing out IPS driver errors when logging in from the website, not the boards.

Well, I'd like to thank everybody here who helped me getting my boards running again. The other administrator I work with had no idea that updating IPB could cause such problems, and it looks that there is no turning back once the update is done. And good luck to Matthias for the next version of IPBWI.

Edited by Scholesy, 14 August 2011 - 12:42 PM.


#17 Matthias Reuter

    Forensklave

  • Admin
  • PipPipPipPipPipPipPipPip
  • 9232 posts
  • Gender:Male
  • Location:Hamburg / Germany

Posted 14 August 2011 - 05:51 PM

View PostScholesy, on 14 August 2011 - 12:41 PM, said:

Well, I'd like to thank everybody here who helped me getting my boards running again. The other administrator I work with had no idea that updating IPB could cause such problems, and it looks that there is no turning back once the update is done. And good luck to Matthias for the next version of IPBWI.

Your administrator always should check release notes and should make backups before upgrading. When there are bigger changes announced in release notes, there are often hidden bugs, that's the reason why v3.2.1 is released rapidly by Invision Power. I'm always recommending a test environment for checking compatibility of new updates before roll out on live environments. The next days I'll release a IPBWI and IPBWI4WP fix for 3.2.x. Pete has got an incentive for his effort providing some hotfixes here. Thanks again for your work, Pete!

#18 Matthias Reuter

    Forensklave

  • Admin
  • PipPipPipPipPipPipPipPip
  • 9232 posts
  • Gender:Male
  • Location:Hamburg / Germany

Posted 16 August 2011 - 06:20 AM

Please try out v3.050 which brings compatibility fixes for IP.board 3.2.x. Please note, that your hotfixes may not be compatible with this release, so you should revert them back and/or overwrite before upgrading. Please don't forget making backups before updating. Release Notes





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users