1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
//------------------------------------------------------------------------------ |
4
|
|
|
// |
5
|
|
|
// eTraxis - Records tracking web-based system |
6
|
|
|
// Copyright (C) 2005-2010 Artem Rodygin |
7
|
|
|
// |
8
|
|
|
// This program is free software: you can redistribute it and/or modify |
9
|
|
|
// it under the terms of the GNU General Public License as published by |
10
|
|
|
// the Free Software Foundation, either version 3 of the License, or |
11
|
|
|
// (at your option) any later version. |
12
|
|
|
// |
13
|
|
|
// This program is distributed in the hope that it will be useful, |
14
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of |
15
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16
|
|
|
// GNU 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, see <http://www.gnu.org/licenses/>. |
20
|
|
|
// |
21
|
|
|
//------------------------------------------------------------------------------ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @package eTraxis |
25
|
|
|
* @ignore |
26
|
|
|
*/ |
27
|
|
|
|
28
|
|
|
/**#@+ |
29
|
|
|
* Dependency. |
30
|
|
|
*/ |
31
|
|
|
require_once('../engine/engine.php'); |
32
|
|
|
require_once('../dbo/accounts.php'); |
33
|
|
|
/**#@-*/ |
34
|
|
|
|
35
|
|
|
init_page(LOAD_TAB); |
36
|
|
|
|
37
|
|
|
if (get_user_level() != USER_LEVEL_ADMIN) |
38
|
|
|
{ |
39
|
|
|
debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.'); |
40
|
|
|
exit; |
41
|
|
|
} |
42
|
|
|
|
43
|
|
|
// local JS functions |
44
|
|
|
|
45
|
|
|
$resTitle = get_js_resource(RES_NEW_ACCOUNT_ID); |
46
|
|
|
$resOK = get_js_resource(RES_OK_ID); |
47
|
|
|
$resCancel = get_js_resource(RES_CANCEL_ID); |
48
|
|
|
|
49
|
|
|
$xml = <<<JQUERY |
50
|
|
|
<script> |
51
|
|
|
|
52
|
|
|
function accountCreate () |
53
|
|
|
{ |
54
|
|
|
jqModal("{$resTitle}", "create.php", "{$resOK}", "{$resCancel}", "$('#createform').submit()"); |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
</script> |
58
|
|
|
JQUERY; |
59
|
|
|
|
60
|
|
|
// get list of accounts |
61
|
|
|
|
62
|
|
|
$sort = $page = NULL; |
63
|
|
|
$list = accounts_list($sort, $page); |
64
|
|
|
|
65
|
|
|
$from = $to = 0; |
66
|
|
|
|
67
|
|
|
// generate buttons |
68
|
|
|
|
69
|
|
|
$xml .= (MAX_ACCOUNTS_NUMBER == 0 || $list->rows < MAX_ACCOUNTS_NUMBER |
|
|
|
|
70
|
|
|
? '<button action="accountCreate()">' |
71
|
|
|
: '<button disabled="true">') |
72
|
|
|
. get_html_resource(RES_CREATE_ID) |
73
|
|
|
. '</button>'; |
74
|
|
|
|
75
|
|
|
// generate list of accounts |
76
|
|
|
|
77
|
|
|
if ($list->rows != 0) |
|
|
|
|
78
|
|
|
{ |
79
|
|
|
$columns = array |
80
|
|
|
( |
81
|
|
|
RES_USERNAME_ID, |
82
|
|
|
RES_FULLNAME_ID, |
83
|
|
|
RES_EMAIL_ID, |
84
|
|
|
RES_PERMISSIONS_ID, |
85
|
|
|
RES_DESCRIPTION_ID, |
86
|
|
|
); |
87
|
|
|
|
88
|
|
|
$bookmarks = gen_xml_bookmarks($page, $list->rows, $from, $to, 'list.php?'); |
|
|
|
|
89
|
|
|
|
90
|
|
|
$xml .= '<list>' |
91
|
|
|
. '<hrow>'; |
92
|
|
|
|
93
|
|
View Code Duplication |
for ($i = 1; $i <= count($columns); $i++) |
94
|
|
|
{ |
95
|
|
|
$smode = ($sort == $i ? ($i + count($columns)) : $i); |
96
|
|
|
|
97
|
|
|
$xml .= "<hcell url=\"list.php?sort={$smode}\">" |
98
|
|
|
. get_html_resource($columns[$i - 1]) |
99
|
|
|
. '</hcell>'; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
$xml .= '</hrow>'; |
103
|
|
|
|
104
|
|
|
$list->seek($from - 1); |
105
|
|
|
|
106
|
|
|
for ($i = $from; $i <= $to; $i++) |
107
|
|
|
{ |
108
|
|
|
$row = $list->fetch(); |
109
|
|
|
|
110
|
|
|
if (is_account_locked($row['locks_count'], $row['lock_time'])) |
111
|
|
|
{ |
112
|
|
|
$color = 'red'; |
113
|
|
|
} |
114
|
|
|
elseif ($row['is_disabled']) |
115
|
|
|
{ |
116
|
|
|
$color = 'grey'; |
117
|
|
|
} |
118
|
|
|
else |
119
|
|
|
{ |
120
|
|
|
$color = NULL; |
121
|
|
|
} |
122
|
|
|
|
123
|
|
|
$xml .= "<row url=\"view.php?id={$row['account_id']}\" color=\"{$color}\">" |
124
|
|
|
. '<cell>' . ustr2html(account_get_username($row['username'], FALSE)) . '</cell>' |
125
|
|
|
. '<cell>' . ustr2html($row['fullname']) . '</cell>' |
126
|
|
|
. '<cell>' . ustr2html($row['email']) . '</cell>' |
127
|
|
|
. '<cell>' . get_html_resource($row['is_admin'] == 0 ? RES_USER_ID : RES_ADMINISTRATOR_ID) . '</cell>' |
128
|
|
|
. '<cell>' . ustr2html($row['description']) . '</cell>' |
129
|
|
|
. '</row>'; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
$xml .= '</list>' |
133
|
|
|
. $bookmarks; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
echo(xml2html($xml)); |
137
|
|
|
|
138
|
|
|
?> |
139
|
|
|
|
Since your code implements the magic setter
_set
, this function will be called for any write access on an undefined variable. You can add the@property
annotation to your class or interface to document the existence of this variable.Since the property has write access only, you can use the @property-write annotation instead.
Of course, you may also just have mistyped another name, in which case you should fix the error.
See also the PhpDoc documentation for @property.