-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfaq.php
186 lines (168 loc) · 7.35 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
<?php
/*
##########################################################################
# #
# Version 4 / / / #
# -----------__---/__---__------__----__---/---/- #
# | /| / /___) / ) (_ ` / ) /___) / / #
# _|/_|/__(___ _(___/_(__)___/___/_(___ _/___/___ #
# Free Content / Management System #
# / #
# #
# #
# Copyright 2005-2015 by webspell.org #
# #
# visit webSPELL.org, webspell.info to get webSPELL for free #
# - Script runs under the GNU GENERAL PUBLIC LICENSE #
# - It's NOT allowed to remove this copyright-tag #
# -- http://www.fsf.org/licensing/licenses/gpl.html #
# #
# Code based on WebSPELL Clanpackage (Michael Gruber - webspell.at), #
# Far Development by Development Team - webspell.org #
# #
# visit webspell.org #
# #
##########################################################################
*/
$_language->readModule('faq');
$title_faq = $GLOBALS["_template"]->replaceTemplate("title_faq", array());
echo $title_faq;
$action = getAction();
if ($action == "faqcat" && is_numeric($_GET[ 'faqcatID' ])) {
if (ispageadmin($userID)) {
echo '<input type="button" onclick="window.open(
\'admin/admincenter.php?site=faq\',
\'News\',\'toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=800,height=600\'
)" value="' . $_language->module[ 'admin_button' ] . '" class="btn btn-primary"><br><br>';
}
$faqcatID = $_GET[ 'faqcatID' ];
$get = safe_query("SELECT faqcatname FROM " . PREFIX . "faq_categories WHERE faqcatID='" . (int)$faqcatID . "'");
$dc = mysqli_fetch_assoc($get);
$faqcatname = $dc[ 'faqcatname' ];
$faqcat = safe_query(
"SELECT
`question`,
`faqID`,
`sort`
FROM
`" . PREFIX . "faq`
WHERE
`faqcatID` = '" . (int)$faqcatID . "'
ORDER BY
sort"
);
if (mysqli_num_rows($faqcat)) {
$data_array = array();
$data_array['$faqcatname'] = $faqcatname;
$faq_question_head = $GLOBALS["_template"]->replaceTemplate("faq_question_head", $data_array);
echo $faq_question_head;
$i = 1;
while ($ds = mysqli_fetch_array($faqcat)) {
$i++;
$sort = $ds[ 'sort' ];
$question = '<a href="index.php?site=faq&action=faq&faqID=' . $ds[ 'faqID' ] . '&faqcatID=' .
$faqcatID . '" class="list-group-item">' . $ds[ 'question' ] . '</a>';
$data_array = array();
$data_array['$question'] = $question;
$faq_question = $GLOBALS["_template"]->replaceTemplate("faq_question", $data_array);
echo $faq_question;
}
$faq_foot = $GLOBALS["_template"]->replaceTemplate("faq_foot", array());
echo $faq_foot;
} else {
echo generateAlert($_language->module[ 'no_faq' ], 'alert-info');
}
} else if ($action == "faq") {
if (ispageadmin($userID)) {
echo
'<p><input type="button" onclick="window.open(
\'admin/admincenter.php?site=faq\',
\'News\',\'toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=800,height=600\'
)" value="' . $_language->module[ 'admin_button' ] . '" class="btn btn-primary"></p>';
}
$faqcatID = intval($_GET[ 'faqcatID' ]);
$get = safe_query(
"SELECT
`faqcatname`
FROM
`" . PREFIX . "faq_categories`
WHERE
`faqcatID` = '" . (int)$faqcatID . "'"
);
$dc = mysqli_fetch_assoc($get);
$faqcatname = $dc[ 'faqcatname' ];
$faqID = intval($_GET[ 'faqID' ]);
$faq = safe_query(
"SELECT
`faqcatID`,
`date`,
`question`,
`answer`
FROM
`" . PREFIX . "faq`
WHERE
`faqID` = '" . (int)$faqID . "'"
);
if (mysqli_num_rows($faq)) {
$ds = mysqli_fetch_array($faq);
$backlink = '<a href="index.php?site=faq&action=faqcat&faqcatID=' . $faqcatID . '" class="titlelink">' .
$faqcatname . '</a>';
$question = $ds[ 'question' ];
if (mb_strlen($question) > 40) {
if ($question{39} == " ") {
$question = mb_substr($question, 0, 38) . "...";
} else {
$question = mb_substr($question, 0, 40) . "...";
}
}
$data_array = array();
$data_array['$backlink'] = $backlink;
$data_array['$question'] = $question;
$faq_answer_head = $GLOBALS["_template"]->replaceTemplate("faq_answer_head", $data_array);
echo $faq_answer_head;
$date = getformatdate($ds[ 'date' ]);
$answer = htmloutput($ds[ 'answer' ]);
$data_array = array();
$data_array['$answer'] = $answer;
$data_array['$date'] = $date;
$faq_answer = $GLOBALS["_template"]->replaceTemplate("faq_answer", $data_array);
echo $faq_answer;
} else {
echo generateAlert($_language->module[ 'no_faq' ], 'alert-info');
}
} else {
if (ispageadmin($userID)) {
echo
'<p><input type="button" onclick="window.open(
\'admin/admincenter.php?site=faq\',
\'News\',
\'toolbar=yes,status=yes,scrollbars=yes,resizable=yes,width=800,height=600\'
)" value="' . $_language->module[ 'admin_button' ] . '" class="btn btn-primary"></p>';
}
$faqcats = safe_query("SELECT * FROM `" . PREFIX . "faq_categories` ORDER BY `sort`");
$anzcats = mysqli_num_rows($faqcats);
if ($anzcats) {
while ($ds = mysqli_fetch_array($faqcats)) {
$anzfaqs = mysqli_num_rows(
safe_query(
"SELECT
`faqID`
FROM
`" . PREFIX . "faq`
WHERE
`faqcatID` = '" . (int)$ds[ 'faqcatID' ] . "'"
)
);
$faqcatname = '<a href="index.php?site=faq&action=faqcat&faqcatID=' . $ds[ 'faqcatID' ] . '">' . $ds[ 'faqcatname' ] . '</a>';
$description = htmloutput($ds[ 'description' ]);
$data_array = array();
$data_array['$faqcatname'] = $faqcatname;
$data_array['$anzfaqs'] = $anzfaqs;
$data_array['$description'] = $description;
$faq_category = $GLOBALS["_template"]->replaceTemplate("faq_category", $data_array);
echo $faq_category;
}
} else {
echo generateAlert($_language->module[ 'no_categories' ], 'alert-info');
}
}