forked from npatel2012/myfaq-php-isa
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathshow.php
107 lines (96 loc) · 3.55 KB
/
show.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
<?php
/**
* Frontend for categories or list of records
*
* PHP Version 5.3
*
* 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/.
*
* @category phpMyFAQ
* @package Frontend
* @author Thorsten Rinne <thorsten@phpmyfaq.de>
* @copyright 2002-2015 phpMyFAQ Team
* @license http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
* @link http://www.phpmyfaq.de
* @since 2002-08-27
*/
if (!defined('IS_VALID_PHPMYFAQ')) {
$protocol = 'http';
if (isset($_SERVER['HTTPS']) && strtoupper($_SERVER['HTTPS']) === 'ON'){
$protocol = 'https';
}
header('Location: ' . $protocol . '://' . $_SERVER['HTTP_HOST'] . dirname($_SERVER['SCRIPT_NAME']));
exit();
}
$currentCategory = PMF_Filter::filterInput(INPUT_GET, 'cat', FILTER_VALIDATE_INT);
$subCategoryContent = '';
if (!is_null($currentCategory) && isset($category->categoryName[$currentCategory])) {
$faqsession->userTracking('show_category', $currentCategory);
$catParent = $category->categoryName[$currentCategory]['parent_id'];
$catName = $category->categoryName[$currentCategory]['name'];
$catDescription = $category->categoryName[$currentCategory]['description'];
$records = $faq->showAllRecords(
$currentCategory,
$faqConfig->get('records.orderby'),
$faqConfig->get('records.sortby')
);
if (empty($records) || $category->getChildNodes($currentCategory)) {
$subCategory = new PMF_Category($faqConfig, $current_groups, true);
$subCategory->setUser($current_user);
$subCategory->transform($currentCategory);
if (empty($records)) {
$records = $subCategory->viewTree();
}
if (count($category->getChildNodes($currentCategory))) {
$categoryFaqsHeader = $PMF_LANG['msgSubCategories'];
$subCategoryContent = $subCategory->viewTree();
$tpl->parseBlock(
'writeContent',
'subCategories',
array(
'categorySubsHeader' => $categoryFaqsHeader
)
);
}
}
$up = '';
if ($catParent != 0) {
$url = sprintf(
'%s?%saction=show&cat=%d',
PMF_Link::getSystemRelativeUri(),
$sids,
$catParent
);
$oLink = new PMF_Link($url, $faqConfig);
$oLink->itemTitle = $category->categoryName[$catParent]['name'];
$oLink->text = $PMF_LANG['msgCategoryUp'];
$up = $oLink->toHtmlAnchor();
}
$tpl->parse(
'writeContent',
array(
'categoryHeader' => $PMF_LANG['msgEntriesIn'] . $catName,
'categoryDescription' => $catDescription,
'categoryFaqsHeader' => $PMF_LANG['msgEntries'],
'categoryContent' => $records,
'subCategoryContent' => $subCategoryContent,
'categoryLevelUp' => $up
)
);
} else {
$faqsession->userTracking('show_all_categories', 0);
$tpl->parse(
'writeContent',
array(
'categoryHeader' => $PMF_LANG['msgFullCategories'],
'categoryDescription' => '',
'categoryFaqsHeader' => '',
'categoryContent' => $category->viewTree(),
'subCategoryContent' => $subCategoryContent,
'categoryLevelUp' => ''
)
);
}
$tpl->merge('writeContent', 'index');