Cleaning up (#13689)

Also removed the useless login box from the ACP.


git-svn-id: file:///svn/phpbb/trunk@7919 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Henry Sudhof 2007-07-22 14:04:26 +00:00
parent 6161658262
commit fcb0c89962
15 changed files with 35 additions and 41 deletions

View file

@ -27,12 +27,6 @@ $auth->acl($user->data);
$user->setup('acp/common'); $user->setup('acp/common');
// End session management // End session management
// Did user forget to login? Give 'em a chance to here ...
if ($user->data['user_id'] == ANONYMOUS)
{
login_box('', $user->lang['LOGIN_ADMIN'], $user->lang['LOGIN_ADMIN_SUCCESS'], true);
}
// Have they authenticated (again) as an admin for this session? // Have they authenticated (again) as an admin for this session?
if (!isset($user->data['session_admin']) || !$user->data['session_admin']) if (!isset($user->data['session_admin']) || !$user->data['session_admin'])
{ {
@ -43,7 +37,7 @@ if (!isset($user->data['session_admin']) || !$user->data['session_admin'])
// check specific permissions but this is a catchall // check specific permissions but this is a catchall
if (!$auth->acl_get('a_')) if (!$auth->acl_get('a_'))
{ {
trigger_error($user->lang['NO_ADMIN']); trigger_error('NO_ADMIN');
} }
// We define the admin variables now, because the user is now able to use the admin related features... // We define the admin variables now, because the user is now able to use the admin related features...

View file

@ -678,7 +678,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
} }
else else
{ {
trigger_error($user->lang['LENGTH_BAN_INVALID']); trigger_error('LENGTH_BAN_INVALID');
} }
} }
} }
@ -730,11 +730,11 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
$clean_name = utf8_clean_string($username); $clean_name = utf8_clean_string($username);
if ($clean_name == $user->data['username_clean']) if ($clean_name == $user->data['username_clean'])
{ {
trigger_error($user->lang['CANNOT_BAN_YOURSELF']); trigger_error('CANNOT_BAN_YOURSELF');
} }
if (in_array($clean_name, $founder_names)) if (in_array($clean_name, $founder_names))
{ {
trigger_error($user->lang['CANNOT_BAN_FOUNDER']); trigger_error('CANNOT_BAN_FOUNDER');
} }
$sql_usernames[] = $clean_name; $sql_usernames[] = $clean_name;
} }
@ -743,7 +743,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
// Make sure we have been given someone to ban // Make sure we have been given someone to ban
if (!sizeof($sql_usernames)) if (!sizeof($sql_usernames))
{ {
trigger_error($user->lang['NO_USER_SPECIFIED']); trigger_error('NO_USER_SPECIFIED');
} }
$sql = 'SELECT user_id $sql = 'SELECT user_id
@ -772,7 +772,7 @@ function user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reas
} }
else else
{ {
trigger_error($user->lang['NO_USERS']); trigger_error('NO_USERS');
} }
$db->sql_freeresult($result); $db->sql_freeresult($result);
} }

View file

@ -276,7 +276,7 @@ function mcp_resync_topics($topic_ids)
if (!sizeof($topic_ids)) if (!sizeof($topic_ids))
{ {
trigger_error($user->lang['NO_TOPIC_SELECTED']); trigger_error('NO_TOPIC_SELECTED');
} }
if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_'))) if (!check_ids($topic_ids, TOPICS_TABLE, 'topic_id', array('m_')))

View file

@ -86,7 +86,7 @@ class mcp_notes
if (!$userrow) if (!$userrow)
{ {
trigger_error($user->lang['NO_USER']); trigger_error('NO_USER');
} }
$user_id = $userrow['user_id']; $user_id = $userrow['user_id'];

View file

@ -26,7 +26,7 @@ function mcp_post_details($id, $mode, $action)
if (!sizeof($post_info)) if (!sizeof($post_info))
{ {
trigger_error($user->lang['POST_NOT_EXIST']); trigger_error('POST_NOT_EXIST');
} }
$post_info = $post_info[$post_id]; $post_info = $post_info[$post_id];
@ -79,7 +79,7 @@ function mcp_post_details($id, $mode, $action)
if (!$row) if (!$row)
{ {
trigger_error($user->lang['NO_USER']); trigger_error('NO_USER');
} }
if ($auth->acl_get('m_chgposter', $post_info['forum_id'])) if ($auth->acl_get('m_chgposter', $post_info['forum_id']))
@ -473,7 +473,7 @@ function change_poster(&$post_info, $userdata)
if (!sizeof($post_info)) if (!sizeof($post_info))
{ {
trigger_error($user->lang['POST_NOT_EXIST']); trigger_error('POST_NOT_EXIST');
} }
$post_info = $post_info[$post_id]; $post_info = $post_info[$post_id];

View file

