1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* @name ElkArte Forum |
5
|
|
|
* @copyright ElkArte Forum contributors |
6
|
|
|
* @license BSD http://opensource.org/licenses/BSD-3-Clause |
7
|
|
|
* |
8
|
|
|
* This software is a derived product, based on: |
9
|
|
|
* |
10
|
|
|
* Simple Machines Forum (SMF) |
11
|
|
|
* copyright: 2011 Simple Machines (http://www.simplemachines.org) |
12
|
|
|
* license: BSD, See included LICENSE.TXT for terms and conditions. |
13
|
|
|
* |
14
|
|
|
* @version 1.0.2 |
15
|
|
|
* |
16
|
|
|
*/ |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Template for the section that allows to modify weights for search settings |
20
|
|
|
* in admin panel. |
21
|
|
|
*/ |
22
|
|
|
function template_modify_weights() |
23
|
|
|
{ |
24
|
|
|
global $context, $settings, $scripturl, $txt, $modSettings; |
25
|
|
|
|
26
|
|
|
echo ' |
27
|
|
|
<div id="admincenter"> |
28
|
|
|
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=managesearch;sa=weights" method="post" accept-charset="UTF-8"> |
29
|
|
|
<h2 class="category_header">', $txt['search_weights'], '</h2>'; |
30
|
|
|
|
31
|
|
|
if (!empty($modSettings['search_index']) && ($modSettings['search_index'] === 'sphinx' || $modSettings['search_index'] === 'sphinxql')) |
32
|
|
|
echo ' |
33
|
|
|
<div class="windowbg"> |
34
|
|
|
<div class="content"> |
35
|
|
|
<div class="infobox">', |
36
|
|
|
$txt['search_weights_sphinx'], ' |
37
|
|
|
</div> |
38
|
|
|
</div> |
39
|
|
|
</div>'; |
40
|
|
|
|
41
|
|
|
echo ' |
42
|
|
|
<div class="windowbg"> |
43
|
|
|
<div class="content"> |
44
|
|
|
<dl class="settings"> |
45
|
|
|
<dt class="large_caption"> |
46
|
|
|
<a href="', $scripturl, '?action=quickhelp;help=search_weight_commonheader%2Bsearch_weight_frequency" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight1_val"> |
47
|
|
|
', $txt['search_weight_frequency'], ':</label> |
48
|
|
|
</dt> |
49
|
|
|
<dd class="large_caption"> |
50
|
|
|
<span class="search_weight"><input type="text" name="search_weight_frequency" id="weight1_val" value="', empty($modSettings['search_weight_frequency']) ? '0' : $modSettings['search_weight_frequency'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> |
51
|
|
|
<span id="weight1" class="search_weight">', $context['relative_weights']['search_weight_frequency'], '%</span> |
52
|
|
|
</dd> |
53
|
|
|
<dt class="large_caption"> |
54
|
|
|
<a href="', $scripturl, '?action=quickhelp;help=search_weight_commonheader%2Bsearch_weight_age" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight2_val"> |
55
|
|
|
', $txt['search_weight_age'], ':</label> |
56
|
|
|
</dt> |
57
|
|
|
<dd class="large_caption"> |
58
|
|
|
<span class="search_weight"><input type="text" name="search_weight_age" id="weight2_val" value="', empty($modSettings['search_weight_age']) ? '0' : $modSettings['search_weight_age'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> |
59
|
|
|
<span id="weight2" class="search_weight">', $context['relative_weights']['search_weight_age'], '%</span> |
60
|
|
|
</dd> |
61
|
|
|
<dt class="large_caption"> |
62
|
|
|
<a href="', $scripturl, '?action=quickhelp;help=search_weight_commonheader%2Bsearch_weight_length" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight3_val"> |
63
|
|
|
', $txt['search_weight_length'], ':</label> |
64
|
|
|
</dt> |
65
|
|
|
<dd class="large_caption"> |
66
|
|
|
<span class="search_weight"><input type="text" name="search_weight_length" id="weight3_val" value="', empty($modSettings['search_weight_length']) ? '0' : $modSettings['search_weight_length'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> |
67
|
|
|
<span id="weight3" class="search_weight">', $context['relative_weights']['search_weight_length'], '%</span> |
68
|
|
|
</dd> |
69
|
|
|
<dt class="large_caption"> |
70
|
|
|
<a href="', $scripturl, '?action=quickhelp;help=search_weight_commonheader%2Bsearch_weight_subject" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight4_val"> |
71
|
|
|
', $txt['search_weight_subject'], ':</label> |
72
|
|
|
</dt> |
73
|
|
|
<dd class="large_caption"> |
74
|
|
|
<span class="search_weight"><input type="text" name="search_weight_subject" id="weight4_val" value="', empty($modSettings['search_weight_subject']) ? '0' : $modSettings['search_weight_subject'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> |
75
|
|
|
<span id="weight4" class="search_weight">', $context['relative_weights']['search_weight_subject'], '%</span> |
76
|
|
|
</dd> |
77
|
|
|
<dt class="large_caption"> |
78
|
|
|
<a href="', $scripturl, '?action=quickhelp;help=search_weight_commonheader%2Bsearch_weight_first_message" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" /></a><label for="weight5_val"> |
79
|
|
|
', $txt['search_weight_first_message'], ':</label> |
80
|
|
|
</dt> |
81
|
|
|
<dd class="large_caption"> |
82
|
|
|
<span class="search_weight"><input type="text" name="search_weight_first_message" id="weight5_val" value="', empty($modSettings['search_weight_first_message']) ? '0' : $modSettings['search_weight_first_message'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> |
83
|
|
|
<span id="weight5" class="search_weight">', $context['relative_weights']['search_weight_first_message'], '%</span> |
84
|
|
|
</dd> |
85
|
|
|
<dt class="large_caption"> |
86
|
|
|
<a href="', $scripturl, '?action=quickhelp;help=search_weight_commonheader%2Bsearch_weight_sticky" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics.png" alt="', $txt['help'], '" style="vertical-align: top;" /></a><label for="weight6_val"> |
87
|
|
|
', $txt['search_weight_sticky'], ':</label> |
88
|
|
|
</dt> |
89
|
|
|
<dd class="large_caption"> |
90
|
|
|
<span class="search_weight"><input type="text" name="search_weight_sticky" id="weight6_val" value="', empty($modSettings['search_weight_sticky']) ? '0' : $modSettings['search_weight_sticky'], '" onchange="calculateNewValues()" size="3" class="input_text" /></span> |
91
|
|
|
<span id="weight6" class="search_weight">', $context['relative_weights']['search_weight_sticky'], '%</span> |
92
|
|
|
</dd> |
93
|
|
|
<dt class="large_caption"> |
94
|
|
|
<strong>', $txt['search_weights_total'], '</strong> |
95
|
|
|
</dt> |
96
|
|
|
<dd class="large_caption"> |
97
|
|
|
<span id="weighttotal" class="search_weight"><strong>', $context['relative_weights']['total'], '</strong></span> |
98
|
|
|
<span class="search_weight"><strong> 100%</strong></span> |
99
|
|
|
</dd> |
100
|
|
|
</dl> |
101
|
|
|
<input type="submit" name="save" value="', $txt['search_weights_save'], '" class="right_submit" /> |
102
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
103
|
|
|
<input type="hidden" name="', $context['admin-msw_token_var'], '" value="', $context['admin-msw_token'], '" /> |
104
|
|
|
</div> |
105
|
|
|
</div> |
106
|
|
|
</form> |
107
|
|
|
</div>'; |
108
|
|
|
} |
109
|
|
|
|
110
|
|
|
/** |
111
|
|
|
* Template for the section to select a search method |
112
|
|
|
* in search area of admin panel. |
113
|
|
|
*/ |
114
|
|
|
function template_select_search_method() |
115
|
|
|
{ |
116
|
|
|
global $context, $scripturl, $txt, $modSettings; |
117
|
|
|
|
118
|
|
|
echo ' |
119
|
|
|
<div id="admincenter"> |
120
|
|
|
<h2 class="category_header">', $txt['search_method'], '</h2> |
121
|
|
|
<div class="infobox"> |
122
|
|
|
<a href="', $scripturl, '?action=quickhelp;help=search_why_use_index" onclick="return reqOverlayDiv(this.href);">', $txt['search_create_index_why'], '</a> |
123
|
|
|
</div> |
124
|
|
|
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=managesearch;sa=method" method="post" accept-charset="UTF-8"> |
125
|
|
|
<h3 class="category_header">', $txt['search_method'], '</h3> |
126
|
|
|
<div class="windowbg"> |
127
|
|
|
<div class="content"> |
128
|
|
|
<dl class="settings"> |
129
|
|
|
|
130
|
|
|
'; |
131
|
|
|
if (!empty($context['table_info'])) |
132
|
|
|
echo ' |
133
|
|
|
<dt> |
134
|
|
|
<strong>', $txt['search_method_messages_table_space'], ':</strong> |
135
|
|
|
</dt> |
136
|
|
|
<dd> |
137
|
|
|
', $context['table_info']['data_length'], ' |
138
|
|
|
</dd> |
139
|
|
|
<dt> |
140
|
|
|
<strong>', $txt['search_method_messages_index_space'], ':</strong> |
141
|
|
|
</dt> |
142
|
|
|
<dd> |
143
|
|
|
', $context['table_info']['index_length'], ' |
144
|
|
|
</dd>'; |
145
|
|
|
|
146
|
|
|
echo ' |
147
|
|
|
</dl> |
148
|
|
|
', $context['double_index'] ? '<div class="warningbox"> |
149
|
|
|
' . $txt['search_double_index'] . '</div>' : '', ' |
150
|
|
|
<fieldset id="search_index" class="search_settings"> |
151
|
|
|
<legend>', $txt['search_index'], '</legend> |
152
|
|
|
<dl> |
153
|
|
|
<dt><input type="radio" id="search_index_none" name="search_index" value="none"', empty($modSettings['search_index']) ? ' checked="checked"' : '', ' class="input_radio" /> |
154
|
|
|
<label for="search_index_none">', $txt['search_index_none'], '</label> |
155
|
|
|
</dt>'; |
156
|
|
|
|
157
|
|
|
if ($context['supports_fulltext']) |
158
|
|
|
{ |
159
|
|
|
echo ' |
160
|
|
|
<dt> |
161
|
|
|
<input type="radio" id="search_index_full" name="search_index" value="fulltext"', !empty($modSettings['search_index']) && $modSettings['search_index'] == 'fulltext' ? ' checked="checked"' : '', empty($context['fulltext_index']) ? ' onclick="alert(\'' . $txt['search_method_fulltext_warning'] . '\'); selectRadioByName(this.form.search_index, \'none\');"' : '', ' class="input_radio" /> |
162
|
|
|
<label for="search_index_full">', $txt['search_method_fulltext_index'], '</label> |
163
|
|
|
</dt> |
164
|
|
|
<dd> |
165
|
|
|
|
166
|
|
|
<span class="smalltext">'; |
167
|
|
|
|
168
|
|
|
if (empty($context['fulltext_index']) && empty($context['cannot_create_fulltext'])) |
169
|
|
|
echo ' |
170
|
|
|
<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createfulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_create'], '</a>]'; |
171
|
|
|
elseif (empty($context['fulltext_index']) && !empty($context['cannot_create_fulltext'])) |
172
|
|
|
echo ' |
173
|
|
|
<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_fulltext_cannot_create']; |
174
|
|
|
else |
175
|
|
|
echo ' |
176
|
|
|
<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removefulltext;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_method_fulltext_remove'], '</a>]<br /> |
177
|
|
|
<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['fulltext_length']; |
178
|
|
|
|
179
|
|
|
echo ' |
180
|
|
|
</span> |
181
|
|
|
</dd>'; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
echo ' |
185
|
|
|
<dt> |
186
|
|
|
<input type="radio" id="search_index_custom" name="search_index" value="custom"', !empty($modSettings['search_index']) && $modSettings['search_index'] == 'custom' ? ' checked="checked"' : '', $context['custom_index'] ? '' : ' onclick="alert(\'' . $txt['search_index_custom_warning'] . '\'); selectRadioByName(this.form.search_index, \'none\');"', ' class="input_radio" /> |
187
|
|
|
<label for="search_index_custom">', $txt['search_index_custom'], '</label> |
188
|
|
|
</dt> |
189
|
|
|
<dd> |
190
|
|
|
<span class="smalltext">'; |
191
|
|
|
|
192
|
|
|
if ($context['custom_index']) |
193
|
|
|
echo ' |
194
|
|
|
<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_already_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>]<br /> |
195
|
|
|
<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
196
|
|
|
elseif ($context['partial_custom_index']) |
197
|
|
|
echo ' |
198
|
|
|
<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_index_partial'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=removecustom;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_remove'], '</a>] [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;resume;', $context['session_var'], '=', $context['session_id'], ';', $context['admin-msm_token_var'], '=', $context['admin-msm_token'], '">', $txt['search_index_custom_resume'], '</a>]<br /> |
199
|
|
|
<strong>', $txt['search_index_size'], ':</strong> ', $context['table_info']['custom_index_length']; |
200
|
|
|
else |
201
|
|
|
echo ' |
202
|
|
|
<strong>', $txt['search_index_label'], ':</strong> ', $txt['search_method_no_index_exists'], ' [<a href="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex">', $txt['search_index_create_custom'], '</a>]'; |
203
|
|
|
|
204
|
|
|
echo ' |
205
|
|
|
</span> |
206
|
|
|
</dd>'; |
207
|
|
|
|
208
|
|
|
// Any search API's to include |
209
|
|
|
foreach ($context['search_apis'] as $api) |
210
|
|
|
{ |
211
|
|
|
if (empty($api['label']) || $api['has_template']) |
212
|
|
|
continue; |
213
|
|
|
|
214
|
|
|
echo ' |
215
|
|
|
<dt> |
216
|
|
|
<input type="radio" id="search_index_', $api['setting_index'], '" name="search_index" value="', $api['setting_index'], '"', !empty($modSettings['search_index']) && $modSettings['search_index'] == $api['setting_index'] ? ' checked="checked"' : '', ' class="input_radio" /> |
217
|
|
|
<label for="search_index_', $api['setting_index'], '">', $api['label'], '</label> |
218
|
|
|
</dt>'; |
219
|
|
|
|
220
|
|
|
if ($api['desc']) |
221
|
|
|
echo ' |
222
|
|
|
<dd> |
223
|
|
|
<span class="smalltext">', $api['desc'], '</span> |
224
|
|
|
</dd>'; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
echo ' |
228
|
|
|
</dl> |
229
|
|
|
</fieldset> |
230
|
|
|
<fieldset id="search_method" class="search_settings"> |
231
|
|
|
<legend>', $txt['search_method'], '</legend> |
232
|
|
|
<input type="checkbox" name="search_force_index" id="search_force_index_check" value="1"', empty($modSettings['search_force_index']) ? '' : ' checked="checked"', ' class="input_check" /><label for="search_force_index_check">', $txt['search_force_index'], '</label><br /> |
233
|
|
|
<input type="checkbox" name="search_match_words" id="search_match_words_check" value="1"', empty($modSettings['search_match_words']) ? '' : ' checked="checked"', ' class="input_check" /><label for="search_match_words_check">', $txt['search_match_words'], '</label> |
234
|
|
|
</fieldset> |
235
|
|
|
</div> |
236
|
|
|
</div> |
237
|
|
|
<div class="submitbutton"> |
238
|
|
|
<input type="submit" name="save" value="', $txt['search_method_save'], '" class="button_submit" /> |
239
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
240
|
|
|
<input type="hidden" name="', $context['admin-msmpost_token_var'], '" value="', $context['admin-msmpost_token'], '" /> |
241
|
|
|
</div> |
242
|
|
|
</form> |
243
|
|
|
</div> |
244
|
|
|
<script><!-- // --><![CDATA[ |
245
|
|
|
showhideSearchMethod(); |
246
|
|
|
|
247
|
|
|
$("#search_index input").change(function() { |
248
|
|
|
showhideSearchMethod(); |
249
|
|
|
}); |
250
|
|
|
// ]]></script>'; |
251
|
|
|
} |
252
|
|
|
|
253
|
|
|
/** |
254
|
|
|
* Template to create a search index. |
255
|
|
|
*/ |
256
|
|
|
function template_create_index() |
257
|
|
|
{ |
258
|
|
|
global $context, $scripturl, $txt; |
259
|
|
|
|
260
|
|
|
echo ' |
261
|
|
|
<div id="admincenter"> |
262
|
|
|
<form action="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;step=1" method="post" accept-charset="UTF-8" name="create_index"> |
263
|
|
|
<h2 class="category_header">', $txt['search_create_index'], '</h2> |
264
|
|
|
<div class="windowbg"> |
265
|
|
|
<div class="content"> |
266
|
|
|
<dl class="settings"> |
267
|
|
|
<dt> |
268
|
|
|
<label for="predefine_select">', $txt['search_predefined'], ':</label> |
269
|
|
|
</dt> |
270
|
|
|
<dd> |
271
|
|
|
<select name="bytes_per_word" id="predefine_select"> |
272
|
|
|
<option value="2">', $txt['search_predefined_small'], '</option> |
273
|
|
|
<option value="4" selected="selected">', $txt['search_predefined_moderate'], '</option> |
274
|
|
|
<option value="5">', $txt['search_predefined_large'], '</option> |
275
|
|
|
</select> |
276
|
|
|
</dd> |
277
|
|
|
</dl> |
278
|
|
|
<hr /> |
279
|
|
|
<input type="submit" name="save" value="', $txt['search_create_index_start'], '" class="right_submit" /> |
280
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
281
|
|
|
</div> |
282
|
|
|
</div> |
283
|
|
|
</form> |
284
|
|
|
</div>'; |
285
|
|
|
} |
286
|
|
|
|
287
|
|
|
/** |
288
|
|
|
* Template to show progress during creation of a search index. |
289
|
|
|
*/ |
290
|
|
|
function template_create_index_progress() |
291
|
|
|
{ |
292
|
|
|
global $context, $scripturl, $txt; |
293
|
|
|
|
294
|
|
|
echo ' |
295
|
|
|
<div id="admincenter"> |
296
|
|
|
<form action="', $scripturl, '?action=admin;area=managesearch;sa=createmsgindex;step=1" name="autoSubmit" method="post" accept-charset="UTF-8"> |
297
|
|
|
<h3 class="category_header">', $txt['search_create_index'], '</h3> |
298
|
|
|
<div class="windowbg"> |
299
|
|
|
<div class="content"> |
300
|
|
|
<div> |
301
|
|
|
<p>', $txt['search_create_index_not_ready'], '</p> |
302
|
|
|
<div class="progress_bar"> |
303
|
|
|
<div class="full_bar">', $context['percentage'], '%</div> |
304
|
|
|
<div class="green_percent" style="width: ', $context['percentage'], '%;"> </div> |
305
|
|
|
</div> |
306
|
|
|
</div> |
307
|
|
|
<hr /> |
308
|
|
|
<input type="submit" name="cont" value="', $txt['search_create_index_continue'], '" class="right_submit" /> |
309
|
|
|
</div> |
310
|
|
|
</div> |
311
|
|
|
<input type="hidden" name="step" value="', $context['step'], '" /> |
312
|
|
|
<input type="hidden" name="start" value="', $context['start'], '" /> |
313
|
|
|
<input type="hidden" name="bytes_per_word" value="', $context['index_settings']['bytes_per_word'], '" /> |
314
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
315
|
|
|
</form> |
316
|
|
|
</div> |
317
|
|
|
<script><!-- // --><![CDATA[ |
318
|
|
|
doAutoSubmit(10, ', JavaScriptEscape($txt['search_create_index_continue']), '); |
319
|
|
|
// ]]></script>'; |
320
|
|
|
} |
321
|
|
|
|
322
|
|
|
/** |
323
|
|
|
* Used to show the completion of the search index creation |
324
|
|
|
*/ |
325
|
|
|
function template_create_index_done() |
326
|
|
|
{ |
327
|
|
|
global $scripturl, $txt; |
328
|
|
|
|
329
|
|
|
echo ' |
330
|
|
|
<div id="admincenter"> |
331
|
|
|
<h2 class="category_header">', $txt['search_create_index'], '</h2> |
332
|
|
|
<div class="windowbg"> |
333
|
|
|
<div class="content"> |
334
|
|
|
<p>', $txt['search_create_index_done'], '</p> |
335
|
|
|
<p> |
336
|
|
|
<strong><a href="', $scripturl, '?action=admin;area=managesearch;sa=method">', $txt['search_create_index_done_link'], '</a></strong> |
337
|
|
|
</p> |
338
|
|
|
</div> |
339
|
|
|
</div> |
340
|
|
|
</div>'; |
341
|
|
|
} |
342
|
|
|
|
343
|
|
|
/** |
344
|
|
|
* Add or edit a search engine spider. |
345
|
|
|
*/ |
346
|
|
|
function template_spider_edit() |
347
|
|
|
{ |
348
|
|
|
global $context, $scripturl, $txt; |
349
|
|
|
|
350
|
|
|
echo ' |
351
|
|
|
<div id="admincenter"> |
352
|
|
|
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=sengines;sa=editspiders;sid=', $context['spider']['id'], '" method="post" accept-charset="UTF-8"> |
353
|
|
|
<h2 class="category_header">', $context['page_title'], '</h2> |
354
|
|
|
<div class="information"> |
355
|
|
|
', $txt['add_spider_desc'], ' |
356
|
|
|
</div> |
357
|
|
|
<div class="windowbg"> |
358
|
|
|
<div class="content"> |
359
|
|
|
<dl class="settings"> |
360
|
|
|
<dt> |
361
|
|
|
<strong><label for="spider_name">', $txt['spider_name'], ':</label></strong><br /> |
362
|
|
|
<span class="smalltext">', $txt['spider_name_desc'], '</span> |
363
|
|
|
</dt> |
364
|
|
|
<dd> |
365
|
|
|
<input type="text" name="spider_name" id="spider_name" value="', $context['spider']['name'], '" class="input_text" /> |
366
|
|
|
</dd> |
367
|
|
|
<dt> |
368
|
|
|
<strong><label for="spider_agent">', $txt['spider_agent'], ':</label></strong><br /> |
369
|
|
|
<span class="smalltext">', $txt['spider_agent_desc'], '</span> |
370
|
|
|
</dt> |
371
|
|
|
<dd> |
372
|
|
|
<input type="text" name="spider_agent" id="spider_agent" value="', $context['spider']['agent'], '" class="input_text" /> |
373
|
|
|
</dd> |
374
|
|
|
<dt> |
375
|
|
|
<strong><label for="spider_ip">', $txt['spider_ip_info'], ':</label></strong><br /> |
376
|
|
|
<span class="smalltext">', $txt['spider_ip_info_desc'], '</span> |
377
|
|
|
</dt> |
378
|
|
|
<dd> |
379
|
|
|
<textarea name="spider_ip" id="spider_ip" rows="4" cols="20">', $context['spider']['ip_info'], '</textarea> |
380
|
|
|
</dd> |
381
|
|
|
</dl> |
382
|
|
|
<hr /> |
383
|
|
|
<input type="submit" name="save" value="', $context['page_title'], '" class="right_submit" /> |
384
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
385
|
|
|
<input type="hidden" name="', $context['admin-ses_token_var'], '" value="', $context['admin-ses_token'], '" /> |
386
|
|
|
</div> |
387
|
|
|
</div> |
388
|
|
|
</form> |
389
|
|
|
</div>'; |
390
|
|
|
} |
391
|
|
|
|
392
|
|
|
/** |
393
|
|
|
* Spider logs page. |
394
|
|
|
*/ |
395
|
|
|
function template_show_spider_logs() |
396
|
|
|
{ |
397
|
|
|
global $context, $txt, $scripturl; |
398
|
|
|
|
399
|
|
|
echo ' |
400
|
|
|
<div id="admincenter">'; |
401
|
|
|
|
402
|
|
|
// Standard fields. |
403
|
|
|
template_show_list('spider_logs'); |
404
|
|
|
|
405
|
|
|
echo ' |
406
|
|
|
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=sengines;sa=logs" method="post" accept-charset="UTF-8"> |
407
|
|
|
<h2 class="category_header">', $txt['spider_logs_delete'], '</h2> |
408
|
|
|
<div class="windowbg"> |
409
|
|
|
<div class="content"> |
410
|
|
|
<p> |
411
|
|
|
<label for="older">', sprintf($txt['spider_stats_delete_older'], '<input type="text" name="older" id="older" value="7" size="3" class="input_text" />'), '</label> |
412
|
|
|
</p> |
413
|
|
|
<input type="submit" name="delete_entries" value="', $txt['spider_logs_delete_submit'], '" onclick="if (document.getElementById(\'older\').value < 1 && !confirm(\'' . addcslashes($txt['spider_logs_delete_confirm'], "'") . '\')) return false; return true;" class="right_submit" /> |
414
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
415
|
|
|
<input type="hidden" name="', $context['admin-sl_token_var'], '" value="', $context['admin-sl_token'], '" /> |
416
|
|
|
</div> |
417
|
|
|
</div> |
418
|
|
|
</form> |
419
|
|
|
</div>'; |
420
|
|
|
} |
421
|
|
|
|
422
|
|
|
/** |
423
|
|
|
* Spider stats section. |
424
|
|
|
*/ |
425
|
|
|
function template_show_spider_stats() |
426
|
|
|
{ |
427
|
|
|
global $context, $txt, $scripturl; |
428
|
|
|
|
429
|
|
|
echo ' |
430
|
|
|
<div id="admincenter">'; |
431
|
|
|
|
432
|
|
|
// Standard fields. |
433
|
|
|
template_show_list('spider_stat_list'); |
434
|
|
|
|
435
|
|
|
echo ' |
436
|
|
|
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=sengines;sa=stats" method="post" accept-charset="UTF-8"> |
437
|
|
|
<h2 class="category_header">', $txt['spider_logs_delete'], '</h2> |
438
|
|
|
<div class="windowbg"> |
439
|
|
|
<div class="content"> |
440
|
|
|
<p> |
441
|
|
|
<label for="older">', sprintf($txt['spider_stats_delete_older'], '<input type="text" name="older" id="older" value="7" size="3" class="input_text" />'), '</label> |
442
|
|
|
</p> |
443
|
|
|
<hr /> |
444
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
445
|
|
|
<input type="hidden" name="', $context['admin-ss_token_var'], '" value="', $context['admin-ss_token'], '" /> |
446
|
|
|
<input type="submit" name="delete_entries" value="', $txt['spider_logs_delete_submit'], '" onclick="if (document.getElementById(\'older\').value < 1 && !confirm(\'' . addcslashes($txt['spider_logs_delete_confirm'], "'") . '\')) return false; return true;" class="right_submit" /> |
447
|
|
|
<br /> |
448
|
|
|
</div> |
449
|
|
|
</div> |
450
|
|
|
</form> |
451
|
|
|
</div>'; |
452
|
|
|
} |
453
|
|
|
|
454
|
|
|
/** |
455
|
|
|
* The settings page for sphinx search |
456
|
|
|
*/ |
457
|
|
|
function template_manage_sphinx() |
458
|
|
|
{ |
459
|
|
|
global $context, $modSettings, $txt, $scripturl; |
460
|
|
|
|
461
|
|
|
echo ' |
462
|
|
|
<div id="admincenter"> |
463
|
|
|
<form id="admin_form_wrapper" action="', $scripturl, '?action=admin;area=managesearch;sa=managesphinx;save=1" method="post" accept-charset="UTF-8" name="create_index"> |
464
|
|
|
<h2 class="category_header">', $context['page_title'], '</h2>'; |
465
|
|
|
|
466
|
|
|
// any results to show? |
467
|
|
|
if (!empty($context['settings_message'])) |
468
|
|
|
{ |
469
|
|
|
echo ' |
470
|
|
|
<div class="', (empty($context['error_type']) ? 'successbox' : ($context['error_type'] !== 'serious' ? 'warningbox' : 'errorbox')), '" id="errors"> |
471
|
|
|
<ul> |
472
|
|
|
<li>', implode('</li><li>', $context['settings_message']), '</li> |
473
|
|
|
</ul> |
474
|
|
|
</div>'; |
475
|
|
|
} |
476
|
|
|
|
477
|
|
|
echo ' |
478
|
|
|
<div class="information"> |
479
|
|
|
', $context['page_description'], ' |
480
|
|
|
</div> |
481
|
|
|
<div class="windowbg"> |
482
|
|
|
<div class="content"> |
483
|
|
|
<dl class="settings"> |
484
|
|
|
<dt> |
485
|
|
|
<label for="sphinx_index_prefix_input"><strong>', $txt['sphinx_index_prefix'], '</strong></label><br /> |
486
|
|
|
<span class="smalltext">', $txt['sphinx_index_prefix_desc'], '</span> |
487
|
|
|
</dt> |
488
|
|
|
<dd> |
489
|
|
|
<input type="text" name="sphinx_index_prefix" id="sphinx_index_prefix_input" value="', isset($modSettings['sphinx_index_prefix']) ? $modSettings['sphinx_data_path'] : 'elkarte', '" size="65" /> |
490
|
|
|
</dd> |
491
|
|
|
<dt> |
492
|
|
|
<label for="sphinx_data_path_input"><strong>', $txt['sphinx_index_data_path'], '</strong></label><br /> |
493
|
|
|
<span class="smalltext">', $txt['sphinx_index_data_path_desc'], '</span> |
494
|
|
|
</dt> |
495
|
|
|
<dd> |
496
|
|
|
<input type="text" name="sphinx_data_path" id="sphinx_data_path_input" value="', isset($modSettings['sphinx_data_path']) ? $modSettings['sphinx_data_path'] : '/var/sphinx/data', '" size="65" /> |
497
|
|
|
</dd> |
498
|
|
|
<dt> |
499
|
|
|
<label for="sphinx_log_path_input"><strong>', $txt['sphinx_log_file_path'], '</strong></label><br /> |
500
|
|
|
<span class="smalltext">', $txt['sphinx_log_file_path_desc'], '</span> |
501
|
|
|
</dt> |
502
|
|
|
<dd> |
503
|
|
|
<input type="text" name="sphinx_log_path" id="sphinx_log_path_input" value="', isset($modSettings['sphinx_log_path']) ? $modSettings['sphinx_log_path'] : '/var/sphinx/log', '" size="65" /> |
504
|
|
|
</dd> |
505
|
|
|
<dt> |
506
|
|
|
<label for="sphinx_stopword_path_input"><strong>', $txt['sphinx_stop_word_path'], '</strong></label><br /> |
507
|
|
|
<span class="smalltext">', $txt['sphinx_stop_word_path_desc'], '</span> |
508
|
|
|
</dt> |
509
|
|
|
<dd> |
510
|
|
|
<input type="text" name="sphinx_stopword_path" id="sphinx_stopword_path_input" value="', isset($modSettings['sphinx_stopword_path']) ? $modSettings['sphinx_stopword_path'] : '', '" size="65" /> |
511
|
|
|
</dd> |
512
|
|
|
<dt> |
513
|
|
|
<label for="sphinx_indexer_mem_input"><strong>', $txt['sphinx_memory_limit'], '</strong></label><br /> |
514
|
|
|
<span class="smalltext">', $txt['sphinx_memory_limit_desc'], '</span> |
515
|
|
|
</dt> |
516
|
|
|
<dd> |
517
|
|
|
<input type="text" name="sphinx_indexer_mem" id="sphinx_indexer_mem_input" value="', isset($modSettings['sphinx_indexer_mem']) ? $modSettings['sphinx_indexer_mem'] : '128', '" size="4" /> MB |
518
|
|
|
</dd> |
519
|
|
|
<dt> |
520
|
|
|
<label for="sphinx_searchd_server_input"><strong>', $txt['sphinx_searchd_server'], '</strong></label><br /> |
521
|
|
|
<span class="smalltext">', $txt['sphinx_searchd_server_desc'], '</span> |
522
|
|
|
</dt> |
523
|
|
|
<dd> |
524
|
|
|
<input type="text" name="sphinx_searchd_server" id="sphinx_searchd_server_input" value="', isset($modSettings['sphinx_searchd_server']) ? $modSettings['sphinx_searchd_server'] : 'localhost', '" size="65" /> |
525
|
|
|
</dd> |
526
|
|
|
<dt> |
527
|
|
|
<label for="sphinx_searchd_port_input"><strong>', $txt['sphinx_searchd_port'], '</strong></label><br /> |
528
|
|
|
<span class="smalltext">', $txt['sphinx_searchd_port_desc'], '</span> |
529
|
|
|
</dt> |
530
|
|
|
<dd> |
531
|
|
|
<input type="text" name="sphinx_searchd_port" id="sphinx_searchd_port_input" value="', isset($modSettings['sphinx_searchd_port']) ? $modSettings['sphinx_searchd_port'] : '9312', '" size="4" /> |
532
|
|
|
</dd> |
533
|
|
|
<dt> |
534
|
|
|
<label for="sphinxql_searchd_port_input"><strong>', $txt['sphinx_searchd_qlport'], '</strong></label><br /> |
535
|
|
|
<span class="smalltext">', $txt['sphinx_searchd_qlport_desc'], '</span> |
536
|
|
|
</dt> |
537
|
|
|
<dd> |
538
|
|
|
<input type="text" name="sphinxql_searchd_port" id="sphinxql_searchd_port_input" value="', isset($modSettings['sphinxql_searchd_port']) ? $modSettings['sphinxql_searchd_port'] : '9306', '" size="4" /> |
539
|
|
|
</dd> |
540
|
|
|
<dt> |
541
|
|
|
<label for="sphinx_max_results_input"><strong>', $txt['sphinx_max_matches'], '</strong></label><br /> |
542
|
|
|
<span class="smalltext">', $txt['sphinx_max_matches_desc'], '</span> |
543
|
|
|
</dt> |
544
|
|
|
<dd> |
545
|
|
|
<input type="text" name="sphinx_max_results" id="sphinx_max_results_input" value="', isset($modSettings['sphinx_max_results']) ? $modSettings['sphinx_max_results'] : '2000', '" size="4" /> |
546
|
|
|
</dd> |
547
|
|
|
</dl> |
548
|
|
|
<div class="submitbutton"> |
549
|
|
|
<input type="submit" class="button_submit" name="createconfig" value="', $txt['sphinx_create_config'], '" /> |
550
|
|
|
<input type="submit" class="button_submit" name="checkconnect" value="', $txt['sphinx_test_connection'], '" /> |
551
|
|
|
<input type="submit" class="button_submit" name="save" value="', $txt['save'], '" /> |
552
|
|
|
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" /> |
553
|
|
|
<input type="hidden" name="', $context['admin-mssphinx_token_var'], '" value="', $context['admin-mssphinx_token'], '" /> |
554
|
|
|
</div> |
555
|
|
|
</div> |
556
|
|
|
</div> |
557
|
|
|
</form> |
558
|
|
|
</div>'; |
559
|
|
|
} |
560
|
|
|
|