[Fix] Failed to update forum auth problems with 2.0.1

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
User avatar
psoTFX
Former Team Member
Posts: 7425
Joined: Tue Jul 03, 2001 8:50 pm

[Fix] Failed to update forum auth problems with 2.0.1

Post by psoTFX »

If you're having problems with admin_forumauth.php failing to update permissions please open admin/admin_forumauth.php in a text editor, find line 112. Change this line from:

Code: Select all

$sql .= " WHERE forum_id = $forum_id";
to

Code: Select all

$sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";
and save the file.

keywords: failed update forum_auth.php permissions 2.0.1
talia679
Registered User
Posts: 716
Joined: Tue Mar 12, 2002 4:07 pm
Location: PA
Contact:

Post by talia679 »

Do you do this before or after you patch the board?
Thanks, Talia
Tag You're It Writing Community || TYI Forums
Taleria - Talia's Gallery of 2000+ Links & 140+ Books
GameCrafters Guild – Gaming info and resources
User avatar
rmang
Registered User
Posts: 285
Joined: Fri Aug 24, 2001 10:33 pm

Post by rmang »

You would do this after you have applied the original 2.0.1 patches. It fixes a small mistake in the 2.0.1 release.

Rob M.
User avatar
auron8785
Registered User
Posts: 243
Joined: Wed Mar 06, 2002 1:28 am
Contact:

Post by auron8785 »

okay i got a problem with mine. Mine is saying can not ubtain forum list

here is the forumouth.php file
<?php
/***************************************************************************
* admin_forumauth.php
* -------------------
* begin : Saturday, Feb 13, 2001
* copyright : (C) 2001 The phpBB Group
* email : support@phpbb.com
*
* $Id: admin_forumauth.php,v 1.23 2002/03/22 17:00:32 psotfx Exp $
*
*
***************************************************************************/

/***************************************************************************
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
***************************************************************************/

define('IN_PHPBB', 1);

if( !empty($setmodules) )
{
$filename = basename(__FILE__);
$module['Forums']['Permissions'] = $filename;

return;
}

//
// Load default header
//
$no_page_header = TRUE;
$phpbb_root_path = "../";
require($phpbb_root_path . 'extension.inc');
require('pagestart.' . $phpEx);

//
// Start program - define vars
//
// View Read Post Reply Edit Delete Sticky Announce Vote Poll
$simple_auth_ary = array(
0 => array(AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
1 => array(AUTH_ALL, AUTH_ALL, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
2 => array(AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_REG, AUTH_MOD, AUTH_MOD, AUTH_REG, AUTH_REG),
3 => array(AUTH_ALL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL),
4 => array(AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_ACL, AUTH_MOD, AUTH_ACL, AUTH_ACL),
5 => array(AUTH_ALL, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD),
6 => array(AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD, AUTH_MOD),
);

$simple_auth_types = array($lang['Public'], $lang['Registered'], $lang['Registered'] . " [" . $lang['Hidden'] . "]", $lang['Private'], $lang['Private'] . " [" . $lang['Hidden'] . "]", $lang['Moderators'], $lang['Moderators'] . " [" . $lang['Hidden'] . "]");

$forum_auth_fields = array("auth_view", "auth_read", "auth_post", "auth_reply", "auth_edit", "auth_delete", "auth_sticky", "auth_announce", "auth_vote", "auth_pollcreate");

$field_names = array(
"auth_view" => $lang['View'],
"auth_read" => $lang['Read'],
"auth_post" => $lang['Post'],
"auth_reply" => $lang['Reply'],
"auth_edit" => $lang['Edit'],
"auth_delete" => $lang['Delete'],
"auth_sticky" => $lang['Sticky'],
"auth_announce" => $lang['Announce'],
"auth_vote" => $lang['Vote'],
"auth_pollcreate" => $lang['Pollcreate']);

$forum_auth_levels = array("ALL", "REG", "PRIVATE", "MOD", "ADMIN");
$forum_auth_const = array(AUTH_ALL, AUTH_REG, AUTH_ACL, AUTH_MOD, AUTH_ADMIN);

if(isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]))
{
$forum_id = (isset($HTTP_POST_VARS[POST_FORUM_URL])) ? intval($HTTP_POST_VARS[POST_FORUM_URL]) : intval($HTTP_GET_VARS[POST_FORUM_URL]);
$forum_sql = "AND forum_id = $forum_id";
}
else
{
unset($forum_id);
$forum_sql = "";
}

