Minor mods + lang var case changes

git-svn-id: file:///svn/phpbb/trunk@3390 89ea8834-ac86-4346-8a33-228a782c2dd0
This commit is contained in:
Paul S. Owen 2003-01-28 18:55:54 +00:00
parent 06af965743
commit f522f21240

View file

@ -88,6 +88,8 @@ if ($mode != '')
$result = $db->sql_query($sql);
$rank_info = $db->sql_fetchrow($result);
$db->sql_freeresult($result);
$s_hidden_fields .= '<input type="hidden" name="id" value="' . $rank_id . '" />';
}
@ -102,27 +104,27 @@ if ($mode != '')
<h1><?php echo $user->lang['RANKS']; ?></h1>
<p><?php echo $user->lang['Ranks_explain']; ?></p>
<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 colspan="2"><?php echo $user->lang['Ranks']; ?></th>
<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="row1" width="40%" nowrap="nowrap"><?php echo $user->lang['RANK_TITLE']; ?>: </td>
<td class="row2"><input type="text" name="title" size="35" maxlength="40" value="<?php echo $rank_info['rank_title']; ?>" /></td>
</tr>
<tr>
<td class="row1" width="40%"><?php echo $user->lang['Rank_special']; ?>: </td>
<td class="row1" width="40%" nowrap="nowrap"><?php echo $user->lang['RANK_SPECIAL']; ?>: </td>
<td class="row2"><input type="radio" name="special_rank" value="1"<?php echo ($rank_info['rank_special']) ? ' checked="checked"' : ''; ?> /><?php echo $user->lang['YES']; ?> &nbsp;&nbsp;<input type="radio" name="special_rank" value="0"<?php echo (!$rank_info['rank_special']) ? ' checked="checked"' : ''; ?> /> <?php echo $user->lang['NO']; ?></td>
</tr>
<tr>
<td class="row1" width="40%"><?php echo $user->lang['Rank_minimum']; ?>: </td>
<td class="row1" width="40%" nowrap="nowrap"><?php echo $user->lang['RANK_MINIMUM']; ?>: </td>
<td class="row2"><input type="text" name="min_posts" size="5" maxlength="10" value="<?php echo ($rank_info['rank_special']) ? '' : $rank_info['rank_min']; ?>" /></td>
</tr>
<tr>
<td class="row1" width="40%"><?php echo $user->lang['Rank_image']; ?>: <br /><span class="gensmall"><?php echo $user->lang['Rank_image_explain']; ?></span></td>
<td class="row2"><input type="text" name="rank_image" size="40" maxlength="255" value="<?php echo ($rank_info['rank_image'] != '') ? $rank_info['rank_image'] : ''; ?>" /><br /><?php echo ($rank_info['rank_image'] != '') ? '<img src="../' . $rank_info['rank_image'] . '" />' : ''; ?></td>
<td class="row1" width="40%"><?php echo $user->lang['RANK_IMAGE']; ?>: <br /><span class="gensmall"><?php echo $user->lang['RANK_IMAGE_EXPLAIN']; ?></span></td>
<td class="row2" valign="middle"><input type="text" name="rank_image" size="40" maxlength="255" value="<?php echo ($rank_info['rank_image'] != '') ? $rank_info['rank_image'] : ''; ?>" /> &nbsp; <?php echo ($rank_info['rank_image'] != '') ? '<img src="../' . $rank_info['rank_image'] . '" />' : ''; ?></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="mainoption" />&nbsp;&nbsp;<input type="reset" value="<?php echo $user->lang['RESET']; ?>" class="liteoption" /></td>
@ -142,13 +144,13 @@ if ($mode != '')
$rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : 0;
$rank_title = (isset($_POST['title'])) ? trim($_POST['title']) : '';
$special_rank = ($_POST['special_rank'] == 1) ? TRUE : 0;
$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($_POST['rank_image']) : '';
$rank_image = (isset($_POST['rank_image'])) ? trim($_POST['rank_image']) : '';
if ($rank_title == '')
{
trigger_error($user->lang['Must_select_rank']);
trigger_error($user->lang['MUST_SELECT_RANK']);
}
if ($special_rank == 1)
@ -161,7 +163,7 @@ if ($mode != '')
//
if ($rank_image != '')
{
if (!preg_match('/(\.gif|\.png|\.jpg|\.jpeg)$/is', $rank_image))
if (!preg_match('#(\.gif|\.png|\.jpg|\.jpeg)$#is', $rank_image))
{
$rank_image = '';
}
@ -170,40 +172,27 @@ if ($mode != '')
if ($rank_id)
{
$sql = "UPDATE " . RANKS_TABLE . "
SET rank_title = '" . str_replace("\'", "''", $rank_title) . "', rank_special = $special_rank, rank_min = $min_posts, rank_image = '" . str_replace("\'", "''", $rank_image) . "'
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'];
$message = $user->lang['RANK_UPDATED'];
}
else
{
$sql = "INSERT INTO " . RANKS_TABLE . " (rank_title, rank_special, rank_min, rank_image)
VALUES ('" . str_replace("\'", "''", $rank_title) . "', $special_rank, $min_posts, '" . str_replace("\'", "''", $rank_image) . "')";
VALUES ('" . $db->sql_escape($rank_title) . "', $special_rank, $min_posts, '" . $db->sql_escape($rank_image) . "')";
$message = $user->lang['Rank_added'];
$message = $user->lang['RANK_ADDED'];
}
$db->sql_query($sql);
$message .= '<br /><br />' . sprintf($user->lang['Click_return_rankadmin'], '<a href="' . "admin_ranks.$phpEx$SID" . '">', '</a>') . '<br /><br />' . sprintf($user->lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID&amp;pane=right" . '">', '</a>');
trigger_error($message);
}
else if ($mode == 'delete')
{
//
// Ok, they want to delete their rank
//
if (isset($_POST['id']) || isset($_GET['id']))
{
$rank_id = (isset($_POST['id'])) ? intval($_POST['id']) : intval($_GET['id']);
}
else
{
$rank_id = 0;
}
$rank_id = (isset($_REQUEST['id'])) ? intval($_REQUEST['id']) : 0;
if ($rank_id)
{
@ -216,14 +205,12 @@ if ($mode != '')
WHERE user_rank = $rank_id";
$db->sql_query($sql);
$message = $user->lang['Rank_removed'] . '<br /><br />' . sprintf($user->lang['Click_return_rankadmin'], '<a href="' . "admin_ranks.$phpEx$SID" . '">', '</a>') . '<br /><br />' . sprintf($user->lang['Click_return_admin_index'], '<a href="' . "index.$phpEx$SID&amp;pane=right" . '">', '</a>');
trigger_error($message);
trigger_error($user->lang['RANK_REMOVED']);
}
else
{
trigger_error($user->lang['Must_select_rank']);
trigger_error($user->lang['MUST_SELECT_RANK']);
}
}
}
@ -234,15 +221,14 @@ page_header($user->lang['RANKS']);
<h1><?php echo $user->lang['RANKS']; ?></h1>
<p><?php echo $user->lang['Ranks_explain']; ?></p>
<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['Edit']; ?></th>
<th><?php echo $user->lang['DELETE']; ?></th>
<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
@ -263,8 +249,7 @@ if ($row = $db->sql_fetchrow($result))
<td class="<?php echo $row_class; ?>" align="center"><img src="../<?php echo $row['rank_image']; ?>"" border="0" alt="<?php echo $row['rank_title']; ?>" title="<?php echo $row['rank_title']; ?>" /></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&amp;mode=edit&amp;id=" . $row['rank_id']; ?>"><?php echo $user->lang['Edit']; ?></a></td>
<td class="<?php echo $row_class; ?>" align="center"><a href="<?php echo "admin_ranks.$phpEx$SID&amp;mode=delete&amp;id=" . $row['rank_id']; ?>"><?php echo $user->lang['DELETE']; ?></a></td>
<td class="<?php echo $row_class; ?>" align="center">&nbsp;<a href="<?php echo "admin_ranks.$phpEx$SID&amp;mode=edit&amp;id=" . $row['rank_id']; ?>"><?php echo $user->lang['EDIT']; ?></a> | <a href="<?php echo "admin_ranks.$phpEx$SID&amp;mode=delete&amp;id=" . $row['rank_id']; ?>"><?php echo $user->lang['DELETE']; ?></a>&nbsp;</td>
</tr>
<?php
@ -274,7 +259,7 @@ if ($row = $db->sql_fetchrow($result))
?>
<tr>
<td class="cat" colspan="6" align="center"><input type="submit" class="mainoption" name="add" value="<?php echo $user->lang['Add_new_rank']; ?>" /></td>
<td class="cat" colspan="5" align="center"><input type="submit" class="mainoption" name="add" value="<?php echo $user->lang['ADD_RANK']; ?>" /></td>
</tr>
</table></form>