diff options
| author | Meik Sievertsen <acydburn@phpbb.com> | 2005-12-09 18:09:43 +0000 |
|---|---|---|
| committer | Meik Sievertsen <acydburn@phpbb.com> | 2005-12-09 18:09:43 +0000 |
| commit | 877d71528d83d217d1f6b71428681dc4bc4c54f3 (patch) | |
| tree | e972c23f3f82210ef5e46c6982a09a165af5d4d6 /phpBB/adm | |
| parent | 28661d61063f677f5bb9d555f179389699e5114b (diff) | |
| download | forums-877d71528d83d217d1f6b71428681dc4bc4c54f3.tar forums-877d71528d83d217d1f6b71428681dc4bc4c54f3.tar.gz forums-877d71528d83d217d1f6b71428681dc4bc4c54f3.tar.bz2 forums-877d71528d83d217d1f6b71428681dc4bc4c54f3.tar.xz forums-877d71528d83d217d1f6b71428681dc4bc4c54f3.zip | |
- banning, disallow usernames and ranks
git-svn-id: file:///svn/phpbb/trunk@5323 89ea8834-ac86-4346-8a33-228a782c2dd0
Diffstat (limited to 'phpBB/adm')
| -rw-r--r-- | phpBB/adm/admin_ban.php | 308 | ||||
| -rw-r--r-- | phpBB/adm/admin_disallow.php | 157 | ||||
| -rw-r--r-- | phpBB/adm/admin_ranks.php | 324 |
3 files changed, 0 insertions, 789 deletions
diff --git a/phpBB/adm/admin_ban.php b/phpBB/adm/admin_ban.php deleted file mode 100644 index 7265ea701e..0000000000 --- a/phpBB/adm/admin_ban.php +++ /dev/null @@ -1,308 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_ban')) - { - return; - } - - $filename = basename(__FILE__); - $module['USER']['BAN_USERS'] = $filename . "$SID&mode=user"; - $module['USER']['BAN_EMAILS'] = $filename . "$SID&mode=email"; - $module['USER']['BAN_IPS'] = $filename . "$SID&mode=ip"; - - return; -} - -define('IN_PHPBB', 1); -// Load default header -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); -include($phpbb_root_path . 'includes/functions_user.'.$phpEx); - -// Do we have ban permissions? -if (!$auth->acl_get('a_ban')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Mode setting -$mode = request_var('mode', ''); -$bansubmit = (isset($_POST['bansubmit'])) ? true : false; -$unbansubmit= (isset($_POST['unbansubmit'])) ? true : false; - -// Set some vars -$current_time = time(); - -// Start program -if ($bansubmit) -{ - // Grab the list of entries - $ban = request_var('ban', ''); - $ban_len = request_var('banlength', 0); - $ban_len_other = request_var('banlengthother', ''); - $ban_exclude = request_var('banexclude', 0); - $ban_reason = request_var('banreason', ''); - - user_ban($mode, $ban, $ban_len, $ban_len_other, $ban_exclude, $ban_reason); - - trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']); -} -else if ($unbansubmit) -{ - $ban = request_var('unban', ''); - - user_unban($mode, $ban); - - trigger_error($user->lang['BAN_UPDATE_SUCESSFUL']); -} - -// -// Output relevant entry page -// - - -// -// Ban length options -// -$ban_end_text = array(0 => $user->lang['PERMANENT'], 30 => $user->lang['30_MINS'], 60 => $user->lang['1_HOUR'], 360 => $user->lang['6_HOURS'], 1440 => $user->lang['1_DAY'], 10080 => $user->lang['7_DAYS'], 20160 => $user->lang['2_WEEKS'], 40320 => $user->lang['1_MONTH'], -1 => $user->lang['OTHER'] . ' -> '); - -$ban_end_options = ''; -foreach ($ban_end_text as $length => $text) -{ - $ban_end_options .= '<option value="' . $length . '">' . $text . '</option>'; -} - -// Title -switch ($mode) -{ - case 'user': - $l_title = $user->lang['BAN_USERS']; - break; - case 'email': - $l_title = $user->lang['BAN_EMAILS']; - break; - case 'ip': - $l_title = $user->lang['BAN_IPS']; - break; -} - -// Output page -adm_page_header($l_title); - -?> - -<p><?php echo $user->lang['BAN_EXPLAIN']; ?></p> - -<?php - -switch ($mode) -{ - case 'user': - - $field = 'username'; - $l_ban_title = $user->lang['BAN_USERS']; - $l_ban_explain = $user->lang['BAN_USERNAME_EXPLAIN']; - $l_ban_exclude_explain = $user->lang['BAN_USER_EXCLUDE_EXPLAIN']; - $l_unban_title = $user->lang['UNBAN_USERNAME']; - $l_unban_explain = $user->lang['UNBAN_USERNAME_EXPLAIN']; - $l_ban_cell = $user->lang['USERNAME'] . ': <br /><span class="gensmall">[ <a href="' . "../memberlist.$phpEx$SID&mode=searchuser&form=banning&field=ban\" onclick=\"window.open('../memberlist.$phpEx$SID&mode=searchuser&form=banning&field=ban', '_phpbbsearch', 'HEIGHT=500,resizable=yes,scrollbars=yes,WIDTH=740');return false;\">" . $user->lang['FIND_USERNAME'] .'</a> ]</span>'; - $l_no_ban_cell = $user->lang['NO_BANNED_USERS']; - - $sql = 'SELECT b.*, u.user_id, u.username - FROM ' . BANLIST_TABLE . ' b, ' . USERS_TABLE . ' u - WHERE (b.ban_end >= ' . time() . ' - OR b.ban_end = 0) - AND u.user_id = b.ban_userid - AND b.ban_userid <> 0 - AND u.user_id <> ' . ANONYMOUS . ' - ORDER BY u.user_id ASC'; - break; - - case 'ip': - - $field = 'ban_ip'; - $l_ban_title = $user->lang['BAN_IPS']; - $l_ban_explain = $user->lang['BAN_IP_EXPLAIN']; - $l_ban_exclude_explain = $user->lang['BAN_IP_EXCLUDE_EXPLAIN']; - $l_unban_title = $user->lang['UNBAN_IP']; - $l_unban_explain = $user->lang['UNBAN_IP_EXPLAIN']; - $l_ban_cell = $user->lang['IP_HOSTNAME'] . ':'; - $l_no_ban_cell = $user->lang['NO_BANNED_IP']; - - $sql = 'SELECT * - FROM ' . BANLIST_TABLE . ' - WHERE (ban_end >= ' . time() . " - OR ban_end = 0) - AND ban_ip <> ''"; - break; - - case 'email': - - $field = 'ban_email'; - $l_ban_title = $user->lang['BAN_EMAILS']; - $l_ban_explain = $user->lang['BAN_EMAIL_EXPLAIN']; - $l_ban_exclude_explain = $user->lang['BAN_EMAIL_EXCLUDE_EXPLAIN']; - $l_unban_title = $user->lang['UNBAN_EMAIL']; - $l_unban_explain = $user->lang['UNBAN_EMAIL_EXPLAIN']; - $l_ban_cell = $user->lang['EMAIL_ADDRESS'] . ':'; - $l_no_ban_cell = $user->lang['NO_BANNED_EMAIL']; - - $sql = 'SELECT * - FROM ' . BANLIST_TABLE . ' - WHERE (ban_end >= ' . time() . " - OR ban_end = 0) - AND ban_email <> ''"; - break; -} -$result = $db->sql_query($sql); - -$banned_options = ''; -$ban_length = $ban_reasons = array(); -if ($row = $db->sql_fetchrow($result)) -{ - do - { - - $banned_options .= '<option' . (($row['ban_exclude']) ? ' class="sep"' : '') . ' value="' . $row['ban_id'] . '">' . $row[$field] . '</option>'; - - $time_length = (!empty($row['ban_end'])) ? ($row['ban_end'] - $row['ban_start']) / 60 : 0; - $ban_length[$row['ban_id']] = (!empty($ban_end_text[$time_length])) ? $ban_end_text[$time_length] : $user->lang['OTHER'] . ' -> ' . gmdate('Y-m-d', $row['ban_end']); - - $ban_reasons[$row['ban_id']] = addslashes($row['ban_reason']); - } - while ($row = $db->sql_fetchrow($result)); -} -$db->sql_freeresult($result); - -?> - -<h1><?php echo $l_ban_title; ?></h1> - -<p><?php echo $l_ban_explain; ?></p> - -<script language="Javascript" type="text/javascript"> -<!-- - -var ban_length = new Array(); -<?php - - if (sizeof($ban_length)) - { - foreach ($ban_length as $ban_id => $length) - { - echo "ban_length['$ban_id'] = \"$length\";\n"; - } - } - -?> - -var ban_reason = new Array(); -<?php - - if (sizeof($ban_reasons)) - { - foreach ($ban_reasons as $ban_id => $reason) - { - echo "ban_reason['$ban_id'] = \"$reason\";\n"; - } - } -?> - -function display_details(option) -{ - document.forms[0].unbanreason.value = ban_reason[option]; - document.forms[0].unbanlength.value = ban_length[option]; -} - -//--> -</script> - -<form name="banning" method="post" action="<?php echo "admin_ban.$phpEx$SID&mode=$mode"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $l_ban_title; ?></th> - </tr> - <tr> - <td class="row1" width="45%"><?php echo $l_ban_cell; ?></td> - <td class="row2"><textarea cols="40" rows="3" name="ban"></textarea></td> - </tr> - <tr> - <td class="row1" width="45%"><?php echo $user->lang['BAN_LENGTH']; ?>:</td> - <td class="row2"><select name="banlength"><?php echo $ban_end_options; ?></select> <input class="post" type="text" name="banlengthother" maxlength="10" size="10" /></td> - </tr> - <tr> - <td class="row1" width="45%"><?php echo $user->lang['BAN_EXCLUDE']; ?>: <br /><span class="gensmall"><?php echo $l_ban_exclude_explain;;?></span></td> - <td class="row2"><input type="radio" name="banexclude" value="1" /> <?php echo $user->lang['YES']; ?> <input type="radio" name="banexclude" value="0" checked="checked" /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1" width="45%"><?php echo $user->lang['BAN_REASON']; ?>:</td> - <td class="row2"><input class="post" type="text" name="banreason" maxlength="255" size="40" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"> <input type="submit" name="bansubmit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /> </td> - </tr> -</table> - -<h1><?php echo $l_unban_title; ?></h1> - -<p><?php echo $l_unban_explain; ?></p> - -<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $l_unban_title; ?></th> - </tr> -<?php - - if ($banned_options) - { - -?> - <tr> - <td class="row1" width="45%"><?php echo $l_ban_cell; ?>: <br /></td> - <td class="row2"> <select name="unban[]" multiple="multiple" size="5" onchange="display_details(this.options[this.selectedIndex].value)"><?php echo $banned_options; ?></select></td> - </tr> - <tr> - <td class="row1" width="45%"><?php echo $user->lang['BAN_REASON']; ?>:</td> - <td class="row2"><input class="row1" style="border:0px" type="text" name="unbanreason" size="40" /></td> - </tr> - <tr> - <td class="row1" width="45%"><?php echo $user->lang['BAN_LENGTH']; ?>:</td> - <td class="row2"><input class="row1" style="border:0px" type="text" name="unbanlength" size="40" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input type="submit" name="unbansubmit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td> - </tr> -<?php - - } - else - { - -?> - <tr> - <td class="row2" colspan="2" align="center"><?php echo $l_no_ban_cell; ?></td> - </tr> -<?php - - } - -?> -</table></form> - -<?php - -adm_page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_disallow.php b/phpBB/adm/admin_disallow.php deleted file mode 100644 index 0f4d5e61f9..0000000000 --- a/phpBB/adm/admin_disallow.php +++ /dev/null @@ -1,157 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_names')) - { - return; - } - - $module['USER']['DISALLOW'] = basename(__FILE__) . $SID; - - return; -} - -define('IN_PHPBB', 1); -// Include files -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); -require($phpbb_root_path . 'includes/functions_user.'.$phpEx); - -// Check permissions -if (!$auth->acl_get('a_names')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -if (isset($_POST['disallow'])) -{ - $disallowed_user = (isset($_REQUEST['disallowed_user'])) ? htmlspecialchars($_REQUEST['disallowed_user']) : ''; - $disallowed_user = str_replace('*', '%', $disallowed_user); - - if (validate_username($disallowed_user)) - { - $message = $user->lang['Disallowed_already']; - } - else - { - $sql = 'INSERT INTO ' . DISALLOW_TABLE . " (disallow_username) - VALUES('" . $db->sql_escape(stripslashes($disallowed_user)) . "')"; - $result = $db->sql_query($sql); - - $message = $user->lang['Disallow_successful']; - } - - add_log('admin', 'log_disallow_add', str_replace('%', '*', $disallowed_user)); - - trigger_error($message); -} -else if (isset($_POST['allow'])) -{ - $disallowed_id = (isset($_REQUEST['disallowed_id'])) ? intval($_REQUEST['disallowed_id']) : ''; - - if (empty($disallowed_id)) - { - trigger_error($user->lang['No_user_selected']); - } - - $sql = 'DELETE FROM ' . DISALLOW_TABLE . " - WHERE disallow_id = $disallowed_id"; - $db->sql_query($sql); - - add_log('admin', 'log_disallow_delete'); - - trigger_error($user->lang['Disallowed_deleted']); -} - -// Grab the current list of disallowed usernames... -$sql = 'SELECT * - FROM ' . DISALLOW_TABLE; -$result = $db->sql_query($sql); - -$disallow_select = ''; -if ($row = $db->sql_fetchrow($result)) -{ - do - { - $disallow_select .= '<option value="' . $row['disallow_id'] . '">' . str_replace('%', '*', $row['disallow_username']) . '</option>'; - } - while ($row = $db->sql_fetchrow($result)); -} - -// Output page -adm_page_header($user->lang['DISALLOW']); - -?> - -<h1><?php echo $user->lang['DISALLOW']; ?></h1> - -<p><?php echo $user->lang['Disallow_explain']; ?></p> - -<form method="post" action="<?php echo "admin_disallow.$phpEx$SID"; ?>"><table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['Add_disallow_title']; ?></th> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['USERNAME']; ?><br /><span class="gensmall"><?php echo $user->lang['Add_disallow_explain']; ?></span></td> - <td class="row2"><input class="post" type="text" name="disallowed_user" size="30" /> </td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="disallow" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /> - </tr> -</table> - -<h1><?php echo $user->lang['Delete_disallow_title']; ?></h1> - -<p><?php echo $user->lang['Delete_disallow_explain']; ?></p> - -<table class="bg" width="80%" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['Delete_disallow_title']; ?></th> - </tr> -<?php - - if ($disallow_select != '') - { - -?> - <tr> - <td class="row1"><?php echo $user->lang['USERNAME']; ?></td> - <td class="row2"><select class="post" name="disallowed_id"><?php echo $disallow_select; ?></select></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><input class="btnmain" type="submit" name="allow" value="<?php echo $user->lang['SUBMIT']; ?>" /> <input class="btnlite" type="reset" value="<?php echo $user->lang['RESET']; ?>" /> - </tr> -<?php - - } - else - { - -?> - <tr> - <td class="row1" colspan="2" align="center"><?php echo $user->lang['No_disallowed']; ?></td> - </tr> -<?php - - } - -?> -</table></form> - -<?php - -adm_page_footer(); - -?>
\ No newline at end of file diff --git a/phpBB/adm/admin_ranks.php b/phpBB/adm/admin_ranks.php deleted file mode 100644 index 3c2c51dd11..0000000000 --- a/phpBB/adm/admin_ranks.php +++ /dev/null @@ -1,324 +0,0 @@ -<?php -/** -* -* @package acp -* @version $Id$ -* @copyright (c) 2005 phpBB Group -* @license http://opensource.org/licenses/gpl-license.php GNU Public License -* -*/ - -/** -*/ -if (!empty($setmodules)) -{ - if (!$auth->acl_get('a_ranks')) - { - return; - } - - $module['USER']['RANKS'] = basename(__FILE__) . $SID; - return; -} - -define('IN_PHPBB', 1); -// Let's set the root dir for phpBB -$phpbb_root_path = '../'; -$phpEx = substr(strrchr(__FILE__, '.'), 1); -require('pagestart.' . $phpEx); - -// Do we have permission? -if (!$auth->acl_get('a_ranks')) -{ - trigger_error($user->lang['NO_ADMIN']); -} - -// Check mode -if (isset($_REQUEST['mode'])) -{ - $mode = $_REQUEST['mode']; -} -else -{ - // These could be entered via a form button - if (isset($_POST['add'])) - { - $mode = 'add'; - } - else if (isset($_POST['save'])) - { - $mode = 'save'; - } - else - { - $mode = ''; - } -} - -$rank_id = (isset($_GET['id'])) ? intval($_GET['id']) : 0; - - -// -switch ($mode) -{ - case 'edit': - case 'add': - - $data = $ranks = $existing_imgs = array(); - $result = $db->sql_query('SELECT * - FROM ' . RANKS_TABLE . ' - ORDER BY rank_special DESC, rank_min DESC'); - if ($row = $db->sql_fetchrow($result)) - { - do - { - $existing_imgs[] = $row['rank_image']; - if ($mode == 'edit' && $rank_id == $row['rank_id']) - { - $ranks = $row; - } - } - while ($row = $db->sql_fetchrow($result)); - } - $db->sql_freeresult($result); - - $imglist = filelist($phpbb_root_path . $config['ranks_path'], ''); - - $edit_img = $filename_list = ''; - foreach ($imglist as $path => $img_ary) - { - foreach ($img_ary as $img) - { - $img = substr($path, 1) . (($path != '') ? '/' : '') . $img; - - if (!in_array($img, $existing_imgs) || $mode == 'edit') - { - if ($ranks && $img == $ranks['rank_image']) - { - $selected = ' selected="selected"'; - $edit_img = $img; - } - else - { - $selected = ''; - } - - $filename_list .= '<option value="' . htmlspecialchars($img) . '"' . $selected . '>' . $img . '</option>'; - } - } - } - $filename_list = '<option value=""' . (($edit_img == '') ? ' selected="selected"' : '') . '>----------</option>' . $filename_list; - unset($existing_imgs); - unset($imglist); - - // They want to add a new rank, show the form. - $s_hidden_fields = '<input type="hidden" name="mode" value="save" />'; - - adm_page_header($user->lang['RANKS']); - -?> - -<script language="javascript" type="text/javascript" defer="defer"> -<!-- - -function update_image(newimage) -{ - document.image.src = (newimage) ? "<?php echo $phpbb_root_path . $config['ranks_path']; ?>/" + newimage : "../images/spacer.gif"; -} - -function update_image_dimensions() -{ - if (document.image.height && document.forms[0].height) - { - document.forms[0].height.value = document.image.height; - document.forms[0].width.value = document.image.width; - } -} - -//--> -</script> - -<h1><?php echo $user->lang['RANKS']; ?></h1> - -<p><?php echo $user->lang['RANKS_EXPLAIN']; ?></p> - -<form method="post" action="<?php echo "admin_ranks.$phpEx$SID&id=$rank_id"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th colspan="2"><?php echo $user->lang['RANKS']; ?></th> - </tr> - <tr> - <td class="row1" width="40%"><?php echo $user->lang['RANK_TITLE']; ?>: </td> - <td class="row2"><input class="post" type="text" name="title" size="25" maxlength="40" value="<?php echo $ranks['rank_title']; ?>" /></td> - </tr> - <tr> - <td class="row1" width="40%"><?php echo $user->lang['RANK_IMAGE']; ?>:</td> - <td class="row2"><table width="100%" cellspacing="0" cellpadding="0" border="0"> - <tr> - <td valign="middle"><select name="rank_image" onchange="update_image(this.options[selectedIndex].value);"><?php echo $filename_list ?></select></td> - <td> </td> - <td valign="middle"><img src="<?php echo ($edit_img) ? $phpbb_root_path . $config['ranks_path'] . '/' . $edit_img : '../images/spacer.gif' ?>" name="image" border="0" alt="" title="" onload="update_image_dimensions()" /></td> - </tr> - </table></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['RANK_SPECIAL']; ?>: </td> - <td class="row2"><input type="radio" name="special_rank" value="1"<?php echo ($ranks['rank_special']) ? ' checked="checked"' : ''; ?> /><?php echo $user->lang['YES']; ?> <input type="radio" name="special_rank" value="0"<?php echo (!$ranks['rank_special']) ? ' checked="checked"' : ''; ?> /> <?php echo $user->lang['NO']; ?></td> - </tr> - <tr> - <td class="row1"><?php echo $user->lang['RANK_MINIMUM']; ?>: </td> - <td class="row2"><input class="post" type="text" name="min_posts" size="5" maxlength="10" value="<?php echo ($ranks['rank_special']) ? '' : $ranks['rank_min']; ?>" /></td> - </tr> - <tr> - <td class="cat" colspan="2" align="center"><?php echo $s_hidden_fields; ?><input type="submit" name="submit" value="<?php echo $user->lang['SUBMIT']; ?>" class="btnmain" /> <input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="btnlite" /></td> - </tr> -</table></form> - -<?php - - adm_page_footer(); - - break; - - case 'save': - - // - // Ok, they sent us our info, let's update it. - // - - $rank_id = (isset($_REQUEST['id'])) ? intval($_REQUEST['id']) : 0; - $rank_title = (isset($_POST['title'])) ? trim($_POST['title']) : ''; - $special_rank = (!empty($_POST['special_rank'])) ? 1 : 0; - $min_posts = (isset($_POST['min_posts'])) ? intval($_POST['min_posts']) : -1; - $rank_image = (isset($_POST['rank_image'])) ? trim(htmlspecialchars($_POST['rank_image'])) : ''; - - if ($special_rank == 1) - { - $min_posts = -1; - } - - // The rank image has to be a jpg, gif or png - if ($rank_image != '' && !preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#i', $rank_image)) - { - $rank_image = ''; - } - - if ($rank_id) - { - $sql = "UPDATE " . RANKS_TABLE . " - SET rank_title = '" . $db->sql_escape($rank_title) . "', rank_special = $special_rank, rank_min = $min_posts, rank_image = '" . $db->sql_escape($rank_image) . "' - WHERE rank_id = $rank_id"; - - $message = $user->lang['RANK_UPDATED']; - } - else - { - $sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_special, rank_min, rank_image) - VALUES ('" . $db->sql_escape($rank_title) . "', $special_rank, $min_posts, '" . $db->sql_escape($rank_image) . "')"; - - $message = $user->lang['RANK_ADDED']; - } - $db->sql_query($sql); - - $cache->destroy('ranks'); - - trigger_error($message); - - break; - - case 'delete': - - // Ok, they want to delete their rank - $rank_id = (isset($_REQUEST['id'])) ? intval($_REQUEST['id']) : 0; - - if ($rank_id) - { - $sql = "DELETE FROM " . RANKS_TABLE . " - WHERE rank_id = $rank_id"; - $db->sql_query($sql); - - $sql = "UPDATE " . USERS_TABLE . " - SET user_rank = 0 - WHERE user_rank = $rank_id"; - $db->sql_query($sql); - - $cache->destroy('ranks'); - - trigger_error($user->lang['RANK_REMOVED']); - } - else - { - trigger_error($user->lang['MUST_SELECT_RANK']); - } - - break; - - default: - - adm_page_header($user->lang['RANKS']); - -?> - -<h1><?php echo $user->lang['RANKS']; ?></h1> - -<p><?php echo $user->lang['RANKS_EXPLAIN']; ?></p> - -<form method="post" action="<?php echo "admin_ranks.$phpEx$SID"; ?>"><table class="bg" cellspacing="1" cellpadding="4" border="0" align="center"> - <tr> - <th><?php echo $user->lang['RANK_IMAGE']; ?></th> - <th><?php echo $user->lang['RANK_TITLE']; ?></th> - <th><?php echo $user->lang['RANK_MINIMUM']; ?></th> - <th><?php echo $user->lang['ACTION']; ?></th> - </tr> -<?php - - // Show the default page - $sql = "SELECT * FROM " . RANKS_TABLE . " - ORDER BY rank_min ASC, rank_special ASC"; - $result = $db->sql_query($sql); - - if ($row = $db->sql_fetchrow($result)) - { - do - { - $row_class = ($row_class != 'row1') ? 'row1' : 'row2'; - -?> - <tr> - <td class="<?php echo $row_class; ?>" align="center"><?php - - if ($row['rank_image']) - { - -?><img src="<?php echo $phpbb_root_path . $config['ranks_path'] . '/' . $row['rank_image']; ?>"" border="0" alt="<?php echo $row['rank_title']; ?>" title="<?php echo $row['rank_title']; ?>" /><?php - - } - else - { - echo '-'; - } - -?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo $row['rank_title']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"><?php echo ($row['rank_special']) ? '-' : $row['rank_min']; ?></td> - <td class="<?php echo $row_class; ?>" align="center"> <a href="<?php echo "admin_ranks.$phpEx$SID&mode=edit&id=" . $row['rank_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> | <a href="<?php echo "admin_ranks.$phpEx$SID&mode=delete&id=" . $row['rank_id']; ?>"><?php echo $user->lang['DELETE']; ?></a> </td> - </tr> -<?php - - } - while ($row = $db->sql_fetchrow($result)); - } - -?> - <tr> - <td class="cat" colspan="5" align="center"><input type="submit" class="btnmain" name="add" value="<?php echo $user->lang['ADD_RANK']; ?>" /></td> - </tr> -</table></form> - -<?php - - adm_page_footer(); - - break; -} - -?>
\ No newline at end of file |
