forked from PHPFusion/PHPFusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
faq.php
90 lines (90 loc) · 3.94 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
/*-------------------------------------------------------+
| PHP-Fusion Content Management System
| Copyright (C) PHP-Fusion Inc
| https://www.php-fusion.co.uk/
+--------------------------------------------------------+
| Filename: faq.php
| Author: Nick Jones (Digitanium)
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once "maincore.php";
require_once THEMES."templates/header.php";
include LOCALE.LOCALESET."faq.php";
add_to_title($locale['global_203']);
if (!isset($_GET['cat_id']) || !isnum($_GET['cat_id'])) {
opentable($locale['400']);
echo "<!--pre_faq_idx-->";
$result = dbquery("SELECT faq_cat_id, faq_cat_name, faq_cat_description, faq_cat_language FROM ".DB_FAQ_CATS." ".(multilang_table("FQ") ? "WHERE faq_cat_language='".LANGUAGE."'" : "")." ORDER BY faq_cat_name");
$rows = dbrows($result);
if ($rows) {
$columns = 2;
$i = 0;
echo "<table cellpadding='0' cellspacing='0' width='100%' class='tbl'>\n<tr>\n";
while ($data = dbarray($result)) {
if ($i != 0 && ($i%$columns == 0)) {
echo "</tr>\n<tr>\n";
}
$num = dbcount("(faq_id)", DB_FAQS, "faq_cat_id='".$data['faq_cat_id']."'");
echo "<td valign='top'><a href='".FUSION_SELF."?cat_id=".$data['faq_cat_id']."'>".$data['faq_cat_name']."</a> <span class='small2'>($num)</span>\n";
if ($data['faq_cat_description']) {
echo "<br />\n<span class='small'>".$data['faq_cat_description']."</span>";
}
echo "</td>\n";
$i++;
}
echo "</tr>\n</table>\n";
} else {
echo "<div style='text-align:center'><br />\n".$locale['410']."<br /><br />\n</div>\n";
}
closetable();
} else {
if ($data = dbarray(dbquery("SELECT faq_cat_name,faq_cat_language FROM ".DB_FAQ_CATS." ".(multilang_table("FQ") ? "WHERE faq_cat_language='".LANGUAGE."' AND" : "WHERE")." faq_cat_id='".$_GET['cat_id']."'"))) {
add_to_title($locale['global_201'].$data['faq_cat_name']);
opentable($locale['401'].": ".$data['faq_cat_name']);
echo "<table cellpadding='0' cellspacing='1' width='100%'>\n<tr>\n";
echo "<td class='tbl2'>\n<a href='".FUSION_SELF."'>".$locale['400']."</a> >";
echo "<a href='".FUSION_SELF."?cat_id=".$_GET['cat_id']."'>".$data['faq_cat_name']."</a></td>\n";
echo "</tr>\n</table>\n";
$rows = dbcount("(faq_id)", DB_FAQS, "faq_cat_id='".$_GET['cat_id']."'");
if ($rows) {
$i = 0;
$ii = 1;
$columns = 4;
$faq_content = "";
echo "<table cellpadding='0' cellspacing='0' width='100%'>\n<tr>\n";
$result = dbquery("SELECT faq_id, faq_question, faq_answer from ".DB_FAQS." WHERE faq_cat_id='".$_GET['cat_id']."' ORDER BY faq_question");
$numrows = dbrows($result);
while ($data = dbarray($result)) {
if ($i != 0 && ($i%$columns == 0)) {
echo "</tr>\n<tr>\n";
}
echo "<td class='tbl1' width='25%'><a href='#faq_".$data['faq_id']."'>".$data['faq_question']."</a></td>";
$faq_content .= "<div class='".($ii%2 == 0 ? "tbl1" : "tbl2")."' style='display:block; padding:10px 5px'>\n";
$faq_content .= "<a id='faq_".$data['faq_id']."'></a><strong>".$data['faq_question']."</strong><br />\n".nl2br(stripslashes($data['faq_answer']));
$faq_content .= "<br style='clear:both' /><a href='#content'><span class='small'>".$locale['402']."</span></a><br />\n";
$faq_content .= "</div>\n";
$i++;
$ii++;
}
echo "</tr>\n</table>\n";
echo "<div style='margin:5px'></div>\n";
echo "<div class='tbl-border' style='padding:1px'>\n".$faq_content."</div>\n";
closetable();
} else {
echo $locale['411']."\n";
closetable();
}
} else {
redirect(FUSION_SELF);
}
}
require_once THEMES."templates/footer.php";
?>