Changeset 1285
- Timestamp:
- 12/30/06 12:45:30 (2 years ago)
- Files:
-
- feedmelinks/comments/delete.php (added)
- feedmelinks/comments/index.php (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
feedmelinks/comments/index.php
r1284 r1285 1 1 <?php 2 2 # $Id$ 3 include_once( " modules/utils.inc.php" );3 include_once( "../modules/utils.inc.php" ); 4 4 $site = getSiteUrl(); 5 5 … … 27 27 include( "$modules/header.inc.php" ); 28 28 $show_comments = true; 29 30 if( $op == "delete" )31 $show_comments = false;32 29 ?> 33 30 … … 36 33 if( $who ) 37 34 echo "Comments by and about $who"; 38 else if( $op == "delete" )39 echo "Delete comment:";40 35 else 41 36 echo "My Comment Activity:"; … … 43 38 </h1> 44 39 <?php 45 if( $op == "delete" && getOwnerForLink( $link ) == $u ) {46 47 $comments = get_file_safe( get_comments_file( $link, $u ));48 if( ! array_key_exists( $comment, $comments ))49 bounceBack();50 51 # cache it for displaying in any error messages52 $c = parse_comment( $comments[ $comment ]);53 echo '"' . $c["comment"] . '"' . " by " . getUserLink( $c["user"] ) . " from " . formatAsSimpleDate( $c["date"]) . " on " . getLink( $link ) . "</p>";54 55 if( $debug )56 echo "<p>comment #$comment</p>";57 58 # back up the comment file so the deletion can be un-done if necessary59 $undo_file = get_undo_file( $u, "comment", "delete" );60 file_append_contents( $undo_file, $link . ":" . $comments[ $comment ]);61 62 # remove the comment line from the array63 $new_comments = $comments;64 unset( $new_comments[ $comment ]);65 if( $debug ) {66 echo "<pre>post deletion";67 print_r( $new_comments );68 }69 70 # write the modified array back into the comment file71 file_put_contents( get_comments_file($link, $u), implode( "", $new_comments ));72 73 # send the user back to the link page with a note that the comment was deleted74 echo bounceTo( "/$link/m/Comment+deleted.", 1 );75 76 }77 40 if( $show_comments ) { 78 41 ?> … … 121 84 echo "<br />\n"; 122 85 echo " <em>$comment</em>\n"; 123 echo " [ <a href='/comments?op=delete&link=$linkId&comment=$line_num'>delete</a>]";86 echo " [" . get_comment_delete_link( $linkId, $line_num ) . "]"; 124 87 125 88 echo "<br />\n"; … … 224 187 echo "<br />\n"; 225 188 echo " <em>$comment</em>\n"; 226 echo " [<a href='/comments?op=delete&link=$linkId&comment=$line_num'>delete</a>]"; 227 echo "<br />\n"; 228 echo "<br />\n"; 189 echo " " . get_comment_delete_link( $linkId, $c - 1 ); 190 echo "<br />\n<br />\n"; 229 191 230 192 $c++;