Skip to content

Commit

Permalink
tidying up code
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@26 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Dec 6, 2000
1 parent 15b61c3 commit 946e256
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 39 deletions.
2 changes: 1 addition & 1 deletion bug_update_advanced_page.php3
Expand Up @@ -172,7 +172,7 @@
</td>
<td bgcolor=<? echo $g_primary_color_light ?> colspan=5>
<select name=f_handler_id>
<option value=""></option>
<option value="">
<?
$query = "SELECT id, username
FROM $g_mantis_user_table
Expand Down
2 changes: 1 addition & 1 deletion bug_update_page.php3
Expand Up @@ -178,7 +178,7 @@
</td>
<td bgcolor=<? echo $g_primary_color_light ?> colspan=5>
<select name=f_handler_id>
<option value=""></option>
<option value="">
<?
$query = "SELECT id, username
FROM $g_mantis_user_table
Expand Down
1 change: 1 addition & 0 deletions bug_view_all_page.php3
Expand Up @@ -114,6 +114,7 @@
$v_summary = string_unsafe( $v_summary );
$lastupdated = date( "m-d", sql_to_unix_time( $v_last_updated ) );

### alternate row colors
if ($i % 2== 0) {
$status_color=$g_primary_color_light;
}
Expand Down
10 changes: 7 additions & 3 deletions main_page.php3
Expand Up @@ -17,16 +17,19 @@
<?
db_mysql_connect( $g_hostname, $g_db_username, $g_db_password, $g_database_name );

### get news count
$query = "SELECT COUNT(id)
FROM $g_mantis_news_table";
$result = mysql_query( $query );
$total_news_count = mysql_result( $result, 0 );

### Show all news items
if ( isset( $f_show ) ) {
$query = "SELECT *
FROM $g_mantis_news_table
ORDER BY id DESC";
}
### Show only $g_limit items
else {
$query = "SELECT *
FROM $g_mantis_news_table
Expand All @@ -48,6 +51,7 @@
$v_body = string_unsafe( $v_body );
$v_date_posted = date( "m-d H:i", sql_to_unix_time( $v_date_posted ) );

## grab the username and email of the poster
$query = "SELECT username, email
FROM $g_mantis_user_table
WHERE id='$v_poster_id'";
Expand Down Expand Up @@ -82,14 +86,14 @@
}
?>

<p>
<div align=center>
<?
if ( $total_news_count > $news_count ) {
PRINT "<p>";
PRINT "<div align=center>";
PRINT "<a href=\"$g_main_page?f_show=all\">more news</a>";
PRINT "</div>";
}
?>
</div>

<? print_footer() ?>
<? print_body_bottom() ?>
Expand Down
3 changes: 2 additions & 1 deletion manage_category_update.php3
Expand Up @@ -15,7 +15,8 @@
exit;
}

$f_category = stripslashes( $f_category );
### remove \ from string
$f_category = string_unsafe( $f_category );
$query = "ALTER TABLE $g_mantis_bug_table
CHANGE category
category ENUM ($f_category)
Expand Down
1 change: 1 addition & 0 deletions manage_create_new_user.php3
Expand Up @@ -15,6 +15,7 @@
exit;
}

### create the almost unique string for each user then insert into the table
$t_cookie_string = create_cookie_string( $f_email );
$t_password = crypt( $f_password );
$query = "INSERT
Expand Down
6 changes: 0 additions & 6 deletions manage_create_user_page.php3
Expand Up @@ -22,12 +22,6 @@
header( "Location: $g_logout_page" );
exit;
}

$query = "SELECT *
FROM $g_mantis_user_table
ORDER BY username";
$result = db_mysql_query($query);
$row_count = mysql_num_rows($result);
?>

<p>
Expand Down
31 changes: 17 additions & 14 deletions manage_page.php3
Expand Up @@ -28,6 +28,7 @@
$f_sort = "username";
}

### Get the user data in $f_sort order
$query = "SELECT *
FROM $g_mantis_user_table
ORDER BY '$f_sort' ASC";
Expand Down Expand Up @@ -98,10 +99,14 @@
</tr>
<?
for ($i=0;$i<$user_count;$i++) {
### prefix user data with u_
$row = mysql_fetch_array($result);
extract( $row, EXTR_PREFIX_ALL, "v" );
$v_date_created = date( "m-d H:i", sql_to_unix_time( $v_date_created ) );
$v_last_visit = date( "m-d H:i", sql_to_unix_time( $v_last_visit ) );
extract( $row, EXTR_PREFIX_ALL, "u" );

$u_date_created = date( "m-d H:i", sql_to_unix_time( $u_date_created ) );
$u_last_visit = date( "m-d H:i", sql_to_unix_time( $u_last_visit ) );

### alternate row colors
if ( $i % 2 == 1) {
$bgcolor=$g_primary_color_dark;
}
Expand All @@ -111,38 +116,36 @@
?>
<tr bgcolor=<? echo $bgcolor ?>>
<td>
<? echo $v_username ?>
<? echo $u_username ?>
</td>
<td>
<a href="mailto:<? echo $v_email ?>"><? echo $v_email ?></a>
<a href="mailto:<? echo $u_email ?>"><? echo $u_email ?></a>
</td>
<td align=center>
<?
echo $v_access_level;
?>
<? echo $u_access_level ?>
</td>
<td align=center>
<? echo $v_enabled ?>
<? echo $u_enabled ?>
</td>
<td align=center>
<?
if ( $v_protected=="on" ) {
if ( $u_protected=="on" ) {
echo "x";
}
?>
</td>
<td align=center>
<? echo $v_date_created ?>
<? echo $u_date_created ?>
</td>
<td align=center>
<? echo $v_last_visit ?>
<? echo $u_last_visit ?>
</td>
<td align=center>
<a href="<? echo $g_manage_user_page ?>?f_id=<? echo $v_id ?>">edit user</a>
<a href="<? echo $g_manage_user_page ?>?f_id=<? echo $u_id ?>">edit user</a>
</td>
</tr>
<?
}
} ### end for
?>
</table>
</td>
Expand Down
27 changes: 14 additions & 13 deletions manage_user_page.php3
Expand Up @@ -23,12 +23,13 @@
exit;
}

