This repository has been archived by the owner on Jan 9, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 163
/
faq.php
108 lines (102 loc) · 4 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
<?php
require "include/bittorrent.php";
dbconn();
require_once(get_langfile_path());
loggedinorreturn();
stdhead($lang_faq['head_faq']);
$Cache->new_page('faq', 900, true);
if (!$Cache->get_page())
{
$Cache->add_whole_row();
//make_folder("cache/" , get_langfolder_cookie());
//cache_check ('faq');
begin_main_frame();
begin_frame($lang_faq['text_welcome_to'].$SITENAME." - ".$SLOGAN);
print($lang_faq['text_welcome_content_one'].$lang_faq['text_welcome_content_two']);
end_frame();
if ($CURUSER)
$lang_id = $CURUSER['lang'];
else
$lang_id = get_guest_lang_id();
$is_rulelang = get_single_value("language","rule_lang","WHERE id = ".sqlesc($lang_id));
if (!$is_rulelang){
$lang_id = 6; //English
}
$res = sql_query("SELECT `id`, `link_id`, `question`, `flag` FROM `faq` WHERE `type`='categ' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC");
while ($arr = mysql_fetch_array($res)) {
$faq_categ[$arr[link_id]][title] = $arr[question];
$faq_categ[$arr[link_id]][flag] = $arr[flag];
$faq_categ[$arr[link_id]][link_id] = $arr[link_id];
}
$res = sql_query("SELECT `id`, `link_id`, `question`, `answer`, `flag`, `categ` FROM `faq` WHERE `type`='item' AND `lang_id` = ".sqlesc($lang_id)." ORDER BY `order` ASC");
while ($arr = mysql_fetch_array($res, MYSQL_BOTH)) {
$faq_categ[$arr[categ]][items][$arr[id]][question] = $arr[question];
$faq_categ[$arr[categ]][items][$arr[id]][answer] = $arr[answer];
$faq_categ[$arr[categ]][items][$arr[id]][flag] = $arr[flag];
$faq_categ[$arr[categ]][items][$arr[id]][link_id] = $arr[link_id];
}
if (isset($faq_categ)) {
// gather orphaned items
/*
foreach ($faq_categ as $id => $temp)
{
if (!array_key_exists("title", $faq_categ[$id]))
{
foreach ($faq_categ[$id][items] as $id2 => $temp)
{
$faq_orphaned[$id2][question] = $faq_categ[$id][items][$id2][question];
$faq_orphaned[$id2][answer] = $faq_categ[$id][items][$id2][answer];
$faq_orphaned[$id2][flag] = $faq_categ[$id][items][$id2][flag];
unset($faq_categ[$id]);
}
}
}
*/
begin_frame("<span id=\"top\">".$lang_faq['text_contents'] . "</span>");
foreach ($faq_categ as $id => $temp)
{
if ($faq_categ[$id][flag] == "1")
{
print("<ul><li><a href=\"#id". $faq_categ[$id][link_id] ."\"><b>". $faq_categ[$id][title] ."</b></a><ul>\n");
if (array_key_exists("items", $faq_categ[$id]))
{
foreach ($faq_categ[$id][items] as $id2 => $temp)
{
if ($faq_categ[$id][items][$id2][flag] == "1") print("<li><a href=\"#id". $faq_categ[$id][items][$id2][link_id] ."\" class=\"faqlink\">". $faq_categ[$id][items][$id2][question] ."</a></li>\n");
elseif ($faq_categ[$id][items][$id2][flag] == "2") print("<li><a href=\"#id". $faq_categ[$id][items][$id2][link_id] ."\" class=\"faqlink\">". $faq_categ[$id][items][$id2][question] ."</a> <img class=\"faq_updated\" src=\"pic/trans.gif\" alt=\"Updated\" /></li>\n");
elseif ($faq_categ[$id][items][$id2][flag] == "3") print("<li><a href=\"#id". $faq_categ[$id][items][$id2][link_id] ."\" class=\"faqlink\">". $faq_categ[$id][items][$id2][question] ."</a> <img class=\"faq_new\" src=\"pic/trans.gif\" alt=\"New\" /></li>\n");
}
}
print("</ul></li></ul><br />");
}
}
end_frame();
foreach ($faq_categ as $id => $temp) {
if ($faq_categ[$id][flag] == "1")
{
$frame = $faq_categ[$id][title] ." - <a href=\"#top\"><img class=\"top\" src=\"pic/trans.gif\" alt=\"Top\" title=\"Top\" /></a>";
begin_frame($frame);
print("<span id=\"id". $faq_categ[$id][link_id] ."\"></span>");
if (array_key_exists("items", $faq_categ[$id]))
{
foreach ($faq_categ[$id][items] as $id2 => $temp)
{
if ($faq_categ[$id][items][$id2][flag] != "0")
{
print("<br /><span id=\"id".$faq_categ[$id][items][$id2][link_id]."\"><b>". $faq_categ[$id][items][$id2][question] ."</b></span><br />\n");
print("<br />". $faq_categ[$id][items][$id2][answer] ."\n<br /><br />\n");
}
}
}
end_frame();
}
}
}
end_main_frame();
$Cache->end_whole_row();
$Cache->cache_page();
}
echo $Cache->next_row();
//cache_save ('faq');
stdfoot();
?>