Set up notify system. Send notify emails for ad and delete Coments
This commit is contained in:
committed by
Jeremy Newman
parent
c81eebd949
commit
90ac967f43
@@ -76,3 +76,24 @@ class Application {
|
||||
return $list;
|
||||
}
|
||||
}
|
||||
|
||||
function lookupVersionName($appId, $versionId)
|
||||
{
|
||||
$result = mysql_query("SELECT versionName FROM appVersion WHERE versionId = $versionId and appId = $appId");
|
||||
if(!$result || mysql_num_rows($result) != 1)
|
||||
return null;
|
||||
$ob = mysql_fetch_object($result);
|
||||
return $ob->versionName;
|
||||
}
|
||||
|
||||
|
||||
function lookupAppName($appId)
|
||||
{
|
||||
$result = mysql_query("SELECT appName FROM appFamily WHERE appId = $appId");
|
||||
if(!$result || mysql_num_rows($result) != 1)
|
||||
return null;
|
||||
$ob = mysql_fetch_object($result);
|
||||
return $ob->appName;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -238,4 +238,9 @@ function dumpmsgbuffer()
|
||||
mysql_query("DELETE FROM sessionMessages WHERE sessionId = '$PHPSESSID'");
|
||||
}
|
||||
|
||||
define("STANDARD_NOTIFY_FOOTER","------- You are receiving this mail because: -------\n".
|
||||
"You are an maintainer of this app or an appdb administrator\n".
|
||||
"to change your preverences go to: http://appdb.winehq.org/preferences.php\n");
|
||||
|
||||
|
||||
?>
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user