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/projects.php'); |
33
|
|
|
/**#@-*/ |
34
|
|
|
|
35
|
|
|
init_page(LOAD_TAB, GUEST_IS_ALLOWED); |
|
|
|
|
36
|
|
|
|
37
|
|
|
// check that requested project exists |
38
|
|
|
|
39
|
|
|
$id = ustr2int(try_request('id')); |
40
|
|
|
$project = project_find($id); |
41
|
|
|
|
42
|
|
|
if (!$project) |
|
|
|
|
43
|
|
|
{ |
44
|
|
|
debug_write_log(DEBUG_NOTICE, 'Project cannot be found.'); |
45
|
|
|
exit; |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
// local JS functions |
49
|
|
|
|
50
|
|
|
$resTitle = ustrprocess(get_js_resource(RES_PROJECT_X_ID), ustr2js($project['project_name'])); |
51
|
|
|
$resOK = get_js_resource(RES_OK_ID); |
52
|
|
|
$resCancel = get_js_resource(RES_CANCEL_ID); |
53
|
|
|
|
54
|
|
|
$xml = <<<JQUERY |
55
|
|
|
<script> |
56
|
|
|
|
57
|
|
|
function projectModify () |
58
|
|
|
{ |
59
|
|
|
jqModal("{$resTitle}", "modify.php?id={$id}", "{$resOK}", "{$resCancel}", "$('#modifyform').submit()"); |
60
|
|
|
} |
61
|
|
|
|
62
|
|
|
function projectDisable () |
63
|
|
|
{ |
64
|
|
|
$.post("disable.php?id={$id}", function() { |
65
|
|
|
reloadTab(); |
66
|
|
|
}); |
67
|
|
|
} |
68
|
|
|
|
69
|
|
|
</script> |
70
|
|
|
JQUERY; |
71
|
|
|
|
72
|
|
|
// generate buttons |
73
|
|
|
|
74
|
|
|
$xml .= '<button url="index.php">' . get_html_resource(RES_BACK_ID) . '</button>'; |
75
|
|
|
|
76
|
|
|
if (get_user_level() == USER_LEVEL_ADMIN) |
77
|
|
|
{ |
78
|
|
|
$xml .= '<button url="pexport.php?id=' . $id . '">' . get_html_resource(RES_EXPORT_ID) . '</button>' |
79
|
|
|
. '<buttonset>' |
80
|
|
|
. '<button action="projectModify()">' . get_html_resource(RES_MODIFY_ID) . '</button>'; |
81
|
|
|
|
82
|
|
|
$xml .= (is_project_removable($id) |
83
|
|
|
? '<button url="delete.php?id=' . $id . '" prompt="' . get_html_resource(RES_CONFIRM_DELETE_PROJECT_ID) . '">' |
84
|
|
|
: '<button disabled="false">') |
85
|
|
|
. get_html_resource(RES_DELETE_ID) |
86
|
|
|
. '</button>'; |
87
|
|
|
|
88
|
|
|
$xml .= '<button action="projectDisable()">' |
89
|
|
|
. get_html_resource($project['is_suspended'] ? RES_ENABLE_ID : RES_DISABLE_ID) |
90
|
|
|
. '</button>' |
91
|
|
|
. '</buttonset>'; |
92
|
|
|
} |
93
|
|
|
|
94
|
|
|
// generate project information |
95
|
|
|
|
96
|
|
|
$xml .= '<group title="' . get_html_resource(RES_PROJECT_INFO_ID) . '">' |
97
|
|
|
. '<text label="' . get_html_resource(RES_PROJECT_NAME_ID) . '">' . ustr2html($project['project_name']) . '</text>' |
98
|
|
|
. '<text label="' . get_html_resource(RES_START_TIME_ID) . '">' . get_date($project['start_time']) . '</text>' |
99
|
|
|
. '<text label="' . get_html_resource(RES_DESCRIPTION_ID) . '">' . ustr2html($project['description']) . '</text>' |
100
|
|
|
. '<text label="' . get_html_resource(RES_STATUS_ID) . '">' . get_html_resource($project['is_suspended'] ? RES_SUSPENDED_ID : RES_ACTIVE_ID) . '</text>' |
101
|
|
|
. '</group>'; |
102
|
|
|
|
103
|
|
|
echo(xml2html($xml)); |
104
|
|
|
|
105
|
|
|
?> |
|
|
|
|
106
|
|
|
|
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: