Chris@76
|
1 <?php
|
Chris@76
|
2
|
Chris@76
|
3 /**
|
Chris@76
|
4 * Simple Machines Forum (SMF)
|
Chris@76
|
5 *
|
Chris@76
|
6 * @package SMF
|
Chris@76
|
7 * @author Simple Machines http://www.simplemachines.org
|
Chris@76
|
8 * @copyright 2011 Simple Machines
|
Chris@76
|
9 * @license http://www.simplemachines.org/about/smf/license.php BSD
|
Chris@76
|
10 *
|
Chris@76
|
11 * @version 2.0
|
Chris@76
|
12 */
|
Chris@76
|
13
|
Chris@76
|
14 if (!defined('SMF'))
|
Chris@76
|
15 die('Hacking attempt...');
|
Chris@76
|
16
|
Chris@76
|
17 /* This file has the important job of taking care of help messages and the
|
Chris@76
|
18 help center. It does this with two simple functions:
|
Chris@76
|
19
|
Chris@76
|
20 void ShowHelp()
|
Chris@76
|
21 - loads information needed for the help section.
|
Chris@76
|
22 - accesed by ?action=help.
|
Chris@76
|
23 - uses the Help template and Manual language file.
|
Chris@76
|
24
|
Chris@76
|
25 void ShowAdminHelp()
|
Chris@76
|
26 - shows a popup for administrative or user help.
|
Chris@76
|
27 - uses the help parameter to decide what string to display and where
|
Chris@76
|
28 to get the string from. ($helptxt or $txt?)
|
Chris@76
|
29 - loads the ManagePermissions language file if the help starts with
|
Chris@76
|
30 permissionhelp.
|
Chris@76
|
31 - uses the Help template, popup sub template, no layers.
|
Chris@76
|
32 - accessed via ?action=helpadmin;help=??.
|
Chris@76
|
33 */
|
Chris@76
|
34
|
Chris@76
|
35 // Redirect to the user help ;).
|
Chris@76
|
36 function ShowHelp()
|
Chris@76
|
37 {
|
Chris@76
|
38 global $scripturl, $context, $txt;
|
Chris@76
|
39
|
Chris@76
|
40 loadTemplate('Help');
|
Chris@76
|
41 loadLanguage('Manual');
|
Chris@76
|
42
|
Chris@76
|
43 // We need to know where our wiki is.
|
Chris@76
|
44 $context['wiki_url'] = 'http://wiki.simplemachines.org/smf';
|
Chris@76
|
45
|
Chris@76
|
46 // Sections were are going to link...
|
Chris@76
|
47 $context['manual_sections'] = array(
|
Chris@76
|
48 'registering' => 'Registering',
|
Chris@76
|
49 'logging_in' => 'Logging_In',
|
Chris@76
|
50 'profile' => 'Profile',
|
Chris@76
|
51 'search' => 'Search',
|
Chris@76
|
52 'posting' => 'Posting',
|
Chris@76
|
53 'bbc' => 'Bulletin_board_code',
|
Chris@76
|
54 'personal_messages' => 'Personal_messages',
|
Chris@76
|
55 'memberlist' => 'Memberlist',
|
Chris@76
|
56 'calendar' => 'Calendar',
|
Chris@76
|
57 'features' => 'Features',
|
Chris@76
|
58 );
|
Chris@76
|
59
|
Chris@76
|
60 // Build the link tree.
|
Chris@76
|
61 $context['linktree'][] = array(
|
Chris@76
|
62 'url' => $scripturl . '?action=help',
|
Chris@76
|
63 'name' => $txt['help'],
|
Chris@76
|
64 );
|
Chris@76
|
65
|
Chris@76
|
66 // Lastly, some minor template stuff.
|
Chris@76
|
67 $context['page_title'] = $txt['manual_smf_user_help'];
|
Chris@76
|
68 $context['sub_template'] = 'manual';
|
Chris@76
|
69 }
|
Chris@76
|
70
|
Chris@76
|
71 // Show some of the more detailed help to give the admin an idea...
|
Chris@76
|
72 function ShowAdminHelp()
|
Chris@76
|
73 {
|
Chris@76
|
74 global $txt, $helptxt, $context, $scripturl;
|
Chris@76
|
75
|
Chris@76
|
76 if (!isset($_GET['help']) || !is_string($_GET['help']))
|
Chris@76
|
77 fatal_lang_error('no_access', false);
|
Chris@76
|
78
|
Chris@76
|
79 if (!isset($helptxt))
|
Chris@76
|
80 $helptxt = array();
|
Chris@76
|
81
|
Chris@76
|
82 // Load the admin help language file and template.
|
Chris@76
|
83 loadLanguage('Help');
|
Chris@76
|
84
|
Chris@76
|
85 // Permission specific help?
|
Chris@76
|
86 if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp')
|
Chris@76
|
87 loadLanguage('ManagePermissions');
|
Chris@76
|
88
|
Chris@76
|
89 loadTemplate('Help');
|
Chris@76
|
90
|
Chris@76
|
91 // Set the page title to something relevant.
|
Chris@76
|
92 $context['page_title'] = $context['forum_name'] . ' - ' . $txt['help'];
|
Chris@76
|
93
|
Chris@76
|
94 // Don't show any template layers, just the popup sub template.
|
Chris@76
|
95 $context['template_layers'] = array();
|
Chris@76
|
96 $context['sub_template'] = 'popup';
|
Chris@76
|
97
|
Chris@76
|
98 // What help string should be used?
|
Chris@76
|
99 if (isset($helptxt[$_GET['help']]))
|
Chris@76
|
100 $context['help_text'] = $helptxt[$_GET['help']];
|
Chris@76
|
101 elseif (isset($txt[$_GET['help']]))
|
Chris@76
|
102 $context['help_text'] = $txt[$_GET['help']];
|
Chris@76
|
103 else
|
Chris@76
|
104 $context['help_text'] = $_GET['help'];
|
Chris@76
|
105
|
Chris@76
|
106 // Does this text contain a link that we should fill in?
|
Chris@76
|
107 if (preg_match('~%([0-9]+\$)?s\?~', $context['help_text'], $match))
|
Chris@76
|
108 $context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']);
|
Chris@76
|
109 }
|
Chris@76
|
110
|
Chris@76
|
111 ?> |