if( isset($HTTP_GET_VARS['adv']) )
{
$adv = intval($HTTP_GET_VARS['adv']);
}
else
{
unset($adv);
}

//
// Start program proper
//
if( isset($HTTP_POST_VARS['submit']) )
{
$sql = "";

if(!empty($forum_id))
{
$sql = "UPDATE " . FORUMS_TABLE . " SET ";

if(isset($HTTP_POST_VARS['simpleauth']))
{
$simple_ary = $simple_auth_ary[$HTTP_POST_VARS['simpleauth']];

for($i = 0; $i < count($simple_ary); $i++)
{
$sql .= $forum_auth_fields[$i] . " = " . $simple_ary[$i];
if($i < count($simple_ary) - 1)
{
$sql .= ", ";
}
}

$sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";
}
else
{
for($i = 0; $i < count($forum_auth_fields); $i++)
{
$value = $HTTP_POST_VARS[$forum_auth_fields[$i]];

if($forum_auth_fields[$i] == 'auth_vote')
{
if( $HTTP_POST_VARS['auth_vote'] == AUTH_ALL )
{
$value = AUTH_REG;
}
}

$sql .= $forum_auth_fields[$i] . " = " . $value;
if($i < count($forum_auth_fields) - 1)
{
$sql .= ", ";
}
}

$sql = "UPDATE " . FORUMS_TABLE . " SET $sql WHERE forum_id = $forum_id";

}

if($sql != "")
{
if(!$db->sql_query($sql))
{
message_die(GENERAL_ERROR, "Couldn't update auth table!", "", __LINE__, __FILE__, $sql);
}
}

$forum_sql = "";
$adv = 0;
}

$template->assign_vars(array(
"META" => '<meta http-equiv="refresh" content="3;url=' . append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=$forum_id") . '">')
);
$message = $lang['Forum_auth_updated'] . '<br /><br />' . sprintf($lang['Click_return_forumauth'], '<a href="' . append_sid("admin_forumauth.$phpEx") . '">', "</a>");
message_die(GENERAL_MESSAGE, $message);

} // End of submit

//
// Get required information, either all forums if
// no id was specified or just the requsted if it
// was
//
$sql = "SELECT f.*
FROM " . FORUMS_TABLE . " f, " . CATEGORIES_TABLE . " c
WHERE c.cat_id = f.cat_id
$forum_sql
ORDER BY c.cat_order ASC, f.forum_order ASC";
if ( !($result = $db->sql_query($sql)) )
{
message_die(GENERAL_ERROR, "Couldn't obtain forum list", "", __LINE__, __FILE__, $sql);
}

$forum_rows = $db->sql_fetchrowset($result);
$db->sql_freeresult($result);

if( empty($forum_id) )
{
//
// Output the selection table if no forum id was
// specified
//
$template->set_filenames(array(
"body" => "admin/auth_select_body.tpl")
);

$select_list = '<select name="' . POST_FORUM_URL . '">';
for($i = 0; $i < count($forum_rows); $i++)
{
$select_list .= '<option value="' . $forum_rows[$i]['forum_id'] . '">' . $forum_rows[$i]['forum_name'] . '</option>';
}
$select_list .= '</select>';

$template->assign_vars(array(
"L_AUTH_TITLE" => $lang['Auth_Control_Forum'],
"L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'],
"L_AUTH_SELECT" => $lang['Select_a_Forum'],
"L_LOOK_UP" => $lang['Look_up_Forum'],

"S_AUTH_ACTION" => append_sid("admin_forumauth.$phpEx"),
"S_AUTH_SELECT" => $select_list)
);

}
else
{
//
// Output the authorisation details if an id was
// specified
//
$template->set_filenames(array(
"body" => "admin/auth_forum_body.tpl")
);

$forum_name = $forum_rows[0]['forum_name'];

@reset($simple_auth_ary);
while( list($key, $auth_levels) = each($simple_auth_ary))
{
$matched = 1;
for($k = 0; $k < count($auth_levels); $k++)
{
$matched_type = $key;

if ( $forum_rows[0][$forum_auth_fields[$k]] != $auth_levels[$k] )
{
$matched = 0;
}
}

if ( $matched )
{
break;
}
}

//
// If we didn't get a match above then we
// automatically switch into 'advanced' mode
//
if(!isset($adv) && !$matched)
{
$adv = 1;
}

$s_column_span == 0;

if( empty($adv) )
{
$simple_auth = "<select name=\"simpleauth\">";

for($j = 0; $j < count($simple_auth_types); $j++)
{
if($matched_type == $j)
{
$simple_auth .= "<option value=\"$j\" selected>";
$simple_auth .= $simple_auth_types[$j];
$simple_auth .= "</option>";
}
else
{
$simple_auth .= "<option value=\"$j\">" . $simple_auth_types[$j] . "</option>";
}
}

$simple_auth .= "</select>";

$template->assign_block_vars("forum_auth_titles", array(
"CELL_TITLE" => $lang['Simple_mode'])
);
$template->assign_block_vars("forum_auth_data", array(
"S_AUTH_LEVELS_SELECT" => $simple_auth)
);

$s_column_span++;
}
else
{
//
// Output values of individual
// fields
//
for($j = 0; $j < count($forum_auth_fields); $j++)
{
$custom_auth[$j] = "&nbsp;<select name=\"" . $forum_auth_fields[$j] . "\">";

for($k = 0; $k < count($forum_auth_levels); $k++)
{
if ( $forum_rows[0][$forum_auth_fields[$j]] == $forum_auth_const[$k] )
{
$custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\" selected>";
$custom_auth[$j] .= $lang['Forum_' . $forum_auth_levels[$k]];
$custom_auth[$j] .= "</option>";
}
else
{
$custom_auth[$j] .= "<option value=\"" . $forum_auth_const[$k] . "\">". $lang['Forum_' . $forum_auth_levels[$k]] . "</option>";
}
}
$custom_auth[$j] .= "</select>&nbsp;";

$cell_title = $field_names[$forum_auth_fields[$j]];

$template->assign_block_vars("forum_auth_titles", array(
"CELL_TITLE" => $cell_title)
);
$template->assign_block_vars("forum_auth_data", array(
"S_AUTH_LEVELS_SELECT" => $custom_auth[$j])
);

$s_column_span++;
}
}

$adv_mode = (empty($adv)) ? "1" : "0";
$switch_mode = append_sid("admin_forumauth.$phpEx?" . POST_FORUM_URL . "=" . $forum_id . "&adv=". $adv_mode);
$switch_mode_text = ( empty($adv) ) ? $lang['Advanced_mode'] : $lang['Simple_mode'];
$u_switch_mode = '<a href="' . $switch_mode . '">' . $switch_mode_text . '</a>';

$s_hidden_fields = '<input type="hidden" name="' . POST_FORUM_URL . '" value="' . $forum_id . '">';

$template->assign_vars(array(
"FORUM_NAME" => $forum_name,

"L_AUTH_TITLE" => $lang['Auth_Control_Forum'],
"L_AUTH_EXPLAIN" => $lang['Forum_auth_explain'],
"L_SUBMIT" => $lang['Submit'],
"L_RESET" => $lang['Reset'],

"U_SWITCH_MODE" => $u_switch_mode,

"S_FORUMAUTH_ACTION" => append_sid("admin_forumauth.$phpEx"),
"S_COLUMN_SPAN" => $s_column_span,
"S_HIDDEN_FIELDS" => $s_hidden_fields)
);

}

include('page_header_admin.'.$phpEx);

$template->pparse("body");

include('page_footer_admin.'.$phpEx);

?>
Live life to the fullest...
Dont forget who you are...
You'll never know until you walk in their shoes...
User avatar
rmang
Registered User
Posts: 285
Joined: Fri Aug 24, 2001 10:33 pm

Post by rmang »

It looks like you tried to apply this change to a 2.0.0 board. You need to first upgrade this file to the 2.0.1 version, and then apply the fix shown above. The fix above corrects a small problem with a board that was upgraded to 2.0.1 already with the original 2.0.1 distro.

Rob M.
User avatar
auron8785
Registered User
Posts: 243
Joined: Wed Mar 06, 2002 1:28 am
Contact:

Post by auron8785 »

ahhh its still not working
Live life to the fullest...
Dont forget who you are...
You'll never know until you walk in their shoes...
User avatar
marja
Registered User
Posts: 19
Joined: Tue May 21, 2002 8:41 pm
Location: The Netherlands
Contact:

Post by marja »

It does not work with me either
User avatar
Techie-Micheal
Security Consultant
Posts: 19511
Joined: Sun Oct 14, 2001 12:11 am
Location: In your servers

Post by Techie-Micheal »

http://www.phpbb.com/phpBB/viewtopic.php?p=119788

The linked topic is quite long but it might be of some help . . .
Proven Offensive Security Expertise. OSCP - GXPN
Falco1199
Registered User
Posts: 156
Joined: Fri May 17, 2002 9:11 pm
Location: New York
Contact:

Post by Falco1199 »

Umm.. it doesn't even work for me.

Anyway, if you're getting that "Can't obtain forums list" error it's most likely something you can't fix without downgrading to version 2.0.0... that's what I had to do when getting the same error. :-D
:-D
User avatar
Techie-Micheal
Security Consultant
Posts: 19511
Joined: Sun Oct 14, 2001 12:11 am
Location: In your servers

Post by Techie-Micheal »

Worked for me. . . (the linked posts that is, I'm on paid hosting)
Proven Offensive Security Expertise. OSCP - GXPN
Waldfee
Registered User
Posts: 21
Joined: Sat May 25, 2002 4:48 pm

Post by Waldfee »

try adding at least ONE message to new forums for 2.0.1 ;-)

cu
waldfee
miltsweb
Registered User
Posts: 7
Joined: Sun May 26, 2002 12:40 am
Location: Madison, Wi.
Contact:

Post by miltsweb »

Sooooooo I tried to find that line and I can't find that particular line to change it. Will there be a replacement for that file available for download sometime soon? Will 2.0.1 work ok without that or shouldI just downgrade back to 2.0.0 until the replacement file is available?
User avatar
Techie-Micheal
Security Consultant
Posts: 19511
Joined: Sun Oct 14, 2001 12:11 am
Location: In your servers

Post by Techie-Micheal »

The Group is pushing for the most current, most stable release because of bugs fixes etc. However, if you can't get it to work, go to 2.0.0 until this is resolved. The line is there by the way, which editor are you using to search?
Proven Offensive Security Expertise. OSCP - GXPN
miltsweb
Registered User
Posts: 7
Joined: Sun May 26, 2002 12:40 am
Location: Madison, Wi.
Contact:

Post by miltsweb »

Well what editor would you recommend? i was just using regular notepad...
User avatar
Techie-Micheal
Security Consultant
Posts: 19511
Joined: Sun Oct 14, 2001 12:11 am
Location: In your servers

Post by Techie-Micheal »

Notepad should work then. It's just that sometimes wordpad screwes up and won't search something that is there. Download the full package and extract only the auth file and you should be good to go. :)
Proven Offensive Security Expertise. OSCP - GXPN
Locked

Return to “2.0.x Support Forum”