Changeset 1286 for feedmelinks/comments/delete.php
- Timestamp:
- 12/30/06 15:44:39 (2 years ago)
- Files:
-
- feedmelinks/comments/delete.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
feedmelinks/comments/delete.php
r1285 r1286 21 21 <h1> Delete comment: </h1> 22 22 <?php 23 if( getOwnerForLink( $link ) != $u )24 bounceBack();25 26 $comments = get_file_safe( get_comments_file( $link, $u ));23 $owner = getOwnerForLink( $link ); 24 $comments = get_file_safe( get_comments_file( $link, $owner )); 25 26 # verify that the comment being deleted exists: 27 27 if( ! array_key_exists( $comment, $comments )) 28 28 bounceBack(); 29 30 # extract the fields: 31 $c = parse_comment( $comments[ $comment ]); 32 $commenter = $c["user"]; 33 34 if( $owner != $u && $commenter != $u ) 35 echo bounceBack(); 29 36 30 37 # cache it for displaying in any error messages 31 $c = parse_comment( $comments[ $comment ]); 32 echo '"' . $c["comment"] . '"' . " by " . getUserLink( $c["user"] ) . " from " . formatAsSimpleDate( $c["date"]) . " on " . getLink( $link ) . "</p>"; 38 echo '"' . $c["comment"] . '"' . " by " . getUserLink( $commenter ) . " from " . formatAsSimpleDate( $c["date"]) . " on " . getLink( $link ) . "</p>"; 33 39 34 40 if( $debug ) … … 36 42 37 43 # back up the comment file so the deletion can be un-done if necessary 38 $undo_file = get_undo_file( $u, "comment", "delete" ); 44 $undo_file = get_undo_file( $u, "comment", "delete" ); # note that the COMMENTER owns the undo - not the link-owner 39 45 file_append_contents( $undo_file, $link . ":" . $comments[ $comment ]); 40 46 … … 48 54 49 55 # write the modified array back into the comment file 50 file_put_contents( get_comments_file($link, $ u), implode( "", $new_comments ));56 file_put_contents( get_comments_file($link, $owner), implode( "", $new_comments )); 51 57 52 58 # send the user back to the link page with a note that the comment was deleted 53 echo bounceTo( "/$link/m/Comment+deleted.", 1 );59 echo bounceTo( $from ? "$from?mesg=Comment+from+$commenter+deleted." : "/$link/m/Comment+from+$commenter+deleted.", 1 ); 54 60 ?> 55 61