-
Notifications
You must be signed in to change notification settings - Fork 9
/
sitemap.php
143 lines (122 loc) · 6.17 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
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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
<?php
header('Content-type: text/plain; charset=UTF-8');
/**
* Sitemap
*/
include_once(__DIR__ . "/include/db_login.php"); //Inloggen database.
include_once(__DIR__ . "/include/safe.php"); //Variabelen
// *** Needed for privacy filter ***
include_once(__DIR__ . "/include/settings_global.php"); //Variables
include_once(__DIR__ . "/include/settings_user.php"); // USER variables
include_once(__DIR__ . "/include/personCls.php");
include_once(__DIR__ . "/include/dbFunctions.php");
$db_functions = new DbFunctions($dbh);
$person_cls = new PersonCls;
// *** Example, see: http://www.sitemaps.org/protocol.html ***
/*
<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<url>
<loc>http://www.example.com/</loc>
<lastmod>2005-01-01</lastmod>
<changefreq>monthly</changefreq>
<priority>0.8</priority>
</url>
<url>
<loc>http://www.example.com/catalog?item=12&desc=vacation_hawaii</loc>
<changefreq>weekly</changefreq>
</url>
<url>
<loc>http://www.example.com/catalog?item=73&desc=vacation_new_zealand</loc>
<lastmod>2004-12-23</lastmod>
<changefreq>weekly</changefreq>
</url>
</urlset>
*/
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\r\n"
. '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\r\n";
// *** Family trees ***
@$datasql = $db_functions->get_trees();
foreach ($datasql as $dataDb) {
// *** Check is family tree is shown or hidden for user group ***
$hide_tree_array = explode(";", $user['group_hide_trees']);
if (!in_array($dataDb->tree_id, $hide_tree_array)) {
// *** Get all family pages ***
$person_qry = $dbh->query("SELECT fam_gedcomnumber FROM humo_families
WHERE fam_tree_id='" . $dataDb->tree_id . "' ORDER BY fam_gedcomnumber");
while (@$personDb = $person_qry->fetch(PDO::FETCH_OBJ)) {
// *** Use class for privacy filter ***
//$person_cls = new PersonCls($personDb);
//$privacy=$person_cls->privacy;
// *** Completely filter person ***
//if ($user["group_pers_hide_totally_act"]=='j'
// AND strpos(' '.$personDb->pers_own_code,$user["group_pers_hide_totally"])>0){
// // *** Don't show person ***
//}
//else{
// *** Example ***
//http://localhost/humo-gen/index.php?page=family&database=humo2_&id=F365&main_person=I1180
// OR, using url_rewrite:
//http://localhost/humo-gen/family/humo_//I2354/
// *** First part of url (strip sitemap.php from path) ***
$position = strrpos($_SERVER['PHP_SELF'], '/');
// *** April 2022: Using full path: http://localhost/humo-genealogy/sitemap.php ***
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
$uri_path = 'https://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, $position);
} else {
$uri_path = 'http://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, $position);
}
if ($humo_option["url_rewrite"] == "j") {
$person_url = $uri_path . '/family/' . $dataDb->tree_id . '/' . $personDb->fam_gedcomnumber . '/';
} else {
$person_url = $uri_path . '/index.php?page=family&tree_id=' . $dataDb->tree_id . '&id=' . $personDb->fam_gedcomnumber;
}
echo "<url>\r\n<loc>" . $person_url . "</loc>\r\n</url>\r\n";
//}
}
// *** Get all single persons ***
$person_qry = $dbh->query("SELECT pers_tree_id, pers_famc, pers_fams, pers_gedcomnumber, pers_own_code FROM humo_persons
WHERE pers_tree_id='" . $dataDb->tree_id . "' AND pers_famc='' AND pers_fams=''");
while (@$personDb = $person_qry->fetch(PDO::FETCH_OBJ)) {
// *** Use class for privacy filter ***
//$person_cls = new PersonCls($personDb);
//$privacy=$person_cls->privacy;
// *** Completely filter person ***
if (
$user["group_pers_hide_totally_act"] == 'j' && strpos(' ' . $personDb->pers_own_code, $user["group_pers_hide_totally"]) > 0
) {
// *** Don't show person ***
} else {
// *** Example ***
//http://localhost/humo-gen/index.php?page=family&tree_id=1&id=F365&main_person=I1180
// OR, using url_rewrite:
//http://localhost/humo-gen/family/humo_/?&main_person=I2354
// *** First part of url (strip sitemap.php from path) ***
$position = strrpos($_SERVER['PHP_SELF'], '/');
//$uri_path= substr($_SERVER['PHP_SELF'],0,$position);
// *** April 2022: Using full path: http://localhost/humo-genealogy/sitemap.php ***
if (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') {
$uri_path = 'https://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, $position);
} else {
$uri_path = 'http://' . $_SERVER['SERVER_NAME'] . substr($_SERVER['PHP_SELF'], 0, $position);
}
$pers_family = '';
if ($personDb->pers_famc) {
$pers_family = $personDb->pers_famc;
}
if ($personDb->pers_fams) {
$pers_fams = explode(';', $personDb->pers_fams);
$pers_family = $pers_fams[0];
}
if ($humo_option["url_rewrite"] == "j") {
$person_url = $uri_path . '/family/' . $dataDb->tree_id . '/' . $pers_family . '?main_person=' . $personDb->pers_gedcomnumber;
} else {
$person_url = $uri_path . '/index.php?page=family&tree_id=' . $dataDb->tree_id . '&id=' . $pers_family . '&main_person=' . $personDb->pers_gedcomnumber;
}
echo "<url>\r\n<loc>" . $person_url . "</loc>\r\n</url>\r\n";
}
}
} // *** End of hidden family tree ***
} // *** End of multiple family trees ***
unset($datasql);
echo '</urlset>';