-
Notifications
You must be signed in to change notification settings - Fork 1
/
editsettings.inc.php
361 lines (337 loc) · 21.1 KB
/
editsettings.inc.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
<?php
if ($result->isSubmitted()) {
if ($result->isSuccess()) {
$tplHelper->redirect($http_referer);
return ;
} else {
showResults($result, array('renderhtml' => 1));
} # else
} # if
require "includes/header.inc.php";
require "includes/form-messages.inc.php";
$nntp_nzb = $this->_settings->get('nntp_nzb');
$nntp_hdr = $this->_settings->get('nntp_hdr');
$nntp_post = $this->_settings->get('nntp_post');
$tmpArDiff = array_diff_assoc($nntp_hdr, $nntp_nzb);
if ((empty($tmpArDiff)) || (empty($nntp_hdr['host']))) {
$nntp_hdr['isadummy'] = true;
} # if
$tmpArDiff = array_diff_assoc($nntp_post, $nntp_nzb);
if ((empty($tmpArDiff)) || (empty($nntp_post['host']))) {
$nntp_post['isadummy'] = true;
} # if
$retrieve_newer_than = $this->_settings->get('retrieve_newer_than');
if ($retrieve_newer_than < 1254373200) {
$retrieve_newer_than = 1254373200; // 2009-11-01
} # if
echo "<script type='text/javascript'>var retrieveNewerThanDate = '" . strftime('%d-%m-%Y', $retrieve_newer_than) . "';</script>";
?>
<div class="panel panel-primary">
<div class="panel-heading">
<h3 class="panel-title"><?php echo _('Settings'); ?></h3>
</div>
<div class="panel-body">
<form class="editsettingsform" name="editsettingsform" action="<?php echo $tplHelper->makeEditSettingsAction(); ?>" method="post" enctype="multipart/form-data">
<input type="hidden" name="editsettingsform[xsrfid]" value="<?php echo $tplHelper->generateXsrfCookie('editsettingsform'); ?>">
<input type="hidden" name="editsettingsform[http_referer]" value="<?php echo $http_referer; ?>">
<ul class="nav nav-tabs" style="margin-bottom: 15px;">
<?php
if ($tplHelper->allowed(SpotSecurity::spotsec_edit_settings, '')) {
?>
<li class=""><a href="#editsettingstab-1" data-toggle="tab"><?php echo _('General'); ?></a></li>
<li class=""><a href="#editsettingstab-2" data-toggle="tab"><?php echo _('Newsservers'); ?></a></li>
<li class=""><a href="#editsettingstab-3" data-toggle="tab"><?php echo _('Retrieve'); ?></a></li>
<li class=""><a href="#editsettingstab-4" data-toggle="tab"><?php echo _('Performance'); ?></a></li>
<li class=""><a href="#editsettingstab-5" data-toggle="tab"><?php echo _("Custom CSS"); ?></a></li>
<?php
}
?>
</ul>
<div id="myTabContent" class="tab-content">
<?php if ($tplHelper->allowed(SpotSecurity::spotsec_edit_settings, '')) { ?>
<div id="editsettingstab-1" class="tab-pane fade active in">
<fieldset>
<dl>
<div class="well well-sm">
<dt><label for="editsettingsform[deny_robots]"><?php echo _('Try to prevent robots from indexing this installation'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[deny_robots]" <?php if ($this->_settings->get('deny_robots')) { echo 'checked="checked"'; } ?>></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[systemfrommail]"><?php echo _('Sender email address'); ?></label></dt>
<dd><input type="text" name="editsettingsform[systemfrommail]" value="<?php echo htmlspecialchars($this->_settings->get('systemfrommail'), ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[sendwelcomemail]"><?php echo _('Always send welcome e-mail to new users'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[sendwelcomemail]" <?php if ($this->_settings->get('sendwelcomemail')) { echo 'checked="checked"'; } ?>></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[cookie_expires]"><?php echo _('Cookie expires after (in days)'); ?></label></dt>
<dd><input type="text" name="editsettingsform[cookie_expires]" value="<?php echo htmlspecialchars($this->_settings->get('cookie_expires'), ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<!-- Add some explanation about the MS translator API -->
<p>
<?php echo _('Spotweb can use the Microsoft Translator API to translate comments and Spot description to the users native language. This requires a so-called Client ID and a SecretID which you need to <a href="http://blogs.msdn.com/b/translation/p/gettingstarted1.aspx">request at Microsoft</a>. Please enter the values in below fields.'); ?>
</p>
<dt><label for="editsettingsform[ms_translator_clientid]"><?php echo _('Microsoft Translator API - Client ID'); ?></label></dt>
<dd><input type="text" name="editsettingsform[ms_translator_clientid]" value="<?php echo htmlspecialchars($this->_settings->get('ms_translator_clientid'), ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[ms_translator_clientsecret]"><?php echo _('Microsoft Translator API - Secret ID'); ?></label></dt>
<dd><input type="text" name="editsettingsform[ms_translator_clientsecret]" value="<?php echo htmlspecialchars($this->_settings->get('ms_translator_clientsecret'), ENT_QUOTES); ?>"></dd>
</div>
</dl>
</fieldset>
</div>
<div id="editsettingstab-2" class="tab-pane fade">
<div class="well well-sm">
<fieldset>
<dt><label for="use_nntp_hdr"><?php echo _('Default newsserver'); ?></label></dt>
</fieldset>
<fieldset class="serverSettings">
<dl>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_nzb][host]"><?php echo _('Hostname'); ?></label></dt>
<dd><input type="text" name="editsettingsform[nntp_nzb][host]" value="<?php echo htmlspecialchars($nntp_nzb['host'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_nzb][user]"><?php echo _('Username'); ?></label></dt>
<dd><input type="text" name="editsettingsform[nntp_nzb][user]" value="<?php echo htmlspecialchars($nntp_nzb['user'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_nzb][pass]"><?php echo _('Password'); ?></label></dt>
<dd><input type="password" name="editsettingsform[nntp_nzb][pass]" value="<?php echo htmlspecialchars($nntp_nzb['pass'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="use_encryption_nzb"><?php echo _('Encryption'); ?></label></dt>
<dd><input type="checkbox" class="enabler" name="editsettingsform[nntp_nzb][enc][switch]" id="use_encryption_nzb" <?php if ($nntp_nzb['enc']) { echo 'checked="checked"'; } ?>></dd>
</div>
<fieldset id="content_use_encryption_nzb">
<div class="well well-sm">
<select name="editsettingsform[nntp_nzb][enc][select]">
<option <?php if ($nntp_nzb['enc'] == 'ssl') { echo 'selected="selected"'; } ?> value="ssl">SSL</option>
<option <?php if ($nntp_nzb['enc'] == 'tls') { echo 'selected="selected"'; } ?> value="tls">TLS</option>
</select>
</div>
</fieldset>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_nzb][port]"><?php echo _('Port'); ?></label></dt>
<dd><input type="text" name="editsettingsform[nntp_nzb][port]" value="<?php echo htmlspecialchars($nntp_nzb['port'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_nzb][buggy]"><?php echo _('Buggy (Some newsservers lose messages once in a while)'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[nntp_nzb][buggy]" <?php if ($nntp_nzb['buggy']) { echo 'checked="checked"'; } ?>></dd>
</div>
</dl>
</fieldset>
</div>
<div class="well well-sm">
<fieldset>
<dt><label for="use_nntp_hdr"><?php echo _('Use different server for headers?'); ?></label></dt>
<dd><input type="checkbox" class="enabler" name="editsettingsform[nntp_hdr][use]" id="use_nntp_hdr" <?php if (!isset($nntp_hdr['isadummy'])) { echo 'checked="checked"'; } ?>></dd>
</fieldset>
<fieldset id="content_use_nntp_hdr" class="serverSettings">
<dl>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_hdr][host]"><?php echo _('Hostname'); ?></label></dt>
<dd><input type="text" name="editsettingsform[nntp_hdr][host]" value="<?php echo htmlspecialchars($nntp_hdr['host'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_hdr][user]"><?php echo _('Username'); ?></label></dt>
<dd><input type="text" name="editsettingsform[nntp_hdr][user]" value="<?php echo htmlspecialchars($nntp_hdr['user'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_hdr][pass]"><?php echo _('Password'); ?></label></dt>
<dd><input type="password" name="editsettingsform[nntp_hdr][pass]" value="<?php echo htmlspecialchars($nntp_hdr['pass'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="use_encryption_hdr"><?php echo _('Encryption'); ?></label></dt>
<dd><input type="checkbox" class="enabler" name="editsettingsform[nntp_hdr][enc][switch]" id="use_encryption_hdr" <?php if ($nntp_hdr['enc']) { echo 'checked="checked"'; } ?>></dd>
</div>
<fieldset id="content_use_encryption_hdr">
<div class="well well-sm">
<select name="editsettingsform[nntp_hdr][enc][select]">
<option <?php if ($nntp_hdr['enc'] == 'ssl') { echo 'selected="selected"'; } ?> value="ssl">SSL</option>
<option <?php if ($nntp_hdr['enc'] == 'tls') { echo 'selected="selected"'; } ?> value="tls">TLS</option>
</select>
</div>
</fieldset>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_hdr][port]"><?php echo _('Port'); ?></label></dt>
<dd><input type="text" name="editsettingsform[nntp_hdr][port]" value="<?php echo htmlspecialchars($nntp_hdr['port'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_hdr][buggy]"><?php echo _('Buggy (Some newsservers lose messages once in a while)'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[nntp_hdr][buggy]" <?php if ($nntp_hdr['buggy']) { echo 'checked="checked"'; } ?>></dd>
</div>
</dl>
</fieldset>
</div>
<div class="well well-sm">
<fieldset>
<dt><label for="use_nntp_post"><?php echo _('Use different server for posting?'); ?></label></dt>
<dd><input type="checkbox" class="enabler" name="editsettingsform[nntp_post][use]" id="use_nntp_post" <?php if (!isset($nntp_post['isadummy'])) { echo 'checked="checked"'; } ?>></dd>
</fieldset>
<fieldset id="content_use_nntp_post" class="serverSettings">
<dl>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_post][host]"><?php echo _('Hostname'); ?></label></dt>
<dd><input type="text" name="editsettingsform[nntp_post][host]" value="<?php echo htmlspecialchars($nntp_post['host'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_post][user]"><?php echo _('Username'); ?></label></dt>
<dd><input type="text" name="editsettingsform[nntp_post][user]" value="<?php echo htmlspecialchars($nntp_post['user'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_post][pass]"><?php echo _('Password'); ?></label></dt>
<dd><input type="password" name="editsettingsform[nntp_post][pass]" value="<?php echo htmlspecialchars($nntp_post['pass'], ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="use_encryption_post"><?php echo _('Encryption'); ?></label></dt>
<dd><input type="checkbox" class="enabler" name="editsettingsform[nntp_post][enc][switch]" id="use_encryption_post" <?php if ($nntp_post['enc']) { echo 'checked="checked"'; } ?>></dd>
</div>
<fieldset id="content_use_encryption_post">
<div class="well well-sm">
<select name="editsettingsform[nntp_post][enc][select]">
<option <?php if ($nntp_post['enc'] == 'ssl') { echo 'selected="selected"'; } ?> value="ssl">SSL</option>
<option <?php if ($nntp_post['enc'] == 'tls') { echo 'selected="selected"'; } ?> value="tls">TLS</option>
</select>
</div>
</fieldset>
<div class="well well-sm">
<dt><label for="editsettingsform[nntp_post][port]"><?php echo _('Port'); ?></label></dt>
<dd><input type="text" name="editsettingsform[nntp_post][port]" value="<?php echo htmlspecialchars($nntp_post['port'], ENT_QUOTES); ?>"></dd>
</div>
<input type="hidden" name="editsettingsform[nntp_post][buggy]" value="">
</dl>
</fieldset>
</div>
</div>
<div id="editsettingstab-3" class="tab-pane fade">
<fieldset>
<dl>
<div class="well well-sm">
<dt><label for="editsettingsform[retention]"><?php echo _('Retention on spots (in days). Older spots will be erased. Select 0 to keep all spots.'); ?></label></dt>
<dd><input type="text" name="editsettingsform[retention]" value="<?php echo htmlspecialchars($this->_settings->get('retention'), ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[retentiontype]"><?php echo _('Retention is for either everything or only the cached data'); ?></label></dt>
<select name="editsettingsform[retentiontype]">
<option <?php if ($this->_settings->get('retentiontype') == 'everything') { echo 'selected="selected"'; } ?> value="everything"><?php echo _('Remove everything'); ?></option>
<option <?php if ($this->_settings->get('retentiontype') == 'fullonly') { echo 'selected="selected"'; } ?> value="fullonly"><?php echo _('Only extra data but keep spots'); ?></option>
</select>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[retrieve_newer_than]"><?php echo _('Retrieve spots after... Select November 1, 2009 to fetch all spots'); ?><br /><?php echo _('To skip all FTD spots select November 24, 2010'); ?></label></dt>
<dd>
<div class="input-append date datepicker" id="dp3">
<div class="input-group">
<input class="form-control" type="text" value="12-02-2012" data-provide="datepicker" id="retrieve_newer_than" name="editsettingsform[retrieve_newer_than]">
</div>
</div>
</dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[retrieve_full]"><?php echo _('Retrieve full spots'); ?></label></dt>
<dd><input type="checkbox" class="enabler" name="editsettingsform[retrieve_full]" id="use_retrieve_full" <?php if ($this->_settings->get('retrieve_full')) { echo 'checked="checked"'; } ?>></dd>
<fieldset id="content_use_retrieve_full">
<div class="well well-sm">
<dt><label for="editsettingsform[prefetch_image]"><?php echo _('Prefetch images'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[prefetch_image]" <?php if ($this->_settings->get('prefetch_image')) { echo 'checked="checked"'; } ?>></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[prefetch_nzb]"><?php echo _('Prefetch NZB files'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[prefetch_nzb]" <?php if ($this->_settings->get('prefetch_nzb')) { echo 'checked="checked"'; } ?>></dd>
</div>
</fieldset>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[retrieve_comments]"><?php echo _('Retrieve comments'); ?></label></dt>
<dd><input type="checkbox" class="enabler" name="editsettingsform[retrieve_comments]" id="use_retrieve_comments" <?php if ($this->_settings->get('retrieve_comments')) { echo 'checked="checked"'; } ?>></dd>
</div>
<div class="well well-sm">
<fieldset id="content_use_retrieve_comments">
<dt><label for="editsettingsform[retrieve_full_comments]"><?php echo _('Retrieve full comments'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[retrieve_full_comments]" <?php if ($this->_settings->get('retrieve_full_comments')) { echo 'checked="checked"'; } ?>></dd>
</fieldset>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[retrieve_reports]"><?php echo _('Retrieve reports'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[retrieve_reports]" <?php if ($this->_settings->get('retrieve_reports')) { echo 'checked="checked"'; } ?>></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[create_collections]"><?php echo _('Create collections of multiple spots?'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[create_collections]" <?php if ($this->_settings->get('create_collections')) { echo 'checked="checked"'; } ?>></dd>
</div>
</dl>
</fieldset>
</div>
<div id="editsettingstab-4" class="tab-pane fade">
<fieldset>
<dl>
<div class="well well-sm">
<dt><label for="editsettingsform[enable_timing]"><?php echo _('Enable timing'); ?><br /><?php echo _('Use this only to identify speed problems within Spotweb.'); ?> <?php echo _('Not suitable for public installations'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[enable_timing]" <?php if ($this->_settings->get('enable_timing')) { echo 'checked="checked"'; } ?>></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[enable_stacktrace]"><?php echo _('Enable stacktrace'); ?><br /><?php echo _('Stacktraces make identifying problems easy, but may contain sensitive information.'); ?> <?php echo _('Not suitable for public installations'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[enable_stacktrace]" <?php if ($this->_settings->get('enable_stacktrace')) { echo 'checked="checked"'; } ?>></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[retrieve_increment]"><?php echo _('Retrieve increment'); ?><br /><?php echo _('Lower this if you get timeouts during retrieve'); ?></label></dt>
<dd><input type="text" name="editsettingsform[retrieve_increment]" value="<?php echo htmlspecialchars($this->_settings->get('retrieve_increment'), ENT_QUOTES); ?>"></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[spot_moderation]"><?php echo _('Handling of moderation messages'); ?></label></dt>
<dd><select name="editsettingsform[spot_moderation]">
<option <?php if ($this->_settings->get('spot_moderation') == 'disable') { echo 'selected="selected"'; } ?> value="disable"><?php echo _('Do nothing'); ?></option>
<option <?php if ($this->_settings->get('spot_moderation') == 'act') { echo 'selected="selected"'; } ?> value="act"><?php echo _('Delete moderated spots'); ?></option>
<option <?php if ($this->_settings->get('spot_moderation') == 'markspot') { echo 'selected="selected"'; } ?> value="markspot"><?php echo _('Mark moderated spots as moderated'); ?></option>
</select></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[prepare_statistics]"><?php echo _('Prepare statistics during retrieve'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[prepare_statistics]" <?php if ($this->_settings->get('prepare_statistics')) { echo 'checked="checked"'; } ?>></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[external_blacklist]"><?php echo _('Fetch the external blacklist during retrieve'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[external_blacklist]" <?php if ($this->_settings->get('external_blacklist')) { echo 'checked="checked"'; } ?>></dd>
</div>
<div class="well well-sm">
<dt><label for="editsettingsform[external_whitelist]"><?php echo _('Fetch the external whitelist during retrieve'); ?></label></dt>
<dd><input type="checkbox" name="editsettingsform[external_whitelist]" <?php if ($this->_settings->get('external_whitelist')) { echo 'checked="checked"'; } ?>></dd>
</div>
</dl>
</fieldset>
</div>
<!-- Custom Stylesheet -->
<div id="editsettingstab-5" class="tab-pane fade">
<div class="well well-sm">
<fieldset>
<dt>
<label for="editsettingsform[customcss]"><?php echo _('Use custom CSS?'); ?></label>
</dt>
<dd>
<textarea name="editsettingsform[customcss]" rows="15" cols="100"><?php echo htmlspecialchars($this->_settings->get('customcss')); ?></textarea>
</dd>
</fieldset>
</div>
</div>
<!-- Einde Custom Stylesheet -->
</div>
<?php } ?>
<div class="editSettingsButtons">
<input class="btn btn-primary" type="submit" name="editsettingsform[submitedit]" value="<?php echo _('Change'); ?>">
<input class="btn btn-default" type="submit" name="editsettingsform[submitcancel]" value="<?php echo _('Cancel'); ?>">
<div class="clear"></div>
</div>
</div>
</form>
</div>
</div>
<script>
$("[class='enabler']").bootstrapSwitch();
</script>
<?php
$toRunJsCode = 'initializeSettingsPage();';
require_once "includes/footer.inc.php";