### grab user data and prefix with u_
$query = "SELECT *
FROM $g_mantis_user_table
WHERE id='$f_id'";
$result = db_mysql_query($query);
$row = mysql_fetch_array($result);
extract( $row, EXTR_PREFIX_ALL, "v" );
extract( $row, EXTR_PREFIX_ALL, "u" );
?>

<p>
Expand All @@ -41,7 +42,7 @@
<td bgcolor=<? echo $g_white_color ?>>
<table width=100%>
<form method=post action="<? echo $g_manage_user_update ?>?f_action=update">
<input type=hidden name=f_id value="<? echo $v_id ?>">
<input type=hidden name=f_id value="<? echo $u_id ?>">
<tr>
<td colspan=3 bgcolor=<? echo $g_white_color ?>>
<b>Edit User</b>
Expand All @@ -52,15 +53,15 @@
Username:
</td>
<td colspan=2>
<input type=text size=16 name=f_username value="<? echo $v_username ?>">
<input type=text size=16 name=f_username value="<? echo $u_username ?>">
</td>
</tr>
<tr bgcolor=<? echo $g_primary_color_light ?>>
<td>
Email:
</td>
<td colspan=2>
<input type=text size=32 name=f_email value="<? echo $v_email ?>">
<input type=text size=32 name=f_email value="<? echo $u_email ?>">
</td>
</tr>
<tr bgcolor=<? echo $g_primary_color_dark ?>>
Expand All @@ -69,11 +70,11 @@
</td>
<td colspan=2>
<select name=f_access_level>
<option value="viewer" <? if ( $v_access_level=="viewer" ) echo "SELECTED" ?>>viewer
<option value="reporter" <? if ( $v_access_level=="reporter" ) echo "SELECTED" ?>>reporter
<option value="updater" <? if ( $v_access_level=="updater" ) echo "SELECTED" ?>>updater
<option value="developer" <? if ( $v_access_level=="developer" ) echo "SELECTED" ?>>developer
<option value="administrator" <? if ( $v_access_level=="administrator" ) echo "SELECTED" ?>>administrator
<option value="viewer" <? if ( $u_access_level=="viewer" ) echo "SELECTED" ?>>viewer
<option value="reporter" <? if ( $u_access_level=="reporter" ) echo "SELECTED" ?>>reporter
<option value="updater" <? if ( $u_access_level=="updater" ) echo "SELECTED" ?>>updater
<option value="developer" <? if ( $u_access_level=="developer" ) echo "SELECTED" ?>>developer
<option value="administrator" <? if ( $u_access_level=="administrator" ) echo "SELECTED" ?>>administrator
</select>
</td>
</tr>
Expand All @@ -82,15 +83,15 @@
Enabled
</td>
<td colspan=2>
<input type=checkbox name=f_enabled <? if ( $v_enabled=="on" ) echo "CHECKED" ?>>
<input type=checkbox name=f_enabled <? if ( $u_enabled=="on" ) echo "CHECKED" ?>>
</td>
</tr>
<tr bgcolor=<? echo $g_primary_color_dark ?>>
<td>
Protected
</td>
<td colspan=2>
<input type=checkbox name=f_protected <? if ( $v_protected=="on" ) echo "CHECKED" ?>>
<input type=checkbox name=f_protected <? if ( $u_protected=="on" ) echo "CHECKED" ?>>
</td>
</tr>
<tr align=center>
Expand All @@ -100,13 +101,13 @@
</form>
<form method=post action="<? echo $g_manage_user_update ?>?f_action=reset">
<td>
<input type=hidden name=f_id value="<? echo $v_id ?>">
<input type=hidden name=f_id value="<? echo $u_id ?>">
<input type=submit value=" Reset Password ">
</td>
</form>
<form method=post action="<? echo $g_manage_user_update ?>?f_action=delete">
<td>
<input type=hidden name=f_id value="<? echo $v_id ?>">
<input type=hidden name=f_id value="<? echo $u_id ?>">
<input type=submit value=" Delete User ">
</td>
</form>
Expand Down

0 comments on commit 946e256

Please sign in to comment.