appdb/include config.php.sample mail.php

WineHQ wineowner at wine.codeweavers.com
Mon Apr 23 18:36:32 CDT 2007


ChangeSet ID:	31094
CVSROOT:	/opt/cvs-commit
Module name:	appdb
Changes by:	wineowner at winehq.org	2007/04/23 18:36:32

Modified files:
	include        : config.php.sample mail.php 

Log message:
	Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
	Add debug option to output e-mail on screen. Useful for testing that mails look correct.

Patch: http://cvs.winehq.org/patch.py?id=31094

Old revision  New revision  Changes     Path
 1.13          1.14          +6 -0       appdb/include/config.php.sample
 1.7           1.8           +11 -0      appdb/include/mail.php

Index: appdb/include/config.php.sample
diff -u -p appdb/include/config.php.sample:1.13 appdb/include/config.php.sample:1.14
--- appdb/include/config.php.sample:1.13	23 Apr 2007 23:36:32 -0000
+++ appdb/include/config.php.sample	23 Apr 2007 23:36:32 -0000
@@ -23,6 +23,12 @@ define("BUGZILLA_ROOT","http://bugs.wine
 //if(!defined("DISABLE_EMAIL"))
 // define("DISABLE_EMAIL", true); // disable email, see mail_appdb() in include/mail.php
 
+// AppDB developers: Use this define to print the contents of the e-mail instead
+// of sending it, useful for testing e-mail notifications.  Has no effect if
+// DISABLE_EMAIL is set
+//if(!defined("PRINT_EMAIL"))
+// define("PRINT_EMAIL", true); // print email, see mail_appdb() in include/mail.php
+
 /*
  * apps database info
  */
Index: appdb/include/mail.php
diff -u -p appdb/include/mail.php:1.7 appdb/include/mail.php:1.8
--- appdb/include/mail.php:1.7	23 Apr 2007 23:36:32 -0000
+++ appdb/include/mail.php	23 Apr 2007 23:36:32 -0000
@@ -21,6 +21,17 @@ function mail_appdb($sEmailList,$sSubjec
     $sMsg .= "\n\nIf you don't want to receive any other e-mail, please change your preferences:\n";
     $sMsg .= APPDB_ROOT."preferences.php\n";
 
+    /* Print the message to the screen instead of sending it, if the PRINT_EMAIL
+       option is set.  Output in purple to distinguish it from other messages */
+    if(defined("PRINT_EMAIL"))
+    {
+        $sMsg = str_replace("\n", "<br />", $sMsg);
+        addmsg("This mail would have been sent<br /><br />".
+               "Subject: $sSubject<br /><br />".
+               "Body:<br />$sMsg", "purple");
+        return;
+    }
+
     $bResult = mail(str_replace(" ",",",$sEmailList), "[AppDB] ".$sSubject, $sMsg, $sHeaders, "-f".APPDB_OWNER_EMAIL);
     if($bResult)
         addmsg("Message sent to: ".$sEmailList, "green");



More information about the wine-cvs mailing list