source: trunk/admin/user_list.php @ 1489

Last change on this file since 1489 was 1489, checked in by nikrou, 18 years ago

bug 482 fixed: deletion of our account must be impossible

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 22.7 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-2005 PhpWebGallery Team - http://phpwebgallery.net |
6// +-----------------------------------------------------------------------+
7// | branch        : BSF (Best So Far)
8// | file          : $RCSfile$
9// | last update   : $Date: 2006-07-21 15:28:09 +0000 (Fri, 21 Jul 2006) $
10// | last modifier : $Author: nikrou $
11// | revision      : $Revision: 1489 $
12// +-----------------------------------------------------------------------+
13// | This program is free software; you can redistribute it and/or modify  |
14// | it under the terms of the GNU General Public License as published by  |
15// | the Free Software Foundation                                          |
16// |                                                                       |
17// | This program is distributed in the hope that it will be useful, but   |
18// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
19// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
20// | General Public License for more details.                              |
21// |                                                                       |
22// | You should have received a copy of the GNU General Public License     |
23// | along with this program; if not, write to the Free Software           |
24// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
25// | USA.                                                                  |
26// +-----------------------------------------------------------------------+
27
28/**
29 * Add users and manage users list
30 */
31
32// +-----------------------------------------------------------------------+
33// |                              functions                                |
34// +-----------------------------------------------------------------------+
35
36/**
37 * returns a list of users depending on page filters (in $_GET)
38 *
39 * Each user comes with his related informations : id, username, mail
40 * address, list of groups.
41 *
42 * @return array
43 */
44function get_filtered_user_list()
45{
46  global $conf, $page;
47
48  $users = array();
49 
50  // filter
51  $filter = array();
52 
53  if (isset($_GET['username']) and !empty($_GET['username']))
54  {
55    $username = str_replace('*', '%', $_GET['username']);
56    if (function_exists('mysql_real_escape_string'))
57    {
58      $filter['username'] = mysql_real_escape_string($username);
59    }
60    else
61    {
62      $filter['username'] = mysql_escape_string($username);
63    }
64  }
65
66  if (isset($_GET['group'])
67      and -1 != $_GET['group']
68      and is_numeric($_GET['group']))
69  {
70    $filter['group'] = $_GET['group'];
71  }
72
73  if (isset($_GET['status'])
74      and in_array($_GET['status'], get_enums(USER_INFOS_TABLE, 'status')))
75  {
76    $filter['status'] = $_GET['status'];
77  }
78
79  // how to order the list?
80  $order_by = 'id';
81  if (isset($_GET['order_by'])
82      and in_array($_GET['order_by'], array_keys($page['order_by_items'])))
83  {
84    $order_by = $_GET['order_by'];
85  }
86 
87  $direction = 'ASC';
88  if (isset($_GET['direction'])
89      and in_array($_GET['direction'], array_keys($page['direction_items'])))
90  {
91    $direction = strtoupper($_GET['direction']);
92  }
93
94  // search users depending on filters and order
95  $query = '
96SELECT DISTINCT u.'.$conf['user_fields']['id'].' AS id,
97                u.'.$conf['user_fields']['username'].' AS username,
98                u.'.$conf['user_fields']['email'].' AS email,
99                ui.status,
100                ui.adviser,
101                ui.enabled_high
102  FROM '.USERS_TABLE.' AS u
103    INNER JOIN '.USER_INFOS_TABLE.' AS ui
104      ON u.'.$conf['user_fields']['id'].' = ui.user_id
105    LEFT JOIN '.USER_GROUP_TABLE.' AS ug
106      ON u.'.$conf['user_fields']['id'].' = ug.user_id
107  WHERE u.'.$conf['user_fields']['id'].' != '.$conf['guest_id'];
108  if (isset($filter['username']))
109  {
110    $query.= '
111  AND u.'.$conf['user_fields']['username'].' LIKE \''.$filter['username'].'\'';
112  }
113  if (isset($filter['group']))
114  {
115    $query.= '
116    AND ug.group_id = '.$filter['group'];
117  }
118  if (isset($filter['status']))
119  {
120    $query.= '
121    AND ui.status = \''.$filter['status']."'";
122  }
123  $query.= '
124  ORDER BY '.$order_by.' '.$direction.'
125;';
126
127  $result = pwg_query($query);
128  while ($row = mysql_fetch_array($result))
129  {
130    $user = $row;
131    $user['groups'] = array();
132
133    array_push($users, $user);
134  }
135
136  // add group lists
137  $user_ids = array();
138  foreach ($users as $i => $user)
139  {
140    $user_ids[$i] = $user['id'];
141  }
142  $user_nums = array_flip($user_ids);
143 
144  if (count($user_ids) > 0)
145  {
146    $query = '
147SELECT user_id, group_id
148  FROM '.USER_GROUP_TABLE.'
149  WHERE user_id IN ('.implode(',', $user_ids).')
150;';
151    $result = pwg_query($query);
152    while ($row = mysql_fetch_array($result))
153    {
154      array_push(
155        $users[$user_nums[$row['user_id']]]['groups'],
156        $row['group_id']
157        );
158    }
159  }
160   
161  return $users;
162}
163
164// +-----------------------------------------------------------------------+
165// |                           initialization                              |
166// +-----------------------------------------------------------------------+
167
168if (!defined('PHPWG_ROOT_PATH'))
169{
170  die('Hacking attempt!');
171}
172
173include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
174
175// +-----------------------------------------------------------------------+
176// | Check Access and exit when user status is not ok                      |
177// +-----------------------------------------------------------------------+
178check_status(ACCESS_ADMINISTRATOR);
179
180$page['order_by_items'] = array(
181  'id' => $lang['registration_date'],
182  'username' => $lang['Username']
183  );
184
185$page['direction_items'] = array(
186  'asc' => $lang['ascending'],
187  'desc' => $lang['descending']
188  );
189
190// +-----------------------------------------------------------------------+
191// |                              add a user                               |
192// +-----------------------------------------------------------------------+
193
194if (isset($_POST['submit_add']))
195{
196  $page['errors'] = register_user($_POST['login'], $_POST['password'], '');
197
198  if (count($page['errors']) == 0)
199  {
200    array_push(
201      $page['infos'],
202      sprintf(
203        l10n('user "%s" added'),
204        $_POST['login']
205        )
206      );
207  }
208}
209
210// +-----------------------------------------------------------------------+
211// |                               user list                               |
212// +-----------------------------------------------------------------------+
213
214$page['filtered_users'] = get_filtered_user_list();
215
216// +-----------------------------------------------------------------------+
217// |                            selected users                             |
218// +-----------------------------------------------------------------------+
219
220if (isset($_POST['delete']) or isset($_POST['pref_submit']))
221{
222  $collection = array();
223 
224  switch ($_POST['target'])
225  {
226    case 'all' :
227    {
228      foreach($page['filtered_users'] as $local_user)
229      {
230        array_push($collection, $local_user['id']);
231      }
232      break;
233    }
234    case 'selection' :
235    {
236      if (isset($_POST['selection']))
237      {
238        $collection = $_POST['selection'];
239      }
240      break;
241    }
242  }
243
244  if (count($collection) == 0)
245  {
246    array_push($page['errors'], l10n('Select at least one user'));
247  }
248}
249
250// +-----------------------------------------------------------------------+
251// |                             delete users                              |
252// +-----------------------------------------------------------------------+
253if (isset($_POST['delete']) and count($collection) > 0)
254{
255  if (in_array($conf['webmaster_id'], $collection))
256  {
257    array_push($page['errors'], l10n('Webmaster cannot be deleted'));
258  }
259  elseif (in_array($user['id'], $collection))
260  {
261    array_push($page['errors'], l10n('You cannot delete your account'));
262  }
263  else
264  {
265    if (isset($_POST['confirm_deletion']) and 1 == $_POST['confirm_deletion'])
266    {
267      foreach ($collection as $user_id)
268      {
269        delete_user($user_id);
270      }
271      array_push(
272        $page['infos'],
273        sprintf(
274          l10n('%d users deleted'),
275          count($collection) 
276          )
277        );
278      foreach ($page['filtered_users'] as $filter_key => $filter_user)
279      {
280        if (in_array($filter_user['id'], $collection))
281        {
282          unset($page['filtered_users'][$filter_key]);
283        }
284      }
285    }
286    else
287    {
288      array_push($page['errors'], l10n('You need to confirm deletion'));
289    }
290  }
291}
292
293// +-----------------------------------------------------------------------+
294// |                       preferences form submission                     |
295// +-----------------------------------------------------------------------+
296
297if (isset($_POST['pref_submit']) and count($collection) > 0)
298{
299  if (-1 != $_POST['associate'])
300  {
301    $datas = array();
302   
303    $query = '
304SELECT user_id
305  FROM '.USER_GROUP_TABLE.'
306  WHERE group_id = '.$_POST['associate'].'
307;';
308    $associated = array_from_query($query, 'user_id');
309   
310    $associable = array_diff($collection, $associated);
311   
312    if (count($associable) > 0)
313    {
314      foreach ($associable as $item)
315      {
316        array_push($datas,
317                   array('group_id'=>$_POST['associate'],
318                         'user_id'=>$item));
319      }
320       
321      mass_inserts(USER_GROUP_TABLE,
322                   array('group_id', 'user_id'),
323                   $datas);
324    }
325  }
326 
327  if (-1 != $_POST['dissociate'])
328  {
329    $query = '
330DELETE FROM '.USER_GROUP_TABLE.'
331  WHERE group_id = '.$_POST['dissociate'].'
332  AND user_id IN ('.implode(',', $collection).')
333';
334    pwg_query($query);
335  }
336 
337  // properties to set for the collection (a user list)
338  $datas = array();
339  $dbfields = array('primary' => array('user_id'), 'update' => array());
340 
341  $formfields =
342    array('nb_image_line', 'nb_line_page', 'template', 'language',
343          'recent_period', 'maxwidth', 'expand', 'show_nb_comments',
344          'maxheight', 'status', 'enabled_high');
345 
346  $true_false_fields = array('expand', 'show_nb_comments', 'enabled_high');
347  if ($conf['allow_adviser'])
348  {
349    array_push($formfields, 'adviser');
350    array_push($true_false_fields, 'adviser');
351  }
352 
353  foreach ($formfields as $formfield)
354  {
355    // special for true/false fields
356    if (in_array($formfield, $true_false_fields))
357    {
358      $test = $formfield;
359    }
360    else
361    {
362      $test = $formfield.'_action';
363    }
364   
365    if ($_POST[$test] != 'leave')
366    {
367      array_push($dbfields['update'], $formfield);
368    }
369  }
370 
371  // updating elements is useful only if needed...
372  if (count($dbfields['update']) > 0)
373  {
374    $datas = array();
375   
376    foreach ($collection as $user_id)
377    {
378      $data = array();
379      $data['user_id'] = $user_id;
380     
381      // TODO : verify if submited values are semanticaly correct
382      foreach ($dbfields['update'] as $dbfield)
383      {
384        // if the action is 'unset', the key won't be in row and
385        // mass_updates function will set this field to NULL
386        if (in_array($dbfield, $true_false_fields)
387            or 'set' == $_POST[$dbfield.'_action'])
388        {
389          $data[$dbfield] = $_POST[$dbfield];
390        }
391      }
392
393      // Webmaster status must not be changed
394      if ($conf['webmaster_id'] == $user_id and isset($data['status']))
395      {
396        $data['status'] = 'webmaster';
397      }
398
399      // Webmaster and guest adviser must not be changed
400      if ((($conf['webmaster_id'] == $user_id) or ($conf['guest_id'] == $user_id)) and isset($data['adviser']))
401      {
402        $data['adviser'] = 'false';
403      }
404
405      array_push($datas, $data);
406    }
407   
408    mass_updates(USER_INFOS_TABLE, $dbfields, $datas);
409  }
410
411  redirect(
412    PHPWG_ROOT_PATH.
413    'admin.php'.
414    get_query_string_diff(
415      array(
416        'start'
417        )
418      )
419    );
420}
421
422// +-----------------------------------------------------------------------+
423// |                              groups list                              |
424// +-----------------------------------------------------------------------+
425
426$groups = array();
427
428$query = '
429SELECT id, name
430  FROM '.GROUPS_TABLE.'
431;';
432$result = pwg_query($query);
433
434while ($row = mysql_fetch_array($result))
435{
436  $groups[$row['id']] = $row['name'];
437}
438
439// +-----------------------------------------------------------------------+
440// |                             template init                             |
441// +-----------------------------------------------------------------------+
442
443$template->set_filenames(array('user_list'=>'admin/user_list.tpl'));
444
445$base_url = PHPWG_ROOT_PATH.'admin.php?page=user_list';
446
447if (isset($_GET['start']) and is_numeric($_GET['start']))
448{
449  $start = $_GET['start'];
450}
451else
452{
453  $start = 0;
454}
455
456$template->assign_vars(
457  array(
458    'L_AUTH_USER'=>$lang['permuser_only_private'],
459    'L_GROUP_ADD_USER' => $lang['group_add_user'],
460    'L_SUBMIT'=>$lang['submit'],
461    'L_STATUS'=>$lang['user_status'],
462    'L_PASSWORD' => $lang['password'],
463    'L_EMAIL' => $lang['mail_address'],
464    'L_ORDER_BY' => $lang['order_by'],
465    'L_ACTIONS' => $lang['actions'],
466    'L_PROPERTIES' => $lang['properties'],
467    'L_PERMISSIONS' => $lang['permissions'],
468    'L_USERS_LIST' => $lang['title_liste_users'],
469    'L_LANGUAGE' => $lang['language'],
470    'L_NB_IMAGE_LINE' => $lang['nb_image_per_row'],
471    'L_NB_LINE_PAGE' => $lang['nb_row_per_page'],
472    'L_TEMPLATE' => $lang['theme'],
473    'L_RECENT_PERIOD' => $lang['recent_period'],
474    'L_EXPAND' => $lang['auto_expand'],
475    'L_SHOW_NB_COMMENTS' => $lang['show_nb_comments'],
476    'L_MAXWIDTH' => $lang['maxwidth'],
477    'L_MAXHEIGHT' => $lang['maxheight'],
478    'L_YES' => $lang['yes'],
479    'L_NO' => $lang['no'],
480    'L_SUBMIT' => $lang['submit'],
481    'L_RESET' => $lang['reset'],
482    'L_DELETE' => $lang['user_delete'],
483    'L_DELETE_HINT' => $lang['user_delete_hint'],
484
485    'U_HELP' => PHPWG_ROOT_PATH.'popuphelp.php?page=user_list',
486   
487    'F_ADD_ACTION' => $base_url,
488    'F_USERNAME' => @$_GET['username'],
489    'F_FILTER_ACTION' => PHPWG_ROOT_PATH.'admin.php'
490    ));
491
492if (isset($_GET['id']))
493{
494  $template->assign_block_vars('session', array('ID' => $_GET['id']));
495}
496
497// Hide radio-button if not allow to assign adviser
498if ($conf['allow_adviser'])
499{
500  $template->assign_block_vars('adviser', array());
501}
502
503foreach ($page['order_by_items'] as $item => $label)
504{
505  $selected = (isset($_GET['order_by']) and $_GET['order_by'] == $item) ?
506    'selected="selected"' : '';
507  $template->assign_block_vars(
508    'order_by',
509    array(
510      'VALUE' => $item,
511      'CONTENT' => $label,
512      'SELECTED' => $selected
513      ));
514}
515
516foreach ($page['direction_items'] as $item => $label)
517{
518  $selected = (isset($_GET['direction']) and $_GET['direction'] == $item) ?
519    'selected="selected"' : '';
520  $template->assign_block_vars(
521    'direction',
522    array(
523      'VALUE' => $item,
524      'CONTENT' => $label,
525      'SELECTED' => $selected
526      ));
527}
528
529$blockname = 'group_option';
530
531$template->assign_block_vars(
532  $blockname,
533  array(
534    'VALUE'=> -1,
535    'CONTENT' => '------------',
536    'SELECTED' => ''
537    ));
538
539foreach ($groups as $group_id => $group_name)
540{
541  $selected = (isset($_GET['group']) and $_GET['group'] == $group_id) ?
542    'selected="selected"' : '';
543  $template->assign_block_vars(
544    $blockname,
545    array(
546      'VALUE' => $group_id,
547      'CONTENT' => $group_name,
548      'SELECTED' => $selected
549      ));
550}
551
552$blockname = 'status_option';
553
554$template->assign_block_vars(
555  $blockname,
556  array(
557    'VALUE'=> -1,
558    'CONTENT' => '------------',
559    'SELECTED' => ''
560    ));
561
562foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
563{
564  $selected = (isset($_GET['status']) and $_GET['status'] == $status) ?
565    'selected="selected"' : '';
566  $template->assign_block_vars(
567    $blockname,
568    array(
569      'VALUE' => $status,
570      'CONTENT' => $lang['user_status_'.$status],
571      'SELECTED' => $selected
572      ));
573}
574
575// ---
576//   $user['template'] = $conf['default_template'];
577//   $user['nb_image_line'] = $conf['nb_image_line'];
578//   $user['nb_line_page'] = $conf['nb_line_page'];
579//   $user['language'] = $conf['default_language'];
580//   $user['maxwidth'] = $conf['default_maxwidth'];
581//   $user['maxheight'] = $conf['default_maxheight'];
582//   $user['recent_period'] = $conf['recent_period'];
583//   $user['expand'] = $conf['auto_expand'];
584//   $user['show_nb_comments'] = $conf['show_nb_comments'];
585// ---
586
587if (isset($_POST['pref_submit']))
588{
589//  echo '<pre>'; print_r($_POST); echo '</pre>';
590  $template->assign_vars(
591    array(
592      'ADVISER_YES' => 'true' == (isset($_POST['adviser']) and $_POST['adviser']) ? 'checked="checked"' : '',
593      'ADVISER_NO' => 'false' == (isset($_POST['adviser']) and $_POST['adviser']) ? 'checked="checked"' : '',
594      'NB_IMAGE_LINE' => $_POST['nb_image_line'],
595      'NB_LINE_PAGE' => $_POST['nb_line_page'],
596      'MAXWIDTH' => $_POST['maxwidth'],
597      'MAXHEIGHT' => $_POST['maxheight'],
598      'RECENT_PERIOD' => $_POST['recent_period'],
599      'EXPAND_YES' => 'true' == $_POST['expand'] ? 'checked="checked"' : '',
600      'EXPAND_NO' => 'false' == $_POST['expand'] ? 'checked="checked"' : '',
601      'SHOW_NB_COMMENTS_YES' =>
602        'true' == $_POST['show_nb_comments'] ? 'checked="checked"' : '',
603      'SHOW_NB_COMMENTS_NO' =>
604        'false' == $_POST['show_nb_comments'] ? 'checked="checked"' : '',
605      'ENABLED_HIGH_YES' => 'true' == $_POST['enabled_high'] ? 'checked="checked"' : '',
606      'ENABLED_HIGH_NO' => 'false' == $_POST['enabled_high'] ? 'checked="checked"' : '',
607      ));
608}
609else
610{
611  $template->assign_vars(
612    array(
613      'NB_IMAGE_LINE' => $conf['nb_image_line'],
614      'NB_LINE_PAGE' => $conf['nb_line_page'],
615      'MAXWIDTH' => @$conf['default_maxwidth'],
616      'MAXHEIGHT' => @$conf['default_maxheight'],
617      'RECENT_PERIOD' => $conf['recent_period'],
618      ));
619}
620
621$blockname = 'template_option';
622
623foreach (get_pwg_themes() as $pwg_template)
624{
625  if (isset($_POST['pref_submit']))
626  {
627    $selected = $_POST['template']==$pwg_template ? 'selected="selected"' : '';
628  }
629  else if ($conf['default_template'] == $pwg_template)
630  {
631    $selected = 'selected="selected"';
632  }
633  else
634  {
635    $selected = '';
636  }
637 
638  $template->assign_block_vars(
639    $blockname,
640    array(
641      'VALUE'=> $pwg_template,
642      'CONTENT' => $pwg_template,
643      'SELECTED' => $selected
644      ));
645}
646
647$blockname = 'language_option';
648
649foreach (get_languages() as $language_code => $language_name)
650{
651  if (isset($_POST['pref_submit']))
652  {
653    $selected = $_POST['language']==$language_code ? 'selected="selected"':'';
654  }
655  else if ($conf['default_language'] == $language_code)
656  {
657    $selected = 'selected="selected"';
658  }
659  else
660  {
661    $selected = '';
662  }
663 
664  $template->assign_block_vars(
665    $blockname,
666    array(
667      'VALUE'=> $language_code,
668      'CONTENT' => $language_name,
669      'SELECTED' => $selected
670      ));
671}
672
673$blockname = 'pref_status_option';
674
675foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
676{
677  if (isset($_POST['pref_submit']))
678  {
679    $selected = $_POST['status'] == $status ? 'selected="selected"' : '';
680  }
681  else if ('normal' == $status)
682  {
683    $selected = 'selected="selected"';
684  }
685  else
686  {
687    $selected = '';
688  }
689
690  // Only status <= can be assign
691  if (is_autorize_status(get_access_type_status($status)))
692  {
693    $template->assign_block_vars(
694      $blockname,
695      array(
696        'VALUE' => $status,
697        'CONTENT' => $lang['user_status_'.$status],
698        'SELECTED' => $selected
699        ));
700  }
701}
702
703// associate
704$blockname = 'associate_option';
705
706$template->assign_block_vars(
707  $blockname,
708  array(
709    'VALUE'=> -1,
710    'CONTENT' => '------------',
711    'SELECTED' => ''
712    ));
713
714foreach ($groups as $group_id => $group_name)
715{
716  if (isset($_POST['pref_submit']))
717  {
718    $selected = $_POST['associate'] == $group_id ? 'selected="selected"' : '';
719  }
720  else
721  {
722    $selected = '';
723  }
724   
725  $template->assign_block_vars(
726    $blockname,
727    array(
728      'VALUE' => $group_id,
729      'CONTENT' => $group_name,
730      'SELECTED' => $selected
731      ));
732}
733
734// dissociate
735$blockname = 'dissociate_option';
736
737$template->assign_block_vars(
738  $blockname,
739  array(
740    'VALUE'=> -1,
741    'CONTENT' => '------------',
742    'SELECTED' => ''
743    ));
744
745foreach ($groups as $group_id => $group_name)
746{
747  if (isset($_POST['pref_submit']))
748  {
749    $selected = $_POST['dissociate'] == $group_id ? 'selected="selected"' : '';
750  }
751  else
752  {
753    $selected = '';
754  }
755   
756  $template->assign_block_vars(
757    $blockname,
758    array(
759      'VALUE' => $group_id,
760      'CONTENT' => $group_name,
761      'SELECTED' => $selected
762      ));
763}
764
765// +-----------------------------------------------------------------------+
766// |                            navigation bar                             |
767// +-----------------------------------------------------------------------+
768
769$url = PHPWG_ROOT_PATH.'admin.php'.get_query_string_diff(array('start'));
770
771$navbar = create_navigation_bar(
772  $url,
773  count($page['filtered_users']),
774  $start,
775  $conf['users_page']
776  );
777
778$template->assign_vars(array('NAVBAR' => $navbar));
779
780// +-----------------------------------------------------------------------+
781// |                               user list                               |
782// +-----------------------------------------------------------------------+
783
784$profile_url = PHPWG_ROOT_PATH.'admin.php?page=profile&amp;user_id=';
785$perm_url = PHPWG_ROOT_PATH.'admin.php?page=user_perm&amp;user_id=';
786
787foreach ($page['filtered_users'] as $num => $local_user)
788{
789  // simulate LIMIT $start, $conf['users_page']
790  if ($num < $start)
791  {
792    continue;
793  }
794  if ($num >= $start + $conf['users_page'])
795  {
796    break;
797  }
798
799  $groups_string = preg_replace(
800    '/(\d+)/e',
801    "\$groups['$1']",
802    implode(
803      ', ',
804      $local_user['groups']
805      )
806    );
807
808  if (isset($_POST['pref_submit'])
809      and isset($_POST['selection'])
810      and in_array($local_user['id'], $_POST['selection']))
811  {
812    $checked = 'checked="checked"';
813  }
814  else
815  {
816    $checked = '';
817  }
818
819  $template->assign_block_vars(
820    'user',
821    array(
822      'CLASS' => ($num % 2 == 1) ? 'row2' : 'row1',
823      'ID' => $local_user['id'],
824      'CHECKED' => $checked,
825      'U_MOD' => $profile_url.$local_user['id'],
826      'U_PERM' => $perm_url.$local_user['id'],
827      'USERNAME' => $local_user['username'],
828      'STATUS' => $lang['user_status_'.$local_user['status']].(($local_user['adviser'] == 'true') ? ' ['.$lang['adviser'].']' : ''),
829      'EMAIL' => get_email_address_as_display_text($local_user['email']),
830      'GROUPS' => $groups_string,
831      'PROPERTIES' => (isset($local_user['enabled_high']) and ($local_user['enabled_high'] == 'true')) ? $lang['is_high_enabled'] : $lang['is_high_disabled']
832      )
833    );
834}
835
836// +-----------------------------------------------------------------------+
837// |                           html code display                           |
838// +-----------------------------------------------------------------------+
839
840$template->assign_var_from_handle('ADMIN_CONTENT', 'user_list');
841?>
Note: See TracBrowser for help on using the repository browser.