-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsitemap.php
53 lines (46 loc) · 1.47 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
<?php
/**
* Sitemap frontend.
*
* This Source Code Form is subject to the terms of the Mozilla Public License,
* v. 2.0. If a copy of the MPL was not distributed with this file, You can
* obtain one at http://mozilla.org/MPL/2.0/.
*
* @package phpMyFAQ
* @author Thomas Zeithaml <[email protected]>
* @author Thorsten Rinne <[email protected]>
* @copyright 2005-2022 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link https://www.phpmyfaq.de
* @since 2005-08-21
*/
use phpMyFAQ\Filter;
use phpMyFAQ\Sitemap;
use phpMyFAQ\Strings;
if (!defined('IS_VALID_PHPMYFAQ')) {
http_response_code(400);
exit();
}
try {
$faqSession->userTracking('sitemap', 0);
} catch (Exception $e) {
// @todo handle the exception
}
$letter = Filter::filterInput(INPUT_GET, 'letter', FILTER_UNSAFE_RAW);
if (!is_null($letter) && (1 == Strings::strlen($letter))) {
$currentLetter = strtoupper(Strings::substr($letter, 0, 1));
} else {
$currentLetter = '';
}
$siteMap = new Sitemap($faqConfig);
$siteMap->setUser($currentUser);
$siteMap->setGroups($currentGroups);
$template->parse(
'mainPageContent',
[
'pageHeader' => empty($currentLetter) ? $PMF_LANG['msgSitemap'] : $currentLetter,
'renderLetters' => $siteMap->getAllFirstLetters(),
'renderSiteMap' => $siteMap->getRecordsFromLetter($currentLetter),
'writeCurrentLetter' => empty($currentLetter) ? $PMF_LANG['msgSitemap'] : $currentLetter,
]
);