source: trunk/admin/user_list.php @ 28187

Last change on this file since 28187 was 26461, checked in by mistic100, 11 years ago

Update headers to 2014. Happy new year!!

  • Property svn:eol-style set to LF
File size: 5.0 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Piwigo - a PHP based photo gallery                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2008-2014 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/**
25 * Add users and manage users list
26 */
27
28// +-----------------------------------------------------------------------+
29// | tabs                                                                  |
30// +-----------------------------------------------------------------------+
31
32include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
33
34$my_base_url = get_root_url().'admin.php?page=';
35
36$tabsheet = new tabsheet();
37$tabsheet->set_id('users');
38$tabsheet->select('user_list');
39$tabsheet->assign();
40
41// +-----------------------------------------------------------------------+
42// |                              groups list                              |
43// +-----------------------------------------------------------------------+
44
45$groups = array();
46
47$query = '
48SELECT id, name
49  FROM '.GROUPS_TABLE.'
50  ORDER BY name ASC
51;';
52$result = pwg_query($query);
53
54while ($row = pwg_db_fetch_assoc($result))
55{
56  $groups[$row['id']] = $row['name'];
57}
58
59// +-----------------------------------------------------------------------+
60// | template                                                              |
61// +-----------------------------------------------------------------------+
62
63$template->set_filenames(array('user_list'=>'user_list.tpl'));
64
65$query = '
66SELECT
67    DISTINCT u.'.$conf['user_fields']['id'].' AS id,
68    u.'.$conf['user_fields']['username'].' AS username,
69    u.'.$conf['user_fields']['email'].' AS email,
70    ui.status,
71    ui.enabled_high,
72    ui.level
73  FROM '.USERS_TABLE.' AS u
74    INNER JOIN '.USER_INFOS_TABLE.' AS ui ON u.'.$conf['user_fields']['id'].' = ui.user_id
75  WHERE u.'.$conf['user_fields']['id'].' > 0
76;';
77
78$result = pwg_query($query);
79while ($row = pwg_db_fetch_assoc($result))
80{
81  $users[] = $row;
82  $user_ids[] = $row['id'];
83}
84
85$template->assign(
86  array(
87    'users' => $users,
88    'all_users' => join(',', $user_ids),
89    'Double_Password' => $conf['double_password_type_in_admin']
90    )
91  );
92
93$default_user = get_default_user_info(true);
94
95$protected_users = array(
96  $user['id'],
97  $conf['guest_id'],
98  $conf['default_user_id'],
99  $conf['webmaster_id'],
100  );
101
102$template->assign(
103  array(
104    'PWG_TOKEN' => get_pwg_token(),
105    'NB_IMAGE_PAGE' => $default_user['nb_image_page'],
106    'RECENT_PERIOD' => $default_user['recent_period'],
107    'theme_options' => get_pwg_themes(),
108    'theme_selected' => get_default_theme(),
109    'language_options' => get_languages(),
110    'language_selected' => get_default_language(),
111    'association_options' => $groups,
112    'protected_users' => implode(',', array_unique($protected_users)),
113    'guest_user' => $conf['guest_id'],
114    )
115  );
116
117// Status options
118foreach (get_enums(USER_INFOS_TABLE, 'status') as $status)
119{
120  // Only status <= can be assign
121  if (is_autorize_status(get_access_type_status($status)))
122  {
123    $pref_status_options[$status] = l10n('user_status_'.$status);
124  }
125}
126$template->assign('pref_status_options', $pref_status_options);
127$template->assign('pref_status_selected', 'normal');
128
129// user level options
130foreach ($conf['available_permission_levels'] as $level)
131{
132  $level_options[$level] = l10n(sprintf('Level %d', $level));
133}
134$template->assign('level_options', $level_options);
135$template->assign('level_selected', $default_user['level']);
136
137
138// +-----------------------------------------------------------------------+
139// | html code display                                                     |
140// +-----------------------------------------------------------------------+
141
142$template->assign_var_from_handle('ADMIN_CONTENT', 'user_list');
143?>
Note: See TracBrowser for help on using the repository browser.