forked from MightyGorgon/icy_phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
faq.php
132 lines (114 loc) · 2.96 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
<?php
/**
*
* @package Icy Phoenix
* @version $Id$
* @copyright (c) 2008 Icy Phoenix
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
/**
*
* @Icy Phoenix is based on phpBB
* @copyright (c) 2008 phpBB Group
*
*/
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
$cms_page['page_id'] = 'faq';
$cms_page['page_nav'] = (!empty($cms_config_layouts[$cms_page['page_id']]['page_nav']) ? true : false);
$cms_page['global_blocks'] = (!empty($cms_config_layouts[$cms_page['page_id']]['global_blocks']) ? true : false);
$cms_auth_level = (isset($cms_config_layouts[$cms_page['page_id']]['view']) ? $cms_config_layouts[$cms_page['page_id']]['view'] : AUTH_ALL);
check_page_auth($cms_page['page_id'], $cms_auth_level);
// Set vars to prevent naughtiness
$faq = array();
$mode = request_var('mode', '');
// Load the appropriate faq file
if(!empty($mode))
{
switch($mode)
{
case 'bbcode':
$lang_file = 'lang_bbcode';
$l_title = $lang['BBCode_guide'];
break;
default:
$lang_file = 'lang_faq';
$l_title = $lang['FAQ'];
break;
}
}
else
{
$lang_file = 'lang_faq';
$l_title = $lang['FAQ'];
}
setup_extra_lang(array($lang_file));
// Pull the array data from the lang pack
$j = 0;
$counter = 0;
$counter_2 = 0;
$faq_block = array();
$faq_block_titles = array();
for($i = 0; $i < sizeof($faq); $i++)
{
if($faq[$i][0] != '--')
{
$faq_block[$j][$counter]['id'] = $counter_2;
$faq_block[$j][$counter]['question'] = $faq[$i][0];
$faq_block[$j][$counter]['answer'] = $faq[$i][1];
$counter++;
$counter_2++;
}
else
{
$j = ($counter != 0) ? $j + 1 : 0;
$faq_block_titles[$j] = $faq[$i][1];
$counter = 0;
}
}
$template->assign_vars(array(
'L_FAQ_TITLE' => $l_title,
'L_BACK_TO_TOP' => $lang['Back_to_top']
)
);
for($i = 0; $i < sizeof($faq_block); $i++)
{
if(sizeof($faq_block[$i]))
{
$template->assign_block_vars('faq_block', array(
'BLOCK_TITLE' => $faq_block_titles[$i])
);
$template->assign_block_vars('faq_block_link', array(
'BLOCK_TITLE' => $faq_block_titles[$i])
);
$row_class = '';
for($j = 0; $j < sizeof($faq_block[$i]); $j++)
{
$row_class = ip_zebra_rows($row_class);
$template->assign_block_vars('faq_block.faq_row', array(
'ROW_CLASS' => $row_class,
'FAQ_QUESTION' => $faq_block[$i][$j]['question'],
'FAQ_ANSWER' => $faq_block[$i][$j]['answer'],
'U_FAQ_ID' => $faq_block[$i][$j]['id']
)
);
$template->assign_block_vars('faq_block_link.faq_row_link', array(
'ROW_CLASS' => $row_class,
'FAQ_LINK' => $faq_block[$i][$j]['question'],
'U_FAQ_LINK' => '#f' . $faq_block[$i][$j]['id']
)
);
}
}
}
make_jumpbox(CMS_PAGE_VIEWFORUM);
full_page_generation('faq_body.tpl', $l_title, '', '');
?>