@ -224,7 +224,7 @@ class mcp_queue
if (!sizeof($topic_info)) if (!sizeof($topic_info))
{ {
trigger_error($user->lang['TOPIC_NOT_EXIST']); trigger_error('TOPIC_NOT_EXIST');
} }
$topic_info = $topic_info[$topic_id]; $topic_info = $topic_info[$topic_id];

View file

@ -242,7 +242,7 @@ class mcp_reports
if (!sizeof($topic_info)) if (!sizeof($topic_info))
{ {
trigger_error($user->lang['TOPIC_NOT_EXIST']); trigger_error('TOPIC_NOT_EXIST');
} }
$topic_info = $topic_info[$topic_id]; $topic_info = $topic_info[$topic_id];

View file

@ -25,7 +25,7 @@ function mcp_topic_view($id, $mode, $action)
if (!sizeof($topic_info)) if (!sizeof($topic_info))
{ {
trigger_error($user->lang['TOPIC_NOT_EXIST']); trigger_error('TOPIC_NOT_EXIST');
} }
$topic_info = $topic_info[$topic_id]; $topic_info = $topic_info[$topic_id];
@ -439,7 +439,7 @@ function split_topic($action, $topic_id, $to_forum_id, $subject)
if (!sizeof($post_id_list)) if (!sizeof($post_id_list))
{ {
trigger_error($user->lang['NO_POST_SELECTED']); trigger_error('NO_POST_SELECTED');
} }
$icon_id = request_var('icon', 0); $icon_id = request_var('icon', 0);

View file

@ -203,19 +203,19 @@ class mcp_warn
if (!$user_row) if (!$user_row)
{ {
trigger_error($user->lang['NO_POST']); trigger_error('NO_POST');
} }
// There is no point issuing a warning to ignored users (ie anonymous and bots) // There is no point issuing a warning to ignored users (ie anonymous and bots)
if ($user_row['user_type'] == USER_IGNORE) if ($user_row['user_type'] == USER_IGNORE)
{ {
trigger_error($user->lang['CANNOT_WARN_ANONYMOUS']); trigger_error('CANNOT_WARN_ANONYMOUS');
} }
// Prevent someone from warning themselves // Prevent someone from warning themselves
if ($user_row['user_id'] == $user->data['user_id']) if ($user_row['user_id'] == $user->data['user_id'])
{ {
trigger_error($user->lang['CANNOT_WARN_SELF']); trigger_error('CANNOT_WARN_SELF');
} }
// Check if there is already a warning for this post to prevent multiple // Check if there is already a warning for this post to prevent multiple
@ -229,7 +229,7 @@ class mcp_warn
if ($row) if ($row)
{ {
trigger_error($user->lang['ALREADY_WARNED']); trigger_error('ALREADY_WARNED');
} }
$user_id = $user_row['user_id']; $user_id = $user_row['user_id'];
@ -325,7 +325,7 @@ class mcp_warn
// Prevent someone from warning themselves // Prevent someone from warning themselves
if ($user_row['user_id'] == $user->data['user_id']) if ($user_row['user_id'] == $user->data['user_id'])
{ {
trigger_error($user->lang['CANNOT_WARN_SELF']); trigger_error('CANNOT_WARN_SELF');
} }
$user_id = $user_row['user_id']; $user_id = $user_row['user_id'];

View file

@ -1515,7 +1515,7 @@ class parse_message extends bbcode_firstpass
if (sizeof($not_orphan)) if (sizeof($not_orphan))
{ {
trigger_error($user->lang['NO_ACCESS_ATTACHMENT'], E_USER_ERROR); trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR);
} }
// Regenerate newly uploaded attachments // Regenerate newly uploaded attachments
@ -1541,7 +1541,7 @@ class parse_message extends bbcode_firstpass
if (sizeof($orphan)) if (sizeof($orphan))
{ {
trigger_error($user->lang['NO_ACCESS_ATTACHMENT'], E_USER_ERROR); trigger_error('NO_ACCESS_ATTACHMENT', E_USER_ERROR);
} }
ksort($this->attachment_data); ksort($this->attachment_data);

View file

@ -309,7 +309,7 @@ class ucp_register
// This should not happen, because the required variables are listed above... // This should not happen, because the required variables are listed above...
if ($user_id === false) if ($user_id === false)
{ {
trigger_error($user->lang['NO_USER'], E_USER_ERROR); trigger_error('NO_USER', E_USER_ERROR);
} }
if ($coppa && $config['email_enable']) if ($coppa && $config['email_enable'])
@ -460,7 +460,7 @@ class ucp_register
if ($config['max_reg_attempts'] && $attempts > $config['max_reg_attempts']) if ($config['max_reg_attempts'] && $attempts > $config['max_reg_attempts'])
{ {
trigger_error($user->lang['TOO_MANY_REGISTERS']); trigger_error('TOO_MANY_REGISTERS');
} }
$code = gen_rand_string(mt_rand(5, 8)); $code = gen_rand_string(mt_rand(5, 8));

