source: extensions/NBC_UserAdvManager/trunk/admin/UserAdvManager_admin.php @ 3742

Last change on this file since 3742 was 3742, checked in by Eric, 15 years ago

Working directory - Compatibility improvement with PHP 5.3 - Some old functions will be deprecated.
ereg() was replaced by preg_match()
eregi() was replace by preg_match() with "i" moderator
split() was replace by preg_split()

  • Property svn:eol-style set to LF
File size: 25.8 KB
Line 
1<?php
2
3global $user, $lang, $conf, $errors;
4
5if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
6// +-----------------------------------------------------------------------+
7// | Check Access and exit when user status is not ok                      |
8// +-----------------------------------------------------------------------+
9check_status(ACCESS_ADMINISTRATOR);
10
11//ini_set('error_reporting', E_ALL);
12//ini_set('display_errors', true);
13
14include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
15include_once (PHPWG_ROOT_PATH.'/include/constants.php');
16$my_base_url = get_admin_plugin_menu_link(__FILE__);
17
18load_language('plugin.lang', NBC_UserAdvManager_PATH);
19
20// +-----------------------------------------------------------------------+
21// |                            Tabssheet                                  |
22// +-----------------------------------------------------------------------+
23if (!isset($_GET['tab']))
24  $page['tab'] = 'global';
25else
26  $page['tab'] = $_GET['tab'];
27
28$tabsheet = new tabsheet();
29$tabsheet->add('global',
30               l10n('Tab_Global'),
31               $my_base_url.'&amp;tab=global');
32$tabsheet->add('confirmmail',
33               l10n('Tab_ConfirmMail'),
34               $my_base_url.'&amp;tab=confirmmail');
35//$tabsheet->add('Misc_Options',
36//               l10n('Tab_Misc_Options'),
37//               $my_base_url.'&amp;tab=Misc_Options');
38$tabsheet->select($page['tab']);
39$tabsheet->assign();
40
41$page['global'] = array();
42$error = array();
43
44// +-----------------------------------------------------------------------+
45// |                            Tabssheet select                           |
46// +-----------------------------------------------------------------------+
47
48switch ($page['tab'])
49{
50// +-----------------------------------------------------------------------+
51// |                           Global Config                               |
52// +-----------------------------------------------------------------------+
53  case 'global':
54       
55  if ( isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_Mail_Info']) and isset($_POST['UserAdvManager_No_Casse']) and isset($_POST['UserAdvManager_Username_Char']) and isset($_POST['UserAdvManager_Confirm_Mail']) and isset($_POST['UserAdvManager_No_Comment_Anonymous']) )
56  {
57    $_POST['UserAdvManager_MailInfo_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_MailInfo_Text']));
58        $_POST['UserAdvManager_ConfirmMail_Text'] = str_replace("\'", "'", str_replace("\\\\", "\\", $_POST['UserAdvManager_ConfirmMail_Text']));
59               
60        $newconf_nbc_UserAdvManager = $_POST['UserAdvManager_Mail_Info'].';'.$_POST['UserAdvManager_No_Casse'].';'.$_POST['UserAdvManager_Confirm_Mail'].';'.(isset($_POST['UserAdvManager_No_Confirm_Group'])?$_POST['UserAdvManager_No_Confirm_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Group'])?$_POST['UserAdvManager_Validated_Group']:'').';'.(isset($_POST['UserAdvManager_Validated_Status'])?$_POST['UserAdvManager_Validated_Status']:'').';'.$_POST['UserAdvManager_No_Comment_Anonymous'].';'.$_POST['UserAdvManager_Username_Char'].';'.$_POST['UserAdvManager_Username_List'].';'.(isset($_POST['UserAdvManager_No_Confirm_Status'])?$_POST['UserAdvManager_No_Confirm_Status']:'').';'.$_POST['UserAdvManager_MailInfo_Text'].';'.$_POST['UserAdvManager_ConfirmMail_Text'].';'.$_POST['UserAdvManager_MailExclusion'].';'.$_POST['UserAdvManager_MailExclusion_List'];
61               
62        $conf['nbc_UserAdvManager'] = $newconf_nbc_UserAdvManager;
63               
64        $query = '
65          UPDATE '.CONFIG_TABLE.'
66          SET value="'.$newconf_nbc_UserAdvManager.'"
67          WHERE param="nbc_UserAdvManager"
68          LIMIT 1
69          ;';
70               
71        pwg_query($query);
72               
73        array_push($page['infos'], l10n('UserAdvManager_save_config'));
74  }
75       
76  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
77       
78/* Group setting for unvalidated and validated users */
79  $groups[-1] = '---------';
80  $No_Valid = -1;
81  $Valid = -1;
82       
83/* Check groups list in database  */
84  $query = '
85    SELECT id, name
86        FROM '.GROUPS_TABLE.'
87        ORDER BY name ASC
88        ;';
89       
90  $result = pwg_query($query);
91       
92  while ($row = mysql_fetch_array($result))
93  {
94    $groups[$row['id']] = $row['name'];
95/* configuration value for unvalidated users */
96    if (isset($conf_nbc_UserAdvManager[3]) and $conf_nbc_UserAdvManager[3] == $row['id'])
97    {
98          $No_Valid = $row['id'];
99        }
100/* configuration value for validated users */
101    if (isset($conf_nbc_UserAdvManager[4]) and $conf_nbc_UserAdvManager[4] == $row['id'])
102        {
103          $Valid = $row['id'];
104        }
105  }
106       
107/* Template initialization for unvalidated users group */
108  $template->assign(
109    'No_Confirm_Group',
110    array(
111          'group_options'=> $groups,
112          'group_selected' => $No_Valid
113        )
114  );
115/* Template initialization for validated users group */
116  $template->assign(
117    'Validated_Group',
118        array(
119      'group_options'=> $groups,
120      'group_selected' => $Valid
121        )
122  );
123       
124/* Status setting for unvalidated and validated users */
125  $status_options[-1] = '------------';
126  $No_Valid_Status = -1;
127  $Valid_Status = -1;
128       
129/* Get status values */
130  foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
131    {
132          $status_options[$status] = l10n('user_status_'.$status);
133          if (isset($conf_nbc_UserAdvManager[9]) and $conf_nbc_UserAdvManager[9] == $status)
134          {
135            $No_Valid_Status = $status;
136          }
137/* Template initialization for unvalidated users group */
138      $template->assign(
139        'No_Confirm_Status',
140        array(
141                  'Status_options' => $status_options,
142                  'Status_selected' => $No_Valid_Status
143                )
144          );
145    }
146/* Get status values */
147  foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
148    {
149          $status_options[$status] = l10n('user_status_'.$status);
150          if (isset($conf_nbc_UserAdvManager[5]) and $conf_nbc_UserAdvManager[5] == $status)
151            {
152                  $Valid_Status = $status;
153                }
154/* Template initialization for unvalidated users group */
155      $template->assign(
156            'Confirm_Status',
157            array(
158                  'Status_options' => $status_options,
159                  'Status_selected' => $Valid_Status
160                )
161          );
162    }
163       
164  $template->assign(
165    array(
166                'UserAdvManager_MAIL_INFO_TRUE'       => $conf_nbc_UserAdvManager[0]=='true' ?  'checked="checked"' : '' ,
167                'UserAdvManager_MAIL_INFO_FALSE'      => $conf_nbc_UserAdvManager[0]=='false' ?  'checked="checked"' : '' ,
168                'UserAdvManager_MAILINFO_TEXT'        => $conf_nbc_UserAdvManager[10],
169                'UserAdvManager_NO_CASSE_TRUE'        => $conf_nbc_UserAdvManager[1]=='true' ?  'checked="checked"' : '' ,
170                'UserAdvManager_NO_CASSE_FALSE'       => $conf_nbc_UserAdvManager[1]=='false' ?  'checked="checked"' : '' ,
171                'UserAdvManager_USERNAME_CHAR_TRUE'   => $conf_nbc_UserAdvManager[7]=='true' ?  'checked="checked"' : '' ,
172                'UserAdvManager_USERNAME_CHAR_FALSE'  => $conf_nbc_UserAdvManager[7]=='false' ?  'checked="checked"' : '' ,
173                'UserAdvManager_USERNAME_CHAR_LIST'   => $conf_nbc_UserAdvManager[8],
174                'UserAdvManager_CONFIRM_MAIL_TRUE'    => $conf_nbc_UserAdvManager[2]=='true' ?  'checked="checked"' : '' ,
175                'UserAdvManager_CONFIRM_MAIL_FALSE'   => $conf_nbc_UserAdvManager[2]=='false' ?  'checked="checked"' : '' ,
176                'UserAdvManager_CONFIRMMAIL_TEXT'     => $conf_nbc_UserAdvManager[11],
177                'UserAdvManager_No_Confirm_Group'     => $conf_nbc_UserAdvManager[3],
178                'UserAdvManager_Validated_Group'      => $conf_nbc_UserAdvManager[4],
179                'UserAdvManager_No_Confirm_Status'    => $conf_nbc_UserAdvManager[9],
180                'UserAdvManager_Validated_Status'     => $conf_nbc_UserAdvManager[5],
181                'UserAdvManager_NO_COMMENT_ANO_TRUE'  => $conf_nbc_UserAdvManager[6]=='true' ?  'checked="checked"' : '' ,
182                'UserAdvManager_NO_COMMENT_ANO_FALSE' => $conf_nbc_UserAdvManager[6]=='false' ?  'checked="checked"' : '' ,
183                'UserAdvManager_MAILEXCLUSION_TRUE'   => $conf_nbc_UserAdvManager[12]=='true' ?  'checked="checked"' : '' ,
184                'UserAdvManager_MAILEXCLUSION_FALSE'  => $conf_nbc_UserAdvManager[12]=='false' ?  'checked="checked"' : '' ,
185                'UserAdvManager_MAILEXCLUSION_LIST'   => $conf_nbc_UserAdvManager[13],
186    )
187  );
188       
189
190  if ( isset($_POST['audit']) or isset($_POST['submit']) )
191    {
192          $msg_error1 = '';
193               
194/* username insensible a la casse */
195      if (isset($conf_nbc_UserAdvManager[3]) and $conf_nbc_UserAdvManager[3] == 'true')
196            {
197                  $query = "
198                    SELECT ".$conf['user_fields']['username']."
199                        FROM ".USERS_TABLE." p1
200                        WHERE EXISTS(
201                        SELECT ".$conf['user_fields']['username']."
202                        FROM ".USERS_TABLE." p2
203                        WHERE p1.".$conf['user_fields']['id']." <> p2.".$conf['user_fields']['id']."
204                        AND LOWER(p1.".$conf['user_fields']['username'].") = LOWER(p2.".$conf['user_fields']['username'].")
205                        )
206                        ;";
207                         
208                  $result = pwg_query($query);
209                       
210                  while($row = mysql_fetch_array($result))
211                    {
212                          $msg_error1 .= (($msg_error1 <> '') ? '<br/>' : '') . l10n('Err_audit_no_casse').$row['username'];
213                        }
214                }
215
216      $msg_error2 = '';
217               
218/* Username without forbidden keys */
219      if ( isset($conf_nbc_UserAdvManager[7]) and $conf_nbc_UserAdvManager[7] == 'true' )
220            {
221                  $query = "
222                    SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']."
223                        FROM ".USERS_TABLE."
224                        ;";
225                         
226                  $result = pwg_query($query);
227                       
228                  while($row = mysql_fetch_array($result))
229                    {
230                          if ( !ValidateUsername($row['username']) )
231                            $msg_error2 .= (($msg_error2 <> '') ? '<br/>' : '') . l10n('Err_audit_username_char').$row['username'];
232                        }
233                }
234
235      $msg_error3 = '';
236               
237/* Email without forbidden domain */
238      if ( isset($conf_nbc_UserAdvManager[12]) and $conf_nbc_UserAdvManager[12] == 'true' )
239            {
240                  $query = "
241                    SELECT ".$conf['user_fields']['username'].", ".$conf['user_fields']['email']."
242                        FROM ".USERS_TABLE."
243                        ;";
244                         
245                  $result = pwg_query($query);
246                       
247                  while($row = mysql_fetch_array($result))
248                    {
249                          $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
250                          $conf_nbc_MailExclusion = preg_split('/,/',$conf_nbc_UserAdvManager[13]);
251                          for ($i = 0 ; $i < count($conf_nbc_MailExclusion) ; $i++)
252                            {
253                          $pattern = '/'.$conf_nbc_MailExclusion[$i].'/';
254                                  if (preg_match($pattern, $row['mail_address']))
255                                    {
256                                          $msg_error3 .=  (($msg_error3 <> '') ? '<br/>' : '') . l10n('Err_audit_email_forbidden').$row['username'].' ('.$row['mail_address'].')';
257                                        }
258                                }
259                        }
260                }
261               
262      if ($msg_error1 <> '')
263            $errors[] = $msg_error1.'<br/><br/>';
264               
265      if ($msg_error2 <> '')
266            $errors[] = $msg_error2.'<br/><br/>';
267               
268          if ($msg_error3 <> '')
269            $errors[] = $msg_error3.'<br/><br/>';
270               
271          if ($msg_error1 <> '' or $msg_error2 <> '' or $msg_error3 <> '')
272            array_push($page['errors'], l10n('Err_audit_advise'));
273          else
274        array_push($page['infos'], l10n('UserAdvManager_audit_ok'));
275    }
276
277
278// +-----------------------------------------------------------------------+
279// |                             errors display                            |
280// +-----------------------------------------------------------------------+
281  if ( isset ($errors) and count($errors) != 0)
282    {
283          $template->assign('errors',array());
284          foreach ($errors as $error)
285            {
286                  array_push($page['errors'], $error);
287                }
288        } 
289
290// +-----------------------------------------------------------------------+
291// |                           templates display                           |
292// +-----------------------------------------------------------------------+
293  $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/global.tpl');
294  $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
295
296  break;
297
298// +-----------------------------------------------------------------------+
299// |                           ConfirmMail Config                          |
300// +-----------------------------------------------------------------------+
301  case 'confirmmail':
302       
303  $conf_nbc_UserAdvManager = isset($conf['nbc_UserAdvManager']) ? explode(";" , $conf['nbc_UserAdvManager']) : array();
304       
305  if (isset($conf_nbc_UserAdvManager[2]) and $conf_nbc_UserAdvManager[2]=='true' )
306    {
307      if ( isset($_POST['submit']) and !is_adviser() and isset($_POST['UserAdvManager_ConfirmMail_TimeOut']) )
308            {           
309                  $newconf_nbc_UserAdvManager_ConfirmMail = $_POST['UserAdvManager_ConfirmMail_TimeOut'].';'.$_POST['UserAdvManager_ConfirmMail_Delay'];
310        //TODO:Adding new option [Auto deletion : True | False]
311        //TODO:Adding new option [Resend_new_validation_key : True | False]
312                  $conf['nbc_UserAdvManager_ConfirmMail'] = $newconf_nbc_UserAdvManager_ConfirmMail;
313               
314                  $query = '
315                    UPDATE '.CONFIG_TABLE.'
316                        SET value="'.$newconf_nbc_UserAdvManager_ConfirmMail.'"
317                        WHERE param="nbc_UserAdvManager_ConfirmMail"
318                        LIMIT 1
319                        ;';
320               
321                  pwg_query($query);
322               
323                  array_push($page['infos'], l10n('UserAdvManager_save_config'));
324                }
325       
326      $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array();
327
328      function get_unvalid_user_list()
329        {
330          global $conf, $page;
331 
332          $conf_nbc_UserAdvManager_ConfirmMail = isset($conf['nbc_UserAdvManager_ConfirmMail']) ? explode(";" , $conf['nbc_UserAdvManager_ConfirmMail']) : array(); 
333 
334          $users = array();
335   
336/* search users depending on filters and order */
337//TODO:Adding condition in request [if user in USER_CONFIRM_MAIL_TABLE]
338          $query = '
339            SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
340                            u.'.$conf['user_fields']['username'].' AS username,
341                            u.'.$conf['user_fields']['email'].' AS email,
342                            ui.status,
343                            ui.adviser,
344                            ui.enabled_high,
345                            ui.level,
346                            ui.registration_date
347            FROM '.USERS_TABLE.' AS u
348            INNER JOIN '.USER_INFOS_TABLE.' AS ui
349              ON u.'.$conf['user_fields']['id'].' = ui.user_id
350            LEFT JOIN '.USER_GROUP_TABLE.' AS ug
351              ON u.'.$conf['user_fields']['id'].' = ug.user_id
352            WHERE u.'.$conf['user_fields']['id'].' > 0
353            AND TO_DAYS(NOW()) - TO_DAYS(ui.registration_date) >= '.$conf_nbc_UserAdvManager_ConfirmMail[1].'
354            ORDER BY id ASC
355          ;';
356
357          $result = pwg_query($query);
358     
359          while ($row = mysql_fetch_array($result))
360            {
361              $user = $row;
362              $user['groups'] = array();
363
364              array_push($users, $user);
365            }
366
367/* add group lists */
368          $user_ids = array();
369          foreach ($users as $i => $user)
370            {
371              $user_ids[$i] = $user['id'];
372            }
373          $user_nums = array_flip($user_ids);
374
375          if (count($user_ids) > 0)
376            {
377              $query = '
378                SELECT user_id, group_id
379                FROM '.USER_GROUP_TABLE.'
380                WHERE user_id IN ('.implode(',', $user_ids).')
381              ;';
382       
383              $result = pwg_query($query);
384       
385                  while ($row = mysql_fetch_array($result))
386                {
387                  array_push(
388                    $users[$user_nums[$row['user_id']]]['groups'],
389                    $row['group_id']
390                  );
391                }
392              }
393
394          return $users;
395        }
396
397// +-----------------------------------------------------------------------+
398// |                           initialization                              |
399// +-----------------------------------------------------------------------+
400
401        if (!defined('PHPWG_ROOT_PATH'))
402          {
403            die('Hacking attempt!');
404          }
405         
406        include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
407
408// +-----------------------------------------------------------------------+
409// | Check Access and exit when user status is not ok                      |
410// +-----------------------------------------------------------------------+
411        check_status(ACCESS_ADMINISTRATOR);
412
413        $page['order_by_items'] = array(
414          'id' => l10n('registration_date'),
415          'username' => l10n('Username'),
416          'level' => l10n('Privacy level'),
417          'language' => l10n('language'),
418        );
419
420// +-----------------------------------------------------------------------+
421// |                               user list                               |
422// +-----------------------------------------------------------------------+
423
424            $page['filtered_users'] = get_unvalid_user_list();
425
426// +-----------------------------------------------------------------------+
427// |                            selected users                             |
428// +-----------------------------------------------------------------------+
429//TODO:Link deletion to all users selected or single user
430        if (isset($_POST['delete']))
431          {
432            $collection = array();
433 
434            switch ($_POST['target'])
435              {
436                case 'all' :
437                  {
438                    foreach($page['filtered_users'] as $local_user)
439                      {
440                        array_push($collection, $local_user['id']);
441                      }
442                    break;
443                  }
444                case 'selection' :
445                  {
446                    if (isset($_POST['selection']))
447                      {
448                        $collection = $_POST['selection'];
449                      }
450                    break;
451                  }
452              }
453
454            if (count($collection) == 0)
455              {
456                array_push($page['errors'], l10n('Select at least one user'));
457              }
458          }
459
460// +-----------------------------------------------------------------------+
461// |                             delete users                              |
462// +-----------------------------------------------------------------------+
463        if (isset($_POST['delete']) and count($collection) > 0)
464          {
465            if (in_array($conf['guest_id'], $collection))
466              {
467                array_push($page['errors'], l10n('Guest cannot be deleted'));
468              }
469            if (($conf['guest_id'] != $conf['default_user_id']) and
470            in_array($conf['default_user_id'], $collection))
471              {
472                array_push($page['errors'], l10n('Default user cannot be deleted'));
473              }
474            if (in_array($conf['webmaster_id'], $collection))
475              {
476                array_push($page['errors'], l10n('Webmaster cannot be deleted'));
477              }
478            if (in_array($user['id'], $collection))
479              {
480                array_push($page['errors'], l10n('You cannot delete your account'));
481              }
482
483            if (count($page['errors']) == 0)
484              {
485                if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion'])
486                  {
487                    foreach ($collection as $user_id)
488                      {
489                        delete_user($user_id);
490                      }
491                    array_push(
492                    $page['infos'],
493                    l10n_dec(
494                      '%d user deleted', '%d users deleted',
495                      count($collection)
496                      )
497                    );
498
499                    foreach ($page['filtered_users'] as $filter_key => $filter_user)
500                      {
501                        if (in_array($filter_user['id'], $collection))
502                          {
503                            unset($page['filtered_users'][$filter_key]);
504                          }
505                      }
506                  }
507                else
508                  {
509                    array_push($page['errors'], l10n('You need to confirm deletion'));
510                  }
511               }
512          }
513// +-----------------------------------------------------------------------+
514// |                 Resend new validation key to users                    |
515// +-----------------------------------------------------------------------+
516
517//TODO:Function to send a new validation key to all | single | selected users
518
519// +-----------------------------------------------------------------------+
520// |                              groups list                              |
521// +-----------------------------------------------------------------------+
522
523          $groups[-1] = '------------';
524
525          $query = '
526            SELECT id, name
527            FROM '.GROUPS_TABLE.'
528            ORDER BY name ASC
529            ;';
530
531          $result = pwg_query($query);
532         
533          while ($row = mysql_fetch_array($result))
534            {
535              $groups[$row['id']] = $row['name'];
536            }
537
538// +-----------------------------------------------------------------------+
539// |                           Template Init                               |
540// +-----------------------------------------------------------------------+
541        $base_url = PHPWG_ROOT_PATH.'admin.php?page=user_list';
542
543        if (isset($_GET['start']) and is_numeric($_GET['start']))
544          {
545            $start = $_GET['start'];
546          }
547        else
548          {
549            $start = 0;
550          }
551
552        $template->assign(
553          array(
554            'F_ADD_ACTION' => $base_url,
555            'F_USERNAME' => @htmlentities($_GET['username']),
556            'F_FILTER_ACTION' => get_root_url().'admin.php'
557            )
558          );
559
560/* Hide radio-button if not allow to assign adviser */
561        if ($conf['allow_adviser'])
562          {
563            $template->assign('adviser', true);
564          }
565       
566// +-----------------------------------------------------------------------+
567// |                               user list                               |
568// +-----------------------------------------------------------------------+
569
570        $profile_url = get_root_url().'admin.php?page=profile&amp;user_id=';
571        $perm_url = get_root_url().'admin.php?page=user_perm&amp;user_id=';
572
573        $visible_user_list = array();
574        foreach ($page['filtered_users'] as $num => $local_user)
575          {
576/* simulate LIMIT $start, $conf['users_page'] */
577            if ($num < $start)
578              {
579                continue;
580              }
581            if ($num >= $start + $conf['users_page'])
582              {
583                break;
584              }
585
586            $visible_user_list[] = $local_user;
587          }
588
589        foreach ($visible_user_list as $local_user)
590          {
591            $groups_string = preg_replace(
592              '/(\d+)/e',
593              "\$groups['$1']",
594              implode(
595                ', ',
596                $local_user['groups']
597              )
598            );
599
600            if (isset($_POST['pref_submit'])
601              and isset($_POST['selection'])
602              and in_array($local_user['id'], $_POST['selection']))
603              {
604                $checked = 'checked="checked"';
605              }
606            else
607              {
608                $checked = '';
609              }
610
611            $properties = array();
612            if ( $local_user['level'] != 0 )
613              {
614                $properties[] = l10n( sprintf('Level %d', $local_user['level']) );
615              }
616            $properties[] =
617            (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true'))
618              ? l10n('is_high_enabled') : l10n('is_high_disabled');
619             
620            if (isset($conf_nbc_UserAdvManager_ConfirmMail[1]) and $conf_nbc_UserAdvManager_ConfirmMail[0]=='true' )
621              {
622                $template->append(
623                  'users',
624                  array(
625                    'ID' => $local_user['id'],
626                    'CHECKED' => $checked,
627                    'U_PROFILE' => $profile_url.$local_user['id'],
628                    'U_PERM' => $perm_url.$local_user['id'],
629                    'USERNAME' => $local_user['username']
630                      .($local_user['id'] == $conf['guest_id']
631                        ? '<BR />['.l10n('is_the_guest').']' : '')
632                      .($local_user['id'] == $conf['default_user_id']
633                        ? '<BR />['.l10n('is_the_default').']' : ''),
634                    'STATUS' => l10n('user_status_'.
635                      $local_user['status']).(($local_user['adviser'] == 'true')
636                      ? '<BR />['.l10n('adviser').']' : ''),
637                    'EMAIL' => get_email_address_as_display_text($local_user['email']),
638                    'GROUPS' => $groups_string,
639                    //TODO:Changing ACTION from $properties to Single_Deletion
640                    //TODO:Addin new ACTION to Resend new validation key
641                    'ACTION' => implode( ', ', $properties),
642                  )
643                );
644              }
645          }             
646
647          $template->assign(
648            array(
649                  'UserAdvManager_CONFIRMMAIL_TIMEOUT_TRUE'             => $conf_nbc_UserAdvManager_ConfirmMail[0]=='true' ?  'checked="checked"' : '' ,
650                  'UserAdvManager_CONFIRMMAIL_TIMEOUT_FALSE'    => $conf_nbc_UserAdvManager_ConfirmMail[0]=='false' ?  'checked="checked"' : '' ,
651                  'UserAdvManager_CONFIRMMAIL_DELAY'                    => $conf_nbc_UserAdvManager_ConfirmMail[1],
652                  //TODO:Adding new option [Auto Deletion : True | False]
653                  //TODO:Adding new option [Resend_new_validation_key : True | False]
654            )
655          );           
656
657// +-----------------------------------------------------------------------+
658// |                             errors display                            |
659// +-----------------------------------------------------------------------+
660          if ( isset ($errors) and count($errors) != 0)
661            {
662              $template->assign('errors',array());
663              foreach ($errors as $error)
664                        {
665                          array_push($page['errors'], $error);
666                        }
667                } 
668
669// +-----------------------------------------------------------------------+
670// |                           templates display                           |
671// +-----------------------------------------------------------------------+
672      $template->set_filename('plugin_admin_content', dirname(__FILE__) . '/confirmmail.tpl');
673      $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');               
674    }
675  else
676    {
677          array_push($page['infos'], l10n('Err_ConfirmMail_Settings'));
678    }
679  break;
680}
681?>
Note: See TracBrowser for help on using the repository browser.