From 4db50a3ecb790eb880f8bc32e6a9343f2ed5abb0 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Sat, 23 Feb 2013 09:31:34 -0700 Subject: [PATCH 1/2] admin option to disable post content in email notifications for the site --- include/enotify.php | 7 ++++++- mod/admin.php | 4 ++++ view/admin_site.tpl | 1 + view/email_notify_html.tpl | 3 +++ view/email_notify_text.tpl | 7 +++++-- view/smarty3/admin_site.tpl | 5 +++-- view/smarty3/email_notify_html.tpl | 3 +++ view/smarty3/email_notify_text.tpl | 7 +++++-- view/theme/decaf-mobile/admin_site.tpl | 1 + view/theme/decaf-mobile/smarty3/admin_site.tpl | 1 + view/theme/frost-mobile/admin_site.tpl | 1 + view/theme/frost-mobile/smarty3/admin_site.tpl | 1 + view/theme/frost/admin_site.tpl | 1 + view/theme/frost/smarty3/admin_site.tpl | 1 + 14 files changed, 36 insertions(+), 7 deletions(-) diff --git a/include/enotify.php b/include/enotify.php index b87b159eb..928d2b4b4 100644 --- a/include/enotify.php +++ b/include/enotify.php @@ -415,6 +415,9 @@ intval($params['uid']), LOGGER_DEBUG); call_hooks('enotify_mail', $datarray); + // check whether sending post content in email notifications is allowed + $content_allowed = !get_config('system','enotify_no_content'); + // load the template for private message notifications $tpl = get_markup_template('email_notify_html.tpl'); $email_html_body = replace_macros($tpl,array( @@ -432,7 +435,8 @@ intval($params['uid']), LOGGER_DEBUG); '$thanks' => $datarray['thanks'], '$site_admin' => $datarray['site_admin'], '$title' => $datarray['title'], - '$htmlversion' => $datarray['htmlversion'], + '$htmlversion' => $datarray['htmlversion'], + '$content_allowed' => $content_allowed, )); // load the template for private message notifications @@ -453,6 +457,7 @@ intval($params['uid']), LOGGER_DEBUG); '$site_admin' => $datarray['site_admin'], '$title' => $datarray['title'], '$textversion' => $datarray['textversion'], + '$content_allowed' => $content_allowed, )); // logger('text: ' . $email_text_body); diff --git a/mod/admin.php b/mod/admin.php index 98e52d28b..c263a646d 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -255,6 +255,8 @@ function admin_page_site_post(&$a){ $global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : ''); $thread_allow = ((x($_POST,'thread_allow')) ? True : False); $newuser_private = ((x($_POST,'newuser_private')) ? True : False); + $enotify_no_content = ((x($_POST,'enotify_no_content')) ? True : False); + $no_multi_reg = ((x($_POST,'no_multi_reg')) ? True : False); $no_openid = !((x($_POST,'no_openid')) ? True : False); $no_regfullname = !((x($_POST,'no_regfullname')) ? True : False); @@ -371,6 +373,7 @@ function admin_page_site_post(&$a){ } set_config('system','thread_allow', $thread_allow); set_config('system','newuser_private', $newuser_private); + set_config('system','enotify_no_content', $enotify_no_content); set_config('system','block_extended_register', $no_multi_reg); set_config('system','no_openid', $no_openid); @@ -505,6 +508,7 @@ function admin_page_site(&$a) { '$global_directory' => array('directory_submit_url', t("Global directory update URL"), get_config('system','directory_submit_url'), t("URL to update the global directory. If this is not set, the global directory is completely unavailable to the application.")), '$thread_allow' => array('thread_allow', t("Allow threaded items"), get_config('system','thread_allow'), t("Allow infinite level threading for items on this site.")), '$newuser_private' => array('newuser_private', t("Private posts by default for new users"), get_config('system','newuser_private'), t("Set default post permissions for all new members to the default privacy group rather than public.")), + '$enotify_no_content' => array('enotify_no_content', t("Don't include post body in email notifications"), get_config('system','enotify_no_content'), t("Don't include the body of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.")), '$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")), '$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")), diff --git a/view/admin_site.tpl b/view/admin_site.tpl index a6fe2d789..20a0839fe 100644 --- a/view/admin_site.tpl +++ b/view/admin_site.tpl @@ -84,6 +84,7 @@ {{ inc field_input.tpl with $field=$global_directory }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$newuser_private }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$enotify_no_content }}{{ endinc }}
diff --git a/view/email_notify_html.tpl b/view/email_notify_html.tpl index 43f72f15c..4a8e5a911 100644 --- a/view/email_notify_html.tpl +++ b/view/email_notify_html.tpl @@ -13,10 +13,12 @@ $preamble + {{ if $content_allowed }} $source_name $title $htmlversion + {{ endif }} $hsitelink $hitemlink $thanks @@ -25,3 +27,4 @@ + diff --git a/view/email_notify_text.tpl b/view/email_notify_text.tpl index 018bb6078..af7931e4b 100644 --- a/view/email_notify_text.tpl +++ b/view/email_notify_text.tpl @@ -1,13 +1,16 @@ $preamble - + +{{ if $content_allowed }} $title $textversion - + +{{ endif }} $tsitelink $titemlink $thanks $site_admin + diff --git a/view/smarty3/admin_site.tpl b/view/smarty3/admin_site.tpl index bad0f5275..c1442202d 100644 --- a/view/smarty3/admin_site.tpl +++ b/view/smarty3/admin_site.tpl @@ -52,12 +52,12 @@ {{include file="field_input.tpl" field=$sitename}} {{include file="field_textarea.tpl" field=$banner}} {{include file="field_select.tpl" field=$language}} - {{include file="field_select.tpl" field=$theme}} + {{include file="field_select.tpl" field=$theme}} {{include file="field_select.tpl" field=$theme_mobile}} {{include file="field_select.tpl" field=$ssl_policy}} {{include file="field_checkbox.tpl" field=$new_share}} {{include file="field_checkbox.tpl" field=$hide_help}} - {{include file="field_select.tpl" field=$singleuser}} + {{include file="field_select.tpl" field=$singleuser}}
@@ -89,6 +89,7 @@ {{include file="field_input.tpl" field=$global_directory}} {{include file="field_checkbox.tpl" field=$thread_allow}} {{include file="field_checkbox.tpl" field=$newuser_private}} + {{include file="field_checkbox.tpl" field=$enotify_no_content}}
diff --git a/view/smarty3/email_notify_html.tpl b/view/smarty3/email_notify_html.tpl index e7d4afaa5..7143adbaf 100644 --- a/view/smarty3/email_notify_html.tpl +++ b/view/smarty3/email_notify_html.tpl @@ -18,10 +18,12 @@ {{$preamble}} + {{if $content_allowed}} {{$source_name}} {{$title}} {{$htmlversion}} + {{/if}} {{$hsitelink}} {{$hitemlink}} {{$thanks}} @@ -30,3 +32,4 @@ + diff --git a/view/smarty3/email_notify_text.tpl b/view/smarty3/email_notify_text.tpl index e164f3023..054a9e1b0 100644 --- a/view/smarty3/email_notify_text.tpl +++ b/view/smarty3/email_notify_text.tpl @@ -5,14 +5,17 @@ *}} {{$preamble}} - + +{{if $content_allowed}} {{$title}} {{$textversion}} - + +{{/if}} {{$tsitelink}} {{$titemlink}} {{$thanks}} {{$site_admin}} + diff --git a/view/theme/decaf-mobile/admin_site.tpl b/view/theme/decaf-mobile/admin_site.tpl index 087de4f7d..a419cd9a5 100644 --- a/view/theme/decaf-mobile/admin_site.tpl +++ b/view/theme/decaf-mobile/admin_site.tpl @@ -41,6 +41,7 @@ {{ inc field_input.tpl with $field=$global_directory }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$newuser_private }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$enotify_no_content }}{{ endinc }}
diff --git a/view/theme/decaf-mobile/smarty3/admin_site.tpl b/view/theme/decaf-mobile/smarty3/admin_site.tpl index 27773da2c..40580c486 100644 --- a/view/theme/decaf-mobile/smarty3/admin_site.tpl +++ b/view/theme/decaf-mobile/smarty3/admin_site.tpl @@ -46,6 +46,7 @@ {{include file="field_input.tpl" field=$global_directory}} {{include file="field_checkbox.tpl" field=$thread_allow}} {{include file="field_checkbox.tpl" field=$newuser_private}} + {{include file="field_checkbox.tpl" field=$enotify_no_content}}
diff --git a/view/theme/frost-mobile/admin_site.tpl b/view/theme/frost-mobile/admin_site.tpl index 087de4f7d..a419cd9a5 100644 --- a/view/theme/frost-mobile/admin_site.tpl +++ b/view/theme/frost-mobile/admin_site.tpl @@ -41,6 +41,7 @@ {{ inc field_input.tpl with $field=$global_directory }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$newuser_private }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$enotify_no_content }}{{ endinc }}
diff --git a/view/theme/frost-mobile/smarty3/admin_site.tpl b/view/theme/frost-mobile/smarty3/admin_site.tpl index 27773da2c..40580c486 100644 --- a/view/theme/frost-mobile/smarty3/admin_site.tpl +++ b/view/theme/frost-mobile/smarty3/admin_site.tpl @@ -46,6 +46,7 @@ {{include file="field_input.tpl" field=$global_directory}} {{include file="field_checkbox.tpl" field=$thread_allow}} {{include file="field_checkbox.tpl" field=$newuser_private}} + {{include file="field_checkbox.tpl" field=$enotify_no_content}}
diff --git a/view/theme/frost/admin_site.tpl b/view/theme/frost/admin_site.tpl index 1ae6aba80..c57c14569 100644 --- a/view/theme/frost/admin_site.tpl +++ b/view/theme/frost/admin_site.tpl @@ -43,6 +43,7 @@ {{ inc field_input.tpl with $field=$global_directory }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$thread_allow }}{{ endinc }} {{ inc field_checkbox.tpl with $field=$newuser_private }}{{ endinc }} + {{ inc field_checkbox.tpl with $field=$enotify_no_content }}{{ endinc }}
diff --git a/view/theme/frost/smarty3/admin_site.tpl b/view/theme/frost/smarty3/admin_site.tpl index 69172468c..2f5117359 100644 --- a/view/theme/frost/smarty3/admin_site.tpl +++ b/view/theme/frost/smarty3/admin_site.tpl @@ -48,6 +48,7 @@ {{include file="field_input.tpl" field=$global_directory}} {{include file="field_checkbox.tpl" field=$thread_allow}} {{include file="field_checkbox.tpl" field=$newuser_private}} + {{include file="field_checkbox.tpl" field=$enotify_no_content}}
From 3843f821b2b83c7f61be728941e6be164b9dc935 Mon Sep 17 00:00:00 2001 From: Zach Prezkuta Date: Sat, 23 Feb 2013 09:33:29 -0700 Subject: [PATCH 2/2] better description --- mod/admin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mod/admin.php b/mod/admin.php index c263a646d..fb333c3e5 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -508,7 +508,7 @@ function admin_page_site(&$a) { '$global_directory' => array('directory_submit_url', t("Global directory update URL"), get_config('system','directory_submit_url'), t("URL to update the global directory. If this is not set, the global directory is completely unavailable to the application.")), '$thread_allow' => array('thread_allow', t("Allow threaded items"), get_config('system','thread_allow'), t("Allow infinite level threading for items on this site.")), '$newuser_private' => array('newuser_private', t("Private posts by default for new users"), get_config('system','newuser_private'), t("Set default post permissions for all new members to the default privacy group rather than public.")), - '$enotify_no_content' => array('enotify_no_content', t("Don't include post body in email notifications"), get_config('system','enotify_no_content'), t("Don't include the body of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.")), + '$enotify_no_content' => array('enotify_no_content', t("Don't include post content in email notifications"), get_config('system','enotify_no_content'), t("Don't include the content of a post/comment/private message/etc. in the email notifications that are sent out from this site, as a privacy measure.")), '$no_multi_reg' => array('no_multi_reg', t("Block multiple registrations"), get_config('system','block_extended_register'), t("Disallow users to register additional accounts for use as pages.")), '$no_openid' => array('no_openid', t("OpenID support"), !get_config('system','no_openid'), t("OpenID support for registration and logins.")),