source: trunk/admin/notification_by_mail.php @ 2297

Last change on this file since 2297 was 2297, checked in by plg, 16 years ago

Modification: new header on PHP files, PhpWebGallery renamed Piwigo.

  • Property svn:eol-style set to LF
  • Property svn:keywords set to Author Date Id Revision
File size: 25.2 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based picture gallery                                  |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008      Piwigo Team                  http://piwigo.org |
6// | Copyright(C) 2003-2008 PhpWebGallery Team    http://phpwebgallery.net |
7// | Copyright(C) 2002-2003 Pierrick LE GALL   http://le-gall.net/pierrick |
8// +-----------------------------------------------------------------------+
9// | This program is free software; you can redistribute it and/or modify  |
10// | it under the terms of the GNU General Public License as published by  |
11// | the Free Software Foundation                                          |
12// |                                                                       |
13// | This program is distributed in the hope that it will be useful, but   |
14// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
15// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
16// | General Public License for more details.                              |
17// |                                                                       |
18// | You should have received a copy of the GNU General Public License     |
19// | along with this program; if not, write to the Free Software           |
20// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
21// | USA.                                                                  |
22// +-----------------------------------------------------------------------+
23// +-----------------------------------------------------------------------+
24// | PhpWebGallery - a PHP based picture gallery                           |
25// | Copyright (C) 2002-2003 Pierrick LE GALL - pierrick@phpwebgallery.net |
26// | Copyright (C) 2003-2008 PhpWebGallery Team - http://phpwebgallery.net |
27// +-----------------------------------------------------------------------+
28// | file          : $Id: notification_by_mail.php 2297 2008-04-04 22:57:23Z plg $
29// | last update   : $Date: 2008-04-04 22:57:23 +0000 (Fri, 04 Apr 2008) $
30// | last modifier : $Author: plg $
31// | revision      : $Revision: 2297 $
32// +-----------------------------------------------------------------------+
33// | This program is free software; you can redistribute it and/or modify  |
34// | it under the terms of the GNU General Public License as published by  |
35// | the Free Software Foundation                                          |
36// |                                                                       |
37// | This program is distributed in the hope that it will be useful, but   |
38// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
39// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
40// | General Public License for more details.                              |
41// |                                                                       |
42// | You should have received a copy of the GNU General Public License     |
43// | along with this program; if not, write to the Free Software           |
44// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
45// | USA.                                                                  |
46// +-----------------------------------------------------------------------+
47
48// +-----------------------------------------------------------------------+
49// | include                                                               |
50// +-----------------------------------------------------------------------+
51
52if (!defined('PHPWG_ROOT_PATH'))
53{
54  die ("Hacking attempt!");
55}
56
57include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
58include_once(PHPWG_ROOT_PATH.'admin/include/functions_notification_by_mail.inc.php');
59include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
60include_once(PHPWG_ROOT_PATH.'include/common.inc.php');
61include_once(PHPWG_ROOT_PATH.'include/functions_notification.inc.php');
62include_once(PHPWG_ROOT_PATH.'include/functions_mail.inc.php');
63
64// +-----------------------------------------------------------------------+
65// | Check Access and exit when user status is not ok                      |
66// +-----------------------------------------------------------------------+
67check_status(ACCESS_ADMINISTRATOR);
68
69// +-----------------------------------------------------------------------+
70// | Initialization                                                        |
71// +-----------------------------------------------------------------------+
72$base_url = get_root_url().'admin.php';
73$must_repost = false;
74
75// +-----------------------------------------------------------------------+
76// | functions                                                             |
77// +-----------------------------------------------------------------------+
78
79/*
80 * Do timeout treatment in order to finish to send mails
81 *
82 * @param $post_keyname: key of check_key post array
83 * @param check_key_treated: array of check_key treated
84 * @return none
85 */
86function do_timeout_treatment($post_keyname, $check_key_treated = array())
87{
88  global $env_nbm, $base_url, $page, $must_repost;
89
90  if ($env_nbm['is_sendmail_timeout'])
91  {
92    if (isset($_POST[$post_keyname]))
93    {
94      $post_count = count($_POST[$post_keyname]);
95      $treated_count = count($check_key_treated);
96      if ($treated_count != 0)
97      {
98        $time_refresh = ceil((get_moment() - $env_nbm['start_time']) * $post_count / $treated_count);
99      }
100      else
101      {
102        $time_refresh = 0;
103      }
104      $_POST[$post_keyname] = array_diff($_POST[$post_keyname], $check_key_treated);
105
106      $must_repost = true;
107      array_push($page['errors'],
108        l10n_dec('nbm_background_treatment_redirect_second',
109                 'nbm_background_treatment_redirect_seconds',
110                  $time_refresh));
111    }
112  }
113
114}
115
116/*
117 * Get the authorized_status for each tab
118 * return corresponding status
119 */
120function get_tab_status($mode)
121{
122  $result = ACCESS_WEBMASTER;
123  switch ($mode)
124  {
125    case 'param':
126    case 'subscribe':
127      $result = ACCESS_WEBMASTER;
128      break;
129    case 'send':
130      $result = ACCESS_ADMINISTRATOR;
131      break;
132    default:
133      $result = ACCESS_WEBMASTER;
134      break;
135  }
136  return $result;
137}
138
139/*
140 * Inserting News users
141 */
142function insert_new_data_user_mail_notification()
143{
144  global $conf, $page, $env_nbm;
145
146  // Set null mail_address empty
147  $query = '
148update
149  '.USERS_TABLE.'
150set
151  '.$conf['user_fields']['email'].' = null
152where
153  trim('.$conf['user_fields']['email'].') = \'\';';
154  pwg_query($query);
155
156  // null mail_address are not selected in the list
157  $query = '
158select
159  u.'.$conf['user_fields']['id'].' as user_id,
160  u.'.$conf['user_fields']['username'].' as username,
161  u.'.$conf['user_fields']['email'].' as mail_address
162from
163  '.USERS_TABLE.' as u left join '.USER_MAIL_NOTIFICATION_TABLE.' as m on u.'.$conf['user_fields']['id'].' = m.user_id
164where
165  u.'.$conf['user_fields']['email'].' is not null and
166  m.user_id is null
167order by
168  user_id;';
169
170  $result = pwg_query($query);
171
172  if (mysql_num_rows($result) > 0)
173  {
174    $inserts = array();
175    $check_key_list = array();
176
177    while ($nbm_user = mysql_fetch_array($result))
178    {
179      // Calculate key
180      $nbm_user['check_key'] = find_available_check_key();
181
182      // Save key
183      array_push($check_key_list, $nbm_user['check_key']);
184
185      // Insert new nbm_users
186      array_push
187      (
188        $inserts,
189        array
190        (
191          'user_id' => $nbm_user['user_id'],
192          'check_key' => $nbm_user['check_key'],
193          'enabled' => 'false' // By default if false, set to true with specific functions
194        )
195      );
196
197      array_push
198      (
199        $page['infos'],
200        sprintf(
201          l10n('nbm_user_x_added'),
202          $nbm_user['username'],
203          get_email_address_as_display_text($nbm_user['mail_address'])
204        )
205      );
206    }
207
208    // Insert new nbm_users
209    mass_inserts(USER_MAIL_NOTIFICATION_TABLE, array('user_id', 'check_key', 'enabled'), $inserts);
210    // Update field enabled with specific function
211    $check_key_treated = do_subscribe_unsubscribe_notification_by_mail
212    (
213      true,
214      $conf['nbm_default_value_user_enabled'],
215      $check_key_list
216    );
217
218     // On timeout simulate like tabsheet send
219    if ($env_nbm['is_sendmail_timeout'])
220    {
221      $quoted_check_key_list = quote_check_key_list(array_diff($check_key_list, $check_key_treated));
222      if (count($quoted_check_key_list) != 0 )
223      {
224        $query = 'delete from '.USER_MAIL_NOTIFICATION_TABLE.' where check_key in ('.implode(",", $quoted_check_key_list).');';
225        $result = pwg_query($query);
226
227        redirect($base_url.get_query_string_diff(array(), false), l10n('nbm_redirect_msg'));
228      }
229    }
230  }
231}
232
233/*
234 * Apply global functions to mail content
235 * return customize mail content rendered
236 */
237function render_global_customize_mail_content($customize_mail_content)
238{
239  global $conf;
240
241  if ($conf['nbm_send_html_mail'] and !(strpos($customize_mail_content, '<') === 0))
242  {
243    // On HTML mail, detects if the content are HTML format.
244    // If it's plain text format, convert content to readable HTML
245    return nl2br(htmlspecialchars($customize_mail_content));
246  }
247  else
248  {
249    return $customize_mail_content;
250  }
251}
252
253/*
254 * Send mail for notification to all users
255 * Return list of "selected" users for 'list_to_send'
256 * Return list of "treated" check_key for 'send'
257 */
258function do_action_send_mail_notification($action = 'list_to_send', $check_key_list = array(), $customize_mail_content = '')
259{
260  global $conf, $page, $user, $lang_info, $lang, $env_nbm;
261  $return_list = array();
262
263  if (in_array($action, array('list_to_send', 'send')))
264  {
265    list($dbnow) = mysql_fetch_row(pwg_query('SELECT NOW();'));
266
267    $is_action_send = ($action == 'send');
268
269    // disabled and null mail_address are not selected in the list
270    $data_users = get_user_notifications('send', $check_key_list);
271
272    // List all if it's define on options or on timeout
273    $is_list_all_without_test = ($env_nbm['is_sendmail_timeout'] or $conf['nbm_list_all_enabled_users_to_send']);
274
275    // Check if exist news to list user or send mails
276    if ((!$is_list_all_without_test) or ($is_action_send))
277    {
278      if (count($data_users) > 0)
279      {
280        $datas = array();
281
282        if (!isset($customize_mail_content))
283        {
284          $customize_mail_content = $conf['nbm_complementary_mail_content'];
285        }
286
287        $customize_mail_content = 
288          trigger_event('nbm_render_global_customize_mail_content', $customize_mail_content);
289
290
291        // Prepare message after change language
292        if ($is_action_send)
293        {
294          $msg_break_timeout = l10n('nbm_break_timeout_send_mail');
295        }
296        else
297        {
298          $msg_break_timeout = l10n('nbm_break_timeout_list_user');
299        }
300
301        // Begin nbm users environment
302        begin_users_env_nbm($is_action_send);
303
304        foreach ($data_users as $nbm_user)
305        {
306          if ((!$is_action_send) and check_sendmail_timeout())
307          {
308            // Stop fill list on 'list_to_send', if the quota is override
309            array_push($page['infos'], $msg_break_timeout);
310            break;
311          }
312          if (($is_action_send) and check_sendmail_timeout())
313          {
314            // Stop fill list on 'send', if the quota is override
315            array_push($page['errors'], $msg_break_timeout);
316            break;
317          }
318
319          // set env nbm user
320          set_user_on_env_nbm($nbm_user, $is_action_send);
321
322          if ($is_action_send)
323          {
324            set_make_full_url();
325            // Fill return list of "treated" check_key for 'send'
326            array_push($return_list, $nbm_user['check_key']);
327
328            if ($conf['nbm_send_detailed_content'])
329            {
330               $news = news($nbm_user['last_send'], $dbnow, false, $conf['nbm_send_html_mail']);
331               $exist_data = count($news) > 0;
332            }
333            else
334            {
335              $exist_data = news_exists($nbm_user['last_send'], $dbnow);
336            }
337
338            if ($exist_data)
339            {
340              $subject = '['.$conf['gallery_title'].']: '.l10n('nbm_object_news');
341
342              // Assign current var for nbm mail
343              assign_vars_nbm_mail_content($nbm_user);
344
345              if (!is_null($nbm_user['last_send']))
346              {
347                $env_nbm['mail_template']->assign
348                (
349                  'content_new_elements_between',
350                  array
351                  (
352                    'DATE_BETWEEN_1' => $nbm_user['last_send'],
353                    'DATE_BETWEEN_2' => $dbnow,
354                  )
355                );
356              }
357              else
358              {
359                $env_nbm['mail_template']->assign
360                (
361                  'content_new_elements_single',
362                  array
363                  (
364                    'DATE_SINGLE' => $dbnow,
365                  )
366                );
367              }
368
369              if ($conf['nbm_send_detailed_content'])
370              {
371                $env_nbm['mail_template']->assign('global_new_lines', $news);
372              }
373
374              $nbm_user_customize_mail_content = 
375                trigger_event('nbm_render_user_customize_mail_content',
376                  $customize_mail_content, $nbm_user);
377              if (!empty($nbm_user_customize_mail_content))
378              {
379                $env_nbm['mail_template']->assign
380                (
381                  'custom_mail_content', $nbm_user_customize_mail_content
382                );
383              }
384
385              if ($conf['nbm_send_html_mail'] and $conf['nbm_send_recent_post_dates'])
386              {
387                $recent_post_dates = get_recent_post_dates_array(
388                  $conf['recent_post_dates']['NBM']);
389                foreach ($recent_post_dates as $date_detail)
390                {
391                  $env_nbm['mail_template']->append
392                  (
393                    'recent_posts',
394                    array
395                    (
396                      'TITLE' => get_title_recent_post_date($date_detail),
397                      'HTML_DATA' => get_html_description_recent_post_date($date_detail)
398                    )
399                  );
400                }
401              }
402
403              $env_nbm['mail_template']->assign
404              (
405                array
406                (
407                  'GOTO_GALLERY_TITLE' => $conf['gallery_title'],
408                  'GOTO_GALLERY_URL' => $conf['gallery_url'],
409                  'SEND_AS_NAME'      => $env_nbm['send_as_name'],
410                )
411              );
412
413              if (pwg_mail
414                  (
415                    format_email($nbm_user['username'], $nbm_user['mail_address']),
416                    array
417                    (
418                      'from' => $env_nbm['send_as_mail_formated'],
419                      'subject' => $subject,
420                      'email_format' => $env_nbm['email_format'],
421                      'content' => $env_nbm['mail_template']->parse('notification_by_mail', true),
422                      'content_format' => $env_nbm['email_format'],
423                      'template' => $nbm_user['template'],
424                      'theme' => $nbm_user['theme']
425                    )
426                  ))
427              {
428                inc_mail_sent_success($nbm_user);
429
430                $data = array('user_id' => $nbm_user['user_id'],
431                              'last_send' => $dbnow);
432                array_push($datas, $data);
433              }
434              else
435              {
436                inc_mail_sent_failed($nbm_user);
437              }
438
439              unset_make_full_url();
440            }
441          }
442          else
443          {
444            if (news_exists($nbm_user['last_send'], $dbnow))
445            {
446              // Fill return list of "selected" users for 'list_to_send'
447              array_push($return_list, $nbm_user);
448            }
449          }
450
451          // unset env nbm user
452          unset_user_on_env_nbm();
453        }
454
455        // Restore nbm environment
456        end_users_env_nbm();
457
458        if ($is_action_send)
459        {
460          mass_updates(
461            USER_MAIL_NOTIFICATION_TABLE,
462            array(
463              'primary' => array('user_id'),
464              'update' => array('last_send')
465             ),
466             $datas
467             );
468
469          display_counter_info();
470        }
471      }
472      else
473      {
474        if ($is_action_send)
475        {
476          array_push($page['errors'], l10n('nbm_no_user_to send_notifications_by_mail'));
477        }
478      }
479    }
480    else
481    {
482      // Quick List, don't check news
483      // Fill return list of "selected" users for 'list_to_send'
484      $return_list = $data_users;
485    }
486  }
487
488  // Return list of "selected" users for 'list_to_send'
489  // Return list of "treated" check_key for 'send'
490  return $return_list;
491}
492
493// +-----------------------------------------------------------------------+
494// | Main                                                                  |
495// +-----------------------------------------------------------------------+
496if (!isset($_GET['mode']))
497{
498  $page['mode'] = 'send';
499}
500else
501{
502  $page['mode'] = $_GET['mode'];
503}
504
505// +-----------------------------------------------------------------------+
506// | Check Access and exit when user status is not ok                      |
507// +-----------------------------------------------------------------------+
508check_status(get_tab_status($page['mode']));
509
510
511// +-----------------------------------------------------------------------+
512// | Add event handler                                                     |
513// +-----------------------------------------------------------------------+
514add_event_handler('nbm_render_global_customize_mail_content', 'render_global_customize_mail_content');
515trigger_action('nbm_event_handler_added');
516
517
518// +-----------------------------------------------------------------------+
519// | Insert new users with mails                                           |
520// +-----------------------------------------------------------------------+
521if (!isset($_POST) or (count($_POST) ==0))
522{
523  // No insert data in post mode
524  insert_new_data_user_mail_notification();
525}
526
527// +-----------------------------------------------------------------------+
528// | Treatment of tab post                                                 |
529// +-----------------------------------------------------------------------+
530switch ($page['mode'])
531{
532  case 'param' :
533  {
534    if (isset($_POST['param_submit']) and !is_adviser())
535    {
536      $updated_param_count = 0;
537      // Update param
538      $result = pwg_query('select param, value from '.CONFIG_TABLE.' where param like \'nbm\\_%\'');
539      while ($nbm_user = mysql_fetch_array($result))
540      {
541        if (isset($_POST[$nbm_user['param']]))
542        {
543          $value = $_POST[$nbm_user['param']];
544
545          $query = '
546update
547'.CONFIG_TABLE.'
548set
549  value = \''. str_replace("\'", "''", $value).'\'
550where
551  param = \''.$nbm_user['param'].'\';';
552          pwg_query($query);
553          $updated_param_count += 1;
554        }
555      }
556
557      array_push($page['infos'],
558        l10n_dec('nbm_updated_param_count', 'nbm_updated_params_count',
559          $updated_param_count));
560
561      // Reload conf with new values
562      load_conf_from_db('param like \'nbm\\_%\'');
563    }
564  }
565  case 'subscribe' :
566  {
567    if (!is_adviser())
568    {
569      if (isset($_POST['falsify']) and isset($_POST['cat_true']))
570      {
571        $check_key_treated = unsubscribe_notification_by_mail(true, $_POST['cat_true']);
572        do_timeout_treatment('cat_true', $check_key_treated);
573      }
574      else
575      if (isset($_POST['trueify']) and isset($_POST['cat_false']))
576      {
577        $check_key_treated = subscribe_notification_by_mail(true, $_POST['cat_false']);
578        do_timeout_treatment('cat_false', $check_key_treated);
579      }
580    }
581    break;
582  }
583
584  case 'send' :
585  {
586    if (isset($_POST['send_submit']) and isset($_POST['send_selection']) and isset($_POST['send_customize_mail_content']) and !is_adviser())
587    {
588      $check_key_treated = do_action_send_mail_notification('send', $_POST['send_selection'], stripslashes($_POST['send_customize_mail_content']));
589      do_timeout_treatment('send_selection', $check_key_treated);
590    }
591  }
592}
593
594// +-----------------------------------------------------------------------+
595// | template initialization                                               |
596// +-----------------------------------------------------------------------+
597$template->set_filenames
598(
599  array
600  (
601    'double_select' => 'admin/double_select.tpl',
602    'notification_by_mail'=>'admin/notification_by_mail.tpl'
603  )
604);
605
606$template->assign
607(
608  array
609  (
610    'U_HELP' => add_url_params(get_root_url().'popuphelp.php', array('page' => 'notification_by_mail')),
611    'F_ACTION'=> $base_url.get_query_string_diff(array())
612  )
613);
614
615if (is_autorize_status(ACCESS_WEBMASTER))
616{
617  // TabSheet
618  $tabsheet = new tabsheet();
619  // TabSheet initialization
620  $tabsheet->add('param', l10n('nbm_param_mode'),
621    add_url_params($base_url.get_query_string_diff(array('mode', 'select')),
622        array('mode' => 'param')));
623  $tabsheet->add('subscribe', l10n('nbm_subscribe_mode'),
624    add_url_params($base_url.get_query_string_diff(array('mode', 'select')),
625      array('mode' => 'subscribe')));
626  $tabsheet->add('send', l10n('nbm_send_mode'),
627    add_url_params($base_url.get_query_string_diff(array('mode', 'select')),
628      array('mode' => 'send')));
629  // TabSheet selection
630  $tabsheet->select($page['mode']);
631  // Assign tabsheet to template
632  $tabsheet->assign();
633}
634
635if ($must_repost)
636{
637  // Get name of submit button
638  $repost_submit_name = '';
639  if (isset($_POST['falsify']))
640  {
641    $repost_submit_name = 'falsify';
642  }
643  elseif (isset($_POST['trueify']))
644  {
645    $repost_submit_name = 'trueify';
646  }
647  elseif (isset($_POST['send_submit']))
648  {
649    $repost_submit_name = 'send_submit';
650  }
651
652  $template->assign('REPOST_SUBMIT_NAME', $repost_submit_name);
653}
654
655switch ($page['mode'])
656{
657  case 'param' :
658  {
659    $template->assign(
660      $page['mode'],
661      array(
662        'SEND_HTML_MAIL' => $conf['nbm_send_html_mail'],
663        'SEND_MAIL_AS' => $conf['nbm_send_mail_as'],
664        'SEND_DETAILED_CONTENT' => $conf['nbm_send_detailed_content'],
665        'COMPLEMENTARY_MAIL_CONTENT' => $conf['nbm_complementary_mail_content'],
666        'SEND_RECENT_POST_DATES' => $conf['nbm_send_recent_post_dates'],
667        ));
668    break;
669  }
670
671  case 'subscribe' :
672  {
673    $template->assign( $page['mode'], true );
674
675    $template->assign(
676      array(
677        'L_CAT_OPTIONS_TRUE' => l10n('nbm_subscribe_col'),
678        'L_CAT_OPTIONS_FALSE' => l10n('nbm_unsubscribe_col')
679        )
680      );
681
682    $data_users = get_user_notifications('subscribe');
683   
684    $opt_true = array();
685    $opt_true_selected = array();
686    $opt_false = array();
687    $opt_false_selected = array();
688    foreach ($data_users as $nbm_user)
689    {
690      if (get_boolean($nbm_user['enabled']))
691      {
692        $opt_true[ $nbm_user['check_key'] ] = $nbm_user['username'].'['.get_email_address_as_display_text($nbm_user['mail_address']).']';
693        if ((isset($_POST['falsify']) and isset($_POST['cat_true']) and in_array($nbm_user['check_key'], $_POST['cat_true'])))
694        {
695          $opt_true_selected[] = $nbm_user['check_key'];
696        }
697      }
698      else
699      {
700        $opt_false[ $nbm_user['check_key'] ] = $nbm_user['username'].'['.get_email_address_as_display_text($nbm_user['mail_address']).']';
701        if (isset($_POST['trueify']) and isset($_POST['cat_false']) and in_array($nbm_user['check_key'], $_POST['cat_false']))
702        {
703          $opt_false_selected[] = $nbm_user['check_key'];
704        }
705      }
706    }
707    $template->assign( array(
708        'category_option_true'          => $opt_true,
709        'category_option_true_selected' => $opt_true_selected,
710        'category_option_false'         => $opt_false,
711        'category_option_false_selected' => $opt_false_selected,
712        )
713    );
714    $template->assign_var_from_handle('DOUBLE_SELECT', 'double_select');
715    break;
716  }
717
718  case 'send' :
719  {
720    $tpl_var = array('users'=> array() );
721
722    $data_users = do_action_send_mail_notification('list_to_send');
723
724    $tpl_var['CUSTOMIZE_MAIL_CONTENT'] = 
725      isset($_POST['send_customize_mail_content']) 
726        ? stripslashes($_POST['send_customize_mail_content']) 
727        : $conf['nbm_complementary_mail_content'];
728
729    if  (count($data_users))
730    {
731      foreach ($data_users as $nbm_user)
732      {
733        if (
734            (!$must_repost) or // Not timeout, normal treatment
735            (($must_repost) and in_array($nbm_user['check_key'], $_POST['send_selection']))  // Must be repost, show only user to send
736            )
737        {
738          $tpl_var['users'][] = 
739            array(
740              'ID' => $nbm_user['check_key'],
741              'CHECKED' =>  ( // not check if not selected,  on init select<all
742                              isset($_POST['send_selection']) and // not init
743                              !in_array($nbm_user['check_key'], $_POST['send_selection']) // not selected
744                            )   ? '' : 'checked="checked"',
745              'USERNAME'=> $nbm_user['username'],
746              'EMAIL' => get_email_address_as_display_text($nbm_user['mail_address']),
747              'LAST_SEND'=> $nbm_user['last_send']
748              );
749        }
750      }
751    }
752    $template->assign($page['mode'], $tpl_var);
753    break;
754  }
755}
756
757// +-----------------------------------------------------------------------+
758// | Sending html code                                                     |
759// +-----------------------------------------------------------------------+
760$template->assign_var_from_handle('ADMIN_CONTENT', 'notification_by_mail');
761
762?>
Note: See TracBrowser for help on using the repository browser.