| 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 file_exists('maincore.php') ? 'maincore.php' : __DIR__ . "/../../maincore.php";
if (!db_exists(DB_FAQS)) {
redirect(BASEDIR . "error.php?code=404");
}
require_once THEMES . "templates/header.php";
if (file_exists(INFUSIONS . "faq/locale/" . LOCALESET . "faq.php")) {
include INFUSIONS . "faq/locale/" . LOCALESET . "faq.php";
} else {
include INFUSIONS . "faq/locale/English/faq.php";
}
include "templates/faq.php";
add_to_title($locale['global_200'] . \PHPFusion\SiteLinks::get_current_SiteLinks("", "link_name"));
if (isset($_GET['cat_id']) && isnum($_GET['cat_id'])) {
$result = dbquery("SELECT *\tFROM " . DB_FAQ_CATS . " " . (multilang_table("FQ") ? "WHERE faq_cat_language='" . LANGUAGE . "' AND" : "WHERE") . " faq_cat_id='" . intval($_GET['cat_id']) . "'");
if (dbrows($result) > 0) {
$data = dbarray($result);
add_to_title($locale['global_201'] . $data['faq_cat_name']);
$data['faq_link'] = INFUSIONS . "faq/faq.php?cat_id=" . $data['faq_cat_id'];
$info = $data;
if (dbcount("(faq_id)", DB_FAQS, "faq_cat_id='" . intval($_GET['cat_id']) . "'")) {
$result = dbquery("SELECT faq_id, faq_question, faq_answer from " . DB_FAQS . " WHERE faq_cat_id='" . intval($_GET['cat_id']) . "' ORDER BY faq_question");
while ($data = dbarray($result)) {
$info['items'][$data['faq_id']] = $data;
}
} else {
$info['nofaq_items'] = $locale['411'];
}