forked from joseconti/WangGuard
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwangguard-conf.php
More file actions
663 lines (638 loc) · 43.1 KB
/
wangguard-conf.php
File metadata and controls
663 lines (638 loc) · 43.1 KB
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
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
<?php
//Configuration page
function wangguard_conf() {
global $wpdb;
global $wangguard_nonce, $wangguard_api_key;
if ( !current_user_can('level_10') )
die(__('Cheatin’ uh?', 'wangguard'));
$key_status = "";
$selectedTab = 0;
if ( isset($_POST['submit']) ) {
check_admin_referer( $wangguard_nonce );
$key = preg_replace( '/[^a-h0-9]/i', '', $_POST['key'] );
if ( empty($key) ) {
$key_status = 'empty';
$ms[] = 'new_key_empty';
update_site_option('wangguard_api_key' , "");
} else {
$key_status = wangguard_verify_key( $key );
}
if ( $key_status == 'valid' ) {
update_site_option('wangguard_api_key', $key);
$ms[] = 'new_key_valid';
} else if ( $key_status == 'invalid' ) {
$ms[] = 'new_key_invalid';
} else if ( $key_status == 'failed' ) {
$ms[] = 'new_key_failed';
}
} elseif ( isset($_POST['saveblockeddomain']) ) {
echo "<div id='wangguard-warning' class='updated fade'><p><strong>".__('Blocked domains has been saved.', 'wangguard')."</strong></p></div>";
$selectedDomains = array();
if (is_array($_POST['domains'])) {
foreach ($_POST['domains'] as $domain) {
$selectedDomains[$domain] = true;
}
}
update_site_option('blocked-list-domains' , $selectedDomains) ;
$selectedTab = 3;
} elseif ( isset($_POST['check']) ) {
wangguard_get_server_connectivity(0);
$selectedTab = 4;
} elseif ( isset($_POST['optssave']) ) {
$wangguardnewallowemailsploggers = $_POST['wangguard_allow_emails_signup_list'];
$wangguardlisttoarrayallowemailsploggers = explode("\n", maybe_serialize(strtolower($wangguardnewallowemailsploggers)));
update_site_option('wangguard-no-use-ssl', @$_POST['wangguardnousessl']=='1' ? 1 : 0 );
update_site_option('wangguard-expertmode', @$_POST['wangguardexpertmode']=='1' ? 1 : 0 );
update_site_option('wangguard-report-posts', @$_POST['wangguardreportposts']=='1' ? 1 : 0 );
update_site_option('wangguard-delete-users-on-report', @$_POST['wangguard-delete-users-on-report']=='1' ? 1 : -1 );
update_site_option('wangguard-enable-bp-report-btn', @$_POST['wangguardenablebpreportbtn']=='1' ? 1 : -1 );
update_site_option('wangguard-enable-bp-report-blog', @$_POST['wangguardenablebpreportblog']=='1' ? 1 : -1 );
update_site_option('wangguard-verify-gmail', @$_POST['wangguard-verify-gmail']=='1' ? 1 : 0 );
update_site_option('wangguard_disable-meta-header', @$_POST['wangguard_disable-meta-header']=='1' ? 1 : 0 );
update_site_option('wangguard-verify-dns-mx', @$_POST['wangguard-verify-dns-mx']=='1' ? 1 : 0 );
update_site_option('wangguard-do-not-check-client-ip', @$_POST['wangguard-do-not-check-client-ip']=='1' ? 1 : 0 );
update_site_option('wangguard-do-not-show-adminbar', @$_POST['wangguard-do-not-show-adminbar']=='1' ? 1 : 0 );
update_site_option('wangguard-add-honeypot', @$_POST['wangguard-add-honeypot']=='1' ? 1 : 0 );
update_site_option('wangguard-moderation-is-active', @$_POST['wangguard-moderation-is-active']=='1' ? 1 : 0 );
update_site_option('wangguard-moderation-type', @$_POST['wangguard-moderation-type']=='all' ? 'all' : 'splog' );
update_site_option('wangguard-sent-email-check', @$_POST['wangguard-sent-email-check']=='1' ? 1 : 0 );
update_site_option('wangguard_allow_signup_emails_list', $wangguardlisttoarrayallowemailsploggers);
do_action('wangguard_save_setting_option');
$selectedTab = 2;
echo "<div id='wangguard-warning' class='updated fade'><p><strong>".__('WangGuard settings has been saved.', 'wangguard')."</strong></p></div>";
}
if ( $key_status != 'valid' ) {
$key = get_site_option('wangguard_api_key');
if ( empty( $key ) ) {
if ( $key_status != 'failed' ) {
if ( wangguard_verify_key( '1234567890ab' ) == 'failed' )
$ms[] = 'no_connection';
else
$ms[] = 'key_empty';
}
$key_status = 'empty';
} else {
$key_status = wangguard_verify_key( $key );
}
if ( $key_status == 'valid' ) {
$ms[] = 'key_valid';
} else if ( $key_status == 'noplan' ) {
$ms[] = 'noplan';
} else if ( $key_status == 'invalid' ) {
delete_option('wangguard_api_key');
$ms[] = 'key_empty';
} else if ( !empty($key) && $key_status == 'failed' ) {
$ms[] = 'key_failed';
}
}
$messages = array(
'new_key_empty' => array('class' => 'wangguard-info', 'text' => __('Your key has been cleared.', 'wangguard')),
'new_key_valid' => array('class' => 'wangguard-info wangguard-success', 'text' => __('Your key has been verified!', 'wangguard')),
'noplan' => array('class' => 'wangguard-info', 'text' => __('Your key has been verified, but your account needs a valid plan to work, check WangGuard Configuration > My account.', 'wangguard')),
'new_key_invalid' => array('class' => 'wangguard-info wangguard-error', 'text' => __('The key you entered is invalid. Please double-check it.', 'wangguard')),
'new_key_failed' => array('class' => 'wangguard-info wangguard-error', 'text' => __('The key you entered could not be verified because a connection to wangguard.com could not be established. Please try to disable secure connection in WangGuard Settings and/or check your server configuration.', 'wangguard')),
'no_connection' => array('class' => 'wangguard-info wangguard-error', 'text' => __('There was a problem connecting to the WangGuard server. Please try to disable secure connection in WangGuard Settings and/or check your server configuration.', 'wangguard')),
'key_empty' => array('class' => 'wangguard-info', 'text' => sprintf(__('Please enter an API key. (<a href="%s" style="color:#fff">Get your key here.</a>)', 'wangguard'), 'http://wangguard.com/getapikey')),
'key_valid' => array('class' => 'wangguard-info wangguard-success', 'text' => __('This key is valid.', 'wangguard')),
'key_failed' => array('class' => 'wangguard-info wangguard-error', 'text' => __('The key below was previously validated but a connection to wangguard.com can not be established at this time. Please check your server configuration. Try to deactivate secure connection to WangGuard API. Go to WangGuard Settings and Disable secure connection to WangGuard server using SSL / TLS. After that Save Options, and save the API Key again.', 'wangguard')));
wp_enqueue_script("jquery-ui-tabs");
wp_print_scripts("jquery-ui-tabs");
?>
<?php if ( !empty($_POST['submit'] ) ) : ?>
<div id="message" class="updated fade"><p><strong><?php _e('Options saved.', 'wangguard') ?></strong></p></div>
<?php endif; ?>
<div class="wrap">
<div class="icon32" id="icon-wangguard"><br></div>
<h2><?php _e('WangGuard Configuration', 'wangguard'); ?></h2>
<div class="">
<div id="wangguard-conf-tabs">
<ul id="wangguard-tabs">
<li><a href="#wangguard-conf-apikeys"><?php _e('WangGuard API Key', 'wangguard'); ?></a></li>
<li><a href="#wangguard-conf-questions"><?php _e('Security questions', 'wangguard'); ?></a></li>
<li><a href="#wangguard-conf-settings"><?php _e('WangGuard settings', 'wangguard'); ?></a></li>
<li><a href="#wangguard-conf-account"><?php _e('My account', 'wangguard'); ?></a></li>
<li><a href="#wangguard-conf-domains"><?php _e('Blocked domains', 'wangguard'); ?></a></li>
<li><a href="#wangguard-conf-conectivity"><?php _e('Server Connectivity', 'wangguard'); ?></a></li>
</ul>
<div id="wangguard-tabs-container">
<!--WANGGUARD API KEY-->
<div id="wangguard-conf-apikeys">
<div class="wangguard-confico"><img src="<?php echo WP_PLUGIN_URL ?>/wangguard/img/apikey.png" alt="<?php echo htmlentities(__('WangGuard API Key', 'wangguard')) ?>" /></div>
<form action="" method="post" id="wangguard-conf" style="margin: auto;">
<p><?php printf(__('For many people, <a href="%1$s">WangGuard</a> will greatly reduce or even completely eliminate the Sploggers you get on your site. If one does happen to get through, simply mark it as Splogger on the Users screen. If you don\'t have an API key yet, <a href="%2$s" target="_new">get one here</a>.', 'wangguard'), 'http://wangguard.com/', 'http://wangguard.com/getapikey'); ?></p>
<h3><label for="key"><?php _e('WangGuard API Key', 'wangguard'); ?></label></h3>
<?php foreach ( $ms as $m ) : ?>
<p class="<?php echo $messages[$m]['class']; ?>"><?php echo $messages[$m]['text']; ?></p>
<?php endforeach; ?>
<p><input id="key" name="key" type="text" size="35" maxlength="32" value="<?php echo get_site_option('wangguard_api_key'); ?>" style="font-family: 'Courier New', Courier, mono; font-size: 1.5em;" /> (<?php _e('<a href="http://wangguard.com/faq" target="_new">What is this?</a>', 'wangguard'); ?>)</p>
<?php if ( $key_status == 'invalid' ) { ?>
<h3><?php _e('Why might my key be invalid?', 'wangguard'); ?></h3>
<p><?php _e('This can mean one of two things, either you copied the key wrong or that the plugin is unable to reach the WangGuard servers, which is most often caused by an issue with your web host around firewalls or similar.', 'wangguard'); ?></p>
<?php } ?>
<?php wangguard_nonce_field($wangguard_nonce) ?>
<p class="submit"><input type="submit" name="submit" class="button-primary" value="<?php _e('Update options »', 'wangguard'); ?>" /></p>
</form>
</div>
<!--WANGGUARD QUESTIONS-->
<div id="wangguard-conf-questions" style="margin: auto;">
<div class="wangguard-confico"><img src="<?php echo WP_PLUGIN_URL ?>/wangguard/img/security.png" alt="<?php echo htmlentities(__('Security questions', 'wangguard')) ?>" /></div>
<h3><?php _e('Security questions', 'wangguard'); ?></h3>
<p><?php _e('Security questions are randomly asked on the registration form to prevent automated signups.', 'wangguard')?></p>
<p><?php _e('Security questions are optional, it\'s up to you whether to use them or not.', 'wangguard')?></p>
<p><?php _e('Create you own security questions from the form below, or delete the questions you don\'t want anymore.', 'wangguard')?></p>
<?php
$table_name = $wpdb->base_prefix . "wangguardquestions";
$wgquestRs = $wpdb->get_results("select * from $table_name order by id");
?>
<h4><?php _e('Existing security questions', 'wangguard')?></h4>
<?php
if (empty ($wgquestRs)) {
?><div id="wangguard-question-noquestion"><?php _e('No security questions created yet','wangguard')?></div><?php
}
foreach ($wgquestRs as $question) {?>
<div class="wangguard-question" id="wangguard-question-<?php echo $question->id?>">
<?php _e("Question", 'wangguard')?>: <strong><?php echo $question->Question?></strong><br/>
<?php _e("Answer", 'wangguard')?>: <strong><?php echo $question->Answer?></strong><br/>
<?php _e("Replied OK / Wrong", 'wangguard')?>: <strong><?php echo $question->RepliedOK?> / <?php echo $question->RepliedWRONG?></strong><br/>
<a href="javascript:void(0)" rel="<?php echo $question->id?>" class="wangguard-delete-question"><?php _e('delete question', 'wangguard')?></a>
</div>
<?php } ?>
<div id="wangguard-new-question-container">
</div>
<h4><?php _e('Add a new security question', 'wangguard')?></h4>
<?php _e("Question", 'wangguard')?><br/><input type="text" name="wangguardnewquestion" id="wangguardnewquestion" class="wangguard-input" maxlength="255" value="" />
<br/><br style="line-height: 5px"/>
<?php _e("Answer", 'wangguard')?><br/><input type="text" name="wangguardnewquestionanswer" id="wangguardnewquestionanswer" class="wangguard-input" maxlength="50" value="" />
<div id="wangguardnewquestionerror">
<?php _e('Fill in both the question and the answer fields to create a new security question', 'wangguard')?>
</div>
<p class="submit"><input type="button" id="wangguardnewquestionbutton" class="button-primary" name="submit" value="<?php _e('Create question »', 'wangguard'); ?>" /></p>
</div>
<!--WANGGUARD SETTINGS-->
<div id="wangguard-conf-settings" style="margin: auto;">
<div class="wangguard-confico"><img src="<?php echo WP_PLUGIN_URL ?>/wangguard/img/settings.png" alt="<?php echo htmlentities(__('WangGuard settings', 'wangguard')) ?>" /></div>
<?php
$wangguard_edit_prefix = "";
if (function_exists( 'is_network_admin' ))
if (is_network_admin())
$wangguard_edit_prefix = "../";
?>
<form action="" method="post" id="wangguard-settings" style="margin:0px auto 0 auto; ">
<h3><?php _e("WangGuard settings", 'wangguard') ?></h3>
<p>
<input type="checkbox" name="wangguardnousessl" id="wangguardnousessl" value="1" <?php echo get_site_option("wangguard-no-use-ssl")=='1' ? 'checked' : ''?> />
<label for="wangguardnousessl"><?php _e( sprintf("<strong>Disable secure connection to WangGuard server using SSL / TLS.</strong><br/>By default since version 1.6 WangGuard use SSL/TLS. If you live in Canada or Europe, you need it. If your server don't allow secure connection, you will need to deactivate it. </a>." , $wangguard_edit_prefix . "edit.php"), 'wangguard') ?></label>
</p>
<p>
<input type="checkbox" name="wangguardreportposts" id="wangguardreportposts" value="1" <?php echo get_site_option("wangguard-report-posts")=='1' ? 'checked' : ''?> />
<label for="wangguardreportposts"><?php _e( sprintf("<strong>Allow reporting users from Posts admin screen.</strong><br/>By checking this option a new link to report a post's author will be added for each post on the <a href=\"%s\">Posts admin screen</a>." , $wangguard_edit_prefix . "edit.php"), 'wangguard') ?></label>
</p>
<p>
<input type="checkbox" name="wangguard-delete-users-on-report" id="wangguard-delete-users-on-report" value="1" <?php echo get_site_option("wangguard-delete-users-on-report")=='1' ? 'checked' : ''?> />
<label for="wangguard-delete-users-on-report"><?php _e("<strong>Delete users when reporting them to WangGuard.</strong><br/>By checking this option, the users you report as Sploggers will be deleted from your site.", 'wangguard') ?></label>
</p>
<p>
<input type="checkbox" name="wangguard-moderation-is-active" id="wangguard-moderation-is-active" value="1" <?php echo get_site_option("wangguard-moderation-is-active")=='1' ? 'checked' : ''?> />
<label for="wangguard-moderation-is-active"><?php _e("<strong>Activate Signup Moderation</strong><br/>By checking this option, Signup Moderation will be active. Select if you want to moderate all signup or only Sploggers detected", 'wangguard') ?></label><br />
<input type="radio" name="wangguard-moderation-type" value="sploggers" <?php echo get_site_option("wangguard-moderation-type")=='splog' ? 'checked' : ''?>/> Moderate Detected Sploggers<br />
<input type="radio" name="wangguard-moderation-type" value="all" <?php echo get_site_option("wangguard-moderation-type")=='all' ? 'checked' : ''?>/> Moderate All Signups<br />
</p>
<p>
<input type="checkbox" name="wangguard-sent-email-check" id="wangguard-sent-email-check" value="1" <?php echo get_site_option("wangguard-sent-email-check")=='1' ? 'checked' : ''?> />
<label for="wangguard-sent-email-check"><?php _e("<strong>Sent WangGuard cronjob report</strong><br/>By checking this option, you will receive a report of WangGuard cronjobs", 'wangguard') ?></label>
</p>
<?php if (defined('BP_VERSION')) { ?>
<p>
<input type="checkbox" name="wangguardenablebpreportbtn" id="wangguardenablebpreportbtn" value="1" <?php echo get_site_option("wangguard-enable-bp-report-btn")=='1' ? 'checked' : ''?> />
<label for="wangguardenablebpreportbtn"><?php _e("<strong>Show the 'report user' button on BuddyPress.</strong><br/>BuddyPress only. By checking this option a link called 'report user' will be shown on each user's activity and profile page.", 'wangguard') ?></label>
</p>
<?php } ?>
<?php if (defined('BP_VERSION') || wangguard_is_multisite()) { ?>
<p>
<input type="checkbox" name="wangguardenablebpreportblog" id="wangguardenablebpreportblog" value="1" <?php echo get_site_option("wangguard-enable-bp-report-blog")=='1' ? 'checked' : ''?> />
<label for="wangguardenablebpreportblog"><?php _e("<strong>Show the 'Report blog and author' menu item in the Admin Bar.</strong><br/>By checking this option a new menu item on the Admin Bar called 'Report blog and author' will be shown on each blog.", 'wangguard') ?></label>
</p>
<?php } ?>
<p>
<input type="checkbox" name="wangguard-do-not-show-adminbar" id="wangguard-do-not-show-adminbar" value="1" <?php echo get_site_option("wangguard-do-not-show-adminbar")=='1' ? 'checked' : ''?> />
<label for="wangguard-do-not-show-adminbar"><?php _e("<strong>Disable</strong> WangGuard menu from WordPress & BuddyPress AdminBar.", 'wangguard') ?></label>
</p>
<p>
<input type="checkbox" name="wangguard-verify-gmail" id="wangguard-verify-gmail" value="1" <?php echo get_site_option("wangguard-verify-gmail")=='1' ? 'checked' : ''?> />
<label for="wangguard-verify-gmail"><?php _e("<strong>Check for duplicated gmail.com and googlemail.com emails on sign up.</strong><br/>Checks that duplicated accounts @gmail.com and @googlemail.com accounts doesn't exists, also takes in count that gMail ignores the dots and what's after a + sign on the left side of the @.", 'wangguard') ?></label>
</p>
<p>
<input type="checkbox" name="wangguard_disable-meta-header" id="wangguard_disable-meta-header" value="1" <?php echo get_site_option("wangguard_disable-meta-header")=='1' ? 'checked' : ''?> />
<label for="wangguard_disable-meta-header"><?php _e("<strong>Remove the generator META tag.</strong><br/>By checking this option, WangGuard will remove the generator META tag from the generated pages of your site, this will prevent automated bots to easilly identify a WordPress site by looking at this META tag.", 'wangguard') ?></label>
</p>
<p>
<input type="checkbox" name="wangguard-add-honeypot" id="wangguard-add-honeypot" value="1" <?php echo get_site_option("wangguard-add-honeypot")=='1' ? 'checked' : ''?> />
<label for="wangguard-add-honeypot"><?php _e("<strong>Enable</strong> honeypot fields (signup trap fields). Some themes has problem with honeypot fields. If you have some problems with those fields, disable this option", 'wangguard') ?></label>
</p>
<?php
//verifies if the getmxrr() function is availabe
$wangguard_mx_ok = function_exists('getmxrr');?>
<p>
<input <?php echo (!$wangguard_mx_ok ? "disabled = 'disabled'" : "") ?> type="checkbox" name="wangguard-verify-dns-mx" id="wangguard-verify-dns-mx" value="1" <?php echo $wangguard_mx_ok && get_site_option("wangguard-verify-dns-mx")=='1' ? 'checked' : ''?> />
<label for="wangguard-verify-dns-mx"><?php _e("<strong>Check email domains agains the DNS server.</strong><br/>Verifies that an associated Mail eXchange (MX) record exists for the email domain, if the verification fails, the sign up process is stopped. Recommeded for WordPress non multisite or BuddyPress installations. Users may notice a small delay of around 1 or 2 seconds on the sign up process due to the DNS verification.", 'wangguard') ?></label>
<?php if (!$wangguard_mx_ok) {
echo "<div>";
_e("<strong>Warning:</strong> PHP function <strong>getmxrr()</strong> is not available on your server. Contact your server admin to enable it in order to activate this feature." , "wangguard");
echo "</div>";
} ?>
</p>
<p>
<input type="checkbox" name="wangguard-do-not-check-client-ip" id="wangguard-do-not-check-client-ip" value="1" <?php echo get_site_option("wangguard-do-not-check-client-ip")=='1' ? 'checked' : ''?> />
<label for="wangguard-do-not-check-client-ip"><?php _e("<strong>Do NOT verify client IP address.</strong><br/>By checking this option, when checking a user, the IP address of the user will not be sent along with the e-mail address to the WangGuard service. Selecting this option reduces WangGuard effectiveness, but if your new accounts come mostly from the same IP, in the case of colleges, universities or other large institutions, this would prevent WangGuard from flagging the IP address as suspicious.", 'wangguard') ?></label>
</p>
<p>
<input type="checkbox" name="wangguardexpertmode" id="wangguardexpertmode" value="1" <?php echo get_site_option("wangguard-expertmode")=='1' ? 'checked' : ''?> />
<label for="wangguardexpertmode"><?php _e("<strong>Ninja mode.</strong><br/>By checking this option no confirmation message will be asked for report operations on the Users manager. Just remember that users gets deleted when reported and the option 'Delete users when reporting them to WangGuard' is selected.", 'wangguard') ?></label>
</p>
<h3>Allow emails to signup</h3>
<p>
<label for="wangguard_allow_emails_signup_list"><?php _e( 'Allowed emails. One per line', 'wangguard-allow-signup-splogger-detected' ) ?></label><br />
<?php $wangguard_allow_emails_signup_list_array = get_site_option( 'wangguard_allow_signup_emails_list' );
$wangguard_allow_emails_signup_list = str_replace( ' ', "\n", $wangguard_allow_emails_signup_list_array ); ?>
<textarea name="wangguard_allow_emails_signup_list" id="wangguard_allow_emails_signup_list" cols="45" rows="5"><?php echo esc_textarea( $wangguard_allow_emails_signup_list == '' ? '' : implode( "\n", (array) $wangguard_allow_emails_signup_list ) ); ?></textarea>
</p>
<p> </p>
<h3><?php _e("Add-ons Settings", 'wangguard') ?></h3>
<?php do_action('wangguard_setting'); ?>
<p class="submit"><input class="button-primary" type="submit" name="optssave" value="<?php _e('Save options »', 'wangguard'); ?>" />
</p>
</form>
</div>
<!--WANGGUARD ACCOUNT-->
<div id="wangguard-conf-account" style="margin: auto;">
<div class="wangguard-confico"><img src="<?php echo WP_PLUGIN_URL ?>/wangguard/img/account.png" alt="<?php echo htmlentities(__('My account', 'wangguard')) ?>" /></div>
<h3><?php _e("My account", 'wangguard') ?></h3>
<?php
$lang = substr(WPLANG, 0,2);
$response_hired = wangguard_http_post("wg=<in><apikey>$wangguard_api_key</apikey><lang>$lang</lang></in>", 'get-plans-hired.php');
$xml_hired = WGG_XML_unserialize($response_hired);
$display_available_plans = true;
$datef = get_option('date_format');
if (!is_array($xml_hired) || !isset($xml_hired['out'])) {
?><p><?php _e("There was an error while pulling contracted plans information from the server.", 'wangguard') ?></p><?php
}
else {
if (!is_array($xml_hired['out'])) $xml_hired['out'] = array('list'=>array());
if (isset($xml_hired['out']['autodate'])) {?>
<div class="error"><p style="font-weight:bold;"><span class="dashicons dashicons-info" style="color: #dd3d36"></span> <?php echo sprintf(__("Your trial plan expires on %s", 'wangguard'), date($datef , strtotime($xml_hired['out']['autodate']))) ?></p></div>
<?php }
if (count($xml_hired['out']['list'])) {
if (!isset($xml_hired['out']['list'][0])) {
$tmp = $xml_hired['out']['list'];
$xml_hired['out']['list'] = array($tmp);
}
$display_available_plans = false;
?>
<h3><?php _e("Your contracted plan", 'wangguard') ?></h3>
<table style="width: 100%;" class="wp-list-table widefat striped">
<thead>
<th><?php _e('Plan', 'wangguard'); ?></th>
<th><?php _e('From', 'wangguard'); ?></th>
<th><?php _e('To', 'wangguard'); ?></th>
<th><?php _e('Queries available resets on', 'wangguard'); ?></th>
<th style="text-align: right;"><?php _e('Queries available', 'wangguard'); ?></th>
<th><?php _e('Usage', 'wangguard'); ?></th>
</thead>
<tbody>
<?php
foreach ($xml_hired['out']['list'] as $plan) {
$used = ($plan['monthlyq'] - $plan['availq']) * 100 / $plan['monthlyq'];
?>
<tr>
<td style="white-space: nowrap; font-weight:bold;"><?php echo $plan['name'] ?></td>
<td style="white-space: nowrap;"><?php echo date($datef , strtotime($plan['datefrom'])) ?></td>
<td style="white-space: nowrap;"><?php echo date($datef , strtotime($plan['dateto'])) ?></td>
<td style="white-space: nowrap;"><?php echo date($datef , strtotime($plan['datereset'])) ?></td>
<td style="white-space: nowrap; text-align: right;"><?php echo number_format($plan['availq'], 0, '' , '.') ?> out of <?php echo number_format($plan['monthlyq'], 0, '' , '.') ?></td>
<td style="white-space: nowrap; min-width: 15%">
<div class="wangguard-minihbar"><div style="width: <?= $used ?>%;"></div></div>
<div style="font-size: 10px; text-align: center;"><?= (int)$used ?>% <?php _e('consumed', 'wangguard'); ?></div>
</td>
</tr>
<?php if (isset($plan['upgrade']) || ($plan['renew'] == 1)) {?>
<tr>
<?php if (isset($plan['upgrade'])) {?>
<td colspan="<?php echo (isset($plan['upgrade']) && ($plan['renew'] == 1)) ? 3 : 6?>" style="text-align: center;">
<h4><?php _e('Need to upgrade?', 'wangguard'); ?></h4>
<?php _e('Click below to upgrade to', 'wangguard'); ?> <strong><?php echo $plan['upgrade']['name'] ?></strong> <?php _e('for', 'wangguard'); ?> <strong><?php echo number_format($plan['upgrade']['cost'], 2, ',' , '.') ?> €</strong>
<?php if ($plan['upgrade']['tax']) {?>+ <?php echo number_format($plan['upgrade']['tax'],2, ',' , '.') ?> € <?php _e('tax', 'wangguard'); ?><?php }?><br/>
<?php echo number_format($plan['upgrade']['monthlyq'], 0, '' , '.') ?> <?php _e('Queries per month', 'wangguard'); ?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="business" value="<?php echo $xml_hired['out']['seller'] ?>">
<input type="hidden" name="amount" value="<?php echo number_format($plan['upgrade']['cost'], 2, '.' , '') ?>">
<input type="hidden" name="tax" value="<?php echo number_format($plan['upgrade']['tax'], 2, '.' , '') ?>">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="custom" value="<?php echo $plan['upgrade']['id'] ?>">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="item_name" value="<?php esc_attr_e($plan['upgrade']['name']) ?>">
<input title="<?php _e('Upgrade to', 'wangguard'); ?> <?php echo esc_html($plan['upgrade']['name']) ?>" type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</td>
<?php } ?>
<?php if ($plan['renew'] == 1) { ?>
<td colspan="<?php echo (isset($plan['upgrade']) && ($plan['renew'] == 1)) ? 3 : 6?>" style="text-align: center;">
<h4><?php _e('Renew your plan', 'wangguard'); ?></h4>
<?php _e('Click below to renew your current plan', 'wangguard'); ?> <?php _e('for', 'wangguard'); ?> <strong><?php echo number_format($plan['renewcost'], 2, ',' , '.') ?> €</strong>
<?php if ($plan['renewtax']) {?>+ <?php echo number_format($plan['renewtax'],2, ',' , '.') ?> € <?php _e('tax', 'wangguard'); ?><?php }?>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="business" value="<?php echo $xml_hired['out']['seller'] ?>">
<input type="hidden" name="amount" value="<?php echo number_format($plan['renewcost'], 2, '.' , '') ?>">
<input type="hidden" name="tax" value="<?php echo number_format($plan['renewtax'], 2, '.' , '') ?>">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="custom" value="<?php echo $plan['renewid'] ?>">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="item_name" value="<?php esc_attr_e($plan['name']) ?>">
<input title="<?php _e('Renew', 'wangguard'); ?> <?php echo esc_html($plan['name']) ?>" type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</td>
<?php } ?>
</tr>
<?php
}
} ?>
</tbody>
</table>
<p class="description"><?php _e('dates are expressed in UTC timezone', 'wangguard'); ?></p>
<?php
}
}
if ($display_available_plans) {?>
<h3 style="margin-top: 30px;"><?php _e("Available plans to buy", 'wangguard') ?></h3>
<?php
$response_avail = wangguard_http_post("wg=<in><apikey>$wangguard_api_key</apikey><lang>$lang</lang></in>", 'get-plans-avail.php');
$xml_avail = WGG_XML_unserialize($response_avail);
if (!is_array($xml_avail) || !isset($xml_avail['out'])) {
?><p><?php _e("There was an error while pulling available plans information from the server.", 'wangguard') ?></p><?php
}
else {
if (!is_array($xml_avail['out'])) $xml_avail['out'] = array('list'=>array());
if (count($xml_avail['out']['list'])) {
if (!isset($xml_avail['out']['list'][0])) {
$tmp = $xml_avail['out']['list'];
$xml_avail['out']['list'] = array($tmp);
}
?>
<p><?php _e('The following are the plans you may contract.', 'wangguard'); ?></p>
<table style="width: 100%;" class="wp-list-table widefat striped">
<thead>
<th><?php _e('Plan', 'wangguard'); ?></th>
<th style="text-align: right;"><?php _e('Cost', 'wangguard'); ?></th>
<th><?php _e('Duration', 'wangguard'); ?></th>
<th style="white-space: nowrap; text-align: right;"><?php _e('Queries per month', 'wangguard'); ?></th>
<th></th>
</thead>
<tbody>
<?php
foreach ($xml_avail['out']['list'] as $plan) {?>
<tr>
<td style="white-space: nowrap; font-weight:bold; color: #23282d ">
<?php echo $plan['name'] ?>
</td>
<td style="white-space: nowrap; text-align: right; font-weight:bold; color: #23282d;">
<?php echo number_format($plan['cost'], 2, ',' , '.') ?> €
<?php if ($plan['tax']) {?>
<span style="font-size: 0.9em; color: #888;"><br/>+ <?php echo number_format($plan['tax'],2, ',' , '.') ?> € <?php _e('tax', 'wangguard'); ?></span>
<?php }?>
</td>
<td style="white-space: nowrap;"><?php echo $plan['months'] ?> <?php _e('mo.', 'wangguard'); ?></td>
<td style="white-space: nowrap; text-align: right;"><?php echo number_format($plan['monthlyq'], 0, '' , '.') ?>/<?php _e('mo.', 'wangguard'); ?></td>
<td style="text-align: center;">
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_xclick">
<input type="hidden" name="currency_code" value="EUR">
<input type="hidden" name="business" value="<?php echo $xml_avail['out']['seller'] ?>">
<input type="hidden" name="amount" value="<?php echo number_format($plan['cost'], 2, '.' , '') ?>">
<input type="hidden" name="tax" value="<?php echo number_format($plan['tax'], 2, '.' , '') ?>">
<input type="hidden" name="quantity" value="1">
<input type="hidden" name="custom" value="<?php echo $plan['id'] ?>">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="item_name" value="<?php esc_attr_e($plan['name']) ?>">
<input title="<?php _e('Buy', 'wangguard'); ?> <?php echo esc_html($plan['name']) ?>" type="image" src="https://www.paypalobjects.com/en_US/i/btn/btn_buynowCC_LG.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form>
</td>
</tr>
<tr>
<td style="border-bottom: 1px solid #e1e1e1 !important;"></td>
<td style="padding-bottom: 40px; border-bottom: 1px solid #e1e1e1 !important;" colspan="4"><?php echo $plan['desc'] ?></td>
</tr>
<?php } ?>
</tbody>
</table>
<?php
}
else {
?><p style="font-style: italic"><?php _e('There are not available plans to contract.', 'wangguard'); ?></p>
<?php }
}
}
?>
</div>
<!--WANGGUARD BLOCKED DOMAINS-->
<div id="wangguard-conf-domains" style="margin: auto;">
<div class="wangguard-confico"><img src="<?php echo WP_PLUGIN_URL ?>/wangguard/img/blocked.png" alt="<?php echo htmlentities(__('Blocked domains', 'wangguard')) ?>" /></div>
<h3><?php _e('Blocked domains', 'wangguard'); ?></h3>
<p><?php _e('Here are different domain lists maintained by WangGuard.', 'wangguard'); ?></p>
<p><?php _e('You should never block all domains contained in these listings or no one can register on your site.', 'wangguard'); ?></p>
<p><?php _e('If a domain is in this list, it is because one or more of its users have used for undesirable activities, but that does not mean they are entirely sploggers.', 'wangguard'); ?></p>
<p><?php _e('These lists are updated automatically each time you enter this screen.', 'wangguard'); ?></p>
<?php
$lang = substr(WPLANG, 0,2);
$response = wangguard_http_post("wg=<in><apikey>$wangguard_api_key</apikey><lang>$lang</lang></in>", 'get-domain-list.php');
$xml = WGG_XML_unserialize($response);
if (!is_array($xml)) {
?><p><?php _e("There was an error while pulling the domains list from WangGuard, please try again later. If the problem persists please contact WangGuard to report it.", 'wangguard') ?></p><?php
}
else {
$selectedDomains = maybe_unserialize( get_site_option('blocked-list-domains') );
if (!is_array($selectedDomains)) $selectedDomains = array();
?>
<form action="" method="post" id="wangguard-blockeddomainsform">
<?php
$first = true;
$lists = $xml['out']['list'];
$domainix = 0;
foreach ($lists as $ix => $list) {
$domainQ = 0;
if (@is_array($list['domains']['domain']))
$domainQ = count($list['domains']['domain']);
elseif (isset($list['domains']['domain']))
$domainQ = 1;
echo "<div class='wangguard-blockeddomain-header' id='wangguard-blockeddomain-header-".$ix."'><a href='javascript:void(0)' rel='".$ix."'>".$list['name']." (<span id='wangguard-domain-count-".$ix."'>0</span> ".sprintf(__('out of %d domains selected', 'wangguard') , $domainQ).")</a></div>";
echo "<div class='wangguard-blockeddomain-domains' id='wangguard-blockeddomain-domains-".$ix."' wgix='".$ix."' ".("style='display:none'").">";
echo "<p>".$list['description']."</p>";
echo "<div class='wangguard-blockeddomain-list'>";
echo '<table class="wp-list-table widefat" cellspacing="0">';
echo '<thead>';
echo '<tr>';
echo '<td colspan="4" class="check-column" style="padding: 4px 7px 2px; font-style:italic; font-weight:bold">';
echo "<input type='checkbox' wgix='".$ix."' id='wangguard-selectall-".$ix."' /> <label for='wangguard-selectall-".$ix."'>" . __('select / unselect all domains', 'wangguard') . "</label><br/>";
echo "</td>";
echo "</tr>";
echo '</thead>';
echo '<tbody>';
if (@is_array($list['domains']['domain'])) {
echo '<tr>';
$colIX = 1;
foreach ($list['domains']['domain'] as $domain) {
$checked = isset( $selectedDomains[$domain] ) ? "checked" : "";
echo '<td class="check-column wangguard-domain" style="padding: 4px 7px 2px;">';
echo "<input wgix='".$ix."' name='domains[]' type='checkbox' value='$domain' $checked id='wangguard-domain-".(++$domainix)."' /> <label for='wangguard-domain-".($domainix)."'>" . $domain . "</label><br/>";
echo "</td>";
if (++$colIX > 4) {
echo '</tr><tr>';
$colIX = 1;
}
}
echo "</tr>";
}
elseif (isset($list['domains']['domain'])) {
$domain = $list['domains']['domain'];
$checked = isset( $selectedDomains[$domain] ) ? "checked" : "";
echo '<tr>';
echo '<td class="check-column wangguard-domain" style="padding: 4px 7px 2px;">';
echo "<input wgix='".$ix."' name='domains[]' type='checkbox' value='$domain' $checked id='wangguard-domain-".(++$domainix)."' /> <label for='wangguard-domain-".($domainix)."'>" . $domain . "</label><br/>";
echo "</td>";
echo "</tr>";
}
echo "</tbody>";
echo "</table>";
echo "</div>";
echo "</div>";
$first = false;
}
?>
<p class="submit"><input class="button-primary" type="submit" name="saveblockeddomain" value="<?php _e('Save blocked domains »', 'wangguard'); ?>" /></p>
</form>
<script type="text/javascript">
function wangguard_update_domain_count(ix) {
var q = jQuery("#wangguard-blockeddomain-domains-"+ix+" td.wangguard-domain input[type=checkbox]:checked").length;
jQuery('#wangguard-domain-count-' + ix).html(q);
}
var wangguardDomainBlockIX = -1;
jQuery(document).ready(function() {
jQuery(".wangguard-blockeddomain-domains input[type=checkbox]").change(function() {
wangguard_update_domain_count(jQuery(this).attr("wgix"));
});
jQuery(".wangguard-blockeddomain-header a").click(function() {
var ix = jQuery(this).attr('rel');
if (wangguardDomainBlockIX == ix) {
jQuery('#wangguard-blockeddomain-domains-'+wangguardDomainBlockIX).slideUp('fast');
wangguardDomainBlockIX = -1;
}
else {
if (wangguardDomainBlockIX != -1)
jQuery('#wangguard-blockeddomain-domains-'+wangguardDomainBlockIX).slideUp('fast');
jQuery('#wangguard-blockeddomain-domains-'+ix).slideDown('fast');
wangguardDomainBlockIX = ix;
}
});
jQuery(".wangguard-blockeddomain-domains").each(function() {
wangguard_update_domain_count(jQuery(this).attr("wgix"));
});
});
</script>
<?php
}
?>
</div>
<!--WANGGUARD BLOCKED DOMAINS-->
<!--WANGGUARD SERVERS-->
<div id="wangguard-conf-conectivity" style="margin: auto;">
<div class="wangguard-confico"><img src="<?php echo WP_PLUGIN_URL ?>/wangguard/img/connectivity.png" alt="<?php echo htmlentities(__('Server Connectivity', 'wangguard')) ?>" /></div>
<form action="" method="post" id="wangguard-connectivity" style="margin:0px auto 0 auto; ">
<h3 style="margin-bottom: 30px;"><?php _e('Server Connectivity', 'wangguard'); ?></h3>
<?php
if ( !function_exists('fsockopen') || !function_exists('gethostbynamel') ) {
?>
<p style="padding: .5em; background-color: #00a000; color: #fff; font-weight:bold;"><?php _e('Network functions are disabled.', 'wangguard'); ?></p>
<p><?php echo sprintf( __('Your web host or server administrator has disabled PHP\'s <code>fsockopen</code> or <code>gethostbynamel</code> functions. <strong>WangGuard cannot work correctly until this is fixed.</strong> Please contact your web host or firewall administrator.', 'wangguard')); ?></p>
<?php
} else {
$servers = wangguard_get_server_connectivity();
$fail_count = count($servers) - count( array_filter($servers) );
if ( is_array($servers) && count($servers) > 0 ) {
// some connections work, some fail
if ( $fail_count > 0 && $fail_count < count($servers) ) { ?>
<p class="wangguard-info wangguard-error"><?php _e('Unable to reach some WangGuard servers.', 'wangguard'); ?></p>
<p><?php echo sprintf( __('A network problem or firewall is blocking some connections from your web server to WangGuard.com. WangGuard is working but this may cause problems during times of network congestion.', 'wangguard')); ?></p>
<?php
// all connections fail
} elseif ( $fail_count > 0 ) { ?>
<p class="wangguard-info wangguard-error"><?php _e('Unable to reach any WangGuard servers.', 'wangguard'); ?></p>
<p><?php echo sprintf( __('A network problem or firewall is blocking all connections from your web server to WangGuard.com. <strong>WangGuard cannot work correctly until this is fixed.</strong> Try to deactivate secure connection to WangGuard API. Go to WangGuard Settings and Disable secure connection to WangGuard server using SSL / TLS. After that Save Options, and save the API Key again.', 'wangguard')); ?></p>
<?php
// all connections work
} else { ?>
<p class="wangguard-info wangguard-success"><?php _e('All WangGuard servers are available.', 'wangguard'); ?></p>
<p><?php _e('WangGuard is working correctly. All servers are accessible.', 'wangguard'); ?></p>
<?php
}
} else {
?>
<p class="wangguard-info wangguard-error"><?php _e('Unable to find WangGuard servers.', 'wangguard'); ?></p>
<p><?php echo sprintf( __('A DNS problem or firewall is preventing all access from your web server to wangguard.com. <strong>WangGuard cannot work correctly until this is fixed.</strong>', 'wangguard')); ?></p>
<?php
}
}
if ( !empty($servers) ) {
?>
<table style="width: 100%;">
<thead>
<th style="border-bottom: 1px solid #999; padding-bottom: 5px; margin-bottom: 5px;"><?php _e('WangGuard server', 'wangguard'); ?></th>
<th style="border-bottom: 1px solid #999; padding-bottom: 5px; margin-bottom: 5px;"><?php _e('Network Status', 'wangguard'); ?></th>
</thead>
<tbody>
<?php
asort($servers);
foreach ( $servers as $ip => $status ) {
$class = ( $status ? 'wangguard-info wangguard-success' : 'wangguard-info wangguard-error');?>
<tr>
<td style="text-align:center; font-weight:bold;"><?php echo htmlspecialchars($ip); ?></td>
<td><p class="<?php echo $class?>"><?php echo ($status ? __('No problems', 'wangguard') : __('Obstructed', 'wangguard') ); ?></p></td>
</tr>
<?php
}?>
</tbody>
</table>
<?php
}
?>
<p><?php if ( get_site_option('wangguard_connectivity_time') ) echo sprintf( __('Last checked %s ago.', 'wangguard'), human_time_diff( get_site_option('wangguard_connectivity_time') ) ); ?></p>
<p class="submit"><input type="submit" name="check" class="button-primary" value="<?php _e('Check network status »', 'wangguard'); ?>" /></p>
</form>
</div>
</div>
</div>
<?php $wpversion = get_bloginfo('version');
if ($wpversion >= '3.6') { ?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#wangguard-conf-tabs').tabs();
jQuery('#wangguard-conf-tabs').tabs("option", "active" , <?php echo $selectedTab?>);
});
</script>
<?php } else { ?>
<script type="text/javascript">
jQuery(document).ready(function() {
jQuery('#wangguard-conf-tabs').tabs();
jQuery('#wangguard-conf-tabs').tabs("select" , <?php echo $selectedTab?>);
});
</script>
<?php } ?>
</div>
</div>
<?php
}
?>