show delete link if user can delete comments
This commit is contained in:
parent
5a2a2fa7e4
commit
9cebbae6b8
2 changed files with 14 additions and 12 deletions
|
@ -101,19 +101,20 @@ class CustomCommentListTheme extends CommentListTheme {
|
||||||
$i_image_id = int_escape($comment->image_id);
|
$i_image_id = int_escape($comment->image_id);
|
||||||
$h_posted = autodate($comment->posted);
|
$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_userlink = "<a class='username' href='".make_link("user/$h_name")."'>$h_name</a>";
|
||||||
$h_dellink = $user->is_admin() ?
|
$h_del = $user->can("delete_comment") ?
|
||||||
"<br>($h_poster_ip, <a ".
|
' - <a onclick="return confirm(\'Delete comment by '.$h_name.':\\n'.$stripped_nonl.'\');" '.
|
||||||
"onclick=\"return confirm('Delete comment by $h_name:\\n".$tfe->stripped."');\" ".
|
'href="'.make_link('comment/delete/'.$i_comment_id.'/'.$i_image_id).'">Del</a>' : '';
|
||||||
"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")."'>>>></a>\n" : "";
|
$h_imagelink = $trim ? "<a href='".make_link("post/view/$i_image_id")."'>>>></a>\n" : "";
|
||||||
if($trim) {
|
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 {
|
else {
|
||||||
return "
|
return "
|
||||||
<table class='comment'><tr>
|
<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>
|
<td>$h_comment</td>
|
||||||
</tr></table>
|
</tr></table>
|
||||||
";
|
";
|
||||||
|
|
|
@ -66,20 +66,21 @@ class CustomCommentListTheme extends CommentListTheme {
|
||||||
$i_comment_id = int_escape($comment->comment_id);
|
$i_comment_id = int_escape($comment->comment_id);
|
||||||
$i_image_id = int_escape($comment->image_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_userlink = "<a href='".make_link("user/$h_name")."'>$h_name</a>";
|
||||||
$h_date = $comment->posted;
|
$h_date = $comment->posted;
|
||||||
$h_dellink = $user->is_admin() ?
|
$h_del = $user->can("delete_comment") ?
|
||||||
" ($h_poster_ip, <a ".
|
' - <a onclick="return confirm(\'Delete comment by '.$h_name.':\\n'.$stripped_nonl.'\');" '.
|
||||||
"onclick=\"return confirm('Delete comment by $h_name:\\n".$tfe->stripped."');\" ".
|
'href="'.make_link('comment/delete/'.$i_comment_id.'/'.$i_image_id).'">Del</a>' : '';
|
||||||
"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>]";
|
$h_reply = "[<a href='".make_link("post/view/$i_image_id")."'>Reply</a>]";
|
||||||
|
|
||||||
if($inner_id == 0) {
|
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 {
|
else {
|
||||||
return "<table><tr><td nowrap class='doubledash'>>></td><td>".
|
return "<table><tr><td nowrap class='doubledash'>>></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>";
|
"</td></tr></table>";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue