Ignore:
Timestamp:
Oct 16, 2007, 11:18:11 PM (17 years ago)
Author:
rub
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/admin/notification_by_mail.php

    r2136 r2140  
    211211
    212212/*
     213 * Apply global functions to mail content
     214 * return customize mail content rendered
     215 */
     216function render_global_customize_mail_content($customize_mail_content)
     217{
     218  global $conf;
     219
     220  if ($conf['nbm_send_html_mail'] and !(strpos($customize_mail_content, '<') === 0))
     221  {
     222    // On HTML mail, detects if the content are HTML format.
     223    // If it's plain text format, convert content to readable HTML
     224    return nl2br(htmlspecialchars($customize_mail_content));
     225  }
     226  else
     227  {
     228    return $customize_mail_content;
     229  }
     230}
     231
     232/*
    213233 * Send mail for notification to all users
    214234 * Return list of "selected" users for 'list_to_send'
     
    244264        }
    245265
    246         if ($conf['nbm_send_html_mail'] and !(strpos($customize_mail_content, '<') === 0))
    247         {
    248           // On HTML mail, detects if the content are HTML format.
    249           // If it's plain text format, convert content to readable HTML
    250           $customize_mail_content = nl2br(htmlspecialchars($customize_mail_content));
    251         }
     266        $customize_mail_content =
     267          trigger_event('nbm_render_global_customize_mail_content', $customize_mail_content);
     268
    252269
    253270        // Prepare message after change language
     
    344361              }
    345362
    346               if (!empty($customize_mail_content))
     363              $nbm_user_customize_mail_content =
     364                trigger_event('nbm_render_user_customize_mail_content',
     365                  $customize_mail_content, $nbm_user);
     366              if (!empty($nbm_user_customize_mail_content))
    347367              {
    348368                $env_nbm['mail_template']->assign_block_vars
    349369                (
    350                   'custom', array('CUSTOMIZE_MAIL_CONTENT' => $customize_mail_content)
     370                  'custom',
     371                  array('CUSTOMIZE_MAIL_CONTENT' =>
     372                    $nbm_user_customize_mail_content)
    351373                );
    352374              }
     
    481503// +-----------------------------------------------------------------------+
    482504check_status(get_tab_status($page['mode']));
     505
     506
     507// +-----------------------------------------------------------------------+
     508// | Add event handler                                                     |
     509// +-----------------------------------------------------------------------+
     510add_event_handler('nbm_render_global_customize_mail_content', 'render_global_customize_mail_content');
     511trigger_action('nbm_event_handler_added');
     512
    483513
    484514// +-----------------------------------------------------------------------+
Note: See TracChangeset for help on using the changeset viewer.