-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsitemap.php
80 lines (68 loc) · 2.3 KB
/
sitemap.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
<?php require_once('Connections/connDBA.php'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php title("Sitemap"); ?>
<?php headers(); ?>
<?php meta(); ?>
</head>
<body>
<?php topPage("public"); ?>
<h4><a href="index.php">Home</a> ► Sitemap</h4>
<h2>Sitemap</h2>
<p>Below is a map of all of the avaliable pages within this site.</p>
<div class="toolBar"><a class="toolBarItem back" href="javascript:history.go(-1)">Go Back</a></div>
<p> </p>
<?php
//Find the current level of a page
function level($id) {
if (exist("pages", "id", $id)) {
$nextPage = query("SELECT * FROM `pages` WHERE `id` = '{$id}'");
return " " . level($nextPage['parentPage']);
}
}
//Check it see if the current page is a child of the parent
function isChild($input) {
if (exist("pages", "id", $input)) {
$childCheck = query("SELECT * FROM `pages` WHERE `id` = '{$input}'");
if ($childCheck['id'] == $_GET['id']) {
return true;
} else {
return isChild($childCheck['parentPage']);
}
}
}
//Recursively loop through the pages
function pagesDirectory($level) {
if ($level == "0") {
$pagesGrabber = query("SELECT * FROM `pages` WHERE `parentPage` = '{$level}' AND `visible` = 'on' AND `published` != '0' ORDER BY `position` ASC", "raw");
} else {
$pagesGrabber = query("SELECT * FROM `pages` WHERE `parentPage` = '{$level}' AND `visible` = 'on' AND `published` != '0' ORDER BY `subPosition` ASC", "raw");
}
while ($pages = mysql_fetch_array($pagesGrabber)) {
if (isset($_GET['id'])) {
$parentPage = query("SELECT * FROM `pages` WHERE `id` = '{$_GET['id']}'");
}
$title = unserialize($pages['content' . $pages['display']]);
echo level($pages['parentPage']);
if ($pages['position'] == "1") {
echo "<span class=\"homePage\">";
} else {
echo "<span class=\"page\">";
}
echo "<a href=\"index.php?page=" . $pages['id'] . "\"";
echo ">" . $title['title'] . "</a>";
echo "</span><br /><br />";
if (exist("pages", "parentPage", $pages['id'])) {
pagesDirectory($pages['id']);
}
}
}
pagesDirectory('0');
?>
<?php
stats("true", "false");
footer("public");
?>
</body>
</html>