- use mail_appdb() instead of mail() for better error handling and to avoid code duplication

- use \r\n as line separator in mail (RFC compliant)
This commit is contained in:
Jonathan Ernst
2005-01-30 00:57:34 +00:00
committed by WineHQ
parent 4b279975f6
commit 0a839e359a
14 changed files with 267 additions and 355 deletions

View File

@@ -4,7 +4,8 @@
/********************************************/
include("path.php");
include(BASE."include/"."incl.php");
require(BASE."include/incl.php");
require(BASE."include/mail.php");
// set http header to not cache
header("Pragma: no-cache");
@@ -134,20 +135,20 @@ function cmd_send_passwd()
{
if ($user->update($userid, $passwd))
{
$msg = "Application DB Lost Password\n";
$msg .= "----------------------------\n";
$msg .= "We have received a request that you lost your password.\n";
$msg .= "We will create a new password for you. You can then change\n";
$msg .= "your password at the Preferences screen.\n\n";
$msg .= "Your new password is: ".$passwd."\n\n";
$sSubject = "Application DB Lost Password";
$sMsg = "We have received a request that you lost your password.\r\n";
$sMsg .= "We will create a new password for you. You can then change\r\n";
$sMsg .= "your password at the Preferences screen.\r\n";
$sMsg .= "Your new password is: ".$passwd."\r\n";
if (mail($user->lookup_email($userid), '[AppDB] Lost Password', $msg))
if (mail_appdb($user->lookup_email($userid), $sSubject ,$sMsg))
{
addmsg("Your new password has been emailed to you.", "green");
}
else
{
addmsg("Your password has changed, but we could not email it to you. Contact Support!", "red");
addmsg("Your password has changed, but we could not email it to you. Contact Support (".APPDB_OWNER_EMAIL.") !", "red");
}
}
else

View File

@@ -3,10 +3,13 @@
/* code to submit a new comment */
/********************************/
# APPLICATION ENVIRONMENT
/*
* application environment
*/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."application.php");
require(BASE."include/incl.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
// you must be logged in to submit comments
if(!loggedin())
@@ -58,46 +61,35 @@ if(isset($_REQUEST['body']))
{
if (UserWantsEmail($_REQUEST['originator']))
{
$email = lookupEmail($_REQUEST['originator']);
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId'].".\n";
$ms .= "\n";
$ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." added comment to ".$fullAppName."\n";
$ms .= "\n";
$ms .= "Subject: ".$subject."\n";
$ms .= "\n";
$ms .= $_REQUEST['body']."\n";
$ms .= "\n";
$ms .= "------- You are receiving this mail because: -------\n";
$ms .= "Someone posted a comment in response to your comment\n";
$ms .= "to change your preferences go to: http://appdb.winehq.org/preferences.php\n";
$sEmail = lookupEmail($_REQUEST['originator']);
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId'].".\n";
$sMsg .= "\r\n";
$sMsg .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." added comment to ".$sFullAppName."\r\n";
$sMsg .= "\r\n";
$sMsg .= "Subject: ".$subject."\r\n";
$sMsg .= "\r\n";
$sMsg .= $_REQUEST['body']."\r\n";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
mail(stripslashes($email), "[AppDB] (Comment Reply): ".$fullAppName ,$ms);
addmsg("Comment message sent to original poster", "green");
}
}
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($email)
$sEmail = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($sEmail)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId'].".\n";
$ms .= "\n";
$ms .= $_SESSION['current']->realname." added comment to ".$fullAppName."\n";
$ms .= "\n";
$ms .= "Subject: ".$subject."\n";
$ms .= "\n";
$ms .= $_REQUEST['body']."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
}
addmsg("message sent to: ".$email, "green");
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId'].".\r\n";
$sMsg .= "\r\n";
$sMsg .= $_SESSION['current']->realname." added comment to ".$fullAppName."\r\n";
$sMsg .= "\r\n";
$sMsg .= "Subject: ".$subject."\r\n";
$sMsg .= "\r\n";
$mssMsg .= $_REQUEST['body']."\r\n";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
addmsg("New Comment Posted", "green");
}
redirect(apidb_fullurl("appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));

View File

@@ -4,8 +4,9 @@
/************************/
include("path.php");
include(BASE."include/"."incl.php");
require(BASE."include/"."application.php");
require(BASE."include/incl.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
//check for admin privs
if(!loggedin() || (!havepriv("admin") && !$_SESSION['current']->is_maintainer($_REQUEST['appId'],$_REQUEST['versionId'])) )
@@ -39,29 +40,21 @@ if($_REQUEST['sub'] == "Submit")
if (query_appdb("INSERT INTO `appNotes` ({$aInsert['FIELDS']}) VALUES ({$aInsert['VALUES']})"))
{
// successful
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($email)
$sEmail = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($sEmail)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId']);
$fullAppName .= " Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$ms .= "\n";
$ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." added note to ".$fullAppName."\n";
$ms .= "\n";
$ms .= "title: ".$_REQUEST['noteTitle']."\n";
$ms .= "\n";
$ms .= $_REQUEST['noteDesc']."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId']);
$sFullAppName .= " Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\r\n";
$sMsg .= "\r\n";
$sMsg .= $_SESSION['current']->realname." added note to ".$sFullAppName."\r\n";
$sMsg .= "\r\n";
$sMsg .= "title: ".$_REQUEST['noteTitle']."\r\n";
$sMsg .= "\r\n";
$sMsg .= $_REQUEST['noteDesc']."\r\n";
mail( "", "[AppDB] ".$fullAppName ,$ms, "Bcc: ".stripslashes( $email));
} else
{
$email = "no one";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
addmsg("message sent to: ".$email, green);
$statusMessage = "<p>Note added into the database</p>\n";
addmsg($statusMessage,Green);
}

View File

@@ -4,10 +4,11 @@
/********************************************************/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."screenshot.php");
require(BASE."include/"."tableve.php");
require(BASE."include/"."category.php");
require(BASE."include/incl.php");
require(BASE."include/screenshot.php");
require(BASE."include/tableve.php");
require(BASE."include/category.php");
require(BASE."include/mail.php");
apidb_header("Admin Application Data Queue");
@@ -201,15 +202,12 @@ if (!$_REQUEST['queueId'])
//Send Status Email
if (lookupEmail($obj_row->userId))
{
$ms = "Application Data Request Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your submission of an application data for ".appIdToName($obj_row->appId).versionIdToName($obj_row->versionId)." has been accepted. ";
$ms .= $_REQUEST['replyText'];
$ms .= "We appreciate your help in making the Application Database better for all users.\n\n";
$ms .= "Thanks!\n";
$ms .= "-The AppDB admins\n";
$sSubject = "Application Data Request Report";
$sMsg = "Your submission of an application data for ".appIdToName($obj_row->appId).versionIdToName($obj_row->versionId)." has been accepted. ";
$sMsg .= $_REQUEST['replyText'];
$sMsg .= "We appreciate your help in making the Application Database better for all users.\r\n";
mail(stripslashes(lookupEmail($obj_row->userId)),'[AppDB] Application Data Request Report',$ms);
mail_appdb(lookupEmail($obj_row->userId), $sSubject ,$sMsg);
}
//done
@@ -220,14 +218,11 @@ if (!$_REQUEST['queueId'])
{
if (lookupEmail($obj_row->userId))
{
$ms = "Application Data Request Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your submission of an application data for ".appIdToName($obj_row->appId).versionIdToName($obj_row->versionId)." was rejected. ";
$ms .= $_REQUEST['replyText'];
$ms .= "";
$ms .= "-The AppDB admins\n";
mail(stripslashes(lookupEmail($obj_row->userId)),'[AppDB] Application Data Request Report',$ms);
$sSubject = "Application Data Request Report";
$sMsg = "Your submission of an application data for ".appIdToName($obj_row->appId).versionIdToName($obj_row->versionId)." was rejected. ";
$sMsg .= $_REQUEST['replyText'];
mail_appdb(lookupEmail($obj_row->userId), $sSubject ,$sMsg);
}
//delete main item

View File

@@ -4,9 +4,10 @@
/*************************************/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."tableve.php");
require(BASE."include/"."application.php");
require(BASE."include/incl.php");
require(BASE."include/tableve.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
//deny access if not logged in
if(!havepriv("admin"))
@@ -305,38 +306,30 @@ if ($_REQUEST['sub'])
//Send Status Email
if ($ob->queueEmail && $goodtogo)
{
$fullAppName = lookupAppName($_REQUEST['appParent'])." Version: ".lookupVersionName($_REQUEST['appParent'], $_REQUEST['appVersion']);
$sFullAppName = lookupAppName($_REQUEST['appParent'])." Version: ".lookupVersionName($_REQUEST['appParent'], $_REQUEST['appVersion']);
$ms = "Application Database Status Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your application: ".$fullAppName." has been entered ";
$ms .= "into the application database.\n\n";
$ms .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appParent']."&versionId=".$_REQUEST['appVersion']."\n\n";
$ms .= "Thanks!\n\n";
$ms .= $emailtext;
$sSubject = "Application Database Status Report";
$sMsg = "Your application: ".$sFullAppName." has been entered ";
$sMsg .= "into the application database.\r\n";
$sMsg .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appParent']."&versionId=".$_REQUEST['appVersion']."\r\n";
$sMsg .= $emailtext;
mail(stripslashes($ob->queueEmail),'[AppDB] Status Report',$ms);
mail_appdb($ob->queueEmail, $sSubject ,$sMsg);
}
if ($goodtogo)
{
$email = getNotifyEmailAddressList($_REQUEST['appParent'], $_REQUEST['appVersion']);
if($email)
$sEmail = getNotifyEmailAddressList($_REQUEST['appParent'], $_REQUEST['appVersion']);
if($sEmail)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appParent']).
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appParent']).
" Version: ".lookupVersionName($_REQUEST['appParent'], $_REQUEST['appVersion']);
$ms = APPDB_ROOT."appview.php?appId=".$_REQUEST['appParent']."&versionId=".$_REQUEST['appVersion']."\n\n";
$ms .= "New Application added to database:\n\n";
$ms .= $fullAppName."\n\n";
$ms .= STANDARD_NOTIFY_FOOTER;
$sSubject = "New ".$sFullAppName;
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appParent']."&versionId=".$_REQUEST['appVersion']."\r\n";
$sMsg .= "New Application added to database:\r\n";
$sMsg .= $sFullAppName."\r\n";
mail(stripslashes($email), "[AppDB] NEW ".$fullAppName ,$ms);
} else
{
$email = "no one";
mail_appdb($sEmail, $sSubject ,$sMsg);
}
addmsg("message sent to: ".$email, "green");
}
//done
addmsg("<a href=".apidb_fullurl("appview.php")."?appId=".$_REQUEST['appParent']."&versionId=".$_REQUEST['appVersion'].">View App</a>", "green");
@@ -359,20 +352,19 @@ if ($_REQUEST['sub'])
{
if($ob->queueCatId == -1) //app version
{
$fullAppName = lookupAppName($_REQUEST['appParent'])." Version: ".$ob->queueVersion;
$sFullAppName = lookupAppName($_REQUEST['appParent'])." Version: ".$ob->queueVersion;
} else
{
$fullAppName = $ob->queueName." Version: ".$ob->queueVersion;
$sFullAppName = $ob->queueName." Version: ".$ob->queueVersion;
}
$ms = "Application Database Status Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your application: ".$fullAppName." has not been entered ";
$ms .= "into the application database.\n\n";
$ms .= "Sorry!\n\n";
$ms .= $emailtext;
$sSubject = "Application Database Status Report";
$sMsg .= "Your application: ".$sFullAppName." has not been entered ";
$sMsg .= "into the application database.\r\n";
$sMsg .= "Sorry!\r\n";
$sMsg .= $emailtext;
mail(stripslashes($ob->queueEmail),'[AppDB] Status Report',$ms);
mail_appdb($ob->queueEmail, $sSubject ,$sMsg);
}
//success
addmsg("Application was successfully deleted from the Queue.", "green");

View File

@@ -4,10 +4,11 @@
/********************************************************/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."tableve.php");
require(BASE."include/"."category.php");
require_once(BASE."include/"."maintainer.php");
require(BASE."include/incl.php");
require(BASE."include/tableve.php");
require(BASE."include/category.php");
require(BASE."include/maintainer.php");
require(BASE."include/mail.php");
if(!havepriv("admin"))
{
@@ -183,17 +184,15 @@ if ($_REQUEST['sub'])
query_appdb("DELETE from appMaintainerQueue where queueId = ".$_REQUEST['queueId'].";");
//Send Status Email
if (lookupEmail($ob->userId))
$sEmail = lookupEmail($ob->userId);
if ($sEmail)
{
$ms = "Application Maintainer Request Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your application to be the maintainer of ".appIdToName($ob->appId).versionIdToName($ob->versionId)." has been accepted. ";
$ms .= $_REQUEST['replyText'];
$ms .= "We appreciate your help in making the Application Database better for all users.\n\n";
$ms .= "Thanks!\n";
$ms .= "-The AppDB admins\n";
$sSubject = "Application Maintainer Request Report";
$sMsg = "Your application to be the maintainer of ".appIdToName($ob->appId).versionIdToName($ob->versionId)." has been accepted. ";
$sMsg .= $_REQUEST['replyText'];
$sMsg .= "We appreciate your help in making the Application Database better for all users.\n\n";
mail(stripslashes(lookupEmail($ob->userId)),'[AppDB] Maintainer Request Report',$ms);
mail_appdb($sEmail, $sSubject ,$sMsg);
}
//done
@@ -202,16 +201,16 @@ if ($_REQUEST['sub'])
}
else if (($_REQUEST['reject'] || ($_REQUEST['sub'] == 'reject')) && $_REQUEST['queueId'])
{
if (lookupEmail($ob->userId))
$sEmail = lookupEmail($ob->userId);
if ($sEmail)
{
$ms = "Application Maintainer Request Report\n";
$ms .= "----------------------------------\n\n";
$ms .= "Your application to be the maintainer of ".appIdToName($ob->appId).versionIdToName($ob->versionId)." was rejected. ";
$ms .= $_REQUEST['replyText'];
$ms .= "";
$ms .= "-The AppDB admins\n";
$sSubject = "Application Maintainer Request Report";
$sMsg = "Your application to be the maintainer of ".appIdToName($ob->appId).versionIdToName($ob->versionId)." was rejected. ";
$sMsg .= $_REQUEST['replyText'];
$sMsg .= "";
$sMsg .= "-The AppDB admins\n";
mail(stripslashes(lookupEmail($ob->userId)),'[AppDB] Maintainer Request Report',$ms);
mail_appdb($sEmail, $sSubject ,$sMsg);
}
//delete main item

View File

@@ -4,10 +4,11 @@
/**********************************/
include("path.php");
include(BASE."include/"."incl.php");
include(BASE."include/"."tableve.php");
require(BASE."include/"."application.php");
require(BASE."include/"."category.php");
require(BASE."include/incl.php");
require(BASE."include/tableve.php");
require(BASE."include/application.php");
require(BASE."include/category.php");
require(BASE."include/mail.php");
if(!is_numeric($_REQUEST['appId']))
{
@@ -179,24 +180,19 @@ if(isset($_REQUEST['submit']))
}
if ($bAppChanged)
{
$email = getNotifyEmailAddressList($_REQUEST['appId']);
if($email)
$sEmail = getNotifyEmailAddressList($_REQUEST['appId']);
if($sEmail)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId']);
$ms .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."\n";
$ms .= "\n";
$ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." changed ".$fullAppName."\n";
$ms .= "\n";
$ms .= $sWhatChanged."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId']);
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."\r\n";
$sMsg .= "\r\n";
$sMsg .= $_SESSION['current']->realname." changed ".$sFullAppName." \r\n";
$sMsg .= "\r\n";
$sMsg .= $sWhatChanged."\r\n";
$sMsg .= "\r\n";
mail( "", "[AppDB] ".$fullAppName ,$ms, "Bcc: ".stripslashes( $email));
} else
{
$email = "no one";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
addmsg("message sent to: ".$email, green);
}
redirect(apidb_fullurl("appview.php?appId={$_REQUEST['appId']}"));

View File

@@ -4,8 +4,9 @@
/****************/
include("path.php");
include(BASE."include/"."incl.php");
require(BASE."include/"."application.php");
require(BASE."include/incl.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
if(!is_numeric($_REQUEST['noteId']))
{
@@ -33,8 +34,8 @@ if(isset($_REQUEST['sub']))
$sFullAppName = "Application: ".lookupAppName($ob->appId)." Version: ".lookupVersionName($ob->appId, $ob->versionId);
/* Start of e-mail */
$ms = APPDB_ROOT."appview.php?appId={$ob->appId}&versionId={$ob->versionId}"."\n";
$ms .= "\n";
$sMsg = APPDB_ROOT."appview.php?appId={$ob->appId}&versionId={$ob->versionId}\r\n";
$sMsg .= "\r\n";
$sEmail = getNotifyEmailAddressList($ob->appId, $ob->versionId);
@@ -45,22 +46,15 @@ if(isset($_REQUEST['sub']))
if($sEmail)
{
$ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." deleted note from ".$sFullAppName."\n";
$ms .= "\n";
$ms .= "title: ".$sOldNoteTitle."\n";
$ms .= "\n";
$ms .= $sOldNoteDesc."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
$sMsg .= $_SESSION['current']->realname." deleted note from ".$sFullAppName."\r\n";
$sMsg .= "\r\n";
$sMsg .= "title: ".$sOldNoteTitle."\r\n";
$sMsg .= "\r\n";
$sMsg .= $sOldNoteDesc."\r\n";
$sMsg .= "\r\n";
mail( "", "[AppDB] ".$sFullAppName ,$ms, "Bcc: ".stripslashes( $sEmail));
} else
{
$sEmail = "no one";
}
addmsg("message sent to: ".$sEmail, 'green');
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
// success
addmsg("Note Deleted.", "green");
}
@@ -73,26 +67,20 @@ if(isset($_REQUEST['sub']))
if($sEmail)
{
$ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." changed note for ".$sFullAppName."\n";
$ms .= "From --------------------------\n";
$ms .= "title: ".$sOldNoteTitle."\n";
$ms .= "\n";
$ms .= $sOldNoteDesc."\n";
$ms .= "To --------------------------\n";
$ms .= "title: ".$_REQUEST['noteTitle']."\n";
$ms .= "\n";
$ms .= $_REQUEST['noteDesc']."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
$sMsg .= $_SESSION['current']->realname." changed note for ".$sFullAppName."\r\n";
$sMsg .= "From --------------------------\r\n";
$sMsg .= "title: ".$sOldNoteTitle."\r\n";
$sMsg .= "\r\n";
$sMsg .= $sOldNoteDesc."\r\n";
$sMsg .= "To --------------------------\r\n";
$sMsg .= "title: ".$_REQUEST['noteTitle']."\r\n";
$sMsg .= "\r\n";
$sMsg .= $_REQUEST['noteDesc']."\r\n";
$sMsg .= "\r\n";
mail( "", "[AppDB] ".$sFullAppName ,$ms, "Bcc: ".stripslashes( $sEmail));
} else
{
$sEmail = "no one";
}
addmsg("message sent to: ".$sEmail, green);
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
addmsg("Note Updated", "green");
}

View File

@@ -1,10 +1,9 @@
<?php
include("path.php");
include(BASE."include/"."incl.php");
include(BASE."include/"."tableve.php");
require(BASE."include/"."application.php");
require(BASE."include/incl.php");
require(BASE."include/ableve.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
if(!is_numeric($_REQUEST['appId']) OR !is_numeric($_REQUEST['versionId']))
{
@@ -100,30 +99,22 @@ if(isset($_REQUEST['submit1']))
'maintainer_release' => $maintainer_release));
$query = "UPDATE appVersion SET $sUpdate WHERE appId = ".$_REQUEST['appId']." and versionId = ".$_REQUEST['versionId'];
// success
if (query_appdb($query))
{
//success
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($email)
$sEmail = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($sEmail)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$ms .= "\n";
$ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." changed ".$fullAppName."\n";
$ms .= "\n";
$ms .= $WhatChanged."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$sMsg .= APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\r\n";
$sMsg .= "\r\n";
$sMsg .= $_SESSION['current']->realname." changed ".$sFullAppName."\n";
$sMsg .= "\r\n";
$sMsg .= $WhatChanged."\r\n";
$sMsg .= "\r\n";
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
addmsg("message sent to: ".$email, green);
addmsg("The Version was successfully updated in the database", "green");
redirect(apidb_fullurl("appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
}

View File

@@ -6,7 +6,8 @@
##################################################
include("path.php");
include(BASE."include/"."incl.php");
include(BASE."include/incl.php");
include(BASE."include/mail.php");
/*
* Let:
@@ -94,76 +95,40 @@ function deleteMaintainer()
function warnUser($sEmail)
{
$sHeaders = "MIME-Version: 1.0\r\n";
$sHeaders .= "From: AppDB <appdb@winehq.org>\r\n";
$sHeaders .= "Reply-to: AppDB <appdb@winehq.orgl>\r\n";
$sHeaders .= "X-Priority: 3\r\n";
$sHeaders .= "X-Mailer: ".APPDB_OWNER." mailer\r\n";
$sSubject = "Warning: inactivity detected";
$sMsg = "You didn't log in in the past six month to the AppDB.\r\n";
$sMsg .= "Please log in or your account will automatically be deleted in one month.\r\n";
$sMsg = "AppDB Warning: inactivity detected\r\n";
$sMsg .= "-----------------------------------\r\n";
$sMsg .= "You didn't log in in the past six month to the AppDB (".APPDB_OWNER_URL.")\r\n";
$sMsg .= "Please log in or your account will automatically be deleted in one month.\r\n\r\n";
$sMsg .= "Best regards.\r\n";
$sMsg .= "The AppDB team.\r\n";
mail($sEmail, "[AppDB] Warning: inactivity detected", $sMsg, $sHeaders, "-fappdb@winehq.org");
mail_appdb($sEmail, $sSubject, $sMsg);
}
function warnMaintainer($sEmail)
{
$sHeaders = "MIME-Version: 1.0\r\n";
$sHeaders .= "From: AppDB <appdb@winehq.org>\r\n";
$sHeaders .= "Reply-to: AppDB <appdb@winehq.orgl>\r\n";
$sHeaders .= "X-Priority: 3\r\n";
$sHeaders .= "X-Mailer: ".APPDB_OWNER." mailer\r\n";
$sSubject = "Warning: inactivity detected";
$sMsg = "You didn't log in in the past six month to the AppDB.\r\n";
$sMsg .= "As a maintainer we would be pleased to see you once in a while.\r\n";
$sMsg .= "Please log in or you will lose your maintainer's abilities in one month.\r\n";
$sMsg = "AppDB Warning: inactivity detected\r\n";
$sMsg .= "-----------------------------------\r\n";
$sMsg .= "You didn't log in in the past six month to the AppDB (".APPDB_OWNER_URL.")\r\n";
$sMsg .= "As a maintainer we would be pleased to see you once in a while\r\n";
$sMsg .= "Please log in or you will lose your maintainer's abilities in one month.\r\n\r\n";
$sMsg .= "Best regards.\r\n";
$sMsg .= "The AppDB team.\r\n";
mail($sEmail, "[AppDB] Warning: inactivity detected", $sMsg, $sHeaders, "-fappdb@winehq.org");
mail_appdb($sEmail, $sSubject, $sMsg);
}
function warnUserDeleted($sEmail)
{
$sHeaders = "MIME-Version: 1.0\r\n";
$sHeaders .= "From: AppDB <appdb@winehq.org>\r\n";
$sHeaders .= "Reply-to: AppDB <appdb@winehq.orgl>\r\n";
$sHeaders .= "X-Priority: 3\r\n";
$sHeaders .= "X-Mailer: ".APPDB_OWNER." mailer\r\n";
$sSubject = "Warning: account removed";
$sMsg = "You didn't log in in the past seven month to the AppDB.\r\n";
$sMsg .= "As you don't have any data associated to your account we have removed it.\r\n";
$sMsg .= "Please feel free to recreate an account anytime.\r\n";
$sMsg = "AppDB Warning: account removed\r\n";
$sMsg .= "-----------------------------------\r\n";
$sMsg .= "You didn't log in in the past seven month to the AppDB (".APPDB_OWNER_URL.")\r\n";
$sMsg .= "As you don't have any data associated to your account we have removed it.\r\n\r\n";
$sMsg .= "Please feel free to recreate an account anytime.\r\n\r\n";
$sMsg .= "Best regards.\r\n";
$sMsg .= "The AppDB team.\r\n";
mail($sEmail, "[AppDB] Warning: account removed", $sMsg, $sHeaders, "-fappdb@winehq.org");
mail_appdb($sEmail, $sSubject, $sMsg);
}
function warnMaintainerDeleted($sEmail)
{
$sHeaders = "MIME-Version: 1.0\r\n";
$sHeaders .= "From: AppDB <appdb@winehq.org>\r\n";
$sHeaders .= "Reply-to: AppDB <appdb@winehq.orgl>\r\n";
$sHeaders .= "X-Priority: 3\r\n";
$sHeaders .= "X-Mailer: ".APPDB_OWNER." mailer\r\n";
$sSubject = "Warning: maintainer rights revoked\r\n";
$sMsg = "You didn't log in in the past seven month to the AppDB.\r\n";
$sMsg .= "As a result, you are not a maintainer anymore.\r\n";
$sMsg .= "Please feel free to enroll again as a maintainer anytime.\r\n";
$sMsg = "AppDB Warning: maintainer rights revoked\r\n";
$sMsg .= "----------------------------------------\r\n";
$sMsg .= "You didn't log in in the past seven month to the AppDB (".APPDB_OWNER_URL.")\r\n";
$sMsg .= "As a result, you are not a maintainer anymore.\r\n\r\n";
$sMsg .= "Please feel free to enroll again as a maintainer anytime.\r\n\r\n";
$sMsg .= "Best regards.\r\n";
$sMsg .= "The AppDB team.\r\n";
mail($sEmail, "[AppDB] Warning: maintainer rights revoked", $sMsg, $sHeaders, "-fappdb@winehq.org");
mail_appdb($sEmail, $sSubject, $sMsg);
}
?>

View File

@@ -7,8 +7,9 @@
* application environment
*/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."application.php");
require(BASE."include/incl.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
$_REQUEST['appId'] = strip_tags($_REQUEST['appId']);
@@ -95,34 +96,30 @@ if($_SESSION['current']->getpref("confirm_comment_deletion") != "no" &&
exit;
} else
{
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
$sEmail = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
$notify_user_email=lookupEmail($ob->userId);
$notify_user_realname=lookupRealname($ob->userId);
$email .= $notify_user_email;
if($email)
$sEmail .= $notify_user_email;
if($sEmail)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$ms .= "\n";
$ms .= $_SESSION['current']->realname." deleted comment from ".$fullAppName."\n";
$ms .= "\n";
$ms .= "This comment was made on ".substr($ob->time,0,10)." by $notify_user_realname \n";
$ms .= "\n";
$ms .= "Subject: ".$subject."\n";
$ms .= "\n";
$ms .= $body."\n";
$ms .= "\n";
$ms .= "Because:\n";
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$sMsg = APPDB_ROOT."appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\r\n";
$sMsg .= "\r\n";
$sMsg .= $_SESSION['current']->realname." deleted comment from ".$sFullAppName."\r\n";
$sMsg .= "\n";
$sMsg .= "This comment was made on ".substr($ob->time,0,10)." by $notify_user_realname \r\n";
$sMsg .= "\r\n";
$sMsg .= "Subject: ".$subject."\r\n";
$sMsg .= "\r\n";
$sMsg .= $body."\r\n";
$sMsg .= "\r\n";
$sMsg .= "Because:\r\n";
if($_REQUEST['str_why'])
$ms .= stripslashes($_REQUEST['str_why'])."\n";
$sMsg .= stripslashes($_REQUEST['str_why'])."\r\n";
else
$ms .= "No reason given.\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
$email = "no one";
addmsg("message sent to: ".$email, "green");
$sMsg .= "No reason given.\r\n";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
addmsg("Comment deleted", "green");
redirect(apidb_fullurl("appview.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
}

View File

@@ -13,11 +13,9 @@ define("APPDB_THUMBNAIL_HEIGHT","128"); // height of the screenshot's thumbnails
define("APPDB_SCREENSHOT_MAXWIDTH","800"); // width of the screenshot's thumbnails
define("APPDB_SCREENSHOT_MAXHEIGHT","600"); // height of the screenshot's thumbnails
define("APPDB_ROOT", "http://appdb.winehq.org/"); // path to AppDB
define("STANDARD_NOTIFY_FOOTER","------- You are receiving this mail because: -------\n".
"You are a maintainer of this application or an AppDB administrator\n".
"to change your preferences go to: ".APPDB_ROOT."preferences.php\n");
define("APPDB_OWNER","WineHQ"); // with what product/company is this AppDB related ?
define("APPDB_OWNER_URL","http://www.winehq.org/"); // website of this product/company
define("APPDB_OWNER_EMAIL","appdb@winehq.org"); // e-mail of this product/company
define("BUGZILLA_ROOT","http://bugs.winehq.org/"); // path to bugzilla

24
include/mail.php Normal file
View File

@@ -0,0 +1,24 @@
<?php
function mail_appdb($sEmailList,$sSubject,$sMsg)
{
$sHeaders = "MIME-Version: 1.0\r\n";
$sHeaders .= "From: AppDB <".APPDB_OWNER_EMAIL.">\r\n";
$sHeaders .= "Reply-to: AppDB <".APPDB_OWNER_EMAIL.">\r\n";
$sHeaders .= "X-Priority: 3\r\n";
$sHeaders .= "X-Mailer: ".APPDB_OWNER." mailer\r\n";
$sMsg = $sSubject."\r\n---------------------------------------------\r\n".$sMsg;
$sMsg .= "Best regards.\r\n";
$sMsg .= "The AppDB team\r\n";
$sMsg .= APPDB_OWNER_URL."\r\n";
$sMsg .= "\r\n\r\nIf you don't want to receive any other e-mail, please change your preferences:\r\n";
$sMsg .= APPDB_ROOT."preferences.php\r\n";
$bResult = mail($sEmail, "[AppDB] ".$sSubject, $sMsg, $sHeaders, "-f".APPDB_OWNER_EMAIL);
if($bResult)
addmsg("Message sent to: ".$sEmailList, "green");
else
addmsg("Error while sending message to: ".$sEmailList, "red");
return $bResult;
}
?>

View File

@@ -9,9 +9,11 @@
* application environment
*/
include("path.php");
require(BASE."include/"."incl.php");
require(BASE."include/"."screenshot.php");
require(BASE."include/"."application.php");
require(BASE."include/incl.php");
require(BASE."include/screenshot.php");
require(BASE."include/application.php");
require(BASE."include/mail.php");
if($_REQUEST['cmd'])
{
@@ -26,23 +28,16 @@ if($_REQUEST['cmd'])
if($oScreenshot)
{
//success
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($email)
$sEmail = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($sEmail)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms .= APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$ms .= "\n";
$ms .= $_SESSION['current']->realname." added screenshot ".$_REQUEST['screenshot_desc']." to ".$fullAppName."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms = APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\r\n";
$ms .= "\r\n";
$ms .= $_SESSION['current']->realname." added screenshot ".$_REQUEST['screenshot_desc']." to ".$sFullAppName."\r\n";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
addmsg("message sent to: ".$email, "green");
addmsg("The image was successfully added into the database", "green");
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
}
@@ -52,23 +47,16 @@ if($_REQUEST['cmd'])
if($oScreenshot)
{
//success
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($email)
$sEmail = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($sEmail)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms .= APPDB_ROOT."admin/adminAppDataQueue.php?queueId=".mysql_insert_id()."\n";
$ms .= "\n";
$ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "an anonymous user")." submitted a screenshot ".$_REQUEST['screenshot_desc']." for ".$fullAppName."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
}
addmsg("message sent to: ".$email, "green");
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$sMsg = APPDB_ROOT."admin/adminAppDataQueue.php?queueId=".mysql_insert_id()."\n";
$sMsg .= "\r\n";
$sMsg .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "an anonymous user")." submitted a screenshot ".$_REQUEST['screenshot_desc']." for ".$sFullAppName."\n";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
addmsg("The image you submitted will be added to the database database after being reviewed", "green");
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
}
@@ -83,23 +71,16 @@ if($_REQUEST['cmd'])
$oScreenshot = new Screenshot($_REQUEST['imageId']);
if($oScreenshot && $oScreenshot->delete())
{
$email = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($email)
$sEmail = getNotifyEmailAddressList($_REQUEST['appId'], $_REQUEST['versionId']);
if($sEmail)
{
$fullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$ms .= APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$ms .= "\n";
$ms .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." deleted screenshot from ".$fullAppName."\n";
$ms .= "\n";
$ms .= STANDARD_NOTIFY_FOOTER;
$sFullAppName = "Application: ".lookupAppName($_REQUEST['appId'])." Version: ".lookupVersionName($_REQUEST['appId'], $_REQUEST['versionId']);
$sMsg = APPDB_ROOT."screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']."\n";
$sMsg .= "\n";
$sMsg .= ($_SESSION['current']->realname ? $_SESSION['current']->realname : "Anonymous")." deleted screenshot from ".$sFullAppName."\r\n";
mail(stripslashes($email), "[AppDB] ".$fullAppName ,$ms);
} else
{
$email = "no one";
mail_appdb($sEmail, $sFullAppName ,$sMsg);
}
addmsg("message sent to: ".$email, "green");
addmsg("Image deleted", "green");
redirect(apidb_fullurl("screenshots.php?appId=".$_REQUEST['appId']."&versionId=".$_REQUEST['versionId']));
} else