|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* This file has the important job of taking care of help messages and the help center. |
|
5
|
|
|
* |
|
6
|
|
|
* Simple Machines Forum (SMF) |
|
7
|
|
|
* |
|
8
|
|
|
* @package SMF |
|
9
|
|
|
* @author Simple Machines https://www.simplemachines.org |
|
10
|
|
|
* @copyright 2020 Simple Machines and individual contributors |
|
11
|
|
|
* @license https://www.simplemachines.org/about/smf/license.php BSD |
|
12
|
|
|
* |
|
13
|
|
|
* @version 2.1 RC3 |
|
14
|
|
|
*/ |
|
15
|
|
|
|
|
16
|
|
|
if (!defined('SMF')) |
|
17
|
|
|
die('No direct access...'); |
|
18
|
|
|
|
|
19
|
|
|
/** |
|
20
|
|
|
* Redirect to the user help ;). |
|
21
|
|
|
* It loads information needed for the help section. |
|
22
|
|
|
* It is accessed by ?action=help. |
|
23
|
|
|
* |
|
24
|
|
|
* Uses Help template and Manual language file. |
|
25
|
|
|
*/ |
|
26
|
|
|
function ShowHelp() |
|
27
|
|
|
{ |
|
28
|
|
|
loadTemplate('Help'); |
|
29
|
|
|
loadLanguage('Manual'); |
|
30
|
|
|
|
|
31
|
|
|
$subActions = array( |
|
32
|
|
|
'index' => 'HelpIndex', |
|
33
|
|
|
); |
|
34
|
|
|
|
|
35
|
|
|
// CRUD $subActions as needed. |
|
36
|
|
|
call_integration_hook('integrate_manage_help', array(&$subActions)); |
|
37
|
|
|
|
|
38
|
|
|
$sa = isset($_GET['sa'], $subActions[$_GET['sa']]) ? $_GET['sa'] : 'index'; |
|
39
|
|
|
call_helper($subActions[$sa]); |
|
40
|
|
|
} |
|
41
|
|
|
|
|
42
|
|
|
/** |
|
43
|
|
|
* The main page for the Help section |
|
44
|
|
|
*/ |
|
45
|
|
|
function HelpIndex() |
|
46
|
|
|
{ |
|
47
|
|
|
global $scripturl, $context, $txt; |
|
48
|
|
|
|
|
49
|
|
|
// We need to know where our wiki is. |
|
50
|
|
|
$context['wiki_url'] = 'https://wiki.simplemachines.org/smf'; |
|
51
|
|
|
$context['wiki_prefix'] = 'SMF2.1:'; |
|
52
|
|
|
|
|
53
|
|
|
$context['canonical_url'] = $scripturl . '?action=help'; |
|
54
|
|
|
|
|
55
|
|
|
// Sections were are going to link... |
|
56
|
|
|
$context['manual_sections'] = array( |
|
57
|
|
|
'registering' => 'Registering', |
|
58
|
|
|
'logging_in' => 'Logging_In', |
|
59
|
|
|
'profile' => 'Profile', |
|
60
|
|
|
'search' => 'Search', |
|
61
|
|
|
'posting' => 'Posting', |
|
62
|
|
|
'bbc' => 'Bulletin_board_code', |
|
63
|
|
|
'personal_messages' => 'Personal_messages', |
|
64
|
|
|
'memberlist' => 'Memberlist', |
|
65
|
|
|
'calendar' => 'Calendar', |
|
66
|
|
|
'features' => 'Features', |
|
67
|
|
|
); |
|
68
|
|
|
|
|
69
|
|
|
// Build the link tree. |
|
70
|
|
|
$context['linktree'][] = array( |
|
71
|
|
|
'url' => $scripturl . '?action=help', |
|
72
|
|
|
'name' => $txt['help'], |
|
73
|
|
|
); |
|
74
|
|
|
|
|
75
|
|
|
// Lastly, some minor template stuff. |
|
76
|
|
|
$context['page_title'] = $txt['manual_smf_user_help']; |
|
77
|
|
|
$context['sub_template'] = 'manual'; |
|
78
|
|
|
} |
|
79
|
|
|
|
|
80
|
|
|
/** |
|
81
|
|
|
* Show some of the more detailed help to give the admin an idea... |
|
82
|
|
|
* It shows a popup for administrative or user help. |
|
83
|
|
|
* It uses the help parameter to decide what string to display and where to get |
|
84
|
|
|
* the string from. ($helptxt or $txt?) |
|
85
|
|
|
* It is accessed via ?action=helpadmin;help=?. |
|
86
|
|
|
* |
|
87
|
|
|
* Uses ManagePermissions language file, if the help starts with permissionhelp. |
|
88
|
|
|
* @uses template_popup() with no layers. |
|
89
|
|
|
*/ |
|
90
|
|
|
function ShowAdminHelp() |
|
91
|
|
|
{ |
|
92
|
|
|
global $txt, $helptxt, $context, $scripturl, $boarddir, $boardurl; |
|
93
|
|
|
|
|
94
|
|
|
if (!isset($_GET['help']) || !is_string($_GET['help'])) |
|
95
|
|
|
fatal_lang_error('no_access', false); |
|
96
|
|
|
|
|
97
|
|
|
if (!isset($helptxt)) |
|
98
|
|
|
$helptxt = array(); |
|
99
|
|
|
|
|
100
|
|
|
// Load the admin help language file and template. |
|
101
|
|
|
loadLanguage('Help'); |
|
102
|
|
|
|
|
103
|
|
|
// Permission specific help? |
|
104
|
|
|
if (isset($_GET['help']) && substr($_GET['help'], 0, 14) == 'permissionhelp') |
|
105
|
|
|
loadLanguage('ManagePermissions'); |
|
106
|
|
|
|
|
107
|
|
|
loadTemplate('Help'); |
|
108
|
|
|
|
|
109
|
|
|
// Allow mods to load their own language file here |
|
110
|
|
|
call_integration_hook('integrate_helpadmin'); |
|
111
|
|
|
|
|
112
|
|
|
// Set the page title to something relevant. |
|
113
|
|
|
$context['page_title'] = $context['forum_name'] . ' - ' . $txt['help']; |
|
114
|
|
|
|
|
115
|
|
|
// Don't show any template layers, just the popup sub template. |
|
116
|
|
|
$context['template_layers'] = array(); |
|
117
|
|
|
$context['sub_template'] = 'popup'; |
|
118
|
|
|
|
|
119
|
|
|
// What help string should be used? |
|
120
|
|
|
if (isset($helptxt[$_GET['help']])) |
|
121
|
|
|
$context['help_text'] = $helptxt[$_GET['help']]; |
|
122
|
|
|
elseif (isset($txt[$_GET['help']])) |
|
123
|
|
|
$context['help_text'] = $txt[$_GET['help']]; |
|
124
|
|
|
else |
|
125
|
|
|
$context['help_text'] = $_GET['help']; |
|
126
|
|
|
|
|
127
|
|
|
switch ($_GET['help']) { |
|
128
|
|
|
case 'cal_short_months': |
|
129
|
|
|
$context['help_text'] = sprintf($context['help_text'], $txt['months_short'][1], $txt['months_titles'][1]); |
|
130
|
|
|
break; |
|
131
|
|
|
case 'cal_short_days': |
|
132
|
|
|
$context['help_text'] = sprintf($context['help_text'], $txt['days_short'][1], $txt['days'][1]); |
|
133
|
|
|
break; |
|
134
|
|
|
case 'cron_is_real_cron': |
|
135
|
|
|
$context['help_text'] = sprintf($context['help_text'], $boarddir, $boardurl); |
|
136
|
|
|
break; |
|
137
|
|
|
case 'enableSpellChecking': |
|
138
|
|
|
$context['help_text'] = sprintf($context['help_text'], ((function_exists('pspell_new') || function_exists('enchant_broker_init')) ? $helptxt['enableSpellCheckingSupported'] : $helptxt['enableSpellCheckingUnsupported'])); |
|
139
|
|
|
break; |
|
140
|
|
|
case 'queryless_urls': |
|
141
|
|
|
$context['help_text'] = sprintf($context['help_text'], (isset($_SERVER['SERVER_SOFTWARE']) && (strpos($_SERVER['SERVER_SOFTWARE'], 'Apache') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'lighttpd') !== false) ? $helptxt['queryless_urls_supported'] : $helptxt['queryless_urls_unsupported'])); |
|
142
|
|
|
break; |
|
143
|
|
|
} |
|
144
|
|
|
|
|
145
|
|
|
// Does this text contain a link that we should fill in? |
|
146
|
|
|
if (preg_match('~%([0-9]+\$)?s\?~', $context['help_text'], $match)) |
|
147
|
|
|
$context['help_text'] = sprintf($context['help_text'], $scripturl, $context['session_id'], $context['session_var']); |
|
148
|
|
|
} |
|
149
|
|
|
|
|
150
|
|
|
?> |