-
Notifications
You must be signed in to change notification settings - Fork 0
/
util.inc.php
110 lines (90 loc) · 3.35 KB
/
util.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<?php
$content_footer = array();
$page_footer = array();
$row_classes = array("even", "odd");
$page_footer["left"] = "Currently logged in as ${_SESSION['username']}";
if (strpos($_SERVER["HTTP_USER_AGENT"], 'MSIE') == true) {
$page_footer["right"] = "Stop using Internet Explorer you idiot!";
} else {
if (count($_SESSION['backlink']) > 0)
$page_footer["right"] = "[ <a href=\"back.php\">Back</a> ]";
}
function page_header ($title, $sub_title = ' ') {
global $onload, $page_navigation, $CONFIG;
/* disabled
if ($_SERVER['REQUEST_URI'] !=
$_SESSION['backlink'][count($_SESSION['backlink'])-1]) {
# FIXME: Ensure referrer points to us!
array_push($_SESSION['backlink'],
$_SERVER['REQUEST_URI']);
if (count($_SESSION['backlink']) > 20)
array_shift($_SESSION['backlink']);
}
*/
include("page-header.inc.php");
}
function page_footer () {
global $content_footer, $page_footer;
include("page-footer.inc.php");
}
function back($count = 2) {
for ($i = 0; $i < ($count-1); $i++)
array_pop($_SESSION['backlink']);
if (count($_SESSION['backlink']) < 1)
redirect("index.php");
else
redirect(array_pop($_SESSION['backlink']));
}
function back_not($page) {
while ($url = array_pop($_SESSION['backlink'])) {
if (strpos($url, $page) == false)
redirect($url);
}
redirect("index.php");
}
function redirect ($location) {
if ((strpos($location, '\n')) || (strpos($location, '\r'))) {
header("Location: index.php");
exit;
}
header("Location: $location");
exit;
}
# does a domain already exist in the system
function domainexists ($domain) {
return FALSE;
}
function domain_id2name($domainid) {
global $DB;
$query = $DB->prepare("SELECT name FROM domains WHERE id=?");
$dbreturn = $DB->execute($query, array((int) $domainid));
if ($dbreturn->numRows() != 1) {
return FALSE;
}
$row = $dbreturn->fetchRow(DB_FETCHMODE_OBJECT);
return $row->name;
}
function show_numberset($thisfile, $page, $search, $id)
{
?>
<form action="<?php print htmlentities($thisfile); ?>" method="get">
Show per page:
<select name="items" size="1">
<option value="10">10</option>
<option value="20">20</option>
<option value="50">50</option>
<option value="100">100</option>
</select>
<?php
if (!is_numeric($page)) { $page = 0; }
if (!is_numeric($id)) { $id = 0; }
if (isset($page)) { print "<input type=\"hidden\" name=\"page\" value=\"".$page."\">\n"; }
if (isset($id)) { print "<input type=\"hidden\" name=\"id\" value=\"$id\">\n"; }
if (isset($search)) { $searchx = htmlentities($search); print "<input type=\"hidden\" name=\"search\" value=\"$searchx\">\n"; }
?>
<input type="text" name="itemsx">
<input type="submit" name="set" value="set" title="Set per page display">
</form>
<?php
}
?>