View file

@ -129,14 +129,14 @@ if (!$auth->acl_getf_global('m_'))
if (!$allow_user) if (!$allow_user)
{ {
trigger_error($user->lang['NOT_AUTHORISED']); trigger_error('NOT_AUTHORISED');
} }
} }
// if the user cannot read the forum he tries to access then we won't allow mcp access either // if the user cannot read the forum he tries to access then we won't allow mcp access either
if ($forum_id && !$auth->acl_get('f_read', $forum_id)) if ($forum_id && !$auth->acl_get('f_read', $forum_id))
{ {
trigger_error($user->lang['NOT_AUTHORISED']); trigger_error('NOT_AUTHORISED');
} }
if ($forum_id) if ($forum_id)

View file

@ -669,7 +669,7 @@ switch ($mode)
{ {
if (!$auth->acl_get('f_read', $row['forum_id'])) if (!$auth->acl_get('f_read', $row['forum_id']))
{ {
trigger_error($user->lang['SORRY_AUTH_READ']); trigger_error('SORRY_AUTH_READ');
} }
if (!$auth->acl_get('f_email', $row['forum_id'])) if (!$auth->acl_get('f_email', $row['forum_id']))
@ -682,7 +682,7 @@ switch ($mode)
// If global announcement, we need to check if the user is able to at least read and email in one forum... // If global announcement, we need to check if the user is able to at least read and email in one forum...
if (!$auth->acl_getf_global('f_read')) if (!$auth->acl_getf_global('f_read'))
{ {
trigger_error($user->lang['SORRY_AUTH_READ']); trigger_error('SORRY_AUTH_READ');
} }
if (!$auth->acl_getf_global('f_email')) if (!$auth->acl_getf_global('f_email'))

View file

@ -51,14 +51,14 @@ $search_forum = request_var('fid', array(0));
if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$config['load_search']) if (!$auth->acl_get('u_search') || !$auth->acl_getf_global('f_search') || !$config['load_search'])
{ {
$template->assign_var('S_NO_SEARCH', true); $template->assign_var('S_NO_SEARCH', true);
trigger_error($user->lang['NO_SEARCH']); trigger_error('NO_SEARCH');
} }
// Check search load limit // Check search load limit
if ($user->load && $config['limit_search_load'] && ($user->load > doubleval($config['limit_search_load']))) if ($user->load && $config['limit_search_load'] && ($user->load > doubleval($config['limit_search_load'])))
{ {
$template->assign_var('S_NO_SEARCH', true); $template->assign_var('S_NO_SEARCH', true);
trigger_error($user->lang['NO_SEARCH_TIME']); trigger_error('NO_SEARCH_TIME');
} }
// Check flood limit ... if applicable // Check flood limit ... if applicable
@ -68,7 +68,7 @@ if ($interval && !$auth->acl_get('u_ignoreflood'))
if ($user->data['user_last_search'] > time() - $interval) if ($user->data['user_last_search'] > time() - $interval)
{ {
$template->assign_var('S_NO_SEARCH', true); $template->assign_var('S_NO_SEARCH', true);
trigger_error($user->lang['NO_SEARCH_TIME']); trigger_error('NO_SEARCH_TIME');
} }
} }
@ -124,7 +124,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
if (!sizeof($author_id_ary)) if (!sizeof($author_id_ary))
{ {
trigger_error($user->lang['NO_SEARCH_RESULTS']); trigger_error('NO_SEARCH_RESULTS');
} }
} }
@ -425,7 +425,7 @@ if ($keywords || $author || $author_id || $search_id || $submit)
// For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options. // For some searches we need to print out the "no results" page directly to allow re-sorting/refining the search options.
if (!sizeof($id_ary) && !$search_id) if (!sizeof($id_ary) && !$search_id)
{ {
trigger_error($user->lang['NO_SEARCH_RESULTS']); trigger_error('NO_SEARCH_RESULTS');
} }
$sql_where = ''; $sql_where = '';
@ -998,7 +998,7 @@ unset($pad_store);
if (!$s_forums) if (!$s_forums)
{ {
trigger_error($user->lang['NO_SEARCH']); trigger_error('NO_SEARCH');
} }
// Number of chars returned // Number of chars returned

View file

@ -81,7 +81,7 @@ if (!$auth->acl_gets('f_list', 'f_read', $forum_id) || ($forum_data['forum_type'
{ {
if ($user->data['user_id'] != ANONYMOUS) if ($user->data['user_id'] != ANONYMOUS)
{ {
trigger_error($user->lang['SORRY_AUTH_READ']); trigger_error('SORRY_AUTH_READ');
} }
login_box('', $user->lang['LOGIN_VIEWFORUM']); login_box('', $user->lang['LOGIN_VIEWFORUM']);