2 /***************************************************************************
5 * begin : Sunday, Jul 8, 2001
6 * copyright : (C) 2001 The phpBB Group
7 * email : support@phpbb.com
9 * $Id: faq.php,v 1.14.2.2 2004/07/11 16:46:15 acydburn Exp $
12 ***************************************************************************/
14 /***************************************************************************
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.
21 ***************************************************************************/
23 define('IN_PHPBB', true);
24 $phpbb_root_path = './';
25 include($phpbb_root_path . 'extension.inc');
26 include($phpbb_root_path . 'common.'.$phpEx);
29 // Start session management
31 $userdata = session_pagestart($user_ip, PAGE_FAQ);
32 init_userprefs($userdata);
34 // End session management
37 // Set vars to prevent naughtiness
41 // Load the appropriate faq file
43 if( isset($HTTP_GET_VARS['mode']) )
45 switch( $HTTP_GET_VARS['mode'] )
48 $lang_file = 'lang_bbcode';
49 $l_title = $lang['BBCode_guide'];
52 $lang_file = 'lang_faq';
53 $l_title = $lang['FAQ'];
59 $lang_file = 'lang_faq';
60 $l_title = $lang['FAQ'];
62 include($phpbb_root_path . 'language/lang_' . $board_config['default_lang'] . '/' . $lang_file . '.' . $phpEx);
65 // Pull the array data from the lang pack
71 $faq_block_titles = array();
73 for($i = 0; $i < count($faq); $i++)
75 if( $faq[$i][0] != '--' )
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];
86 $j = ( $counter != 0 ) ? $j + 1 : 0;
88 $faq_block_titles[$j] = $faq[$i][1];
95 // Lets build a page ...
97 $page_title = $l_title;
98 include($phpbb_root_path . 'includes/page_header.'.$phpEx);
100 $template->set_filenames(array(
101 'body' => 'faq_body.tpl')
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'])
110 for($i = 0; $i < count($faq_block); $i++)
112 if( count($faq_block[$i]) )
114 $template->assign_block_vars('faq_block', array(
115 'BLOCK_TITLE' => $faq_block_titles[$i])
117 $template->assign_block_vars('faq_block_link', array(
118 'BLOCK_TITLE' => $faq_block_titles[$i])
121 for($j = 0; $j < count($faq_block[$i]); $j++)
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'])
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'])
146 $template->pparse('body');
148 include($phpbb_root_path . 'includes/page_tail.'.$phpEx);