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