mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-12 14:28:56 +00:00
Allows for selectable ranks in user admin.
git-svn-id: file:///svn/phpbb/trunk@1202 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
parent
2eb565a15c
commit
e89a960a90
4 changed files with 52 additions and 24 deletions
|
@ -139,7 +139,7 @@ if( $mode == "searchuser" )
|
||||||
//
|
//
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
else if ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_URL]) || isset($HTTP_POST_VARS[POST_USERS_URL]) )
|
else if ( ($mode == "edit") || (isset($HTTP_POST_VARS['username_select']) || isset($HTTP_GET_VARS[POST_USERS_URL]) || isset($HTTP_POST_VARS[POST_USERS_URL])) )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Let's find out a little about them...
|
// Let's find out a little about them...
|
||||||
|
@ -151,7 +151,7 @@ else if ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$this_userdata = get_userdata($HTTP_POST_VARS['username']);
|
$this_userdata = get_userdata($HTTP_POST_VARS['username_select']);
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -199,8 +199,8 @@ else if ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_
|
||||||
$bbcode_status = ($board_config['allow_bbcode']) ? $lang['ON'] : $lang['OFF'];
|
$bbcode_status = ($board_config['allow_bbcode']) ? $lang['ON'] : $lang['OFF'];
|
||||||
$smilies_status = ($board_config['allow_smilies']) ? $lang['ON'] : $lang['OFF'];
|
$smilies_status = ($board_config['allow_smilies']) ? $lang['ON'] : $lang['OFF'];
|
||||||
|
|
||||||
$s_hidden_fields = '<input type="hidden" name="mode" value="' . $mode . '" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
|
$s_hidden_fields = '<input type="hidden" name="mode" value="save" /><input type="hidden" name="agreed" value="true" /><input type="hidden" name="coppa" value="' . $coppa . '" />';
|
||||||
$s_hidden_fields .= '<input type="hidden" name="user_id" value="' . $this_userdata['user_id'] . '" />';
|
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $this_userdata['user_id'] . '" />';
|
||||||
|
|
||||||
if( $user_avatar_type )
|
if( $user_avatar_type )
|
||||||
{
|
{
|
||||||
|
@ -222,6 +222,33 @@ else if ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_
|
||||||
$avatar = "";
|
$avatar = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$sql = "SELECT * FROM " . RANKS_TABLE . "
|
||||||
|
WHERE rank_special = 1
|
||||||
|
ORDER BY rank_title";
|
||||||
|
if( !$result = $db->sql_query($sql) )
|
||||||
|
{
|
||||||
|
message_die(GENERAL_ERROR, "Couldn't obtain ranks data", "", __LINE__, __FILE__, $sql);
|
||||||
|
}
|
||||||
|
$rank_count = $db->sql_numrows($result);
|
||||||
|
|
||||||
|
$rank_rows = $db->sql_fetchrowset($result);
|
||||||
|
|
||||||
|
$rank_select_box = "";
|
||||||
|
|
||||||
|
for($i = 0; $i < $rank_count; $i++)
|
||||||
|
{
|
||||||
|
$rank = $rank_rows[$i]['rank_title'];
|
||||||
|
$rank_id = $rank_rows[$i]['rank_id'];
|
||||||
|
if ( $this_userdata['user_rank'] == $i + 1 )
|
||||||
|
{
|
||||||
|
$rank_select_box .= "<option value=\"" . $rank_id . "\" selected=\"selected\">" . $rank . "</option>";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$rank_select_box .= "<option value=\"" . $rank_id . "\">" . $rank . "</option>";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$signature = preg_replace("/\:[0-9a-z\:]*?\]/si", "]", $signature);
|
$signature = preg_replace("/\:[0-9a-z\:]*?\]/si", "]", $signature);
|
||||||
|
|
||||||
$template->set_filenames(array(
|
$template->set_filenames(array(
|
||||||
|
@ -271,6 +298,7 @@ else if ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_
|
||||||
"ALLOW_AVATAR_NO" => (!$user_allowavatar) ? "checked=\"checked\"" : "",
|
"ALLOW_AVATAR_NO" => (!$user_allowavatar) ? "checked=\"checked\"" : "",
|
||||||
"USER_ACTIVE_YES" => ($user_status) ? "checked=\"checked\"" : "",
|
"USER_ACTIVE_YES" => ($user_status) ? "checked=\"checked\"" : "",
|
||||||
"USER_ACTIVE_NO" => (!$user_status) ? "checked=\"checked\"" : "",
|
"USER_ACTIVE_NO" => (!$user_status) ? "checked=\"checked\"" : "",
|
||||||
|
"RANK_SELECT_BOX" => $rank_select_box,
|
||||||
|
|
||||||
"L_PASSWORD_IF_CHANGED" => $lang['password_if_changed'],
|
"L_PASSWORD_IF_CHANGED" => $lang['password_if_changed'],
|
||||||
"L_PASSWORD_CONFIRM_IF_CHANGED" => $lang['password_confirm_if_changed'],
|
"L_PASSWORD_CONFIRM_IF_CHANGED" => $lang['password_confirm_if_changed'],
|
||||||
|
@ -326,6 +354,7 @@ else if ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_
|
||||||
|
|
||||||
"L_DELETE_USER" => $lang['User_delete'],
|
"L_DELETE_USER" => $lang['User_delete'],
|
||||||
"L_DELETE_USER_EXPLAIN" => $lang['User_delete_explain'],
|
"L_DELETE_USER_EXPLAIN" => $lang['User_delete_explain'],
|
||||||
|
"L_SELECT_RANK" => $lang['Rank_title'],
|
||||||
|
|
||||||
"S_HIDDEN_FIELDS" => $s_hidden_fields,
|
"S_HIDDEN_FIELDS" => $s_hidden_fields,
|
||||||
"S_PROFILE_ACTION" => append_sid("admin_users.$phpEx"))
|
"S_PROFILE_ACTION" => append_sid("admin_users.$phpEx"))
|
||||||
|
@ -333,12 +362,12 @@ else if ( isset($HTTP_POST_VARS['username']) || isset($HTTP_GET_VARS[POST_USERS_
|
||||||
|
|
||||||
$template->pparse("body");
|
$template->pparse("body");
|
||||||
}
|
}
|
||||||
else if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['user_id']) )
|
else if( $HTTP_POST_VARS['mode'] == "save" )
|
||||||
{
|
{
|
||||||
//
|
//
|
||||||
// Ok, the profile has been modified and submitted, let's update
|
// Ok, the profile has been modified and submitted, let's update
|
||||||
//
|
//
|
||||||
$user_id = intval($HTTP_POST_VARS['user_id']);
|
$user_id = intval($HTTP_POST_VARS['id']);
|
||||||
|
|
||||||
$username = (!empty($HTTP_POST_VARS['username'])) ? trim(strip_tags($HTTP_POST_VARS['username'])) : "";
|
$username = (!empty($HTTP_POST_VARS['username'])) ? trim(strip_tags($HTTP_POST_VARS['username'])) : "";
|
||||||
$email = (!empty($HTTP_POST_VARS['email'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : "";
|
$email = (!empty($HTTP_POST_VARS['email'])) ? trim(strip_tags(htmlspecialchars($HTTP_POST_VARS['email']))) : "";
|
||||||
|
@ -376,7 +405,10 @@ else if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['user_id']) )
|
||||||
|
|
||||||
$user_status = (!empty($HTTP_POST_VARS['user_status'])) ? intval($HTTP_POST_VARS['user_status']) : 0;
|
$user_status = (!empty($HTTP_POST_VARS['user_status'])) ? intval($HTTP_POST_VARS['user_status']) : 0;
|
||||||
$user_allowpm = (!empty($HTTP_POST_VARS['user_allowpm'])) ? intval($HTTP_POST_VARS['user_allowpm']) : 0;
|
$user_allowpm = (!empty($HTTP_POST_VARS['user_allowpm'])) ? intval($HTTP_POST_VARS['user_allowpm']) : 0;
|
||||||
$user_allowavatar = (!empty($HTTP_POST_VARS['usr_allowavatar'])) ? intval($HTTP_POST_VARS['user_allowavatar']) : 0;
|
$user_allowavatar = (!empty($HTTP_POST_VARS['user_allowavatar'])) ? intval($HTTP_POST_VARS['user_allowavatar']) : 0;
|
||||||
|
$user_rank = (!empty($HTTP_POST_VARS['user_rank'])) ? intval($HTTP_POST_VARS['user_rank']) : "";
|
||||||
|
|
||||||
|
$user_rank_sql = (isset($user_rank)) ? ", user_rank = " . $user_rank : "";
|
||||||
|
|
||||||
if(isset($HTTP_POST_VARS['submit']))
|
if(isset($HTTP_POST_VARS['submit']))
|
||||||
{
|
{
|
||||||
|
@ -411,20 +443,8 @@ else if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['user_id']) )
|
||||||
|
|
||||||
if( $signature != "" )
|
if( $signature != "" )
|
||||||
{
|
{
|
||||||
if( strlen($signature) > $board_config['max_sig_chars'] )
|
$signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : "";
|
||||||
{
|
$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
|
||||||
$error = TRUE;
|
|
||||||
if(isset($error_msg))
|
|
||||||
{
|
|
||||||
$error_msg .= "<br />";
|
|
||||||
}
|
|
||||||
$error_msg .= $lang['Signature_too_long'];
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$signature_bbcode_uid = ( $allowbbcode ) ? make_bbcode_uid() : "";
|
|
||||||
$signature = prepare_message($signature, $allowhtml, $allowbbcode, $allowsmilies, $signature_bbcode_uid);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if( isset($HTTP_POST_VARS['avatardel']) )
|
if( isset($HTTP_POST_VARS['avatardel']) )
|
||||||
|
@ -502,9 +522,9 @@ else if( isset($HTTP_POST_VARS['submit']) && isset($HTTP_POST_VARS['user_id']) )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$sql = "UPDATE " . USERS_TABLE . "
|
$sql = "UPDATE " . USERS_TABLE . "
|
||||||
SET " . $username_sql . $passwd_sql . "user_email = '$email', user_icq = '$icq', user_website = '$website', user_occ = '$occupation', user_from = '$location', user_interests = '$interests', user_sig = '$signature', user_viewemail = $viewemail, user_aim = '$aim', user_yim = '$yim', user_msnm = '$msn', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_lang = '$user_lang', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '$user_dateformat', user_active = $user_status, user_actkey = '$user_actkey'" . $avatar_sql . "
|
SET " . $username_sql . $passwd_sql . "user_email = '$email', user_icq = '$icq', user_website = '$website', user_occ = '$occupation', user_from = '$location', user_interests = '$interests', user_sig = '$signature', user_viewemail = $viewemail, user_aim = '$aim', user_yim = '$yim', user_msnm = '$msn', user_attachsig = $attachsig, user_allowsmile = $allowsmilies, user_allowhtml = $allowhtml, user_allowavatar = $user_allowavatar, user_allowbbcode = $allowbbcode, user_allow_viewonline = $allowviewonline, user_allow_pm = $user_allowpm, user_notify_pm = $notifypm, user_lang = '$user_lang', user_style = $user_style, user_timezone = $user_timezone, user_dateformat = '$user_dateformat', user_active = $user_status, user_actkey = '$user_actkey' " . $user_rank_sql . $avatar_sql . "
|
||||||
WHERE user_id = $user_id";
|
WHERE user_id = $user_id";
|
||||||
if($result = $db->sql_query($sql))
|
if( $result = $db->sql_query($sql) )
|
||||||
{
|
{
|
||||||
$template->set_filenames(array(
|
$template->set_filenames(array(
|
||||||
"body" => "admin/admin_message_body.tpl")
|
"body" => "admin/admin_message_body.tpl")
|
||||||
|
|
|
@ -136,6 +136,10 @@
|
||||||
<td class="row1"><span class="gen">{L_ALLOW_AVATAR}:</span></td>
|
<td class="row1"><span class="gen">{L_ALLOW_AVATAR}:</span></td>
|
||||||
<td class="row2"><input type="radio" name="user_allowavatar" value="1" {ALLOW_AVATAR_YES} /> <span class="gen">{L_YES}</span> <input type="radio" name="user_allowavatar" value="0" {ALLOW_AVATAR_NO} /> <span class="gen">{L_NO}</span></td>
|
<td class="row2"><input type="radio" name="user_allowavatar" value="1" {ALLOW_AVATAR_YES} /> <span class="gen">{L_YES}</span> <input type="radio" name="user_allowavatar" value="0" {ALLOW_AVATAR_NO} /> <span class="gen">{L_NO}</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="row1"><span class="gen">{L_SELECT_RANK}:</span></td>
|
||||||
|
<td class="row2"><select name="user_rank">{RANK_SELECT_BOX}</select></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1"><span class="gen">{L_DELETE_USER}?</span></td>
|
<td class="row1"><span class="gen">{L_DELETE_USER}?</span></td>
|
||||||
<td class="row2"><input type="checkbox" name="deleteuser">{L_DELETE_USER_EXPLAIN}</td>
|
<td class="row2"><input type="checkbox" name="deleteuser">{L_DELETE_USER_EXPLAIN}</td>
|
||||||
|
|
|
@ -237,6 +237,10 @@
|
||||||
<input type="radio" name="user_allowavatar" value="0" {ALLOW_AVATAR_NO} />
|
<input type="radio" name="user_allowavatar" value="0" {ALLOW_AVATAR_NO} />
|
||||||
<span class="gen">{L_NO}</span></td>
|
<span class="gen">{L_NO}</span></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td class="row1"><span class="gen">{L_SELECT_RANK}:</span></td>
|
||||||
|
<td class="row2"><select name="user_rank">{RANK_SELECT_BOX}</select></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1"><span class="gen">{L_DELETE_USER}?</span></td>
|
<td class="row1"><span class="gen">{L_DELETE_USER}?</span></td>
|
||||||
<td class="row2">
|
<td class="row2">
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
<th class="thHead" align="center">{L_USER_SELECT}</th>
|
<th class="thHead" align="center">{L_USER_SELECT}</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td class="row1" align="center"><input type="text" class="post" name="username" maxlength="50" size="20" /> <input type="submit" name="submit" value="{L_LOOK_UP}" class="mainoption" /> <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>
|
<td class="row1" align="center"><input type="text" class="post" name="username_select" maxlength="50" size="20" /> <input type="hidden" name="mode" value="edit" /><input type="submit" name="submit" value="{L_LOOK_UP}" class="mainoption" /> <input type="submit" name="usersubmit" value="{L_FIND_USERNAME}" class="liteoption" onClick="window.open('{U_SEARCH_USER}', '_phpbbsearch', 'HEIGHT=250,resizable=yes,WIDTH=400');return false;" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
</table></form>
|
</table></form>
|
||||||
|
|
Loading…
Add table
Reference in a new issue