show delete link if user can delete comments

This commit is contained in:
Shish 2012-03-31 15:46:21 +01:00
parent 5a2a2fa7e4
commit 9cebbae6b8
2 changed files with 14 additions and 12 deletions

View file

@ -101,19 +101,20 @@ class CustomCommentListTheme extends CommentListTheme {
$i_image_id = int_escape($comment->image_id);
$h_posted = autodate($comment->posted);
$stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
$stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
$h_userlink = "<a class='username' href='".make_link("user/$h_name")."'>$h_name</a>";
$h_dellink = $user->is_admin() ?
"<br>($h_poster_ip, <a ".
"onclick=\"return confirm('Delete comment by $h_name:\\n".$tfe->stripped."');\" ".
"href='".make_link("comment/delete/$i_comment_id/$i_image_id")."'>Del</a>)" : "";
$h_del = $user->can("delete_comment") ?
' - <a onclick="return confirm(\'Delete comment by '.$h_name.':\\n'.$stripped_nonl.'\');" '.
'href="'.make_link('comment/delete/'.$i_comment_id.'/'.$i_image_id).'">Del</a>' : '';
$h_imagelink = $trim ? "<a href='".make_link("post/view/$i_image_id")."'>&gt;&gt;&gt;</a>\n" : "";
if($trim) {
return "<p class='comment'>$h_userlink $h_dellink<br/>$h_posted<br/>$h_comment</p>";
return "<p class='comment'>$h_userlink $h_del<br/>$h_posted<br/>$h_comment</p>";
}
else {
return "
<table class='comment'><tr>
<td class='meta'>$h_userlink<br/>$h_posted$h_dellink</td>
<td class='meta'>$h_userlink<br/>$h_posted$h_del</td>
<td>$h_comment</td>
</tr></table>
";

View file

@ -66,20 +66,21 @@ class CustomCommentListTheme extends CommentListTheme {
$i_comment_id = int_escape($comment->comment_id);
$i_image_id = int_escape($comment->image_id);
$stripped_nonl = str_replace("\n", "\\n", substr($tfe->stripped, 0, 50));
$stripped_nonl = str_replace("\r", "\\r", $stripped_nonl);
$h_userlink = "<a href='".make_link("user/$h_name")."'>$h_name</a>";
$h_date = $comment->posted;
$h_dellink = $user->is_admin() ?
" ($h_poster_ip, <a ".
"onclick=\"return confirm('Delete comment by $h_name:\\n".$tfe->stripped."');\" ".
"href='".make_link("comment/delete/$i_comment_id/$i_image_id")."'>Del</a>)" : "";
$h_del = $user->can("delete_comment") ?
' - <a onclick="return confirm(\'Delete comment by '.$h_name.':\\n'.$stripped_nonl.'\');" '.
'href="'.make_link('comment/delete/'.$i_comment_id.'/'.$i_image_id).'">Del</a>' : '';
$h_reply = "[<a href='".make_link("post/view/$i_image_id")."'>Reply</a>]";
if($inner_id == 0) {
return "<div class='comment' style='margin-top: 8px;'>$h_userlink$h_dellink $h_date No.$i_comment_id $h_reply<p>$h_comment</p></div>";
return "<div class='comment' style='margin-top: 8px;'>$h_userlink$h_del $h_date No.$i_comment_id $h_reply<p>$h_comment</p></div>";
}
else {
return "<table><tr><td nowrap class='doubledash'>&gt;&gt;</td><td>".
"<div class='reply'>$h_userlink$h_dellink $h_date No.$i_comment_id $h_reply<p>$h_comment</p></div>" .
"<div class='reply'>$h_userlink$h_del $h_date No.$i_comment_id $h_reply<p>$h_comment</p></div>" .
"</td></tr></table>";
}
}