]> git.vanrenterghem.biz Git - www.vanrenterghem.biz.git/blob - phpBB2/faq.php
Baseline
[www.vanrenterghem.biz.git] / phpBB2 / faq.php
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,v 1.14.2.2 2004/07/11 16:46:15 acydburn Exp $
10  *
11  *
12  ***************************************************************************/
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  ***************************************************************************/
23 define('IN_PHPBB', true);
24 $phpbb_root_path = './';
25 include($phpbb_root_path . 'extension.inc');
26 include($phpbb_root_path . 'common.'.$phpEx);
28 //
29 // Start session management
30 //
31 $userdata = session_pagestart($user_ip, PAGE_FAQ);
32 init_userprefs($userdata);
33 //
34 // End session management
35 //
37 // Set vars to prevent naughtiness
38 $faq = array();
40 //
41 // Load the appropriate faq file
42 //
43 if( isset($HTTP_GET_VARS['mode']) )
44 {
45         switch( $HTTP_GET_VARS['mode'] )
46         {
47                 case 'bbcode':
48                         $lang_file = 'lang_bbcode';
49                         $l_title = $lang['BBCode_guide'];
50                         break;
51                 default:
52                         $lang_file = 'lang_faq';
53                         $l_title = $lang['FAQ'];
54                         break;
55         }
56 }
57 else
58 {
59         $lang_file = 'lang_faq';
60         $l_title = $lang['FAQ'];
61 }
62 include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/' . $lang_file . '.' . $phpEx);
64 //
65 // Pull the array data from the lang pack
66 //
67 $j = 0;
68 $counter = 0;
69 $counter_2 = 0;
70 $faq_block = array();
71 $faq_block_titles = array();
73 for($i = 0; $i < count($faq); $i++)
74 {
75         if( $faq[$i][0] != '--' )
76         {
77                 $faq_block[$j][$counter]['id'] = $counter_2;
78                 $faq_block[$j][$counter]['question'] = $faq[$i][0];
79                 $faq_block[$j][$counter]['answer'] = $faq[$i][1];
81                 $counter++;
82                 $counter_2++;
83         }
84         else
85         {
86                 $j = ( $counter != 0 ) ? $j + 1 : 0;
88                 $faq_block_titles[$j] = $faq[$i][1];
90                 $counter = 0;
91         }
92 }
94 //
95 // Lets build a page ...
96 //
97 $page_title = $l_title;
98 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
100 $template->set_filenames(array(
101         'body' => 'faq_body.tpl')
102 );
103 make_jumpbox('viewforum.'.$phpEx);
105 $template->assign_vars(array(
106         'L_FAQ_TITLE' => $l_title, 
107         'L_BACK_TO_TOP' => $lang['Back_to_top'])
108 );
110 for($i = 0; $i < count($faq_block); $i++)
112         if( count($faq_block[$i]) )
113         {
114                 $template->assign_block_vars('faq_block', array(
115                         'BLOCK_TITLE' => $faq_block_titles[$i])
116                 );
117                 $template->assign_block_vars('faq_block_link', array( 
118                         'BLOCK_TITLE' => $faq_block_titles[$i])
119                 );
121                 for($j = 0; $j < count($faq_block[$i]); $j++)
122                 {
123                         $row_color = ( !($j % 2) ) ? $theme['td_color1'] : $theme['td_color2'];
124                         $row_class = ( !($j % 2) ) ? $theme['td_class1'] : $theme['td_class2'];
126                         $template->assign_block_vars('faq_block.faq_row', array(
127                                 'ROW_COLOR' => '#' . $row_color,
128                                 'ROW_CLASS' => $row_class,
129                                 'FAQ_QUESTION' => $faq_block[$i][$j]['question'], 
130                                 'FAQ_ANSWER' => $faq_block[$i][$j]['answer'], 
132                                 'U_FAQ_ID' => $faq_block[$i][$j]['id'])
133                         );
135                         $template->assign_block_vars('faq_block_link.faq_row_link', array(
136                                 'ROW_COLOR' => '#' . $row_color,
137                                 'ROW_CLASS' => $row_class,
138                                 'FAQ_LINK' => $faq_block[$i][$j]['question'], 
140                                 'U_FAQ_LINK' => '#' . $faq_block[$i][$j]['id'])
141                         );
142                 }
143         }
146 $template->pparse('body');
148 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);
150 ?>