This repository has been archived by the owner on May 27, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
faq.php
68 lines (62 loc) · 3.04 KB
/
faq.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
<?php
/*---------------------------------------------------------------------+
| ExiteCMS Content Management System |
+----------------------------------------------------------------------+
| Copyright 2006-2008 Exite BV, The Netherlands |
| for support, please visit http://www.exitecms.org |
+----------------------------------------------------------------------+
| Some code derived from PHP-Fusion, copyright 2002 - 2006 Nick Jones |
+----------------------------------------------------------------------+
| Released under the terms & conditions of v2 of the GNU General Public|
| License. For details refer to the included gpl.txt file or visit |
| http://gnu.org |
+----------------------------------------------------------------------+
| $Id:: $|
+----------------------------------------------------------------------+
| Last modified by $Author:: $|
| Revision number $Rev:: $|
+---------------------------------------------------------------------*/
require_once dirname(__FILE__)."/includes/core_functions.php";
require_once PATH_ROOT."/includes/theme_functions.php";
// make sure the parameter passed is valid
if (!isset($cat_id)) $cat_id = 0;
if (isset($cat_id) && !isNum($cat_id)) fallback("index.php");
// load this module's locales
locale_load("main.faq");
// temp storage for template variables
$variables = array();
// if no cat_id given, show the FAQ categories
if (!$cat_id) {
$title = $locale['400'];
$result = dbquery("SELECT * FROM ".$db_prefix."faq_cats ORDER BY faq_cat_name");
$variables['faqs'] = array();
while($data = dbarray($result)) {
$data['count'] = dbcount("(faq_id)", "faqs", "faq_cat_id='".$data['faq_cat_id']."'");
$variables['faqs'][] = $data;
}
} else {
if (!$data = dbarray(dbquery("SELECT * FROM ".$db_prefix."faq_cats WHERE faq_cat_id='$cat_id'"))) {
redirect(FUSION_SELF);
}
$title = $locale['401'].": ".$data['faq_cat_name'];
$rows = dbcount("(*)", "faqs", "faq_cat_id='$cat_id'");
$variables['rows'] = $rows;
if (!isset($rowstart) || !isNum($rowstart)) $rowstart = 0;
$variables['rowstart'] = $rowstart;
$variables['items_per_page'] = $settings['numofthreads'];
if ($rows != 0) {
$variables['faqs'] = array();
$result = dbquery("SELECT * FROM ".$db_prefix."faqs WHERE faq_cat_id='$cat_id' ORDER BY faq_id LIMIT $rowstart,".$settings['numofthreads']);
while ($data = dbarray($result)) {
$data['faq_answer'] = nl2br(stripslashes($data['faq_answer']));
$variables['faqs'][] = $data;
}
}
}
$variables['cat_id'] = $cat_id;
// define the body panel variables
$template_panels[] = array('type' => 'body', 'name' => 'faq', 'title' => $title, 'template' => 'main.faq.tpl', 'locale' => "main.faq");
$template_variables['faq'] = $variables;
// Call the theme code to generate the output for this webpage
require_once PATH_THEME."/theme.php";
?>