mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-03 21:15:42 +02:00
Auth now returns a type allowing for more meaningful failure messa ges
git-svn-id: file:///svn/phpbb/trunk@434 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
6ac0e7b4b3
commit
43bc7ac78f
@ -113,7 +113,7 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
|
||||
{
|
||||
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "WHERE aa.forum_id = $forum_id" : "";
|
||||
$sql = "SELECT aa.forum_id, $a_sql
|
||||
FROM ".AUTH_FORUMS_TABLE." aa
|
||||
FROM ".FORUMS_TABLE." aa
|
||||
$forum_match_sql";
|
||||
$af_result = $db->sql_query($sql);
|
||||
|
||||
@ -156,6 +156,29 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
|
||||
if($forum_id != AUTH_LIST_ALL)
|
||||
{
|
||||
$auth_user[$key] = ($f_access[$key] == AUTH_ALL) ? 1 : 0;
|
||||
|
||||
switch($f_access[$key])
|
||||
{
|
||||
case AUTH_ALL:
|
||||
$auth_user[$key . '_type'] = "Anonymous Users";
|
||||
break;
|
||||
|
||||
case AUTH_REG:
|
||||
$auth_user[$key . '_type'] = "Registered Users";
|
||||
break;
|
||||
|
||||
case AUTH_ACL:
|
||||
$auth_user[$key . '_type'] = "Users granted Special Access";
|
||||
break;
|
||||
|
||||
case AUTH_MOD:
|
||||
$auth_user[$key . '_type'] = "Moderators";
|
||||
break;
|
||||
|
||||
case AUTH_ADMIN:
|
||||
$auth_user[$key . '_type'] = "Administrators";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -163,6 +186,29 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
|
||||
{
|
||||
$forum_id = $f_access[$i]['forum_id'];
|
||||
$auth_user[$forum_id][$key] = ($f_access[$i][$key] == AUTH_ALL) ? 1 : 0;
|
||||
|
||||
switch($f_access[$i][$key])
|
||||
{
|
||||
case AUTH_ALL:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Anonymous Users";
|
||||
break;
|
||||
|
||||
case AUTH_REG:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Registered Users";
|
||||
break;
|
||||
|
||||
case AUTH_ACL:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Users granted special access";
|
||||
break;
|
||||
|
||||
case AUTH_MOD:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Moderators";
|
||||
break;
|
||||
|
||||
case AUTH_ADMIN:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Administrators";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -205,6 +251,29 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
|
||||
if($forum_id != AUTH_LIST_ALL)
|
||||
{
|
||||
$auth_user[$key] = ($f_access[$key] == AUTH_ALL || $f_access[$key] == AUTH_REG) ? 1 : 0;
|
||||
|
||||
switch($f_access[$key])
|
||||
{
|
||||
case AUTH_ALL:
|
||||
$auth_user[$key . '_type'] = "Anonymous Users";
|
||||
break;
|
||||
|
||||
case AUTH_REG:
|
||||
$auth_user[$key . '_type'] = "Registered Users";
|
||||
break;
|
||||
|
||||
case AUTH_ACL:
|
||||
$auth_user[$key . '_type'] = "Users granted special access";
|
||||
break;
|
||||
|
||||
case AUTH_MOD:
|
||||
$auth_user[$key . '_type'] = "Moderators";
|
||||
break;
|
||||
|
||||
case AUTH_ADMIN:
|
||||
$auth_user[$key . '_type'] = "Administrators";
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -212,6 +281,29 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
|
||||
{
|
||||
$f_forum_id = $f_access[$k]['forum_id'];
|
||||
$auth_user[$f_forum_id][$key] = ($f_access[$k][$key] == AUTH_ALL || $f_access[$k][$key] == AUTH_REG) ? 1 : 0;
|
||||
|
||||
switch($f_access[$k][$key])
|
||||
{
|
||||
case AUTH_ALL:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Anonymous Users";
|
||||
break;
|
||||
|
||||
case AUTH_REG:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Registered Users";
|
||||
break;
|
||||
|
||||
case AUTH_ACL:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Users granted special access";
|
||||
break;
|
||||
|
||||
case AUTH_MOD:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Moderators";
|
||||
break;
|
||||
|
||||
case AUTH_ADMIN:
|
||||
$auth_user[$forum_id][$key . '_type'] = "Administrators";
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -254,22 +346,27 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
|
||||
{
|
||||
case AUTH_ALL:
|
||||
$auth_user[$key] = 1;
|
||||
$auth_user[$key . '_type'] = "Anonymous Users";
|
||||
break;
|
||||
|
||||
case AUTH_REG:
|
||||
$auth_user[$key] = 1;
|
||||
$auth_user[$key . '_type'] = "Registered Users";
|
||||
break;
|
||||
|
||||
case AUTH_ACL:
|
||||
$auth_user[$key] = auth_check_user(AUTH_ACL, $key, $u_access, $is_admin);
|
||||
$auth_user[$key . '_type'] = "Users granted special access";
|
||||
break;
|
||||
|
||||
case AUTH_MOD:
|
||||
$auth_user[$key] = auth_check_user(AUTH_MOD, $key, $u_access, $is_admin);
|
||||
$auth_user[$key . '_type'] = "Moderators";
|
||||
break;
|
||||
|
||||
case AUTH_ADMIN:
|
||||
$auth_user[$key] = $is_admin;
|
||||
$auth_user[$key . '_type'] = "Administrators";
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -288,22 +385,27 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
|
||||
{
|
||||
case AUTH_ALL:
|
||||
$auth_user[$f_forum_id][$key] = 1;
|
||||
$auth_user[$f_forum_id][$key . '_type'] = "Anonymous Users";
|
||||
break;
|
||||
|
||||
case AUTH_REG:
|
||||
$auth_user[$f_forum_id][$key] = 1;
|
||||
$auth_user[$f_forum_id][$key . '_type'] = "Registered Users";
|
||||
break;
|
||||
|
||||
case AUTH_ACL:
|
||||
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_ACL, $key, $u_access, $is_admin);
|
||||
$auth_user[$f_forum_id][$key . '_type'] = "Users granted special access";
|
||||
break;
|
||||
|
||||
case AUTH_MOD:
|
||||
$auth_user[$f_forum_id][$key] = auth_check_user(AUTH_MOD, $key, $u_access, $is_admin);
|
||||
$auth_user[$f_forum_id][$key . '_type'] = "Moderators";
|
||||
break;
|
||||
|
||||
case AUTH_ADMIN:
|
||||
$auth_user[$f_forum_id][$key] = $is_admin;
|
||||
$auth_user[$f_forum_id][$key . '_type'] = "Administrators";
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -11,7 +11,6 @@
|
||||
*
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
/***************************************************************************
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
@ -60,10 +59,6 @@ function prepare_message($message, $html_on, $bbcode_on, $smile_on, $bbcode_uid
|
||||
//
|
||||
// Start program proper
|
||||
//
|
||||
|
||||
//
|
||||
// Obtain which forum id is required
|
||||
//
|
||||
if(!isset($HTTP_GET_VARS['forum']) && !isset($HTTP_POST_VARS['forum'])) // For backward compatibility
|
||||
{
|
||||
$forum_id = ($HTTP_GET_VARS[POST_FORUM_URL]) ? $HTTP_GET_VARS[POST_FORUM_URL] : $HTTP_POST_VARS[POST_FORUM_URL];
|
||||
@ -72,6 +67,7 @@ else
|
||||
{
|
||||
$forum_id = ($HTTP_GET_VARS['forum']) ? $HTTP_GET_VARS['forum'] : $HTTP_POST_VARS['forum'];
|
||||
}
|
||||
|
||||
$mode = (isset($HTTP_GET_VARS['mode'])) ? $HTTP_GET_VARS['mode'] : ( (isset($HTTP_POST_VARS['mode'])) ? $HTTP_POST_VARS['mode'] : "");
|
||||
|
||||
//
|
||||
@ -96,22 +92,27 @@ switch($mode)
|
||||
case 'newtopic':
|
||||
$auth_type = AUTH_POST;
|
||||
$is_auth_type = "auth_post";
|
||||
$error_string = "post new topics";
|
||||
break;
|
||||
case 'reply':
|
||||
$auth_type = AUTH_REPLY;
|
||||
$is_auth_type = "auth_reply";
|
||||
$error_string = "reply to topics";
|
||||
break;
|
||||
case 'editpost':
|
||||
$auth_type = AUTH_EDIT;
|
||||
$is_auth_type = "auth_edit";
|
||||
$error_string = "edit topics";
|
||||
break;
|
||||
case 'delete':
|
||||
$auth_type = AUTH_DELETE;
|
||||
$is_auth_type = "auth_delete";
|
||||
$error_string = "delete topics";
|
||||
break;
|
||||
default:
|
||||
$auth_type = AUTH_POST;
|
||||
$is_auth_type = "auth_post";
|
||||
$error_string = "post new topics";
|
||||
break;
|
||||
}
|
||||
|
||||
@ -125,7 +126,7 @@ if(!$is_auth[$is_auth_type])
|
||||
//
|
||||
include('includes/page_header.'.$phpEx);
|
||||
|
||||
$msg = "I am sorry but you are not currently authorised to post to this forum. You could try logging on and trying again. If you are logged on then this is a private forum for which you have not been granted access.";
|
||||
$msg = "I am sorry but you cannot $error_string in this forum, this function is restricted to " . $is_auth[$is_auth_type . "_type"] . " only.";
|
||||
|
||||
$template->set_filenames(array(
|
||||
"reg_header" => "error_body.tpl"
|
||||
|
@ -109,7 +109,7 @@ if(!$is_auth['auth_read'] || !$is_auth['auth_view'])
|
||||
//
|
||||
include('includes/page_header.'.$phpEx);
|
||||
|
||||
$msg = "I am sorry but you are not currently authorised to read this forum. You could try logging on and trying again. If you are logged on then this is a private forum for which you have not been granted access.";
|
||||
$msg = "I am sorry but only " . $is_auth['auth_read_type'] . " can read this forum.";
|
||||
|
||||
$template->set_filenames(array(
|
||||
"reg_header" => "error_body.tpl"
|
||||
|
@ -234,7 +234,7 @@ if(!$is_auth['auth_view'] || !$is_auth['auth_view'])
|
||||
//
|
||||
include('includes/page_header.'.$phpEx);
|
||||
|
||||
$msg = "I am sorry but you are not currently authorised to read this forum. You could try logging on and trying again. If you are logged on then this is a private forum for which you have not been granted access.";
|
||||
$msg = "I am sorry but only " . $is_auth['auth_read_type'] . " can read this topic.";
|
||||
|
||||
$template->set_filenames(array(
|
||||
"reg_header" => "error_body.tpl"
|
||||
|
Loading…
x
Reference in New Issue
Block a user