phpBB
Statistics
| Revision:

root / tags / release_2_0_2 / phpBB / faq.php

History | View | Annotate | Download (3.5 kB)

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