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

@@ -351,5 +351,61 @@ function lookupEmail($userid)
return $ob->email;
}
function UserWantsEmail($userid)
{
$result = mysql_query("SELECT * FROM user_prefs WHERE userid = $userid AND name = 'send_email'");
if(!$result || mysql_num_rows($result) == 0)
{
return true;
}
$ob = mysql_fetch_object($result);
return ($ob->value == 'no' ? false : true);
}
/*
* get the email address of people to notify for this appId and versionId
*/
function getNotifyEmailAddressList($appId, $versionId)
{
$aUserId = array();
$c = 0;
$retval = "";
$query = "SELECT userId FROM ".
"appMaintainers WHERE appId = '$appId' " .
"AND versionId = '$versionId';";
$result = mysql_query($query);
if(mysql_num_rows($result) > 0)
{
while($row = mysql_fetch_object($result))
{
$aUserId[$c] = array($row->userId);
$c++;
}
}
$result = mysql_query("SELECT * FROM user_privs WHERE priv = 'admin'");
if(mysql_num_rows($result) > 0)
{
while($row = mysql_fetch_object($result))
{
$i = array_search($row->userid, $aUserId);
if ($aUserId[$i] != array($row->userid))
{
$aUserId[$c] = array($row->userid);
$c++;
}
}
}
if ($c > 0)
{
while(list($index, list($userIdValue)) = each($aUserId))
{
if (UserWantsEmail($userIdValue))
$retval .= lookupEmail($userIdValue)." ";
}
}
return $retval;
}
?>