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/fields.php'); |
33
|
|
|
require_once('../dbo/records.php'); |
34
|
|
|
require_once('../dbo/views.php'); |
35
|
|
|
/**#@-*/ |
36
|
|
|
|
37
|
|
|
init_page(LOAD_CONTAINER, GUEST_IS_ALLOWED); |
|
|
|
|
38
|
|
|
|
39
|
|
|
// process search mode, if one is specified |
40
|
|
|
|
41
|
|
View Code Duplication |
if (isset($_REQUEST['search'])) |
42
|
|
|
{ |
43
|
|
|
debug_write_log(DEBUG_NOTICE, 'REQUEST["search"] is set.'); |
44
|
|
|
|
45
|
|
|
$search_text = ustrcut($_REQUEST['search'], MAX_SEARCH_TEXT); |
46
|
|
|
|
47
|
|
|
if (ustrlen($search_text) == 0) |
48
|
|
|
{ |
49
|
|
|
$_SESSION[VAR_SEARCH_MODE] = FALSE; |
50
|
|
|
} |
51
|
|
|
else |
52
|
|
|
{ |
53
|
|
|
$_SESSION[VAR_SEARCH_MODE] = TRUE; |
54
|
|
|
$_SESSION[VAR_SEARCH_TEXT] = $search_text; |
55
|
|
|
} |
56
|
|
|
} |
57
|
|
|
|
58
|
|
|
// generate breadcrumbs and tabs |
59
|
|
|
|
60
|
|
|
$xml = '<breadcrumbs>' |
61
|
|
|
. '<breadcrumb url="index.php">' . get_html_resource(RES_RECORDS_ID) . '</breadcrumb>' |
62
|
|
|
. '</breadcrumbs>' |
63
|
|
|
. '<tabs>'; |
64
|
|
|
|
65
|
|
|
// active tab must be created first |
66
|
|
|
|
67
|
|
|
if ($_SESSION[VAR_SEARCH_MODE]) |
68
|
|
|
{ |
69
|
|
|
$xml .= '<tab url="list.php?search=' . urlencode($_SESSION[VAR_SEARCH_TEXT]) . '">' |
70
|
|
|
. get_html_resource(RES_SEARCH_RESULTS_ID) |
71
|
|
|
. '</tab>'; |
72
|
|
|
} |
73
|
|
|
else |
74
|
|
|
{ |
75
|
|
|
$xml .= '<tab url="list.php?search=">' |
76
|
|
|
. get_html_resource(RES_RECORDS_ID) |
77
|
|
|
. '</tab>'; |
78
|
|
|
} |
79
|
|
|
|
80
|
|
|
$xml .= '</tabs>'; |
81
|
|
|
|
82
|
|
|
// add secondary tab run-time |
83
|
|
|
|
84
|
|
|
if ($_SESSION[VAR_SEARCH_MODE]) |
85
|
|
|
{ |
86
|
|
|
$xml .= '<onready>' |
87
|
|
|
. sprintf('$("#tabs").tabs("add", "list.php?search=", "%s", 0);', get_html_resource(RES_RECORDS_ID)) |
88
|
|
|
. '</onready>'; |
89
|
|
|
} |
90
|
|
|
else |
91
|
|
|
{ |
92
|
|
|
if (ustrlen($_SESSION[VAR_SEARCH_TEXT]) != 0) |
93
|
|
|
{ |
94
|
|
|
$xml .= '<onready>' |
95
|
|
|
. sprintf('$("#tabs").tabs("add", "list.php?search=%s", "%s");', urlencode($_SESSION[VAR_SEARCH_TEXT]), get_html_resource(RES_SEARCH_RESULTS_ID)) |
96
|
|
|
. '</onready>'; |
97
|
|
|
} |
98
|
|
|
} |
99
|
|
|
|
100
|
|
|
echo(xml2html($xml, get_html_resource(RES_RECORDS_ID))); |
101
|
|
|
|
102
|
|
|
?> |
103
|
|
|
|
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: