-
Notifications
You must be signed in to change notification settings - Fork 4
/
faq.php
124 lines (116 loc) · 3.29 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
<?php
/**
**********************
** BTManager v3.0.2 **
**********************
** http://www.btmanager.org/
** https://github.com/blackheart1/BTManager3.0.2
** http://demo.btmanager.org/index.php
** Licence Info: GPL
** Copyright (C) 2018
** Formerly Known As phpMyBitTorrent
** Created By Antonio Anzivino (aka DJ Echelon)
** And Joe Robertson (aka joeroberts/Black_Heart)
** Project Leaders: Black_Heart, Thor.
** File faq.php 2018-09-22 00:00:00 Thor
**
** CHANGES
**
** 2018-09-22 - Updated Masthead, Github, !defined('IN_BTM')
**/
if (defined('IN_BTM'))
{
require_once($_SERVER['DOCUMENT_ROOT'].'/security.php');
die ("Error 404 - Page Not Found");
}
define("IN_BTM",true);
require_once("common.php");
require_once("include/torrent_functions.php");
//$user->set_lang('faq',$user->ulanguage);
include_once('include/function_posting.php');
include_once('include/message_parser.php');
include_once('include/class.bbcode.php');
include_once('include/bbcode.' . $phpEx);
$template = new Template();
set_site_var($user->lang['TITTLE']);
$res1 = "SELECT * FROM `".$db_prefix."_faq` ORDER BY `id` ASC;";
$res = $db->sql_query($res1);
$help_set = array();
while ($arr = $db->sql_fetchrow($res)) {
$bbcode = false;
$text = censor_text($arr['answer']);
// Instantiate BBCode if need be
if ($arr['bbcode_bitfield'])
{
$bbcode = new bbcode($arr['bbcode_bitfield']);
$bbcode->bbcode_second_pass($text, $arr['bbcode_uid'], $arr['bbcode_bitfield']);
}
// Parse the message and subject
$text = bbcode_nl2br($text);
$text = smiley_text($text);
if($arr['type'] == 'categ')
{
$help_set[$arr['id']] = array(0=>'--', 1=>$arr['question'],2=>array(),3=>$arr['id']);
}
else
{
$help_set[$arr['categ']][2][] = array(0=>$arr['question'], 1=>$text);
}
}
$db->sql_freeresult($res);
$help = array();
$i = 0;
foreach($help_set as $var)
{
array_push($help,array('--',stripslashes($var[1]),$var[3]));
if($var[2])
{
foreach($var[2] as $val)
{
array_push($help,array(stripslashes($val[0]),stripslashes($val[1])));
}
}
$i++;
if($i == '5')
{
array_push($help,array('--','--'));
}
}
//die(print_r($help));
$switch_column = $found_switch = false;
$help_blocks = array();
foreach ($help as $help_ary)
{
if ($help_ary[0] == '--')
{
if ($help_ary[1] == '--')
{
$switch_column = true;
$found_switch = true;
continue;
}
$template->assign_block_vars('faq_block', array(
'FAQ_ID' => $help_ary[2],
'BLOCK_TITLE' => $help_ary[1],
'SWITCH_COLUMN' => $switch_column,
));
if ($switch_column)
{
$switch_column = false;
}
continue;
}
$template->assign_block_vars('faq_block.faq_row', array(
'FAQ_QUESTION' => $help_ary[0],
'FAQ_ANSWER' => $help_ary[1])
);
}
// Lets build a page ...
$template->assign_vars(array(
'L_FAQ_TITLE' => $user->lang['FAQ_EXPLAIN'],
'L_BACK_TO_TOP' => $user->lang['BACK_TO_TOP'],
'SWITCH_COLUMN_MANUALLY' => (!$found_switch) ? true : false,
));
echo $template->fetch('faq.html');
close_out();
?>