phpBB
Statistics
| Revision:

root / tags / milestone_3 / phpBB / faq.php

History | View | Annotate | Download (2.2 kB)

1 604 psotfx
<?php
2 5114 acydburn
/**
3 5114 acydburn
*
4 5114 acydburn
* @package phpBB3
5 5114 acydburn
* @version $Id$
6 5114 acydburn
* @copyright (c) 2005 phpBB Group
7 5114 acydburn
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
8 5114 acydburn
*
9 5114 acydburn
*/
10 604 psotfx
11 5114 acydburn
/**
12 5114 acydburn
*/
13 2305 psotfx
define('IN_PHPBB', true);
14 2448 psotfx
$phpbb_root_path = './';
15 4473 psotfx
$phpEx = substr(strrchr(__FILE__, '.'), 1);
16 646 psotfx
include($phpbb_root_path . 'common.'.$phpEx);
17 604 psotfx
18 604 psotfx
// Start session management
19 5247 acydburn
$user->session_begin();
20 2958 psotfx
$auth->acl($user->data);
21 4262 psotfx
$user->setup();
22 4262 psotfx
23 4844 acydburn
$mode = request_var('mode', '');
24 4844 acydburn
25 1331 psotfx
// Load the appropriate faq file
26 4844 acydburn
switch ($mode)
27 1614 psotfx
{
28 4844 acydburn
        case 'bbcode':
29 4844 acydburn
                $l_title = $user->lang['BBCODE_GUIDE'];
30 4844 acydburn
                $user->add_lang('bbcode', false, true);
31 4844 acydburn
                break;
32 4844 acydburn
33 4844 acydburn
        default:
34 4844 acydburn
                $l_title = $user->lang['FAQ'];
35 4844 acydburn
                $user->add_lang('faq', false, true);
36 4844 acydburn
                break;
37 1614 psotfx
}
38 1614 psotfx
39 1331 psotfx
// Pull the array data from the lang pack
40 1331 psotfx
$j = 0;
41 1331 psotfx
$counter = 0;
42 1331 psotfx
$counter_2 = 0;
43 4844 acydburn
$help_block = array();
44 4844 acydburn
$help_block_titles = array();
45 1466 psotfx
46 4844 acydburn
foreach ($user->help as $help_ary)
47 1331 psotfx
{
48 4844 acydburn
        if ($help_ary[0] != '--')
49 1331 psotfx
        {
50 4844 acydburn
                $help_block[$j][$counter]['id'] = $counter_2;
51 4844 acydburn
                $help_block[$j][$counter]['question'] = $help_ary[0];
52 4844 acydburn
                $help_block[$j][$counter]['answer'] = $help_ary[1];
53 1331 psotfx
54 1331 psotfx
                $counter++;
55 1331 psotfx
                $counter_2++;
56 1331 psotfx
        }
57 1331 psotfx
        else
58 1331 psotfx
        {
59 4262 psotfx
                $j = ($counter != 0) ? $j + 1 : 0;
60 1466 psotfx
61 4844 acydburn
                $help_block_titles[$j] = $help_ary[1];
62 1466 psotfx
63 1331 psotfx
                $counter = 0;
64 1331 psotfx
        }
65 1331 psotfx
}
66 1331 psotfx
67 1331 psotfx
//
68 1331 psotfx
// Lets build a page ...
69 1331 psotfx
$template->assign_vars(array(
70 4844 acydburn
        'L_FAQ_TITLE'        => $l_title,
71 4844 acydburn
        'L_BACK_TO_TOP'        => $user->lang['BACK_TO_TOP'])
72 1331 psotfx
);
73 1331 psotfx
74 4984 acydburn
for ($i = 0, $size = sizeof($help_block); $i < $size; $i++)
75 1127 thefinn
{
76 4844 acydburn
        if (sizeof($help_block[$i]))
77 1331 psotfx
        {
78 2448 psotfx
                $template->assign_block_vars('faq_block', array(
79 4844 acydburn
                        'BLOCK_TITLE' => $help_block_titles[$i])
80 1331 psotfx
                );
81 3487 psotfx
82 2849 psotfx
                $template->assign_block_vars('faq_block_link', array(
83 4844 acydburn
                        'BLOCK_TITLE' => $help_block_titles[$i])
84 1331 psotfx
                );
85 1331 psotfx
86 4984 acydburn
                for ($j = 0, $_size = sizeof($help_block[$i]); $j < $_size; $j++)
87 1331 psotfx
                {
88 2448 psotfx
                        $template->assign_block_vars('faq_block.faq_row', array(
89 4844 acydburn
                                'FAQ_QUESTION' => $help_block[$i][$j]['question'],
90 4844 acydburn
                                'FAQ_ANSWER' => $help_block[$i][$j]['answer'],
91 1383 psotfx
92 4844 acydburn
                                'U_FAQ_ID' => $help_block[$i][$j]['id'])
93 1331 psotfx
                        );
94 1331 psotfx
95 2448 psotfx
                        $template->assign_block_vars('faq_block_link.faq_row_link', array(
96 4844 acydburn
                                'FAQ_LINK' => $help_block[$i][$j]['question'],
97 1383 psotfx
98 4844 acydburn
                                'U_FAQ_LINK' => '#' . $help_block[$i][$j]['id'])
99 1331 psotfx
                        );
100 1331 psotfx
                }
101 1331 psotfx
        }
102 1127 thefinn
}
103 1127 thefinn
104 3969 psotfx
page_header($l_title);
105 1127 thefinn
106 2673 psotfx
$template->set_filenames(array(
107 2673 psotfx
        'body' => 'faq_body.html')
108 2673 psotfx
);
109 2673 psotfx
make_jumpbox('viewforum.'.$phpEx, $forum_id);
110 2673 psotfx
111 3969 psotfx
page_footer();
112 604 psotfx
113 604 psotfx
?>