|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
//------------------------------------------------------------------------------ |
|
4
|
|
|
// |
|
5
|
|
|
// eTraxis - Records tracking web-based system |
|
6
|
|
|
// Copyright (C) 2005-2009 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/states.php'); |
|
33
|
|
|
/**#@-*/ |
|
34
|
|
|
|
|
35
|
|
|
init_page(); |
|
36
|
|
|
|
|
37
|
|
|
if (get_user_level() == USER_LEVEL_ADMIN) |
|
38
|
|
|
{ |
|
39
|
|
|
$id = ustr2int(try_request('id')); |
|
40
|
|
|
$state = state_find($id); |
|
41
|
|
|
|
|
42
|
|
|
if (!$state) |
|
|
|
|
|
|
43
|
|
|
{ |
|
44
|
|
|
debug_write_log(DEBUG_NOTICE, 'State cannot be found.'); |
|
45
|
|
|
header('Location: index.php'); |
|
46
|
|
|
} |
|
47
|
|
|
else |
|
48
|
|
|
{ |
|
49
|
|
|
if ($state['is_locked']) |
|
50
|
|
|
{ |
|
51
|
|
|
if ($state['state_type'] == STATE_TYPE_INTERMEDIATE) |
|
52
|
|
|
{ |
|
53
|
|
|
state_set_initial($state['template_id'], $id); |
|
54
|
|
|
} |
|
55
|
|
|
else |
|
56
|
|
|
{ |
|
57
|
|
|
debug_write_log(DEBUG_NOTICE, 'State must be intermediate.'); |
|
58
|
|
|
} |
|
59
|
|
|
} |
|
60
|
|
|
else |
|
61
|
|
|
{ |
|
62
|
|
|
debug_write_log(DEBUG_NOTICE, 'Template must be locked.'); |
|
63
|
|
|
} |
|
64
|
|
|
} |
|
65
|
|
|
} |
|
66
|
|
|
else |
|
67
|
|
|
{ |
|
68
|
|
|
debug_write_log(DEBUG_NOTICE, 'User must have admin rights to be allowed.'); |
|
69
|
|
|
header('Location: index.php'); |
|
70
|
|
|
} |
|
71
|
|
|
|
|
72
|
|
|
?> |
|
|
|
|
|
|
73
|
|
|
|
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.