2 parse errors after upgrading from 2.0.3 to 2.0.4

This is an archive of the phpBB 2.0.x support forum. Support for phpBB2 has now ended.
Forum rules
Following phpBB2's EoL, this forum is now archived for reference purposes only.
Please see the following announcement for more information: viewtopic.php?f=14&t=1385785
Locked
Philip Roy
Registered User
Posts: 14
Joined: Sat Feb 15, 2003 11:38 pm
Contact:

2 parse errors after upgrading from 2.0.3 to 2.0.4

Post by Philip Roy »

Hi all,

I have trawled this forum to try and solve these issues and find simple answers, but I am stuck. Please help!

I set up a discussion forum on a site (http://www.nzmac.com/forums) using version 2.0.3 of phpBB. While setting up the site initially, the cpanel let me set this forum up, so I’ve never really had a copy of all the files on my local Mac.

I made the following alterations to the bulletin board and was enjoying a successful forum with no technical problems...(1) changing the logo and URL that goes to in the header (2) adding some Javascript from phpAdsnew to show an ad at the top of each page (3) updated the file that lists times zones to add in GMT+13 for us New Zealanders (4) using the Post Notification mod, so I could make myself moderator of each forum and have it tell me when people posted to the forum.

I think (1)(2)(3) aren’t significant and I should point out I was using version 1.0.9 of the mod, but after the problems I describe below, I have updated to 1.2.3...but still have problems.

Some other details...the server in the States is Linux, Apache Version 1.3.27, PHP Version 4.2.3, MySQL Version 3.23.55

OK...here’s the problem....(but please note....the Post Notification mod is sending me email notifications as I hoped)

I wanted to patch the board to 2.0.4, but I couldn’t do this, as I didn’t have terminal access to patch the forum. So, on the advice in another forum, I set up a copy of phpBB on my local computer (a Mac, running OSX and MySQL). Yesterday I ran the patch (2.0.3 to 2.0.4) and altered the files. I then uploaded all the files to the server, ran the update_to_204.php once I had uploaded these files and thought that I had done everything successfully, However, I’m getting tow parse errors which I can’t seem to solve....

Problems
----------
If you click on the “Register” link. You get the following error.........
Parse error: parse error in /home2/phil_roy/public_html/forums/includes/usercp_register.php on line 346


People seem to request code in these instances...so here goes....lines 336 to 361 are as follows.....

Code: Select all

	$username_sql = '';
	if ( $board_config['allow_namechange'] || $mode == 'register' )
	{
		if ( empty($username) )
		{
			$error = TRUE;
			$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $lang['Username_disallowed'];
		}
			if (strtolower($username) != strtolower($userdata['username']))
			{
		else if ( $username != $userdata['username'] || $mode == 'register' )
		{
			$result = validate_username($username);
			if ( $result['error'] )
			{
				$error = TRUE;
				$error_msg .= ( ( isset($error_msg) ) ? '<br />' : '' ) . $result['error_msg'];
			}
			}

			if (!$error)
			{
				$username_sql = "username = '" . str_replace("\'", "''", $username) . "', ";
			}
		}
	}
The second error is also a parsing error that occurs on submitting a reply. (Note, although you get this error, going back to the forum you discover the reply was posted)......
Fatal error: Cannot redeclare class emailer in /home2/phil_roy/public_html/forums/includes/emailer.php on line 28

Lines 27 to 43 are.....

Code: Select all

class emailer
{
	var $tpl_file;
	var $use_smtp;
	var $msg;
	var $mimeOut;
	var $arrPlaceHolders = array();	// an associative array that has the key = placeHolderName and val = placeHolderValue.
	var $subject, $extra_headers, $address;

	function emailer($use_smtp)
	{
		$this->use_smtp = $use_smtp;
		$this->tpl_file = NULL;
		$this->address = NULL;
 		$this->msg = '';
		$this->mimeOut = '';
	}
If you want to register and try out the replying, I’m running a test post to try out problems.

http://nzmac.com/forums/viewtopic.php?t=61

Many thanks in advance.

Phil

Philip Roy
Registered User
Posts: 14
Joined: Sat Feb 15, 2003 11:38 pm
Contact:

SOLVED

Post by Philip Roy »

Sorry...it was a stray piece of mod coding that I had put in a file and didn't realise.

I can't delete this topic, so sorry for taking up people's time.

Phil

khisanthax
Registered User
Posts: 443
Joined: Sun Mar 02, 2003 1:49 am

Post by khisanthax »

mind sharing how you fixed the second problem? I have the same one now

Philip Roy
Registered User
Posts: 14
Joined: Sat Feb 15, 2003 11:38 pm
Contact:

Just check the files

Post by Philip Roy »

OK,

Couple of things I did...I hadn't really realised what those stray files (from memory, they ended in .rej) meant when I patched the board....so they were patches that hadn't worked....so I went in and fixed those files that had rejected changes.

Secondly, I just really checked any file that was reporting the error....look at the URL at the top of your browser to figure out what page/file the board is using at the time.

On a couple of files, I had stuffed them up so much, I downloaded a complete copy of 2.0.4....added the mod coding into these "new" files and uploaded those to replace the files I was having problems with.

All I can say...and I know it is said with all mods....just really be careful with pasting in the coding.

Hope that helps.

Phil

Locked

Return to “2.0.x Support Forum”