PDA

View Full Version : What wrong with my PHP code?


BK123
12-30-2004, 02:08 PM
Hi all,
I have just put on a MOD on my new PHPBB forum.

However, when I log in to the Admin, the admin panel is not working.

It says:

"Parse error: parse error, unexpected T_VARIABLE in /home/admin1/public_html/admin/admin_forums.php on line 381."

Below is the php code:

Line 381 is in Bold
-------------------------------------------

'DESCRIPTION' => $forumdesc,
'ICON_LIST' => $forum_icons_list, // Forum Icon MOD
'ICON_BASEDIR' => $phpbb_root_path . $board_config['forum_icon_path'], // Forum Icon MOD
'ICON_IMG' => ( $forumicon ) ? $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forumicon : $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $default_ficon // Forum Icon MOD
)
$template->pparse("body");
break;

case 'createforum':
//
// Create a forum in the DB
//
--------------------------------------------------------------

I don't know PHP but I suppose it's something small.

Thanks in advance! :thumbsup:

BK123
-------------

marek_mar
12-30-2004, 02:18 PM
Add a ; to the end of the line before your error.

BK123
12-30-2004, 02:24 PM
Hi Marek_mar,
I've done that ...

'ICON_IMG' => ( $forumicon ) ? $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forumicon : $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $default_ficon // Forum Icon MOD
);
$template->pparse("body");


and now it says :

"Parse error: parse error, unexpected ';' in /home/admin1/public_html/admin/admin_forums.php on line 380."

:confused:

BK123
-------------

BK123
12-30-2004, 02:25 PM
P.S. I got to take the kids to a party so I'll be back later... :thumbsup:

xiaodao
12-30-2004, 02:34 PM
try to put before close bracket

Fou-Lu
12-30-2004, 02:46 PM
What? What good will that do, this appears to be an array of values, and assumably pparse is for some sort of template useage.

My guess is that you are missing another bracket in there. It will probably be something like:
$object->something(array( // Note the two:

Therefore it should be closed with two:

...
'DESCRIPTION' => $forumdesc,
'ICON_LIST' => $forum_icons_list, // Forum Icon MOD
'ICON_BASEDIR' => $phpbb_root_path . $board_config['forum_icon_path'], // Forum Icon MOD
'ICON_IMG' => ( $forumicon ) ? $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forumicon : $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $default_ficon // Forum Icon MOD
) // This is number one:
); // This is number two
$template->pparse("body");
break;

Unfortunatly I do not have a phpbb so I don't know this for sure, but it would explain the unexpected ';' for your second error, and if this is the case than marek_mar was right, just missing the ';', from what we can see, though there is more than meets the eye.

BK123
12-30-2004, 07:06 PM
Thanks Fou-Lu,
I'll download a new PhpBB and open the files and look to see if I deleted too much of the original code!

BK123
12-30-2004, 07:17 PM
Can't see it myself...

This is the MOD I changed:

-[ FIND ]------------------------------------------
#
'DESCRIPTION' => $forumdesc)

#
#-----[ REPLACE WITH ]------------------------------------------
#
'DESCRIPTION' => $forumdesc,
'ICON_LIST' => $forum_icons_list, // Forum Icon MOD
'ICON_BASEDIR' => $phpbb_root_path . $board_config['forum_icon_path'], // Forum Icon MOD
'ICON_IMG' => ( $forumicon ) ? $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forumicon : $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $default_ficon // Forum Icon MOD
)

Which I did...... :confused:

Can anyone of you see any bugs/mistakes in this MOD's coding?

Kurashu
12-30-2004, 08:40 PM
What mod is that, I'll look into it.

Ultragames
12-30-2004, 10:06 PM
i dont even see an opening bracet for the closing bracet in question. Try deleting it and putting a ; at the end of the line.

marek_mar
12-30-2004, 10:18 PM
Maybe you bost the whole block of code to eliminate the guesswork? ;)

Fou-Lu
12-30-2004, 10:49 PM
I just d/l'd a copy of phpbb2.somethingorother, and this is what I find:

$template->assign_vars(array(
'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_SUBMIT_VALUE' => $buttonvalue,
'S_CAT_LIST' => $catlist,
'S_STATUS_LIST' => $statuslist,
'S_PRUNE_ENABLED' => $prune_enabled,

'L_FORUM_TITLE' => $l_title,
'L_FORUM_EXPLAIN' => $lang['Forum_edit_delete_explain'],
'L_FORUM_SETTINGS' => $lang['Forum_settings'],
'L_FORUM_NAME' => $lang['Forum_name'],
'L_CATEGORY' => $lang['Category'],
'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],
'L_FORUM_STATUS' => $lang['Forum_status'],
'L_AUTO_PRUNE' => $lang['Forum_pruning'],
'L_ENABLED' => $lang['Enabled'],
'L_PRUNE_DAYS' => $lang['prune_days'],
'L_PRUNE_FREQ' => $lang['prune_freq'],
'L_DAYS' => $lang['Days'],

'PRUNE_DAYS' => ( isset($pr_row['prune_days']) ) ? $pr_row['prune_days'] : 7,
'PRUNE_FREQ' => ( isset($pr_row['prune_freq']) ) ? $pr_row['prune_freq'] : 1,
'FORUM_NAME' => $forumname,
'DESCRIPTION' => $forumdesc)
);
$template->pparse("body");
break;

Now, when looking at the code provided by your alteration:

'DESCRIPTION' => $forumdesc,
'ICON_LIST' => $forum_icons_list, // Forum Icon MOD
'ICON_BASEDIR' => $phpbb_root_path . $board_config['forum_icon_path'], // Forum Icon MOD
'ICON_IMG' => ( $forumicon ) ? $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $forumicon : $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $default_ficon // Forum Icon MOD
)

