Statistics
| Revision:

root / tags / release_2_0_1 / phpBB / faq.php

History | View | Annotate | Download (3.5 KB)

1
<?php
2
/***************************************************************************
3
 *                                  faq.php
4
 *                            -------------------
5
 *   begin                : Sunday, Jul 8, 2001
6
 *   copyright            : (C) 2001 The phpBB Group
7
 *   email                : support@phpbb.com
8
 *
9
 *   $Id: faq.php 2448 2002-03-31 00:06:34Z psotfx $
10
 *
11
 *
12
 ***************************************************************************/
13
14
/***************************************************************************
15
 *
16
 *   This program is free software; you can redistribute it and/or modify
17
 *   it under the terms of the GNU General Public License as published by
18
 *   the Free Software Foundation; either version 2 of the License, or
19
 *   (at your option) any later version.
20
 *
21
 ***************************************************************************/
22
23
define('IN_PHPBB', true);
24
$phpbb_root_path = './';
25
include($phpbb_root_path . 'extension.inc');
26
include($phpbb_root_path . 'common.'.$phpEx);
27
28
//
29
// Start session management
30
//
31
$userdata = session_pagestart($user_ip, PAGE_FAQ);
32
init_userprefs($userdata);
33
//
34
// End session management
35
//
36
37
//
38
// Load the appropriate faq file
39
//
40
if( isset($HTTP_GET_VARS['mode']) )
41
{
42
        switch( $HTTP_GET_VARS['mode'] )
43
        {
44
                case 'bbcode':
45
                        $lang_file = 'lang_bbcode';
46
                        $l_title = $lang['BBCode_guide'];
47
                        break;
48
                default:
49
                        $lang_file = 'lang_faq';
50
                        $l_title = $lang['FAQ'];
51
                        break;
52
        }
53
}
54
else
55
{
56
        $lang_file = 'lang_faq';
57
        $l_title = $lang['FAQ'];
58
}
59
include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/' . $lang_file . '.' . $phpEx);
60
61
//
62
// Pull the array data from the lang pack
63
//
64
$j = 0;
65
$counter = 0;
66
$counter_2 = 0;
67
$faq_block = array();
68
$faq_block_titles = array();
69
70
for($i = 0; $i < count($faq); $i++)
71
{
72
        if( $faq[$i][0] != '--' )
73
        {
74
                $faq_block[$j][$counter]['id'] = $counter_2;
75
                $faq_block[$j][$counter]['question'] = $faq[$i][0];
76
                $faq_block[$j][$counter]['answer'] = $faq[$i][1];
77
78
                $counter++;
79
                $counter_2++;
80
        }
81
        else
82
        {
83
                $j = ( $counter != 0 ) ? $j + 1 : 0;
84
85
                $faq_block_titles[$j] = $faq[$i][1];
86
87
                $counter = 0;
88
        }
89
}
90
91
//
92
// Lets build a page ...
93
//
94
$page_title = $l_title;
95
include($phpbb_root_path . 'includes/page_header.'.$phpEx);
96
97
$template->set_filenames(array(
98
        'body' => 'faq_body.tpl')
99
);
100
make_jumpbox('viewforum.'.$phpEx, $forum_id);
101
102
$template->assign_vars(array(
103
        'L_FAQ_TITLE' => $l_title, 
104
        'L_BACK_TO_TOP' => $lang['Back_to_top'])
105
);
106
107
for($i = 0; $i < count($faq_block); $i++)
108
{
109
        if( count($faq_block[$i]) )
110
        {
111
                $template->assign_block_vars('faq_block', array(
112
                        'BLOCK_TITLE' => $faq_block_titles[$i])
113
                );
114
                $template->assign_block_vars('faq_block_link', array( 
115
                        'BLOCK_TITLE' => $faq_block_titles[$i])
116
                );
117
118
                for($j = 0; $j < count($faq_block[$i]); $j++)
119
                {
120
                        $row_color = ( !($j % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
121
                        $row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
122
123
                        $template->assign_block_vars('faq_block.faq_row', array(
124
                                'ROW_COLOR' => '#' . $row_color,
125
                                'ROW_CLASS' => $row_class,
126
                                'FAQ_QUESTION' => $faq_block[$i][$j]['question'], 
127
                                'FAQ_ANSWER' => $faq_block[$i][$j]['answer'], 
128
129
                                'U_FAQ_ID' => $faq_block[$i][$j]['id'])
130
                        );
131
132
                        $template->assign_block_vars('faq_block_link.faq_row_link', array(
133
                                'ROW_COLOR' => '#' . $row_color,
134
                                'ROW_CLASS' => $row_class,
135
                                'FAQ_LINK' => $faq_block[$i][$j]['question'], 
136
137
                                'U_FAQ_LINK' => '#' . $faq_block[$i][$j]['id'])
138
                        );
139
                }
140
        }
141
}
142
143
$template->pparse('body');
144
145
include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
146
147
?>