aboutsummaryrefslogtreecommitdiffstats
path: root/admin
diff options
context:
space:
mode:
authorrub <rub@piwigo.org>2007-10-16 21:18:11 +0000
committerrub <rub@piwigo.org>2007-10-16 21:18:11 +0000
commitc1cd43c87415a1a268bf649d7b79ae330624f9db (patch)
treec49672f88480149b202e166935efc39fa2fa2dea /admin
parentb606b6d1ab4a484fae1922a574540c4bf6753be2 (diff)
Resolved issue 0000763: mail triggers:
Add triggers on mail part: o NBM o Group mail o process send mail + check group_id null on group mail Merge branch-1_7 2138:2139 into BSF git-svn-id: http://piwigo.org/svn/trunk@2140 68402e56-0260-453c-a942-63ccdbb3a9ee
Diffstat (limited to '')
-rw-r--r--admin/cat_modify.php4
-rw-r--r--admin/notification_by_mail.php46
2 files changed, 40 insertions, 10 deletions
diff --git a/admin/cat_modify.php b/admin/cat_modify.php
index fd6588c97..63da625c5 100644
--- a/admin/cat_modify.php
+++ b/admin/cat_modify.php
@@ -529,7 +529,7 @@ display_select_cat_wrapper(
);
// info by email to an access granted group of category informations
-if (isset($_POST['submitEmail']))
+if (isset($_POST['submitEmail']) and !empty($_POST['group']))
{
set_make_full_url();
@@ -640,7 +640,7 @@ SELECT
while ($row = mysql_fetch_array($result))
{
$template->assign_block_vars(
- 'group_option',
+ 'group_mail.group_option',
array(
'VALUE' => $row['id'],
'OPTION' => $row['name'],
diff --git a/admin/notification_by_mail.php b/admin/notification_by_mail.php
index ca59b3158..10c65214e 100644
--- a/admin/notification_by_mail.php
+++ b/admin/notification_by_mail.php
@@ -210,6 +210,26 @@ order by
}
/*
+ * Apply global functions to mail content
+ * return customize mail content rendered
+ */
+function render_global_customize_mail_content($customize_mail_content)
+{
+ global $conf;
+
+ if ($conf['nbm_send_html_mail'] and !(strpos($customize_mail_content, '<') === 0))
+ {
+ // On HTML mail, detects if the content are HTML format.
+ // If it's plain text format, convert content to readable HTML
+ return nl2br(htmlspecialchars($customize_mail_content));
+ }
+ else
+ {
+ return $customize_mail_content;
+ }
+}
+
+/*
* Send mail for notification to all users
* Return list of "selected" users for 'list_to_send'
* Return list of "treated" check_key for 'send'
@@ -243,12 +263,9 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
$customize_mail_content = $conf['nbm_complementary_mail_content'];
}
- if ($conf['nbm_send_html_mail'] and !(strpos($customize_mail_content, '<') === 0))
- {
- // On HTML mail, detects if the content are HTML format.
- // If it's plain text format, convert content to readable HTML
- $customize_mail_content = nl2br(htmlspecialchars($customize_mail_content));
- }
+ $customize_mail_content =
+ trigger_event('nbm_render_global_customize_mail_content', $customize_mail_content);
+
// Prepare message after change language
if ($is_action_send)
@@ -343,11 +360,16 @@ function do_action_send_mail_notification($action = 'list_to_send', $check_key_l
}
}
- if (!empty($customize_mail_content))
+ $nbm_user_customize_mail_content =
+ trigger_event('nbm_render_user_customize_mail_content',
+ $customize_mail_content, $nbm_user);
+ if (!empty($nbm_user_customize_mail_content))
{
$env_nbm['mail_template']->assign_block_vars
(
- 'custom', array('CUSTOMIZE_MAIL_CONTENT' => $customize_mail_content)
+ 'custom',
+ array('CUSTOMIZE_MAIL_CONTENT' =>
+ $nbm_user_customize_mail_content)
);
}
@@ -481,6 +503,14 @@ else
// +-----------------------------------------------------------------------+
check_status(get_tab_status($page['mode']));
+
+// +-----------------------------------------------------------------------+
+// | Add event handler |
+// +-----------------------------------------------------------------------+
+add_event_handler('nbm_render_global_customize_mail_content', 'render_global_customize_mail_content');
+trigger_action('nbm_event_handler_added');
+
+
// +-----------------------------------------------------------------------+
// | Insert new users with mails |
// +-----------------------------------------------------------------------+