source: trunk/admin/notification_by_mail.php @ 2262

Last change on this file since 2262 was 2262, checked in by rub, 16 years ago

Fix bug of svn:2249
Fix quicky mail error with smarty

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