forked from renlok/WeBid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
viewhelp.php
89 lines (78 loc) · 2.94 KB
/
viewhelp.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
<?php
/***************************************************************************
* copyright : (C) 2008 - 2015 WeBid
* site : http://www.webidsupport.com/
***************************************************************************/
/***************************************************************************
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version. Although none of the code may be
* sold. If you have been sold this script, get a refund.
***************************************************************************/
include 'common.php';
$cat = (isset($_GET['cat'])) ? intval($_GET['cat']) : intval($_POST['cat']);
if ($cat > 0)
{
// Retrieve category's name
$query = "SELECT category FROM " . $DBPrefix . "faqscategories WHERE id = :cats";
$params = array();
$params[] = array(':cats', $cat, 'int');
$db->query($query, $params);
$FAQ_ctitle = $db->result('category');
$template->assign_vars(array(
'DOCDIR' => $DOCDIR, // Set document direction (set in includes/messages.XX.inc.php) ltr/rtl
'PAGE_TITLE' => $system->SETTINGS['sitename'] . ' ' . $MSG['5236'] . ' - ' . $FAQ_ctitle,
'CHARSET' => $CHARSET,
'LOGO' => ($system->SETTINGS['logo']) ? '<a href="' . $system->SETTINGS['siteurl'] . 'index.php?"><img src="' . $system->SETTINGS['siteurl'] . 'themes/' . $system->SETTINGS['theme'] . '/' . $system->SETTINGS['logo'] . '" border="0" alt="' . $system->SETTINGS['sitename'] . '"></a>' : " ",
'SITEURL' => $system->SETTINGS['siteurl'],
'THEME' => $system->SETTINGS['theme'],
'FNAME' => $FAQ_ctitle
));
// Retrieve FAQs categories from the database
$query = "SELECT * FROM " . $DBPrefix . "faqscategories ORDER BY category ASC";
$db->direct_query($query);
while ($cats = $db->fetch())
{
$template->assign_block_vars('cats', array(
'CAT' => $cats['category'],
'ID' => $cats['id']
));
}
include 'header.php';
// Retrieve FAQs from the database
$query = "SELECT f.question As q, f.answer As a, t.* FROM " . $DBPrefix . "faqs f
LEFT JOIN " . $DBPrefix . "faqs_translated t ON (t.id = f.id)
WHERE f.category = :cat AND t.lang = :languages";
$params = array();
$params[] = array(':cat', $cat, 'int');
$params[] = array(':languages', $language, 'int');
$db->query($query, $params);
while ($row = $db->fetch())
{
if (!empty($row['question']) && !empty($row['answer']))
{
$question = $row['question'];
$answer = $row['answer'];
}
else
{
$question = $row['q'];
$answer = $row['a'];
}
$template->assign_block_vars('faqs', array(
'Q' => $question,
'A' => $answer,
'ID' => $row['id']
));
}
$template->set_filenames(array(
'body' => 'viewhelp.tpl'
));
$template->display('body');
}
else
{
header('location: help.php');
}
include 'footer.php';