Changeset:
f66e8dc3bcf9
https://sourceforge.net/p/mrbs/hg-code/ci/f66e8dc3bcf9877ae39c0ad9615eb46efcfc92b9
Author:
Campbell Morrison <[email protected]>
Date:
Sun Oct 18 07:19:56 2015 +0100
Log message:
Restructured mail debug code and made default output destination the error_log,
for consistency with ldap debugging.
diffstat:
web/functions_mail.inc | 34 +++++++++++++++++++---------------
web/systemdefaults.inc.php | 4 ++--
2 files changed, 21 insertions(+), 17 deletions(-)
diffs (64 lines):
diff -r 3a6efc27573c -r f66e8dc3bcf9 web/functions_mail.inc
--- a/web/functions_mail.inc Sat Oct 17 23:20:39 2015 +0100
+++ b/web/functions_mail.inc Sun Oct 18 07:19:56 2015 +0100
@@ -1085,27 +1085,31 @@
* @return bool TRUE or PEAR error object if fails
*/
+function debug_output($message)
+{
+ global $mail_settings;
+
+ if (isset($mail_settings['debug_output']) &&
+ ($mail_settings['debug_output'] == 'browser'))
+ {
+ echo htmlspecialchars($message) . "<br>\n";
+ // flush in case they have output_buffering configured on
+ ob_flush();
+ flush();
+ }
+ else // anything else goes to the error log
+ {
+ error_log($message);
+ }
+}
function mail_debug($message)
{
global $mail_settings;
- if (!$mail_settings['debug'])
+ if ($mail_settings['debug'])
{
- return;
- }
-
- $full_message = '[DEBUG] ' . $message;
-
- if ($mail_settings['debug_output'] == 'log')
- {
- error_log($full_message);
- }
- else // anything else goes to the browser
- {
- echo htmlspecialchars($full_message) . "<br>\n";
- ob_flush();
- flush();
+ debug_output('[DEBUG] ' . $message);
}
}
diff -r 3a6efc27573c -r f66e8dc3bcf9 web/systemdefaults.inc.php
--- a/web/systemdefaults.inc.php Sat Oct 17 23:20:39 2015 +0100
+++ b/web/systemdefaults.inc.php Sun Oct 18 07:19:56 2015 +0100
@@ -1036,8 +1036,8 @@
// are being called in the first place (b) whether there are addresses to send
email to and (c)
// the result of the mail sending operation.
$mail_settings['debug'] = FALSE;
-// Where to send the debug output to. Can be 'browser' or 'log' (for the
error_log)
-$mail_settings['debug_output'] = 'browser';
+// Where to send the debug output. Can be 'browser' or 'log' (for the
error_log)
+$mail_settings['debug_output'] = 'log';
// Set this to TRUE if you do not want any email sent, whatever the rest of
the settings.
// This is a global setting that will override anything else. Useful when
testing MRBS.
------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits