Changed way moderator lang is output on viewforum and index

git-svn-id: file:///svn/phpbb/trunk@1611 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2001-12-16 18:58:05 +00:00
parent 687b659888
commit b14ca3c338
6 changed files with 49 additions and 49 deletions

View file

@ -56,7 +56,7 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
{ {
global $db, $lang; global $db, $lang;
switch($type) switch( $type )
{ {
case AUTH_ALL: case AUTH_ALL:
$a_sql = "a.auth_view, a.auth_read, a.auth_post, a.auth_reply, a.auth_edit, a.auth_delete, a.auth_sticky, a.auth_announce, a.auth_vote, a.auth_pollcreate"; $a_sql = "a.auth_view, a.auth_read, a.auth_post, a.auth_reply, a.auth_edit, a.auth_delete, a.auth_sticky, a.auth_announce, a.auth_vote, a.auth_pollcreate";
@ -124,7 +124,7 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
// If f_access has been passed, or auth is needed to return an array of forums // If f_access has been passed, or auth is needed to return an array of forums
// then we need to pull the auth information on the given forum (or all forums) // then we need to pull the auth information on the given forum (or all forums)
// //
if($f_access == -1) if( $f_access == -1 )
{ {
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "WHERE a.forum_id = $forum_id" : ""; $forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "WHERE a.forum_id = $forum_id" : "";
@ -139,7 +139,7 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
} }
else else
{ {
if(!$db->sql_numrows($af_result)) if( !$db->sql_numrows($af_result) )
{ {
message_die(GENERAL_ERROR, "No forum access control lists exist!", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "No forum access control lists exist!", "", __LINE__, __FILE__, $sql);
} }
@ -157,37 +157,24 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
// //
$auth_user = array(); $auth_user = array();
if($userdata['session_logged_in']) if( $userdata['session_logged_in'] )
{ {
$forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "AND a.forum_id = $forum_id" : ""; $forum_match_sql = ($forum_id != AUTH_LIST_ALL) ? "AND a.forum_id = $forum_id" : "";
/* $sql = "SELECT au.forum_id, $a_sql, au.auth_mod, g.group_single_user $sql = "SELECT a.forum_id, $a_sql, a.auth_mod
FROM " . AUTH_ACCESS_TABLE . " au, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE. " g FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug
WHERE ug.user_id = " . $userdata['user_id'] . "
AND g.group_id = ug.group_id
AND (
( au.user_id = ug.user_id
AND g.group_id = 0 )
OR
( au.group_id = ug.group_id
AND g.group_id <> 0 )
)
$forum_match_sql";*/
$sql = "SELECT a.forum_id, $a_sql, a.auth_mod, g.group_single_user
FROM " . AUTH_ACCESS_TABLE . " a, " . USER_GROUP_TABLE . " ug, " . GROUPS_TABLE . " g
WHERE ug.user_id = ".$userdata['user_id']. " WHERE ug.user_id = ".$userdata['user_id']. "
AND ug.user_pending = 0 AND ug.user_pending = 0
AND g.group_id = ug.group_id
AND a.group_id = ug.group_id AND a.group_id = ug.group_id
$forum_match_sql"; $forum_match_sql";
$a_result = $db->sql_query($sql); $a_result = $db->sql_query($sql);
if(!$a_result) if( !$a_result )
{ {
message_die(GENERAL_ERROR, "Failed obtaining forum access control lists", "", __LINE__, __FILE__, $sql); message_die(GENERAL_ERROR, "Failed obtaining forum access control lists", "", __LINE__, __FILE__, $sql);
} }
$num_u_access = $db->sql_numrows($a_result); $num_u_access = $db->sql_numrows($a_result);
if($num_u_access) if( $num_u_access )
{ {
if($forum_id != AUTH_LIST_ALL) if($forum_id != AUTH_LIST_ALL)
{ {
@ -195,7 +182,7 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
} }
else else
{ {
while($u_row = $db->sql_fetchrow($a_result)) while( $u_row = $db->sql_fetchrow($a_result) )
{ {
$u_access[$u_row['forum_id']][] = $u_row; $u_access[$u_row['forum_id']][] = $u_row;
} }
@ -203,7 +190,7 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
} }
} }
$is_admin = ($userdata['user_level'] == ADMIN && $userdata['session_logged_in']) ? TRUE : 0; $is_admin = ( $userdata['user_level'] == ADMIN && $userdata['session_logged_in'] ) ? TRUE : 0;
$auth_user = array(); $auth_user = array();
@ -233,35 +220,35 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
// be assigned). If the row does represent a single user then forget any previous group results // be assigned). If the row does represent a single user then forget any previous group results
// and instead set the auth to whatever the OR'd contents of the access levels are. // and instead set the auth to whatever the OR'd contents of the access levels are.
// //
if($forum_id != AUTH_LIST_ALL) if( $forum_id != AUTH_LIST_ALL )
{ {
$value = $f_access[$key]; $value = $f_access[$key];
switch($value) switch( $value )
{ {
case AUTH_ALL: case AUTH_ALL:
$auth_user[$key] = TRUE; $auth_user[$key] = TRUE;
$auth_user[$key . '_type'] = $lang['Anonymous_users']; $auth_user[$key . '_type'] = $lang['Auth_Anonymous_users'];
break; break;
case AUTH_REG: case AUTH_REG:
$auth_user[$key] = ( $userdata['session_logged_in'] ) ? TRUE : 0; $auth_user[$key] = ( $userdata['session_logged_in'] ) ? TRUE : 0;
$auth_user[$key . '_type'] = $lang['Registered_Users']; $auth_user[$key . '_type'] = $lang['Auth_Registered_Users'];
break; break;
case AUTH_ACL: case AUTH_ACL:
$auth_user[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access, $is_admin) : 0; $auth_user[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access, $is_admin) : 0;
$auth_user[$key . '_type'] = $lang['Users_granted_access']; $auth_user[$key . '_type'] = $lang['Auth_Users_granted_access'];
break; break;
case AUTH_MOD: case AUTH_MOD:
$auth_user[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0; $auth_user[$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0;
$auth_user[$key . '_type'] = $lang['Moderators']; $auth_user[$key . '_type'] = $lang['Auth_Moderators'];
break; break;
case AUTH_ADMIN: case AUTH_ADMIN:
$auth_user[$key] = $is_admin; $auth_user[$key] = $is_admin;
$auth_user[$key . '_type'] = $lang['Administrators']; $auth_user[$key . '_type'] = $lang['Auth_Administrators'];
break; break;
default: default:
@ -276,31 +263,31 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
$value = $f_access[$k][$key]; $value = $f_access[$k][$key];
$f_forum_id = $f_access[$k]['forum_id']; $f_forum_id = $f_access[$k]['forum_id'];
switch($value) switch( $value )
{ {
case AUTH_ALL: case AUTH_ALL:
$auth_user[$f_forum_id][$key] = TRUE; $auth_user[$f_forum_id][$key] = TRUE;
$auth_user[$f_forum_id][$key . '_type'] = $lang['Anonymous_users']; $auth_user[$f_forum_id][$key . '_type'] = $lang['Auth_Anonymous_users'];
break; break;
case AUTH_REG: case AUTH_REG:
$auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? TRUE : 0; $auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? TRUE : 0;
$auth_user[$f_forum_id][$key . '_type'] = $lang['Registered_Users']; $auth_user[$f_forum_id][$key . '_type'] = $lang['Auth_Registered_Users'];
break; break;
case AUTH_ACL: case AUTH_ACL:
$auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin) : 0; $auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_ACL, $key, $u_access[$f_forum_id], $is_admin) : 0;
$auth_user[$f_forum_id][$key . '_type'] = $lang['Users_granted_access']; $auth_user[$f_forum_id][$key . '_type'] = $lang['Auth_Users_granted_access'];
break; break;
case AUTH_MOD: case AUTH_MOD:
$auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin) : 0; $auth_user[$f_forum_id][$key] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin) : 0;
$auth_user[$f_forum_id][$key . '_type'] = $lang['Moderators']; $auth_user[$f_forum_id][$key . '_type'] = $lang['Auth_Moderators'];
break; break;
case AUTH_ADMIN: case AUTH_ADMIN:
$auth_user[$f_forum_id][$key] = $is_admin; $auth_user[$f_forum_id][$key] = $is_admin;
$auth_user[$f_forum_id][$key . '_type'] = $lang['Administrators']; $auth_user[$f_forum_id][$key . '_type'] = $lang['Auth_Administrators'];
break; break;
default: default:
@ -314,9 +301,9 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
// //
// Is user a moderator? // Is user a moderator?
// //
if($forum_id != AUTH_LIST_ALL) if( $forum_id != AUTH_LIST_ALL )
{ {
$auth_user['auth_mod'] = ($userdata['session_logged_in']) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0; $auth_user['auth_mod'] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access, $is_admin) : 0;
} }
else else
{ {
@ -324,7 +311,7 @@ function auth($type, $forum_id, $userdata, $f_access = -1)
{ {
$f_forum_id = $f_access[$k]['forum_id']; $f_forum_id = $f_access[$k]['forum_id'];
$auth_user[$f_forum_id]['auth_mod'] = ($userdata['session_logged_in']) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin) : 0; $auth_user[$f_forum_id]['auth_mod'] = ( $userdata['session_logged_in'] ) ? auth_check_user(AUTH_MOD, 'auth_mod', $u_access[$f_forum_id], $is_admin) : 0;
} }
} }
@ -335,7 +322,7 @@ function auth_check_user($type, $key, $u_access, $is_admin)
{ {
$auth_user = 0; $auth_user = 0;
if(count($u_access)) if( count($u_access) )
{ {
for($j = 0; $j < count($u_access); $j++) for($j = 0; $j < count($u_access); $j++)
{ {

View file

@ -269,7 +269,6 @@ $template->assign_vars(array(
"L_VIEWS" => $lang['Views'], "L_VIEWS" => $lang['Views'],
"L_POSTS" => $lang['Posts'], "L_POSTS" => $lang['Posts'],
"L_LASTPOST" => $lang['Last_Post'], "L_LASTPOST" => $lang['Last_Post'],
"L_MODERATOR" => $lang['Moderator'],
"L_NO_NEW_POSTS" => $lang['No_new_posts'], "L_NO_NEW_POSTS" => $lang['No_new_posts'],
"L_NEW_POSTS" => $lang['New_posts'], "L_NEW_POSTS" => $lang['New_posts'],
"L_NO_NEW_POSTS_HOT" => $lang['No_new_posts_hot'], "L_NO_NEW_POSTS_HOT" => $lang['No_new_posts_hot'],

View file

@ -251,6 +251,7 @@ if($total_categories = $db->sql_numrows($q_categories))
"FORUM_NEW_IMG" => $images['forum_new'], "FORUM_NEW_IMG" => $images['forum_new'],
"FORUM_LOCKED_IMG" => $images['forum_locked'], "FORUM_LOCKED_IMG" => $images['forum_locked'],
"L_MODERATOR" => $lang['Moderators'],
"L_FORUM_LOCKED" => $lang['Forum_is_locked'], "L_FORUM_LOCKED" => $lang['Forum_is_locked'],
"L_MARK_FORUMS_READ" => $lang['Mark_all_forums'], "L_MARK_FORUMS_READ" => $lang['Mark_all_forums'],
@ -379,11 +380,20 @@ if($total_categories = $db->sql_numrows($q_categories))
} }
} }
if($moderators_links == "") if( $moderators_links == "" )
{ {
$moderators_links = "&nbsp;"; $moderators_links = "&nbsp;";
} }
if( $mods > 0 )
{
$l_moderators = ( $mods == 1 ) ? $lang['Moderator'] : $lang['Moderators'];
}
else
{
$l_moderators = "&nbsp;";
}
$row_color = ( !($count % 2) ) ? $theme['td_color1'] : $theme['td_color2']; $row_color = ( !($count % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
$row_class = ( !($count % 2) ) ? $theme['td_class1'] : $theme['td_class2']; $row_class = ( !($count % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
@ -398,6 +408,8 @@ if($total_categories = $db->sql_numrows($q_categories))
"LAST_POST" => $last_post, "LAST_POST" => $last_post,
"MODERATORS" => $moderators_links, "MODERATORS" => $moderators_links,
"L_MODERATOR" => $l_moderators,
"U_VIEWFORUM" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id")) "U_VIEWFORUM" => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
); );

View file

@ -144,7 +144,8 @@ $lang['Memberlist'] = "Memberlist";
$lang['FAQ'] = "FAQ"; $lang['FAQ'] = "FAQ";
$lang['Usergroups'] = "Usergroups"; $lang['Usergroups'] = "Usergroups";
$lang['Last_Post'] = "Last Post"; $lang['Last_Post'] = "Last Post";
$lang['Moderator'] = "Moderator/s"; $lang['Moderator'] = "Moderator";
$lang['Moderators'] = "Moderators";
// //
@ -749,11 +750,11 @@ $lang['Sorry_auth_delete'] = "Sorry but only %s can delete posts in this forum";
$lang['Sorry_auth_vote'] = "Sorry but only %s can vote in polls in this forum"; $lang['Sorry_auth_vote'] = "Sorry but only %s can vote in polls in this forum";
// These replace the %s in the above strings // These replace the %s in the above strings
$lang['Anonymous_Users'] = "<b>anonymous users</b>"; $lang['Auth_Anonymous_Users'] = "<b>anonymous users</b>";
$lang['Registered_Users'] = "<b>registered users</b>"; $lang['Auth_Registered_Users'] = "<b>registered users</b>";
$lang['Users_granted_access'] = "<b>users granted special access</b>"; $lang['Auth_Users_granted_access'] = "<b>users granted special access</b>";
$lang['Moderators'] = "<b>moderators</b>"; $lang['Auth_Moderators'] = "<b>moderators</b>";
$lang['Administrators'] = "<b>administrators</b>"; $lang['Auth_Administrators'] = "<b>administrators</b>";
$lang['Not_Moderator'] = "You are not a moderator of this forum"; $lang['Not_Moderator'] = "You are not a moderator of this forum";
$lang['Not_Authorised'] = "Not Authorised"; $lang['Not_Authorised'] = "Not Authorised";

View file

@ -30,7 +30,7 @@
<td class="row1" align="center" valign="middle" height="50">{catrow.forumrow.FOLDER}</td> <td class="row1" align="center" valign="middle" height="50">{catrow.forumrow.FOLDER}</td>
<td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br /> <td class="row1" width="100%" height="50"><span class="forumlink"> <a href="{catrow.forumrow.U_VIEWFORUM}" class="forumlink">{catrow.forumrow.FORUM_NAME}</a><br />
</span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br /> </span> <span class="genmed">{catrow.forumrow.FORUM_DESC}<br />
</span><span class="gensmall">{L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td> </span><span class="gensmall">{catrow.forumrow.L_MODERATOR} {catrow.forumrow.MODERATORS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td> <td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.TOPICS}</span></td>
<td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td> <td class="row2" align="center" valign="middle" height="50"><span class="gensmall">{catrow.forumrow.POSTS}</span></td>
<td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td> <td class="row2" align="center" valign="middle" height="50" nowrap="nowrap"> <span class="gensmall">{catrow.forumrow.LAST_POST}</span></td>

View file

@ -371,6 +371,7 @@ $template->assign_vars(array(
"FOLDER_ANNOUNCE_IMG" => $images['folder_announce'], "FOLDER_ANNOUNCE_IMG" => $images['folder_announce'],
"FOLDER_ANNOUNCE_NEW_IMG" => $images['folder_announce_new'], "FOLDER_ANNOUNCE_NEW_IMG" => $images['folder_announce_new'],
"L_MODERATOR" => ( $total_mods == 1 ) ? $lang['Moderator'] : $lang['Moderators'],
"L_MARK_TOPICS_READ" => $lang['Mark_all_topics'], "L_MARK_TOPICS_READ" => $lang['Mark_all_topics'],
"L_POST_NEW_TOPIC" => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'], "L_POST_NEW_TOPIC" => ( $forum_row['forum_status'] == FORUM_LOCKED ) ? $lang['Forum_locked'] : $lang['Post_new_topic'],