|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
//------------------------------------------------------------------------------ |
|
4
|
|
|
// |
|
5
|
|
|
// eTraxis - Records tracking web-based system |
|
6
|
|
|
// Copyright (C) 2005-2011 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/groups.php'); |
|
33
|
|
|
require_once('../dbo/projects.php'); |
|
34
|
|
|
/**#@-*/ |
|
35
|
|
|
|
|
36
|
|
|
init_page(LOAD_TAB); |
|
37
|
|
|
|
|
38
|
|
|
if (get_user_level() != USER_LEVEL_ADMIN) |
|
39
|
|
|
{ |
|
40
|
|
|
debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.'); |
|
41
|
|
|
exit; |
|
42
|
|
|
} |
|
43
|
|
|
|
|
44
|
|
|
// check that requested project exists |
|
45
|
|
|
|
|
46
|
|
|
$pid = ustr2int(try_request('pid')); |
|
47
|
|
|
$project = project_find($pid); |
|
48
|
|
|
|
|
49
|
|
|
if (!$project) |
|
|
|
|
|
|
50
|
|
|
{ |
|
51
|
|
|
debug_write_log(DEBUG_NOTICE, 'Project cannot be found.'); |
|
52
|
|
|
exit; |
|
53
|
|
|
} |
|
54
|
|
|
|
|
55
|
|
|
// check that requested group exists |
|
56
|
|
|
|
|
57
|
|
|
$id = ustr2int(try_request('id')); |
|
58
|
|
|
$group = group_find($id); |
|
59
|
|
|
|
|
60
|
|
|
if (!$group) |
|
|
|
|
|
|
61
|
|
|
{ |
|
62
|
|
|
debug_write_log(DEBUG_NOTICE, 'Group cannot be found.'); |
|
63
|
|
|
exit; |
|
64
|
|
|
} |
|
65
|
|
|
|
|
66
|
|
|
// local JS functions |
|
67
|
|
|
|
|
68
|
|
|
$resTitle = ustrprocess(get_js_resource(RES_GROUP_X_ID), ustr2js($group['group_name'])); |
|
69
|
|
|
$resOK = get_js_resource(RES_OK_ID); |
|
70
|
|
|
$resCancel = get_js_resource(RES_CANCEL_ID); |
|
71
|
|
|
|
|
72
|
|
|
$xml = <<<JQUERY |
|
73
|
|
|
<script> |
|
74
|
|
|
|
|
75
|
|
|
function groupModify () |
|
76
|
|
|
{ |
|
77
|
|
|
jqModal("{$resTitle}", "gmodify.php?id={$id}", "{$resOK}", "{$resCancel}", "$('#modifyform').submit()"); |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
</script> |
|
81
|
|
|
JQUERY; |
|
82
|
|
|
|
|
83
|
|
|
// generate buttons |
|
84
|
|
|
|
|
85
|
|
|
$xml .= '<button url="view.php?id=' . $pid . '&tab=2">' . get_html_resource(RES_BACK_ID) . '</button>'; |
|
86
|
|
|
|
|
87
|
|
|
if (!$group['is_global']) |
|
88
|
|
|
{ |
|
89
|
|
|
$xml .= '<buttonset>' |
|
90
|
|
|
. '<button action="groupModify()">' . get_html_resource(RES_MODIFY_ID) . '</button>' |
|
91
|
|
|
. (is_group_removable($id) |
|
92
|
|
|
? '<button url="gdelete.php?id=' . $id . '" prompt="' . get_html_resource(RES_CONFIRM_DELETE_GROUP_ID) . '">' |
|
93
|
|
|
: '<button disabled="false">') |
|
94
|
|
|
. get_html_resource(RES_DELETE_ID) |
|
95
|
|
|
. '</button>' |
|
96
|
|
|
. '</buttonset>'; |
|
97
|
|
|
} |
|
98
|
|
|
|
|
99
|
|
|
// generate group information |
|
100
|
|
|
|
|
101
|
|
|
$xml .= '<group title="' . get_html_resource(RES_GROUP_INFO_ID) . '">' |
|
102
|
|
|
. '<text label="' . get_html_resource(RES_GROUP_NAME_ID) . '">' . ustr2html($group['group_name']) . '</text>' |
|
103
|
|
|
. '<text label="' . get_html_resource(RES_GROUP_TYPE_ID) . '">' . get_html_resource($group['is_global'] ? RES_GLOBAL_ID : RES_LOCAL_ID) . '</text>' |
|
104
|
|
|
. '<text label="' . get_html_resource(RES_DESCRIPTION_ID) . '">' . ustr2html($group['description']) . '</text>' |
|
105
|
|
|
. '</group>'; |
|
106
|
|
|
|
|
107
|
|
|
echo(xml2html($xml)); |
|
108
|
|
|
|
|
109
|
|
|
?> |
|
|
|
|
|
|
110
|
|
|
|
This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.
Consider making the comparison explicit by using
empty(..)or! empty(...)instead.