- people can tell why they delete comments again

This commit is contained in:
Jonathan Ernst
2005-03-12 17:13:08 +00:00
committed by WineHQ
parent cd54d6d02b
commit 12a7858235
3 changed files with 54 additions and 16 deletions

View File

@@ -26,19 +26,6 @@ if($_REQUEST['what'])
{ {
switch($_REQUEST['what']) switch($_REQUEST['what'])
{ {
case "comment":
$oComment = new Comment($_REQUEST['commentId']);
if( !$_SESSION['current']->isMaintainer($oComment->iVersionId)
&& !$_SESSION['current']->isSuperMaintainer($oComment->iAppId)
&& !$_SESSION['current']->hasPriv("admin") )
{
errorpage();
} else
{
$oComment->delete();
redirect(BASE."appview.php?versionId=".$oComment->iVersionId);
}
break;
case "category": case "category":
// delete category and the apps in it // delete category and the apps in it
$oCategory = new Category($_REQUEST['catId']); $oCategory = new Category($_REQUEST['catId']);

53
deletecomment.php Normal file
View File

@@ -0,0 +1,53 @@
<?php
/*******************/
/* delete comments */
/*******************/
/*
* application environment
*/
include("path.php");
require(BASE."include/incl.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
$oComment = new Comment($_REQUEST['commentId']);
/* if we aren't an admin or the maintainer of this app we shouldn't be */
/* allowed to delete any comments */
if (!$_SESSION['current']->hasPriv("admin")
&& !$_SESSION['current']->isMaintainer($oComment->iVersionId)
&& !$_SESSION['current']->isSuperMaintainer($oComment->iAppId))
{
errorpage('You don\'t have sufficient privileges to delete this comment.');
exit;
}
if($_SESSION['current']->getPref("confirm_comment_deletion") != "no" && !isset($_REQUEST['int_delete_it']))
{
apidb_header("Delete Comment");
$mesTitle = "<b>Please state why you are deleting the following comment</b>";
echo "<form method=\"POST\" action=\"".$_SERVER['PHP_SELF']."\">\n";
echo html_frame_start($mesTitle,500,"",0);
echo "<br />";
echo html_frame_start($oComment->sSubject,500);
echo htmlify_urls($oComment->sBody), "<br /><br />\n";
echo html_frame_end();
echo '<table width="100%" border=0 cellpadding=0 cellspacing=1>',"\n";
echo "<tr class=color1><td colspan=2><textarea name=\"str_why\" cols=\"70\" rows=\"15\" wrap=\"virtual\"></textarea></td></tr>\n";
echo "<tr class=color1><td colspan=2 align=center>\n";
echo " <input type=\"SUBMIT\" value=\"Delete Comment\" class=\"button\" />\n";
echo "</td></tr>\n";
echo "</table>\n";
echo html_frame_end();
echo "<input type=\"HIDDEN\" name=\"int_delete_it\" value=\"1\" />\n";
echo "<input type=\"hidden\" name=\"commentId\" value=\"".$oComment->iCommentId."\" />";
echo "</form>";
apidb_footer();
} else
{
$oComment->delete($_REQUEST['str_why']);
redirect(apidb_fullurl("appview.php?versionId=".$oComment->iVersionId));
}
?>

View File

@@ -230,10 +230,8 @@ function view_app_comment($ob)
|| $_SESSION['current']->isSuperMaintainer($ob->appId)) || $_SESSION['current']->isSuperMaintainer($ob->appId))
{ {
echo "<tr>"; echo "<tr>";
echo "<td><form method=\"post\" name=\"message\" action=\"".BASE."admin/deleteAny.php\"><input type=\"submit\" value=\"Delete\" class=\"button\">\n"; echo "<td><form method=\"post\" name=\"message\" action=\"".BASE."deletecomment.php\"><input type=\"submit\" value=\"Delete\" class=\"button\">\n";
echo "<input type=\"hidden\" name=\"commentId\" value=\"$ob->commentId\" />"; echo "<input type=\"hidden\" name=\"commentId\" value=\"$ob->commentId\" />";
echo "<input type=\"hidden\" name=\"confirmed\" value=\"yes\" />";
echo "<input type=\"hidden\" name=\"what\" value=\"comment\" />";
echo "</form>\n"; echo "</form>\n";
echo "</td></tr>"; echo "</td></tr>";
} }