Skip to content

Commit

Permalink
Tidied up news code
Browse files Browse the repository at this point in the history
git-svn-id: http://mantisbt.svn.sourceforge.net/svnroot/mantisbt/trunk@16 f5dc347c-c33d-0410-90a0-b07cc1902cb9
  • Loading branch information
Kenzaburo Ito committed Dec 5, 2000
1 parent 754adb7 commit d344e53
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
2 changes: 2 additions & 0 deletions news_add.php3
Expand Up @@ -15,8 +15,10 @@
exit;
}

### " character poses problem when editting so let's just convert them
$f_headline = string_safe( str_replace( "\"", "'", $f_headline ) );
$f_body = string_safe( $f_body );
### Add item
$query = "INSERT
INTO $g_mantis_news_table
( id, poster_id, date_posted, last_modified, headline, body )
Expand Down
1 change: 1 addition & 0 deletions news_delete.php3
Expand Up @@ -15,6 +15,7 @@
exit;
}

### Delete the news entry
$query = "DELETE
FROM $g_mantis_news_table
WHERE id='$f_id'";
Expand Down
4 changes: 2 additions & 2 deletions news_edit_page.php3
Expand Up @@ -15,13 +15,13 @@
exit;
}

### deleting news items
### If Deleteing item redirect to delete script
if ( $f_action=="delete") {
header( "Location: $g_news_delete?f_id=$f_id" );
exit;
}

### editing news item
### Retrieve new item data and prefix with v_
$query = "SELECT *
FROM $g_mantis_news_table
WHERE id='$f_id'";
Expand Down
8 changes: 5 additions & 3 deletions news_menu_page.php3
Expand Up @@ -15,6 +15,7 @@
exit;
}

### Get user information and prefix with u_
$query = "SELECT *
FROM $g_mantis_user_table
WHERE cookie_string='$g_string_cookie_val'";
Expand Down Expand Up @@ -103,14 +104,15 @@
<td width=75%>
<select name=f_id>
<?
### Get current headlines and id prefix with v_
$query = "SELECT id, headline
FROM $g_mantis_news_table
ORDER BY id DESC";
$result = db_mysql_query($query);
$result = db_mysql_query( $query );
$news_count = mysql_num_rows( $ result );

for ($i=0;$i<$news_count;$i++) {
$row = mysql_fetch_array($result);
$row = mysql_fetch_array( $result );
extract( $row, EXTR_PREFIX_ALL, "v" );
$v_headline = string_unsafe( $v_headline );

Expand All @@ -122,7 +124,7 @@
</tr>
<tr>
<td align=center colspan=2>
<input type=submit value=" Edit Post ">
<input type=submit value=" Edit Post ">
</td>
</form>
</tr>
Expand Down
4 changes: 3 additions & 1 deletion news_update.php3
Expand Up @@ -15,8 +15,10 @@
exit;
}

$f_headline = string_safe( $f_headline );
### " character poses problem when editting so let's just convert them
$f_headline = string_safe( str_replace( "\"", "'", $f_headline ) );
$f_body = string_safe( $f_body );
### Update entry
$query = "UPDATE $g_mantis_news_table
SET headline='$f_headline', body='$f_body', last_modified=NOW()
WHERE id='$f_id'";
Expand Down

0 comments on commit d344e53

Please sign in to comment.