1
0
Fork 0
mirror of https://github.com/sbrl/Pepperminty-Wiki.git synced 2024-11-21 16:13:00 +00:00

Add new email_debug_dontsend setting

This commit is contained in:
Starbeamrainbowlabs 2019-12-23 17:53:46 +00:00
parent 1602fab2c3
commit 1686ee33d3
Signed by: sbrl
GPG key ID: 1BE5172E637709C2
3 changed files with 15 additions and 1 deletions

View file

@ -9,6 +9,7 @@ This file holds the changelog for Pepperminty Wiki. This is the master list of t
- Fixed link loop when logging in for crawlers
- [security] Bugfix: Don't leak the PHP version in emails when expose_php is turned off
- Fixed handling of Unicode characters when emailing users - added new `email_subject_utf8` and `email_body_utf8` settings to control the new behaviour
- Add new `email_debug_dontsend` setting for debugging emails sent by Pepperminty Wiki
## Changed
- Improved the search indexing system performance - again

View file

@ -730,7 +730,19 @@ function email_user($username, $subject, $body)
foreach($headers as $header => $value)
$compiled_headers .= "$header: $value\r\n";
return mail($settings->users->{$username}->emailAddress, $subject, $body, $compiled_headers, "-t");
if($settings->email_debug_dontsend) {
error_log("[email] Username: $username ({$settings->users->{$username}->emailAddress})
Subject: $subject
----- Headers -----
$compiled_headers
-------------------
----- Body -----
$body
----------------");
return true;
}
else
return mail($settings->users->{$username}->emailAddress, $subject, $body, $compiled_headers, "-t");
}
/**
* Sends a plain text email to a list of users, replacing {username} with each user's name.

View file

@ -228,6 +228,7 @@
"search_tags_matches_weighting": { "type": "number", "description": "The weighting to give to search term matches found in a page's tags.", "default": 3},
"dynamic_page_suggestion_count": { "type": "number", "description": "The number of dynamic page name suggestions to fetch from the server when typing in the page search box. Note that lowering this number doesn't <em>really</em> improve performance. Set to 0 to disable.", "default": 7 },
"defaultaction": { "type": "text", "description": "The default action. This action will be performed if no other action is specified. It is recommended you set this to \"view\" - that way the user automatically views the default page (see above).", "default": "view" },
"email_debug_dontsend": { "type": "checkbox", "description": "If set to true, emails are logged to the standard error instead of being actually sent.", "default": false },
"email_subject_utf8": { "type": "checkbox", "description": "Whether to encode the subject of emails sent to allow them to contain unicode characters. Without this, email subjects will be transliterated to ASCII. If utf-8 email subjects are disabled, page names may not be represented properly.", "default": true },
"email_body_utf8": { "type": "checkbox", "description": "Whether to send emails with utf-8 bodies. If set to false, email bodies will be transliterated to ASCII. If utf-8 email bodies are disabled, page names may not be represented properly.", "default": true },
"updateurl": { "type": "url", "description": "The url from which to fetch updates. Defaults to the master (development) branch. MAKE SURE THAT THIS POINTS TO A *HTTPS* URL, OTHERWISE SOMEONE COULD INJECT A VIRUS INTO YOUR WIKI!", "default": "https://raw.githubusercontent.com/sbrl/pepperminty-wiki/master/index.php" },