Set up notify system. Send notify emails for ad and delete Coments

This commit is contained in:
Tony Lambregts
2004-11-09 22:42:12 +00:00
committed by Jeremy Newman
parent c81eebd949
commit 90ac967f43
6 changed files with 147 additions and 6 deletions

View File

@@ -2,6 +2,8 @@
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."application.php");
$appId = strip_tags($_POST['appId']);
$versionId = strip_tags($_POST['versionId']);
@@ -31,7 +33,19 @@ if (!$result)
$ob = mysql_fetch_object($result);
$deletedParentId = $ob->parentId;
/* get the subject and body from the comment */
$result = mysql_query("select * FROM appComments WHERE commentId = '$commentId'");
if (!$result)
{
errorpage('Internal Database Access Error',mysql_error());
exit;
}
$ob = mysql_fetch_object($result);
$body = $ob->body;
$subject = $ob->subject;
/* delete the comment from the database */
$result = mysql_query("DELETE FROM appComments WHERE commentId = '$commentId'");
if (!$result)
@@ -47,6 +61,27 @@ if(!$result)
errorpage('Internal database error fixing up the parentId of child comments');
exit;
}
$email = getNotifyEmailAddressList($appId, $versionId);
if($email)
{
$fullAppName = "Application: ".lookupAppName($appId)." Version: ".lookupVersionName($appId, $versionId);
$ms .= apidb_fullurl("appview.php?appId=$appId&versionId=$versionId")."\n";
$ms .= "\n";
$ms .= ($current->username ? $current->username : "Anonymous")." deleted comment from ".$fullAppName."\n";
$ms .= "\n";
$ms .= "Subject: ".$subject."\n";
$ms .= "\n";
$ms .= $body."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
}
addmsg("mesage sent to: ".$email, green);
addmsg("Comment deleted", "green");
redirect(apidb_fullurl("appview.php?appId=$appId&versionId=$versionId"));