/* You appear to be missing the ending brakcet here: */
$template->pparse("body");
break;

Therefore the combination between the two results in:

$template->assign_vars(array(
'S_FORUM_ACTION' => append_sid("admin_forums.$phpEx"),
'S_HIDDEN_FIELDS' => $s_hidden_fields,
'S_SUBMIT_VALUE' => $buttonvalue,
'S_CAT_LIST' => $catlist,
'S_STATUS_LIST' => $statuslist,
'S_PRUNE_ENABLED' => $prune_enabled,

'L_FORUM_TITLE' => $l_title,
'L_FORUM_EXPLAIN' => $lang['Forum_edit_delete_explain'],
'L_FORUM_SETTINGS' => $lang['Forum_settings'],
'L_FORUM_NAME' => $lang['Forum_name'],
'L_CATEGORY' => $lang['Category'],
'L_FORUM_DESCRIPTION' => $lang['Forum_desc'],
'L_FORUM_STATUS' => $lang['Forum_status'],
'L_AUTO_PRUNE' => $lang['Forum_pruning'],
'L_ENABLED' => $lang['Enabled'],
'L_PRUNE_DAYS' => $lang['prune_days'],
'L_PRUNE_FREQ' => $lang['prune_freq'],
'L_DAYS' => $lang['Days'],

'PRUNE_DAYS' => ( isset($pr_row['prune_days']) ) ? $pr_row['prune_days'] : 7,
'PRUNE_FREQ' => ( isset($pr_row['prune_freq']) ) ? $pr_row['prune_freq'] : 1,
'FORUM_NAME' => $forumname,
'DESCRIPTION' => $forumdesc,
'ICON_LIST' => $forum_icons_list,
'ICON_BASEDIR' => $phpbb_root_path . $board_config['forum_icon_path'],
'ICON_IMG' => ($forumicon) ? $phpbb_root_path . $board_config['forum_icon_pagt'] . '/' . $forumicon : $phpbb_root_path . $board_config['forum_icon_path'] . '/' . $default_ficon)
);
$template->pparse("body");
break;


Which appears to have been missing only the ending bracket to the object in use.

gsnedders
12-30-2004, 10:55 PM
Try using EasyMOD (http://area51.phpbb.com/phpBB22/viewtopic.php?sid=&f=17&t=15391)...

BK123
12-31-2004, 12:05 AM
Hi again guys,
I got the answer...
it needed )); on the line before 381.

The only problem now is my icons are not showing.
I've done everything the MOD says.
I don't know if you are familiar with phpbb but in my admin panel I have submitted images/forum_icons for the Forum Icon Storage Path .
It says that my submission has been successful but when I then go to my admin panel again the Forum Icon Storage Path is still blank.
Everything else I've submitted has stayed viewable on my admin panel.
I'm wondering if it really has been uploaded.
Do you think it's possible that this is the fault and is there a way of verifying my Forum Icon Storage Path?

Thanks :thumbsup:
BK123
------------

marek_mar
12-31-2004, 12:06 AM
Which appears to have been missing only the ending bracket to the object in use.
The ; was missing too :thumbsup: .

BK123
12-31-2004, 12:13 AM
Try using EasyMOD (http://area51.phpbb.com/phpBB22/viewtopic.php?sid=&f=17&t=15391)...

Thanks Error404, have you had any experience of it?
I'm wondering if it might cause me more trouble?
Probably worth it though...I'll look into theEMC Mods available ! :thumbsup:

bk123
-----------------

Brandoe85
12-31-2004, 12:18 AM
I think Fou-Lu posted the solution in post #6. My guess is that you are missing another bracket in there. It will probably be something like:
$object->something(array( // Note the two:

Therefore it should be closed with two:

) // This is number one:
); // This is number two

Kurashu
12-31-2004, 02:58 AM
Hi again guys,
I got the answer...
it needed )); on the line before 381.

The only problem now is my icons are not showing.
I've done everything the MOD says.
I don't know if you are familiar with phpbb but in my admin panel I have submitted images/forum_icons for the Forum Icon Storage Path .
It says that my submission has been successful but when I then go to my admin panel again the Forum Icon Storage Path is still blank.
Everything else I've submitted has stayed viewable on my admin panel.
I'm wondering if it really has been uploaded.
Do you think it's possible that this is the fault and is there a way of verifying my Forum Icon Storage Path?

Thanks :thumbsup:
BK123
------------

That sounds more like a problem for the phpBB forums, or the phpBBhacks fourms.

Fou-Lu
12-31-2004, 10:44 AM
yeah, from this point the code is correct, but what its for is a whole nother aspect. It has so many variables within it, I cannot guarentee that anything scripted here will be accurate for your purposes.
Because I haven't gone through the script in depth, I don't know if thats where it is writting to or whether that is just displaying. It appears that its just for population purposes from my general guess, which means it will only display what is there. I don't know what modifications need to be made in order to store the information to a database (or other). Sorry, but as Kurashu mentioned, this is really more of a task for phpbb to be looking at.

gsnedders
12-31-2004, 01:13 PM
Thanks Error404, have you had any experience of it?
I'm wondering if it might cause me more trouble?
Probably worth it though...I'll look into theEMC Mods available ! :thumbsup:

bk123
-----------------


Only installed a couple hundred MODs with it, and don't worry about it being beta software, it's very secure and stable, it's only in beta because it doesn't have some features... Like MOD uninstall, and history...