/
index.php
executable file
·1348 lines (1333 loc) · 96.9 KB
/
index.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
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
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
/*
Plugin Name: Anti-Malware and Brute-Force Security by ELI
Plugin URI: http://gotmls.net/
Author: Eli Scheetz
Text Domain: gotmls
Author URI: http://wordpress.ieonly.com/category/my-plugins/anti-malware/
Contributors: scheeeli, gotmls
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=QZHD8QHZ2E7PE
Description: This Anti-Virus/Anti-Malware plugin searches for Malware and other Virus like threats and vulnerabilities on your server and helps you remove them. It's always growing and changing to adapt to new threats so let me know if it's not working for you.
Version: 4.15.24
*/
if (isset($_SERVER["DOCUMENT_ROOT"]) && ($SCRIPT_FILE = str_replace($_SERVER["DOCUMENT_ROOT"], "", isset($_SERVER["SCRIPT_FILENAME"])?$_SERVER["SCRIPT_FILENAME"]:isset($_SERVER["SCRIPT_NAME"])?$_SERVER["SCRIPT_NAME"]:"")) && strlen($SCRIPT_FILE) > strlen("/".basename(__FILE__)) && substr(__FILE__, -1 * strlen($SCRIPT_FILE)) == substr($SCRIPT_FILE, -1 * strlen(__FILE__)))
include(dirname(__FILE__)."/safe-load/index.php");
else
require_once(dirname(__FILE__)."/images/index.php");
/* ___
* / /\ GOTMLS Main Plugin File
* / /:/ @package GOTMLS
* /__/::\
Copyright \__\/\:\__ © 2012-2015 Eli Scheetz (email: eli@gotmls.net)
* \ \:\/\
* \__\::/ This program is free software; you can redistribute it
* ___ /__/:/ and/or modify it under the terms of the GNU General Public
* /__/\ _\__\/ License as published by the Free Software Foundation;
* \ \:\ / /\ either version 2 of the License, or (at your option) any
* ___\ \:\ /:/ later version.
* / /\\ \:\/:/
/ /:/ \ \::/ This program is distributed in the hope that it will be useful,
/ /:/_ \__\/ but WITHOUT ANY WARRANTY; without even the implied warranty
/__/:/ /\__ of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
\ \:\/:/ /\ See the GNU General Public License for more details.
\ \::/ /:/
\ \:\/:/ You should have received a copy of the GNU General Public License
* \ \::/ with this program; if not, write to the Free Software Foundation,
* \__\/ Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */
load_plugin_textdomain('gotmls', false, basename(GOTMLS_plugin_path).'/languages');
require_once(GOTMLS_plugin_path.'images/index.php');
function GOTMLS_install() {
global $wp_version;
if (version_compare($wp_version, GOTMLS_require_version, "<"))
die(GOTMLS_require_version_LANGUAGE);
}
register_activation_hook(__FILE__, "GOTMLS_install");
function GOTMLS_user_can() {
if (is_multisite())
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"] = "manage_network";
elseif (!isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"]) || $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"] == "manage_network")
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"] = "activate_plugins";
if (current_user_can($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"]))
return true;
else
return false;
}
function GOTMLS_menu() {
GOTMLS_user_can();
if (isset($_POST["GOTMLS_menu_group"]) && is_numeric($_POST["GOTMLS_menu_group"])) {
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["menu_group"] = $_POST["GOTMLS_menu_group"];
/* $capabilities = array();
if (current_user_can($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"]))
foreach (get_editable_roles() as $role)
$capabilities = array_merge($capabilities, $role["capabilities"]);
if (isset($_POST["GOTMLS_user_can"]) && in_array($_POST["GOTMLS_user_can"], $capabilities))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"] = $_POST["GOTMLS_user_can"];*/
update_option('GOTMLS_settings_array', $GLOBALS["GOTMLS"]["tmp"]["settings_array"]);
}
$GOTMLS_Full_plugin_logo_URL = GOTMLS_images_path.'GOTMLS-16x16.gif';
$base_page = "GOTMLS-settings";
$base_function = "GOTMLS_settings";
$pluginTitle = "Anti-Malware";
$pageTitle = "$pluginTitle ".GOTMLS_Scan_Settings_LANGUAGE;
if (!function_exists("add_object_page") || $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["menu_group"])
$my_admin_page = add_menu_page($pageTitle, $pluginTitle, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], $base_page, $base_function, $GOTMLS_Full_plugin_logo_URL);
else
$my_admin_page = add_object_page($pageTitle, $pluginTitle, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], $base_page, $base_function, $GOTMLS_Full_plugin_logo_URL);
add_action('load-'.$my_admin_page, 'GOTMLS_admin_add_help_tab');
add_submenu_page($base_page, "$pluginTitle ".GOTMLS_Scan_Settings_LANGUAGE, GOTMLS_Scan_Settings_LANGUAGE, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], $base_page, $base_function);
add_submenu_page($base_page, "$pluginTitle ".GOTMLS_Run_Quick_Scan_LANGUAGE, GOTMLS_Run_Quick_Scan_LANGUAGE, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], "$base_page&scan_type=Quick+Scan", $base_function);
add_submenu_page($base_page, "$pluginTitle ".GOTMLS_View_Quarantine_LANGUAGE, GOTMLS_View_Quarantine_LANGUAGE, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["user_can"], "GOTMLS-View-Quarantine", "GOTMLS_View_Quarantine");
}
function GOTMLS_admin_add_help_tab() {
$screen = get_current_screen();
$screen->add_help_tab(array(
'id' => "GOTMLS_Getting_Started",
'title' => __("Getting Started", 'gotmls'),
'content' => '<p>'.__("Make sure the Definition Updates are current and Run a Complete Scan.").'</p><p>'.sprintf(__("If Known Threats are found and displayed in red then there will be a button to '%s'. If only Potentional Threats are found then there is no automatic fix because those are probably not malicious."), GOTMLS_Automatically_Fix_LANGUAGE).'</p><p>'.__("A backup of the original infected files are placed in the Quarantine in case you need to restore them or just want to look at them later. You can delete these files if you don't want to save more.").'</p>'
));
$FAQMarker = '== Frequently Asked Questions ==';
if (is_file(dirname(__FILE__).'/readme.txt') && ($readme = explode($FAQMarker, @file_get_contents(dirname(__FILE__).'/readme.txt').$FAQMarker)) && strlen($readme[1]) && ($readme = explode("==", $readme[1]."==")) && strlen($readme[0])) {
$screen->add_help_tab(array(
'id' => "GOTMLS_FAQs",
'title' => __("FAQs", 'gotmls'),
'content' => '<p>'.preg_replace('/\[(.+?)\]\((.+?)\)/', "<a target=\"_blank\" href=\"\\2\">\\1</a>", preg_replace('/[\r\n]+= /', "</p><b>", preg_replace('/ =[\r\n]+/', "</b><p>", $readme[0]))).'</p>'
));
}
if (is_multisite() && current_user_can("manage_network"))
$GOTMLS_menu_groups = array(__("Main Menu Item placed at the <b>Top</b>",'gotmls'),__("Main Menu Item placed at the <b>Bottom</b>",'gotmls'));
else
$GOTMLS_menu_groups = array(__("Main Menu Item placed below <b>Comments</b> and above <b>Appearance</b>",'gotmls'),__("Main Menu Item placed below <b>Settings</b>",'gotmls'));
$menu_opts = '<h5>'.__("Menu Item Placement Options",'gotmls').'</h5>';
foreach ($GOTMLS_menu_groups as $mg => $GOTMLS_menu_group)
$menu_opts .= '<div style="padding: 4px;" id="menu_group_div_'.$mg.'"><input type="radio" name="GOTMLS_menu_group" value="'.$mg.'"'.($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["menu_group"]==$mg?' checked':'').' onchange="document.GOTMLS_menu_Form.submit();" />'.$GOTMLS_menu_group.'</div>';
$screen->add_help_tab(array(
'id' => 'GOTMLS_Menu_Placement',
'title' => __("Menu Placement", 'gotmls'),
'content' => '<form method="POST" name="GOTMLS_menu_Form">'.$menu_opts.'</form>'
));
}
function GOTMLS_close_button($box_id, $margin = '6px') {
return '<a href="javascript:void(0);" style="float: right; color: #F00; overflow: hidden; width: 20px; height: 20px; text-decoration: none; margin: '.$margin.'" onclick="showhide(\''.$box_id.'\');"><span class="dashicons dashicons-dismiss"></span>X</a>';
}
function GOTMLS_enqueue_scripts() {
wp_enqueue_style('dashicons');
}
add_action('admin_enqueue_scripts', 'GOTMLS_enqueue_scripts');
function GOTMLS_display_header($optional_box = "") {
global $GOTMLS_onLoad, $wp_version, $current_user;
get_currentuserinfo();
$GOTMLS_url_parts = explode('/', GOTMLS_siteurl);
if (isset($_GET["check_site"]) && $_GET["check_site"] == 1)
echo '<div id="check_site" style="z-index: 1234567;"><img src="'.GOTMLS_images_path.'checked.gif" height=16 width=16 alt="✔"> '.__("Tested your site. It appears we didn't break anything",'gotmls').' ;-)</div><script type="text/javascript">window.parent.document.getElementById("check_site_warning").style.backgroundColor=\'#0C0\';</script><li>Please <a target="_blank" href="https://wordpress.org/plugins/gotmls/stats/?compatibility%5Bversion%5D='.$wp_version.'&compatibility%5Btopic_version%5D='.GOTMLS_Version.'&compatibility%5Bcompatible%5D=1#compatibility-works">Vote "Works"</a> or <a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/gotmls#postform">write a "Five-Star" Reviews</a> on WordPress.org if you like this plugin.</li><style>#footer, #GOTMLS-metabox-container, #GOTMLS-right-sidebar, #admin-page-container, #wpadminbar, #adminmenuback, #adminmenuwrap, #adminmenu, .error, .updated, .update-nag {display: none !important;} #wpbody-content {padding-bottom: 0;} #wpbody, html.wp-toolbar {padding-top: 0 !important;} #wpcontent, #footer {margin-left: 5px !important;}';
else
echo '<style>#GOTMLS-right-sidebar {float: right; margin-right: 0px;}';
$Update_Definitions = GOTMLS_plugin_home.'definitions.js'.$GLOBALS["GOTMLS"]["tmp"]["Definition"]["Updates"].'&js='.GOTMLS_Version.'&p='.strtoupper(GOTMLS_plugin_dir).'&wp='.$wp_version.'&ts='.date("YmdHis").'&key='.GOTMLS_installation_key.'&d='.ur1encode(GOTMLS_siteurl);
$Update_Link = '<div style="text-align: center;"><a href="';
$new_version = "";
$file = basename(GOTMLS_plugin_path).'/index.php';
$current = get_site_transient("update_plugins");
if (isset($current->response[$file]->new_version)) {
$new_version = sprintf(__("Upgrade to %s now!",'gotmls'), $current->response[$file]->new_version).'<br /><br />';
$Update_Link .= wp_nonce_url(self_admin_url('update.php?action=upgrade-plugin&plugin=').$file, 'upgrade-plugin_'.$file);
}
$Update_Link .= "\">$new_version</a></div>";
$Update_Div ='<div id="findUpdates" style="display: none;"><center>'.__("Searching for updates ...",'gotmls').'<br /><img src="'.GOTMLS_images_path.'wait.gif" height=16 width=16 alt="Wait..." /><br /><input type="button" value="Cancel" onclick="cancelserver(\'findUpdates\');" /></center></div>';
echo '
span.GOTMLS_date {float: right; width: 120px; white-space: nowrap;}
.rounded-corners {margin: 10px; border-radius: 10px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border: 1px solid #000;}
.shadowed-box {box-shadow: -3px 3px 3px #666; -moz-box-shadow: -3px 3px 3px #666; -webkit-box-shadow: -3px 3px 3px #666;}
.sidebar-box {background-color: #CCC;}
.GOTMLS-scanlog li a {display: none;}
.GOTMLS-scanlog li:hover a {display: block;}
.GOTMLS-sidebar-links {list-style: none;}
.GOTMLS-sidebar-links li img {margin: 3px; height: 16px; vertical-align: middle;}
.GOTMLS-sidebar-links li {margin-bottom: 0 !important;}
.popup-box {background-color: #FFC; display: none; position: absolute; left: 0px; z-index: 10;}
.shadowed-text {text-shadow: #00F -1px 1px 1px;}
.sub-option {float: left; margin: 3px 5px;}
.inside p {margin: 10px;}
.GOTMLS_li, .GOTMLS_plugin li {list-style: none;}
.GOTMLS_plugin {margin: 5px; background: #cfc; border: 1px solid #0f0; padding: 0 5px; border-radius: 3px;}
.GOTMLS_plugin.known, .GOTMLS_plugin.backdoor, .GOTMLS_plugin.htaccess, .GOTMLS_plugin.timthumb, .GOTMLS_plugin.errors {background: #f99; border: 1px solid #f00;}
.GOTMLS_plugin.potential, .GOTMLS_plugin.wp_core, .GOTMLS_plugin.skipdirs, .GOTMLS_plugin.skipped {background: #ffc; border: 1px solid #fc6;}
.GOTMLS ul li {margin-left: 20px;}
.GOTMLS h2 {margin: 0 0 10px;}
.postbox {margin-right: 10px;}
#pastDonations li {list-style: none;}
#quarantine_buttons {position: absolute; right: 0px; top: -54px; margin: 0px; padding: 0px;}
#quarantine_buttons input.button-primary {margin-right: 20px;}
#delete_button {
background-color: #C33;
color: #FFF;
background-image: linear-gradient(to bottom, #C22, #933);
border-color: #933 #933 #900;
box-shadow: 0 1px 0 rgba(230, 120, 120, 0.5) inset;
text-decoration: none; text-shadow: 0 1px 0 rgba(0, 0, 0, 0.1);
margin-top: 10px;
}
#main-page-title {
background: url("'.$GLOBALS["GOTMLS"]["tmp"]["protocol"].'//gravatar.com/avatar/5feb789dd3a292d563fea3b885f786d6?s=64") no-repeat scroll 0 0 transparent;
height: 64px;
line-height: 58px;
margin: 10px 0 0 0;
max-width: 600px;
padding: 0 110px 0 84px;
}
#main-page-title h1 {
background: url("'.$GLOBALS["GOTMLS"]["tmp"]["protocol"].'//gravatar.com/avatar/8151cac22b3fc543d099241fd573d176?s=64") no-repeat scroll top right transparent;
height: 64px;
line-height: 32px;
margin: 0;
padding: 0 84px 0 0;
display: table-cell;
text-align: center;
vertical-align: middle;
}
</style>
<div id="div_file" class="shadowed-box rounded-corners sidebar-box" style="padding: 0; display: none; position: fixed; top: '.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][1].'; left: '.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][0].'; width: '.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][3].'; height: '.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][2].'; border: solid #c00; z-index: 112358;"><table style="width: 100%; height: 100%;" cellspacing="0" cellpadding="0"><tr><td style="border-bottom: 1px solid #EEE; height: 32px;" colspan="2">'.GOTMLS_close_button("div_file").'<h3 onmousedown="grabDiv();" onmouseup="releaseDiv();" id="windowTitle" style="cursor: move; border-bottom: 0px none; z-index: 2345677; position: absolute; left: 0px; top: 0px; margin: 0px; padding: 6px; width: 90%; height: 20px;">'.GOTMLS_Loading_LANGUAGE.'</h3></td></tr><tr><td colspan="2" style="height: 100%"><div style="width: 100%; height: 100%; position: relative; padding: 0; margin: 0;" class="inside"><br /><br /><center><img src="'.GOTMLS_images_path.'wait.gif" height=16 width=16 alt="..."> '.GOTMLS_Loading_LANGUAGE.'<br /><br /><input type="button" onclick="showhide(\'GOTMLS_iFrame\', true);" value="'.__("If this is taking too long, click here.",'gotmls').'" class="button-primary" /></center><iframe id="GOTMLS_iFrame" name="GOTMLS_iFrame" style="top: 0px; left: 0px; position: absolute; width: 100%; height: 100%; background-color: #CCC;"></iframe></td></tr><tr><td style="height: 20px;"><iframe id="GOTMLS_statusFrame" name="GOTMLS_statusFrame" style="width: 100%; height: 20px; background-color: #CCC;"></iframe></div></td><td style="height: 20px; width: 20px;"><h3 id="cornerGrab" onmousedown="grabCorner();" onmouseup="releaseCorner();" style="cursor: move; height: 24px; width: 24px; margin: 0; padding: 0; z-index: 2345678; overflow: hidden; position: absolute; right: 0px; bottom: 0px;"><span class="dashicons dashicons-editor-expand"></span>⇲</h3></td></tr></table></div>
<script type="text/javascript">
function showhide(id) {
divx = document.getElementById(id);
if (divx) {
if (divx.style.display == "none" || arguments[1]) {
divx.style.display = "block";
divx.parentNode.className = (divx.parentNode.className+"close").replace(/close/gi,"");
return true;
} else {
divx.style.display = "none";
return false;
}
}
}
function checkAllFiles(check) {
var checkboxes = new Array();
checkboxes = document["GOTMLS_Form_clean"].getElementsByTagName("input");
for (var i=0; i<checkboxes.length; i++)
if (checkboxes[i].type == "checkbox")
checkboxes[i].checked = check;
}
function setvalAllFiles(val) {
var checkboxes = document.getElementById("GOTMLS_fixing");
if (checkboxes)
checkboxes.value = val;
}
function getWindowWidth(min) {
if (typeof window.innerWidth != "undefined" && window.innerWidth > min)
min = window.innerWidth;
else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientWidth != "undefined" && document.documentElement.clientWidth > min)
min = document.documentElement.clientWidth;
else if (typeof document.getElementsByTagName("body")[0].clientWidth != "undefined" && document.getElementsByTagName("body")[0].clientWidth > min)
min = document.getElementsByTagName("body")[0].clientWidth;
return min;
}
function getWindowHeight(min) {
if (typeof window.innerHeight != "undefined" && window.innerHeight > min)
min = window.innerHeight;
else if (typeof document.documentElement != "undefined" && typeof document.documentElement.clientHeight != "undefined" && document.documentElement.clientHeight > min)
min = document.documentElement.clientHeight;
else if (typeof document.getElementsByTagName("body")[0].clientHeight != "undefined" && document.getElementsByTagName("body")[0].clientHeight > min)
min = document.getElementsByTagName("body")[0].clientHeight;
return min;
}
function loadIframe(title) {
showhide("GOTMLS_iFrame", true);
showhide("GOTMLS_iFrame");
document.getElementById("windowTitle").innerHTML = title;
if (curDiv) {
windowW = getWindowWidth(200);
windowH = getWindowHeight(200);
if (windowW > 200)
windowW -= 30;
if (windowH > 200)
windowH -= 20;
if (px2num(curDiv.style.width) > windowW) {
curDiv.style.width = windowW + "px";
curDiv.style.left = "0px";
} else if ((px2num(curDiv.style.left) + px2num(curDiv.style.width)) > windowW) {
curDiv.style.left = (windowW - px2num(curDiv.style.width)) + "px";
}
if (px2num(curDiv.style.height) > windowH) {
curDiv.style.height = windowH + "px";
curDiv.style.top = "0px";
} else if ((px2num(curDiv.style.top) + px2num(curDiv.style.height)) > windowH) {
curDiv.style.top = (windowH - px2num(curDiv.style.height)) + "px";
}
if (px2num(curDiv.style.left) < 0)
curDiv.style.left = "0px";
if (px2num(curDiv.style.top)< 0)
curDiv.style.top = "0px";
}
showhide("div_file", true);
if (IE)
curDiv.scrollIntoView(true);
}
function cancelserver(divid) {
document.getElementById(divid).innerHTML = "<div class=\'error\'>'. __("No response from server!",'gotmls').'</div>";
}
function checkupdateserver(server, divid) {
var updatescript = document.createElement("script");
updatescript.setAttribute("src", server);
divx = document.getElementById(divid);
if (divx) {
divx.appendChild(updatescript);
if (arguments[2])
return setTimeout("stopCheckingDefinitions = checkupdateserver(\'"+arguments[2]+"\',\'"+divid+"\')",15000);
else
return setTimeout("cancelserver(\'"+divid+"\')",'.($GLOBALS["GOTMLS"]["tmp"]['execution_time']+1).'000+3000);
}
}
var IE = document.all?true:false;
if (!IE) document.captureEvents(Event.MOUSEMOVE)
document.onmousemove = getMouseXY;
var offsetX = 0;
var offsetY = 0;
var offsetW = 0;
var offsetH = 0;
var curX = 0;
var curY = 0;
var curDiv;
function getMouseXY(e) {
if (IE) { // grab the mouse pos if browser is IE
curX = event.clientX + document.body.scrollLeft;
curY = event.clientY + document.body.scrollTop;
} else { // grab the mouse pos if browser is Not IE
curX = e.pageX - document.body.scrollLeft;
curY = e.pageY - document.body.scrollTop;
}
if (curX < 0) {curX = 0;}
if (curY < 0) {curY = 0;}
if (offsetX && curX > 10) {curDiv.style.left = (curX - offsetX)+"px";}
if (offsetY && (curY - offsetY) > 0) {curDiv.style.top = (curY - offsetY)+"px";}
if (offsetW && (curX - offsetW) > 360) {curDiv.style.width = (curX - offsetW)+"px";}
if (offsetH && (curY - offsetH) > 200) {curDiv.style.height = (curY - offsetH)+"px";}
return true;
}
function px2num(px) {
return parseInt(px.substring(0, px.length - 2), 10);
}
function setDiv(DivID) {
if (curDiv = document.getElementById(DivID)) {
if (IE)
curDiv.style.position = "absolute";
curDiv.style.left = "'.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][0].'";
curDiv.style.top = "'.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][1].'";
curDiv.style.height = "'.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][2].'";
curDiv.style.width = "'.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["msg_position"][3].'";
}
}
function grabDiv() {
corner = document.getElementById("windowTitle");
if (corner) {
corner.style.width="100%";
corner.style.height="100%";
}
offsetX=curX-px2num(curDiv.style.left);
offsetY=curY-px2num(curDiv.style.top);
}
function releaseDiv() {
corner = document.getElementById("windowTitle");
if (corner) {
corner.style.width="90%";
corner.style.height="20px";
}
document.getElementById("GOTMLS_statusFrame").src = "'.GOTMLS_script_URI.'&GOTMLS_x="+curDiv.style.left+"&GOTMLS_y="+curDiv.style.top;
offsetX=0;
offsetY=0;
}
function grabCorner() {
corner = document.getElementById("cornerGrab");
if (corner) {
corner.style.width="100%";
corner.style.height="100%";
}
offsetW=curX-px2num(curDiv.style.width);
offsetH=curY-px2num(curDiv.style.height);
}
function releaseCorner() {
corner = document.getElementById("cornerGrab");
if (corner) {
corner.style.width="20px";
corner.style.height="20px";
}
document.getElementById("GOTMLS_statusFrame").src = "'.GOTMLS_script_URI.'&GOTMLS_w="+curDiv.style.width+"&GOTMLS_h="+curDiv.style.height;
offsetW=0;
offsetH=0;
}
setDiv("div_file");
</script>
<div id="main-page-title"><h1 style="vertical-align: middle;">Anti-Malware from GOTMLS.NET</h1></div>
<div id="admin-page-container">
<div id="GOTMLS-right-sidebar" style="width: 300px;" class="metabox-holder">
'.GOTMLS_box(__("Updates & Registration",'gotmls'), '<ul style=""><li>WordPress: <span class="GOTMLS_date">'.$wp_version.'</span></li>
<li>Plugin: <span class="GOTMLS_date">'.GOTMLS_Version.'</span></li>
<li>Definitions: <span class="GOTMLS_date">'.$GLOBALS["GOTMLS"]["tmp"]["Definition"]["Latest"].'</span></li>
<li>Key: <span style="float: right;">'.GOTMLS_installation_key.'</span></li></ul>
<form id="updateform" method="post" name="updateform" action="'.GOTMLS_script_URI.'">
<img style="display: none; float: right; margin-right: 14px;" src="'.GOTMLS_images_path.'checked.gif" height=16 width=16 alt="definitions file updated" id="autoUpdateDownload" onclick="showhide(\'autoUpdateForm\', true);">
'.str_replace('findUpdates', 'Definition_Updates', $Update_Div).'
<div id="autoUpdateForm" style="display: none;">
<input type="submit" style="width: 100%;" name="auto_update" value="'.__("Download new definitions!",'gotmls').'">
</div>
</form>
<div id="registerKeyForm" style="display: none;"><span style="color: #F00">'.__("<p>Get instant access to definition updates.</p>",'gotmls').'</span><input type="button" style="width: 100%;" value="'.__("Check for Definition Updates Now!",'gotmls').'" onclick="check_for_updates(\'Definition_Updates\');" /><p>
'.__("If you have not already registered your Key then register now using the form below.<br />* All registration fields are required<br />** I will NOT share your information.",'gotmls').'</p>
<form id="registerform" onsubmit="return sinupFormValidate(this);" action="'.GOTMLS_plugin_home.'wp-login.php?action=register" method="post" name="registerform" target="GOTMLS_iFrame"><input type="hidden" name="redirect_to" id="register_redirect_to" value="/donate/"><input type="hidden" name="user_login" id="register_user_login" value="">
<div>'.__("Your Full Name:",'gotmls').'</div>
<div style="float: left; width: 50%;"><input style="width: 100%;" id="first_name" type="text" name="first_name" value="'.$current_user->user_firstname.'" /></div>
<div style="float: left; width: 50%;"><input style="width: 100%;" id="last_name" type="text" name="last_name" value="'.$current_user->user_lastname.'" /></div>
<div style="clear: left; width: 100%;">
<div>'.__("A password will be e-mailed to this address:",'gotmls').'</div>
<input style="width: 100%;" id="user_email" type="text" name="user_email" value="'.$current_user->user_email.'" /></div>
<div>
<div>'.__("Your WordPress Site URL:",'gotmls').'</div>
<input style="width: 100%;" id="user_url" type="text" name="user_url" value="'.GOTMLS_siteurl.'" readonly /></div>
<div>
<div>'.__("Plugin Installation Key:",'gotmls').'</div>
<input style="width: 100%;" id="installation_key" type="text" name="installation_key" value="'.GOTMLS_installation_key.'" readonly /><input id="old_key" type="hidden" name="old_key" value="'.md5($GOTMLS_url_parts[2]).'" /></div>
<input style="width: 100%;" id="wp-submit" type="submit" name="wp-submit" value="Register Now!" /></form></div>'.$Update_Link, "stuffbox").'
<script type="text/javascript">
function check_for_updates(update_type) {
showhide(update_type, true);
stopCheckingDefinitions = checkupdateserver("'.$Update_Definitions.'", update_type, "'.str_replace("://", "://www.", $Update_Definitions).'");
}
function updates_complete(chk) {
if (auto_img = document.getElementById("autoUpdateDownload")) {
auto_img.style.display="block";
check_for_donation(chk);
}
}
function check_for_registration() {
if ('.preg_replace('/[^0-9]/', "", GOTMLS_sexagesimal($GLOBALS["GOTMLS"]["tmp"]["Definition"]["Latest"])).'0 > '.preg_replace('/[^0-9]/', "", GOTMLS_sexagesimal($GLOBALS["GOTMLS"]["tmp"]["Definition"]["Default"])).'0)
return true;
else
return false;
}
function check_for_donation(chk) {
if (document.getElementById("autoUpdateDownload").src.replace(/^.+\?/,"")=="0")
if (chk.substr(0, 8) != "Changed " || chk.substr(8, 1) != "0")
chk += "\\n\\n'.__("Please make a donation for the use of this wonderful feature!",'gotmls').'";
alert(chk);
}
function sinupFormValidate(form) {
var error = "";
if(form["first_name"].value == "")
error += "'.__("First Name is a required field!",'gotmls').'\n";
if(form["last_name"].value == "")
error += "'.__("Last Name is a required field!",'gotmls').'\n";
if(form["user_email"].value == "")
error += "'.__("Email Address is a required field!",'gotmls').'\n";
else {
if (uem = document.getElementById("register_user_login"))
uem.value = form["user_email"].value;
if (uem = document.getElementById("register_redirect_to"))
uem.value = "/donate/?email="+form["user_email"].value.replace("@", "%40");
}
if(form["user_url"].value == "")
error += "'.__("Your WordPress Site URL is a required field!",'gotmls').'\n";
if(form["installation_key"].value == "")
error += "'.__("Plugin Installation Key is a required field!",'gotmls').'\n";
if(error != "") {
alert(error);
return false;
} else {
document.getElementById("Definition_Updates").innerHTML = \'<img src="'.GOTMLS_images_path.'wait.gif">'.__("Submitting Registration ...",'gotmls').'\';
showhide("Definition_Updates", true);
setTimeout(\'stopCheckingDefinitions = checkupdateserver("'.$Update_Definitions.'", "Definition_Updates")\', 3000);
showhide("registerKeyForm");
return true;
}
}
var divNAtext = false;
function loadGOTMLS() {
clearTimeout(divNAtext);
setDivNAtext();
'.$GOTMLS_onLoad.'
}
if (check_for_registration())
check_for_updates("Definition_Updates");
else
showhide("registerKeyForm", true);
if (divNAtext)
loadGOTMLS();
else
divNAtext=true;
</script>
'.GOTMLS_box(__("Resources & Links",'gotmls'), '
<div id="pastDonations"></div>
<form name="ppdform" id="ppdform" action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_blank">
<input type="hidden" name="cmd" value="_donations">
<input type="hidden" name="business" value="eli@gotmls.net">
<input type="hidden" name="no_shipping" value="1">
<input type="hidden" name="no_note" value="1">
<input type="hidden" name="currency_code" value="USD">
<input type="hidden" name="tax" value="0">
<input type="hidden" name="lc" value="US">
<input type="hidden" name="bn" value="PP-DonationsBF">
<input type="radio" name="amount" value="14.89">$14+
<input type="radio" id="default_level_donation" name="amount" value="29.29" checked>$29+
<input type="radio" id="higher_level_donation" name="amount" value="52.00">$52
<input type="radio" name="amount" value="86.00">$86
<input type="radio" name="amount" value="133.70">$133.7
<input type="hidden" name="item_name" value="Donation to Eli\'s Anti-Malware Plugin">
<input type="hidden" name="item_number" value="GOTMLS-key-'.GOTMLS_installation_key.'">
<input type="hidden" name="custom" value="key-'.GOTMLS_installation_key.'">
<input type="hidden" name="notify_url" value="'.GOTMLS_plugin_home.GOTMLS_installation_key.'/ipn">
<input type="hidden" name="page_style" value="GOTMLS">
<input type="hidden" name="return" value="'.GOTMLS_plugin_home.'donate/?donation-source=paid">
<input type="hidden" name="cancel_return" value="'.GOTMLS_plugin_home.'donate/?donation-source=cancel">
<input type="image" id="pp_button" src="'.GOTMLS_images_path.'btn_donateCC_WIDE.gif" border="0" name="submitc" alt="'.__("Make a Donation with PayPal",'gotmls').'">
<div>
<ul class="GOTMLS-sidebar-links">
<li style="float: right;"><b>on <a target="_blank" href="https://profiles.wordpress.org/scheeeli#content-plugins">WordPress.org</a></b><ul class="GOTMLS-sidebar-links">
<li><a target="_blank" href="https://wordpress.org/plugins/'.GOTMLS_plugin_dir.'/faq/">Plugin FAQs</a></li>
<li><a target="_blank" href="https://wordpress.org/support/plugin/'.GOTMLS_plugin_dir.'">Forum Posts</a></li>
<li><a target="_blank" href="https://wordpress.org/support/view/plugin-reviews/'.GOTMLS_plugin_dir.'">Plugin Reviews</a></li>
</ul></li>
<li><img src="//gravatar.com/avatar/5feb789dd3a292d563fea3b885f786d6?s=16" border="0" alt="Plugin site:"><b><a target="_blank" href="'.GOTMLS_plugin_home.'">GOTMLS.NET</a></b></li>
<li><img src="//gravatar.com/avatar/8151cac22b3fc543d099241fd573d176?s=16" border="0" alt="Developer site:"><b><a target="_blank" href="'.GOTMLS_blog_home.'/category/my-plugins/anti-malware/">Eli\'s Blog</a></b></li>
<li><img src="https://ssl.gstatic.com/ui/v1/icons/mail/favicon.ico" border="0" alt="mail:"><b><a target="_blank" href="mailto:eli@gotmls.net">Email Eli</a></b></li>
<li><iframe allowtransparency="true" frameborder="0" scrolling="no" src="https://platform.twitter.com/widgets/follow_button.html?screen_name=GOTMLS&show_count=false" style="width:125px; height:20px;"></iframe></li>
</ul>
</div>
</form>
<a target="_blank" href="http://safebrowsing.clients.google.com/safebrowsing/diagnostic?site='.urlencode(GOTMLS_siteurl).'">Google Safe Browsing Diagnostic</a>', "stuffbox").'
'.GOTMLS_box(__("Last Scan Status",'gotmls'), GOTMLS_scan_log(), "stuffbox").'
'.$optional_box.'
</div>';
if (isset($GLOBALS["GOTMLS"]["tmp"]["stuffbox"]) && is_array($GLOBALS["GOTMLS"]["tmp"]["stuffbox"])) {
echo '
<script type="text/javascript">
function stuffbox_showhide(id) {
divx = document.getElementById(id);
if (divx) {
if (divx.style.display == "none" || arguments[1]) {';
$else = '
if (divx = document.getElementById("GOTMLS-right-sidebar"))
divx.style.width = "30px";
if (divx = document.getElementById("GOTMLS-main-section"))
divx.style.marginRight = "30px";';
foreach ($GLOBALS["GOTMLS"]["tmp"]["stuffbox"] as $md5 => $bTitle) {
echo "\nif (divx = document.getElementById('inside_$md5'))\n\tdivx.style.display = 'block';\nif (divx = document.getElementById('title_$md5'))\n\tdivx.innerHTML = '".GOTMLS_strip4java($bTitle)."';";
$else .= "\nif (divx = document.getElementById('inside_$md5'))\n\tdivx.style.display = 'none';\nif (divx = document.getElementById('title_$md5'))\n\tdivx.innerHTML = '".substr($bTitle, 0, 1)."';";
}
echo '
if (divx = document.getElementById("GOTMLS-right-sidebar"))
divx.style.width = "300px";
if (divx = document.getElementById("GOTMLS-main-section"))
divx.style.marginRight = "300px";
return true;
} else {'.$else.'
return false;
}
}
}
if (getWindowWidth(780) == 780)
setTimeout("stuffbox_showhide(\'inside_'.$md5.'\')", 200);
</script>';
}
echo '
<div id="GOTMLS-main-section" style="margin-right: 300px;">
<div class="metabox-holder GOTMLS" style="width: 100%;" id="GOTMLS-metabox-container">';
}
function GOTMLS_box($bTitle, $bContents, $bType = "postbox") {
$md5 = md5($bTitle);
if (isset($GLOBALS["GOTMLS"]["tmp"]["$bType"]) && is_array($GLOBALS["GOTMLS"]["tmp"]["$bType"]))
$GLOBALS["GOTMLS"]["tmp"]["$bType"]["$md5"] = "$bTitle";
else
$GLOBALS["GOTMLS"]["tmp"]["$bType"] = array("$md5"=>"$bTitle");
return '
<div id="box_'.$md5.'" class="'.$bType.'"><h3 title="Click to toggle" onclick="if (typeof '.$bType.'_showhide == \'function\'){'.$bType.'_showhide(\'inside_'.$md5.'\');}else{showhide(\'inside_'.$md5.'\');}" style="cursor: pointer;" class="hndle"><span id="title_'.$md5.'">'.$bTitle.'</span></h3>
<div id="inside_'.$md5.'" class="inside">
'.$bContents.'
</div>
</div>';
}
function GOTMLS_get_scanlog() {
global $wpdb;
$LastScan = '';
if (isset($_GET["GOTMLS_cl"])) {
$SQL = $wpdb->prepare("DELETE FROM `$wpdb->options` WHERE option_name LIKE %s AND substring_index(option_name, '/', -1) < %s", 'GOTMLS_scan_log/%', $_GET["GOTMLS_cl"]);
if ($cleared = $wpdb->query($SQL))
$LastScan .= sprintf(__("Cleared %s records from this log.",'gotmls'), $cleared);
// else $LastScan .= $wpdb->last_error."<li>$SQL</li>";
}
$SQL = "SELECT substring_index(option_name, '/', -1) AS `mt`, option_name, option_value FROM `$wpdb->options` WHERE option_name LIKE 'GOTMLS_scan_log/%' ORDER BY mt DESC";
if ($rs = $wpdb->get_results($SQL, ARRAY_A)) {
$units = array("seconds"=>60,"minutes"=>60,"hours"=>24,"days"=>365,"years"=>10);
$LastScan .= '<ul class="GOTMLS-scanlog GOTMLS-sidebar-links">';
foreach ($rs as $row) {
$LastScan .= "\n<li>";
$GOTMLS_scan_log = (isset($row["option_name"])?get_option($row["option_name"], array()):array());
if (isset($GOTMLS_scan_log["scan"]["type"]) && strlen($GOTMLS_scan_log["scan"]["type"]))
$LastScan .= htmlentities($GOTMLS_scan_log["scan"]["type"]);
else
$LastScan .= "Unknown scan type";
if (isset($GOTMLS_scan_log["scan"]["dir"]) && is_dir($GOTMLS_scan_log["scan"]["dir"]))
$LastScan .= " of ".basename($GOTMLS_scan_log["scan"]["dir"]);
if (isset($GOTMLS_scan_log["scan"]["start"]) && is_numeric($GOTMLS_scan_log["scan"]["start"])) {
$time = (time() - $GOTMLS_scan_log["scan"]["start"]);
$ukeys = array_keys($units);
for ($unit = $ukeys[0], $key=0; (isset($units[$ukeys[$key]]) && $key < (count($ukeys) - 1) && $time >= $units[$ukeys[$key]]); $unit = $ukeys[++$key])
$time = floor($time/$units[$ukeys[$key]]);
if (1 == $time)
$unit = substr($unit, 0, -1);
$LastScan .= " started $time $unit ago";
if (isset($GOTMLS_scan_log["scan"]["finish"]) && is_numeric($GOTMLS_scan_log["scan"]["finish"]) && ($GOTMLS_scan_log["scan"]["finish"] >= $GOTMLS_scan_log["scan"]["start"])) {
$time = ($GOTMLS_scan_log["scan"]["finish"] - $GOTMLS_scan_log["scan"]["start"]);
for ($unit = $ukeys[0], $key=0; (isset($units[$ukeys[$key]]) && $key < (count($ukeys) - 1) && $time >= $units[$ukeys[$key]]); $unit = $ukeys[++$key])
$time = floor($time/$units[$ukeys[$key]]);
if (1 == $time)
$unit = substr($unit, 0, -1);
$LastScan .= " and ran for $time $unit";
} else
$LastScan .= " and has not finish";
} else
$LastScan .= " failed to started";
$LastScan .= '<a href="'.GOTMLS_script_URI.'&GOTMLS_cl='.$row["mt"].'">[clear log below this entry]</a></li>';
}
$LastScan .= '</ul>';
} else
$LastScan .= '<h3>'.__("No Scans have been logged",'gotmls').'</h3>';
return "$LastScan\n";
}
function GOTMLS_get_whitelists() {
$Q_Page = '';
if (isset($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]["whitelist"]) && is_array($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]["whitelist"])) {
$Q_Page .= '<ul name="found_Quarantine" id="found_Quarantine" class="GOTMLS_plugin known" style="background-color: #ccc; padding: 0;"><h3>'.__("Globally White-listed files",'gotmls').'<span class="GOTMLS_date">'.__("# of patterns",'gotmls').'</span><span class="GOTMLS_date">'.__("Date Updated",'gotmls').'</span></h3>';
foreach ($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]["whitelist"] as $file => $non_threats) {
if (isset($non_threats[0])) {
$updated = GOTMLS_sexagesimal($non_threats[0]);
unset($non_threats[0]);
} else
$updated = "Unknown";
$Q_Page .= '<li style="margin: 4px 12px;"><span class="GOTMLS_date">'.count($non_threats).'</span><span class="GOTMLS_date">'.$updated."</span>$file</li>\n";
//if (is_array($non_threats) && count($non_threats)) $Q_Page .= print_r($non_threats, 1);
}
if (isset($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]["wp_core"]) && is_array($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]["wp_core"])) {
$Q_Page .= '<h3>'.__("WordPress Core files",'gotmls').'<span class="GOTMLS_date">'.__("# of files",'gotmls').'</span></h3>';
foreach ($GLOBALS["GOTMLS"]["tmp"]["definitions_array"]["wp_core"] as $ver => $files) {
$Q_Page .= '<li style="margin: 4px 12px;"><span class="GOTMLS_date">'.count($files)."</span>Version $ver</li>\n";
//if (is_array($non_threats) && count($non_threats)) $Q_Page .= print_r($non_threats, 1);
}
}
$Q_Page .= "</ul>";
}
return "$Q_Page\n";
}
function GOTMLS_get_quarantine() {
$entries = GOTMLS_getfiles($GLOBALS["GOTMLS"]["tmp"]["quarantine_dir"]);
$Q_Page = '
<form method="POST" target="GOTMLS_iFrame" name="GOTMLS_Form_clean"><input type="hidden" id="GOTMLS_fixing" name="GOTMLS_fixing" value="1">';
if (is_array($entries) && ($key = array_search(".htaccess", $entries)))
unset($entries[$key]);
if (is_array($entries) && ($key = array_search("index.php", $entries)))
unset($entries[$key]);
if (is_array($entries) && count($entries)) {
$Q_Page .= '<p id="quarantine_buttons" style="display: none;"><input id="repair_button" type="submit" value="'.__("Restore selected files",'gotmls').'" class="button-primary" onclick="if (confirm(\''.__("Are you sure you want to overwrite the previously cleaned files with the selected files in the Quarantine?",'gotmls').'\')) { setvalAllFiles(1); loadIframe(\'File Restoration Results\'); } else return false;" /><input id="delete_button" type="submit" class="button-primary" value="'.__("Delete selected files",'gotmls').'" onclick="if (confirm(\''.__("Are you sure you want to permanently delete the selected files in the Quarantine?",'gotmls').'\')) { setvalAllFiles(2); loadIframe(\'File Deletion Results\'); } else return false;" /></p><p><b>'.__("The following items have been found to contain malicious code, they have been cleaned, and the original infected file contents have been saved here in the Quarantine. The code is safe here and you do not need to do anything further with these files.",'gotmls').'</b></p><p>'.sprintf(__("FYI - these files are found in: %s",'gotmls'), ' '.$GLOBALS["GOTMLS"]["tmp"]["quarantine_dir"]).'</p>
<ul name="found_Quarantine" id="found_Quarantine" class="GOTMLS_plugin known" style="background-color: #ccc; padding: 0;"><h3>'.(count($entries)>1?'<input type="checkbox" onchange="checkAllFiles(this.checked); document.getElementById(\'quarantine_buttons\').style.display = \'block\';"> '.sprintf(__("Check all %d",'gotmls'),count($entries)):"").__(" Items in Quarantine",'gotmls').'<span class="GOTMLS_date">Date Quarantined</span><span class="GOTMLS_date">Date Infected</span></h3>';
sort($entries);
$root_path = implode(GOTMLS_slash(), array_slice(GOTMLS_explode_dir(__file__), 0, (2 + intval($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_level"])) * -1));
foreach ($entries as $entry) {
$file = GOTMLS_trailingslashit($GLOBALS["GOTMLS"]["tmp"]["quarantine_dir"]).$entry;
$filetime = date("Y-m-d H:i", filemtime($file));
$Q_Page .= '
<li style="margin: 4px 12px;"><span class="GOTMLS_date">'.$filetime.'</span>';
$infectime = 'Unknown';
if (is_file($file) && GOTMLS_get_ext($entry) == "gotmls") {
$file_date = explode(".", $entry);
if (count($file_date) > 2 && strlen($file_date[0]) == 5 && ($filetime != GOTMLS_sexagesimal($file_date[0])))
$infectime = GOTMLS_sexagesimal($file_date[0]);
elseif (count($file_date) > 3 && strlen($file_date[1]) == 5 && ($filetime != GOTMLS_sexagesimal($file_date[1])))
$infectime = GOTMLS_sexagesimal($file_date[1]);
elseif (@rename($file, GOTMLS_trailingslashit($GLOBALS["GOTMLS"]["tmp"]["quarantine_dir"]).GOTMLS_sexagesimal($filetime).".$entry"))
$file = GOTMLS_trailingslashit($GLOBALS["GOTMLS"]["tmp"]["quarantine_dir"]).GOTMLS_sexagesimal($filetime).".$entry";
$Q_Page .= '<span class="GOTMLS_date">'.$infectime.'</span><input type="checkbox" name="GOTMLS_fix[]" value="'.GOTMLS_encode($file).'" id="check_'.GOTMLS_encode($file).'" onchange="document.getElementById(\'quarantine_buttons\').style.display = \'block\';" /><img src="'.GOTMLS_images_path.'blocked.gif" height=16 width=16 alt="Q">'.preg_replace('/9000px;\">(.+?)<\/div>/', '9000px;">\1'.GOTMLS_strip4java(GOTMLS_decode($file_date[count($file_date)-2])).' (Quarantined)</div>', GOTMLS_error_link(__("View Quarantined File",'gotmls'), $file)).str_replace($root_path, "...", GOTMLS_decode($file_date[count($file_date)-2]));
} else
$Q_Page .= '<img src="'.GOTMLS_images_path.'threat.gif" height=16 width=16 alt="?">'.GOTMLS_error_link(__("Foreign File in Quarantine",'gotmls'), $file).$entry;
$Q_Page .= "</a></li>\n";
}
$Q_Page .= "\n</ul>";
} else
$Q_Page .= '<h3>'.__("No Items in Quarantine",'gotmls').'</h3>';
return "$Q_Page\n</form>\n";
}
function GOTMLS_View_Quarantine() {
GOTMLS_display_header();
echo GOTMLS_box($Q_Page = __("White-lists",'gotmls'), GOTMLS_get_whitelists());
if (!isset($_GET['Whitelists']))
echo "\n<script>\nshowhide('inside_".md5($Q_Page)."');\n</script>\n";
echo GOTMLS_box($Q_Page = __("Quarantine",'gotmls'), GOTMLS_get_quarantine());
if (isset($_GET['Scanlog']))
echo "\n<script>\nshowhide('inside_".md5($Q_Page)."');\n</script>\n";
echo GOTMLS_box(__("Scan Logs",'gotmls'), GOTMLS_get_scanlog());
echo "\n</div></div></div>";
}
function GOTMLS_settings() {
global $current_user, $wp_version, $GOTMLS_scanfiles, $GOTMLS_skip_dirs, $GOTMLS_dirs_at_depth, $GOTMLS_dir_at_depth;
$GOTMLS_scan_groups = array();
$gt = ">";
$lt = "<";
$dirs = GOTMLS_explode_dir(__file__);
for ($SL=0;$SL<intval($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_level"]);$SL++)
$GOTMLS_scan_groups[] = $lt.'b'.$gt.implode(GOTMLS_slash(), array_slice($dirs, -1 * (3 + $SL), 1)).$lt.'/b'.$gt;
if (isset($_POST["check"]))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check"] = $_POST["check"];
if (isset($_POST["exclude_ext"])) {
if (strlen(trim(str_replace(",","",$_POST["exclude_ext"]).' ')) > 0)
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_ext"] = preg_split('/[\s]*([,]+[\s]*)+/', trim(str_replace('.', ',', htmlentities($_POST["exclude_ext"]))), -1, PREG_SPLIT_NO_EMPTY);
else
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_ext"] = array();
}
$default_exclude_ext = str_replace(",gotmls", "", implode(",", $GLOBALS["GOTMLS"]["tmp"]["skip_ext"]));
$GLOBALS["GOTMLS"]["tmp"]["skip_ext"] = $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_ext"];
if (isset($_POST["UPDATE_definitions_checkbox"])) {
if (isset($_POST[$_POST["UPDATE_definitions_checkbox"]]) && $_POST[$_POST["UPDATE_definitions_checkbox"]] == 1)
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["auto_UPDATE_definitions"] = 1;
else
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["auto_UPDATE_definitions"] = "";
}
if (isset($_POST["exclude_dir"])) {
if (strlen(trim(str_replace(",","",$_POST["exclude_dir"]).' ')) > 0)
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_dir"] = preg_split('/[\s]*([,]+[\s]*)+/', trim(htmlentities($_POST["exclude_dir"])), -1, PREG_SPLIT_NO_EMPTY);
else
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_dir"] = array();
for ($d=0; $d<count($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_dir"]); $d++)
if (dirname($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_dir"][$d]) != ".")
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_dir"][$d] = str_replace("\\", "", str_replace("/", "", str_replace(dirname($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_dir"][$d]), "", $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_dir"][$d])));
}
$GOTMLS_skip_dirs = array_merge($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_dir"], $GOTMLS_skip_dirs);
if (isset($_POST["scan_what"]) && is_numeric($_POST["scan_what"]) && $_POST["scan_what"] != $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_what"])
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_what"] = $_POST["scan_what"];
if (isset($_POST["check_custom"]) && $_POST["check_custom"] != $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check_custom"])
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check_custom"] = stripslashes($_POST["check_custom"]);
if (isset($_POST["scan_depth"]) && is_numeric($_POST["scan_depth"]) && $_POST["scan_depth"] != $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_depth"])
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_depth"] = $_POST["scan_depth"];
if (isset($_POST['check_htaccess']) && is_numeric($_POST['check_htaccess']) && $_POST['check_htaccess'] != $GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_htaccess'])
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_htaccess'] = $_POST['check_htaccess'];
if (isset($_POST['check_timthumb']) && is_numeric($_POST['check_timthumb']) && $_POST['check_timthumb'] != $GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_timthumb'])
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_timthumb'] = $_POST['check_timthumb'];
if (isset($_POST['check_wp_core']) && is_numeric($_POST['check_wp_core']) && $_POST['check_wp_core'] != $GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_wp_core'])
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_wp_core'] = $_POST['check_wp_core'];
if (isset($_POST['check_known']) && is_numeric($_POST['check_known']) && $_POST['check_known'] != $GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_known'])
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_known'] = $_POST['check_known'];
if (isset($_POST['check_potential']) && is_numeric($_POST['check_potential']) && $_POST['check_potential'] != $GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_potential'])
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]['check_potential'] = $_POST['check_potential'];
if (isset($_POST['skip_quarantine']) && $_POST['skip_quarantine'])
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]['skip_quarantine'] = $_POST['skip_quarantine'];
elseif (isset($_POST["exclude_ext"]))
$GLOBALS["GOTMLS"]["tmp"]["settings_array"]['skip_quarantine'] = 0;
GOTMLS_update_scan_log(array("settings" => $GLOBALS["GOTMLS"]["tmp"]["settings_array"]));
$scan_whatopts = '';
$scan_optjs = "\n{$lt}script type=\"text/javascript\"$gt\nfunction showOnly(what) {\n";
foreach ($GOTMLS_scan_groups as $mg => $GOTMLS_scan_group) {
$scan_optjs .= "document.getElementById('only$mg').style.display = 'none';\n";
$scan_whatopts = "\n$lt/div$gt\n$lt/div$gt\n$scan_whatopts";
$dir = implode(GOTMLS_slash(), array_slice($dirs, 0, -1 * (2 + $mg)));
$files = GOTMLS_getfiles($dir);
if (is_array($files))
foreach ($files as $file)
if (is_dir(GOTMLS_trailingslashit($dir).$file))
$scan_whatopts = $lt.'input type="checkbox" name="scan_only[]" value="'.$file.'" /'.$gt.$file.$lt.'br /'.$gt.$scan_whatopts;
$scan_whatopts = "\n$lt".'div style="padding: 4px 30px;" id="scan_group_div_'.$mg.'"'.$gt.$lt.'input type="radio" name="scan_what" id="not-only'.$mg.'" value="'.$mg.'"'.($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_what"]==$mg?' checked':'').' /'.$gt.$lt.'a style="text-decoration: none;" href="#scan_what" onclick="showOnly(\''.$mg.'\');document.getElementById(\'not-only'.$mg.'\').checked=true;"'."$gt$GOTMLS_scan_group$lt/a$gt{$lt}br /$gt\n$lt".'div class="rounded-corners" style="position: absolute; display: none; background-color: #CCF; margin: 0; padding: 10px; z-index: 10;" id="only'.$mg.'"'.$gt.$lt.'div style="padding-bottom: 6px;"'.$gt.GOTMLS_close_button('only'.$mg, 0).$lt.'b'.$gt.str_replace(" ", " ", __("Only Scan These Folders:",'gotmls')).$lt.'/b'.$gt.$lt.'/div'.$gt.$scan_whatopts;
}
$scan_optjs .= "document.getElementById('only'+what).style.display = 'block';\n}".((isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["auto_UPDATE_definitions"]) && $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["auto_UPDATE_definitions"])?"\nfunction auto_UPDATE_check() {\n\tif (auto_UPdef_check = document.getElementById('auto_UPDATE_definitions_check'))\n\t\tauto_UPdef_check.checked = true;\n}\nif (window.addEventListener)\n\twindow.addEventListener('load', auto_UPDATE_check)\nelse\n\tdocument.attachEvent('onload', auto_UPDATE_check);\n":"")."$lt/script$gt";
$scan_opts = "\n$lt".'form method="POST" name="GOTMLS_Form" action="'.str_replace('&mt=', '&last_mt=', str_replace('&scan_type=', '&last_type=', GOTMLS_script_URI)).'"'.$gt.$lt.'input type="hidden" name="scan_type" id="scan_type" value="Complete Scan" /'.$gt.'
'.$lt.'div style="float: left;"'.$gt.$lt.'p'.$gt.$lt.'b'.$gt.__("What to look for:",'gotmls').$lt.'/b'.$gt.$lt.'/p'.$gt.'
'.$lt.'div style="padding: 0 30px;"'.$gt;
foreach ($GLOBALS["GOTMLS"]["tmp"]["threat_levels"] as $threat_level_name=>$threat_level) {
$scan_opts .= $lt.'div style="padding: 0; position: relative;" id="check_'.$threat_level.'_div"'.$gt;
if (($threat_level != "wp_core" && isset($GLOBALS["GOTMLS"]["tmp"]["definitions_array"][$threat_level])) || isset($GLOBALS["GOTMLS"]["tmp"]["definitions_array"][$threat_level]["$wp_version"])) {
$scan_opts .= $lt.'input type="checkbox" name="check[]" id="check_'.$threat_level.'_Yes" value="'.$threat_level.'"'.(in_array($threat_level,$GLOBALS["GOTMLS"]["log"]["settings"]["check"])?' checked':'').' /'.$gt.' '.$lt.'a style="text-decoration: none;" href="#check_'.$threat_level.'_div_0" onclick="document.getElementById(\'check_'.$threat_level.'_Yes\').checked=true;showhide(\'dont_check_'.$threat_level.'\');"'."$gt{$lt}b$gt$threat_level_name$lt/b$gt$lt/a$gt\n";
if (isset($_GET["SESSION"])) {
if (isset($_SESSION["GOTMLS_debug"][$threat_level]))
print_r($_SESSION["GOTMLS_debug"][$threat_level],1);
$scan_opts .= "\n$lt".'div style="padding: 0 20px; position: relative; top: -18px; display: none;" id="dont_check_'.$threat_level.'"'.$gt.$lt.'a class="rounded-corners" style="position: absolute; left: 0; margin: 0; padding: 0 4px; text-decoration: none; color: #C00; background-color: #FCC; border: solid #F00 1px;" href="#check_'.$threat_level.'_div_0" onclick="showhide(\'dont_check_'.$threat_level.'\');"'.$gt.'X'.$lt.'/a'.$gt;
foreach ($GLOBALS["GOTMLS"]["tmp"]["definitions_array"][$threat_level] as $threat_name => $threat_regex)
$scan_opts .= $lt."br /$gt\n$lt".'input type="checkbox" name="dont_check[]" value="'.htmlspecialchars($threat_name).'"'.(in_array($threat_name, $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["dont_check"])?' checked /'.$gt.$lt.'script'.$gt.'showhide("dont_check_'.$threat_level.'", true);'.$lt.'/script'.$gt:' /'.$gt).(isset($_SESSION["GOTMLS_debug"][$threat_name])?print_r($_SESSION["GOTMLS_debug"][$threat_name],1):"").$threat_name;
$scan_opts .= "\n$lt/div$gt";
}
} else
$scan_opts .= $lt.'a title="'.__("Download Definition Updates to Use this feature",'gotmls').'"'.$gt.$lt.'img src="'.GOTMLS_images_path.'blocked.gif" height=16 width=16 alt="X"'.$gt.$lt.'b'.$gt.' '.$threat_level_name.$lt.'/b'.$gt.$lt.'br /'.$gt.$lt.'div style="padding: 14px;" id="check_'.$threat_level.'_div_NA"'.$gt.$lt.'span style="color: #F00"'.$gt.__("Download the new definitions (Right sidebar) to activate this feature.",'gotmls')."$lt/span$gt$lt/div$gt";
$scan_opts .= "\n$lt/div$gt";
}
$scan_opts .= $lt.'/div'.$gt.$lt.'/div'.$gt.'
'.$lt.'div style="float: left;"'.$gt.$lt.'p'.$gt.$lt.'b'.$gt.__("What to scan:",'gotmls').$lt.'/b'.$gt.$lt.'/p'.$gt.$scan_whatopts.$scan_optjs.$lt.'/div'.$gt.'
'.$lt.'div style="float: left;" id="scanwhatfolder"'.$gt.$lt.'/div'.$gt.'
'.$lt.'div style="float: left;"'.$gt.$lt.'p'.$gt.$lt.'b'.$gt.__("Scan Depth:",'gotmls').$lt.'/b'.$gt.$lt.'/p'.$gt.'
'.$lt.'div style="padding: 0 30px;"'.$gt.$lt.'input type="text" value="'.$GLOBALS["GOTMLS"]["tmp"]["settings_array"]["scan_depth"].'" name="scan_depth" size="5"'.$gt.$lt.'br /'.$gt.__("how far to drill down",'gotmls').$lt.'br /'.$gt.'('.__("-1 is infinite depth",'gotmls').')'.$lt.'/div'.$gt.$lt.'/div'.$gt.$lt.'br style="clear: left;"'.$gt;
if (isset($_GET["SESSION"]) && isset($_SESSION["GOTMLS_debug"]['total'])) {$scan_opts .= print_r($_SESSION["GOTMLS_debug"]['total'],1); unset($_SESSION["GOTMLS_debug"]);}
if (isset($_GET["eli"])) {//still testing this option
$scan_opts .= "\n$lt".'div style="padding: 10px;"'.$gt.$lt.'p'.$gt.$lt.'b'.$gt.__("Custom RegExp:",'gotmls').$lt.'/b'.$gt.' ('.__("For very advanced users only. Do not use this without talking to Eli first. If used incorrectly you could easily break your site.",'gotmls').')'.$lt.'/p'.$gt.$lt.'input type="text" name="check_custom" style="width: 100%;" value="'.htmlspecialchars($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["check_custom"]).'" /'.$gt.$lt.'/div'.$gt;
}
$scan_opts .= "\n$lt".'p'.$gt.$lt.'b'.$gt.__("Skip files with the following extentions:",'gotmls')."$lt/b$gt".(($default_exclude_ext!=implode(",", $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_ext"]))?" {$lt}a href=\"javascript:void(0);\" onclick=\"document.getElementById('exclude_ext').value = '$default_exclude_ext';\"{$gt}[Restore Defaults]$gt/a$gt":"").$lt.'/p'.$gt.'
'.$lt.'div style="padding: 0 30px;"'.$gt.$lt.'input type="text" placeholder="'.__("a comma separated list of file extentions to skip",'gotmls').'" name="exclude_ext" id="exclude_ext" value="'.implode(",", $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_ext"]).'" style="width: 100%;" /'.$gt.$lt.'/div'.$gt.'
'.$lt.'p'.$gt.$lt.'b'.$gt.__("Skip directories with the following names:",'gotmls').$lt.'/b'.$gt.$lt.'/p'.$gt.'
'.$lt.'div style="padding: 0 30px;"'.$gt.$lt.'input type="text" placeholder="'.__("a folder name or comma separated list of folder names to skip",'gotmls').'" name="exclude_dir" value="'.implode(",", $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["exclude_dir"]).'" style="width: 100%;" /'.$gt.$lt.'/div'.$gt.'
'.$lt.'table style="width: 100%" cellspacing="10"'.$gt.$lt.'tr'.$gt.$lt.'td nowrap valign="top" style="white-space: nowrap; width: 1px; border-bottom: #F00 solid 2px;"'.$gt.$lt.'b'.$gt.__("Automatically Update Definitions:",'gotmls').$lt.'/b'.$gt.$lt.'/td'.$gt.$lt.'td colspan=2 style="border-bottom: #F00 solid 2px;"'.$gt.$lt.'div id="UPDATE_definitions_div"'.$gt.$lt.'span style="color: #C00;"'.$gt.__("This new BETA feature is only available to registered users who have donated at a certain level.",'gotmls')."$lt/span$gt$lt/div$gt$lt/td$gt$lt/tr$gt{$lt}tr$gt{$lt}td nowrap$gt\n{$lt}b$gt".GOTMLS_Skip_Quarantine_LANGUAGE.$lt.'/b'.$gt.$lt.'/td'.$gt.$lt.'td'.$gt.$lt.'input type="checkbox" name="skip_quarantine" value="1"'.((isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["skip_quarantine"]) && $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["skip_quarantine"])?" checked":"").''.$gt.$lt.'/td'.$gt.$lt.'td align="right" valign="bottom"'.$gt.$lt.'input type="submit" id="complete_scan" value="'.__("Run Complete Scan",'gotmls').'" class="button-primary" /'."$gt$lt/td$gt$lt/tr$gt$lt/table$gt$lt/form$gt";
@ob_start();
$OB_default_handlers = array("default output handler", "zlib output compression");
$OB_handlers = @ob_list_handlers();
if (is_array($OB_handlers) && count($OB_handlers))
foreach ($OB_handlers as $OB_last_handler)
if (!in_array($OB_last_handler, $OB_default_handlers))
echo $lt.'div class="error"'.$gt.sprintf(__("Another Plugin or Theme is using '%s' to handle output buffers. <br />This prevents actively outputing the buffer on-the-fly and will severely degrade the performance of this (and many other) Plugins. <br />Consider disabling caching and compression plugins (at least during the scanning process).",'gotmls'), $OB_last_handler)."$lt/div$gt";
GOTMLS_display_header();
$scan_groups = array_merge(array(__("Scanned Files",'gotmls')=>"scanned",__("Selected Folders",'gotmls')=>"dirs",__("Scanned Folders",'gotmls')=>"dir",__("Skipped Folders",'gotmls')=>"skipdirs",__("Skipped Files",'gotmls')=>"skipped",__("Read/Write Errors",'gotmls')=>"errors",__("Quarantined Files",'gotmls')=>"bad"), $GLOBALS["GOTMLS"]["tmp"]["threat_levels"]);
echo $lt.'script type="text/javascript">
var percent = 0;
function changeFavicon(percent) {
var oldLink = document.getElementById("wait_gif");
if (oldLink) {
if (percent >= 100) {
document.getElementsByTagName("head")[0].removeChild(oldLink);
var link = document.createElement("link");
link.id = "wait_gif";
link.type = "image/gif";
link.rel = "shortcut icon";
var threats = '.implode(" + ", array_merge($GLOBALS["GOTMLS"]["tmp"]["threat_levels"], array(__("Potential Threats",'gotmls')=>"errors",__("WP-Login Updates",'gotmls')=>"errors"))).';
if (threats > 0) {
if ((errors * 2) == threats)
linkhref = "blocked";
else
linkhref = "threat";
} else
linkhref = "checked";
link.href = "'.GOTMLS_images_path.'"+linkhref+".gif";
document.getElementsByTagName("head")[0].appendChild(link);
}
} else {
var icons = document.getElementsByTagName("link");
var link = document.createElement("link");
link.id = "wait_gif";
link.type = "image/gif";
link.rel = "shortcut icon";
link.href = "'.GOTMLS_images_path.'wait.gif";
// document.head.appendChild(link);
document.getElementsByTagName("head")[0].appendChild(link);
}
}
function update_status(title, time) {
sdir = (dir+direrrors);
if (arguments[2] >= 0 && arguments[2] <= 100)
percent = arguments[2];
else
percent = Math.floor((sdir*100)/dirs);
scan_state = "6F6";
if (percent == 100) {
showhide("pause_button", true);
showhide("pause_button");
title = "'.$lt.'b'.$gt.__("Scan Complete!",'gotmls').$lt.'/b'.$gt.'";
} else
scan_state = "99F";
changeFavicon(percent);
if (sdir) {
if (arguments[2] >= 0 && arguments[2] <= 100)
timeRemaining = Math.ceil(((time-startTime)*(100/percent))-(time-startTime));
else
timeRemaining = Math.ceil(((time-startTime)*(dirs/sdir))-(time-startTime));
if (timeRemaining > 59)
timeRemaining = Math.ceil(timeRemaining/60)+" Minute";
else
timeRemaining += " Second";
if (timeRemaining.substr(0, 2) != "1 ")
timeRemaining += "s";
} else
timeRemaining = "Calculating Time";
timeElapsed = Math.ceil(time);
if (timeElapsed > 59)
timeElapsed = Math.floor(timeElapsed/60)+" Minute";
else
timeElapsed += " Second";
if (timeElapsed.substr(0, 2) != "1 ")
timeElapsed += "s";
divHTML = \''.$lt.'div align="center" style="vertical-align: middle; background-color: #ccc; z-index: 3; height: 18px; width: 100%; border: solid #000 1px; position: relative; padding: 10px 0;"'.$gt.$lt.'div style="height: 18px; padding: 10px 0; position: absolute; top: 0px; left: 0px; background-color: #\'+scan_state+\'; width: \'+percent+\'%"'.$gt.$lt.'/div'.$gt.$lt.'div style="height: 32px; position: absolute; top: 3px; left: 10px; z-index: 5; line-height: 16px;" align="left"'.$gt.'\'+sdir+" Folder"+(sdir==1?"":"s")+" Checked'.$lt.'br /'.$gt.'"+timeElapsed+\' Elapsed'.$lt.'/div'.$gt.$lt.'div style="height: 38px; position: absolute; top: 0px; left: 0px; width: 100%; z-index: 5; line-height: 38px; font-size: 30px; text-align: center;"'.$gt.'\'+percent+\'%'.$lt.'/div'.$gt.$lt.'div style="height: 32px; position: absolute; top: 3px; right: 10px; z-index: 5; line-height: 16px;" align="right"'.$gt.'\'+(dirs-sdir)+" Folder"+((dirs-sdir)==1?"":"s")+" Remaining'.$lt.'br /'.$gt.'"+timeRemaining+" Remaining'.$lt.'/div'.$gt.$lt.'/div'.$gt.'";
document.getElementById("status_bar").innerHTML = divHTML;
document.getElementById("status_text").innerHTML = title;
dis="none";
divHTML = \''.$lt.'ul style="float: right; margin: 0 20px; text-align: right;"'.$gt.'\';
/*'.$lt.'!--*'.'/';
$MAX = 0;
$vars = "var i, intrvl, direrrors=0";
$fix_button_js = "";
$found = "";
$li_js = "return false;";
foreach ($scan_groups as $scan_name => $scan_group) {
$vars .= ", $scan_group=0";
if ($MAX++ == 6) {
echo "/*--{$gt}*"."/\n\tif ($scan_group > 0)\n\t\tscan_state = ' potential'; \n\telse\n\t\tscan_state = '';\n\tdivHTML += '</ul><ul style=\"text-align: left;\"><li class=\"GOTMLS_li\"><a href=\"admin.php?page=GOTMLS-View-Quarantine\" class=\"GOTMLS_plugin".((isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]["skip_quarantine"]) && $GLOBALS["GOTMLS"]["tmp"]["settings_array"]["skip_quarantine"])?" potential\" title=\"".GOTMLS_Skip_Quarantine_LANGUAGE:"'+scan_state+'\" title=\"".GOTMLS_View_Quarantine_LANGUAGE)."\">'+$scan_group+' '+($scan_group==1?('$scan_name').slice(0,-1):'$scan_name')+'</a></li>';\n/*{$lt}!--*"."/";
$found = "Found ";
$fix_button_js = "\n\t\tdis='block';";
} else {
if ($found && !in_array($scan_group, $GLOBALS["GOTMLS"]["log"]["settings"]["check"]))
$potential_threat = ' potential" title="'.__("You are not currently scanning for this type of threat!",'gotmls');
else
$potential_threat = "";
echo "/*--{$gt}*"."/\n\tif ($scan_group > 0) {\n\t\tscan_state = ' href=\"#found_$scan_group\" onclick=\"$li_js showhide(\\'found_$scan_group\\', true);\" class=\"GOTMLS_plugin $scan_group\"';$fix_button_js".($MAX>6?"\n\tshowhide('found_$scan_group', true);":"")."\n\t} else\n\t\tscan_state = ' class=\"GOTMLS_plugin$potential_threat\"';\n\tdivHTML += '<li class=\"GOTMLS_li\"><a'+scan_state+'>$found'+$scan_group+' '+($scan_group==1?('$scan_name').slice(0,-1):'$scan_name')+'</a></li>';\n/*{$lt}!--*"."/";
}
$li_js = "";
if ($MAX > 11)
$fix_button_js = "";
}
echo "/*--{$gt}*".'/
document.getElementById("status_counts").innerHTML = divHTML+"'.$lt.'/ul'.$gt.'";
document.getElementById("fix_button").style.display = dis;
}
'.$vars.';
function showOnly(what) {
document.getElementById("only_what").innerHTML = document.getElementById("only"+what).innerHTML;
}
var startTime = 0;
'.$lt.'/script'.$gt.GOTMLS_box(GOTMLS_Scan_Settings_LANGUAGE, $scan_opts);
if (isset($_REQUEST["scan_what"]) && is_numeric($_REQUEST["scan_what"]) && ($_REQUEST["scan_what"] > -1)) {
if (!isset($_REQUEST["scan_type"]))
$_REQUEST["scan_type"] = "Complete Scan";
update_option('GOTMLS_settings_array', $GLOBALS["GOTMLS"]["tmp"]["settings_array"]);
foreach ($_POST as $name => $value) {
if (substr($name, 0, 10) != 'GOTMLS_fix') {
if (is_array($value)) {
foreach ($value as $val)
echo $lt.'input type="hidden" name="'.$name.'[]" value="'.htmlspecialchars($val).'"'.$gt;
} else
echo $lt.'input type="hidden" name="'.$name.'" value="'.htmlspecialchars($value).'"'.$gt;
}
}
echo "\n$lt".'form method="POST" target="GOTMLS_iFrame" name="GOTMLS_Form_clean"'.$gt.$lt.'input type="hidden" id="GOTMLS_fixing" name="GOTMLS_fixing" value="1"'.$gt.'
'.$lt.'script type="text/javascript"'.$gt.'
showhide("inside_'.md5(GOTMLS_Scan_Settings_LANGUAGE).'");
'.$lt.'/script'.$gt.GOTMLS_box(htmlentities($_REQUEST["scan_type"]).' Status', $lt.'div id="status_text"'.$gt.$lt.'img src="'.GOTMLS_images_path.'wait.gif" height=16 width=16 alt="..."'.$gt.' '.GOTMLS_Loading_LANGUAGE.$lt.'/div'.$gt.$lt.'div id="status_bar"'.$gt.$lt.'/div'.$gt.$lt.'p id="pause_button" style="display: none; position: absolute; left: 0; text-align: center; margin-left: -30px; padding-left: 50%;"'.$gt.$lt.'input type="button" value="Pause" class="button-primary" onclick="pauseresume(this);" id="resume_button" /'.$gt.$lt.'/p'.$gt.$lt.'div id="status_counts"'.$gt.$lt.'/div'.$gt.$lt.'p id="fix_button" style="display: none; text-align: center;"'.$gt.$lt.'input id="repair_button" type="submit" value="'.GOTMLS_Automatically_Fix_LANGUAGE.'" class="button-primary" onclick="loadIframe(\'Examine Results\');" /'.$gt.$lt.'/p'.$gt);
$scan_groups_UL = "";
foreach ($scan_groups as $scan_name => $scan_group)
$scan_groups_UL .= "\n{$lt}ul name=\"found_$scan_group\" id=\"found_$scan_group\" class=\"GOTMLS_plugin $scan_group\" style=\"background-color: #ccc; display: none; padding: 0;\"$gt{$lt}a class=\"rounded-corners\" name=\"link_$scan_group\" style=\"float: right; padding: 0 4px; margin: 5px 5px 0 30px; line-height: 16px; text-decoration: none; color: #C00; background-color: #FCC; border: solid #F00 1px;\" href=\"#found_top\" onclick=\"showhide('found_$scan_group');\"{$gt}X$lt/a$gt{$lt}h3$gt$scan_name$lt/h3$gt\n".($scan_group=='potential'?$lt.'p'.$gt.' * '.__("NOTE: These are probably not malicious scripts (but it's a good place to start looking <u>IF</u> your site is infected and no Known Threats were found).",'gotmls').$lt.'/p'.$gt:($scan_group=='wp_core'?$lt.'p'.$gt.' * '.sprintf(__("NOTE: We have detected changes to the WordPress Core files on your site. This could be an intentional modification or the malicious work of a hacker. We can restore these files to their original state to preserve the integrity of your original WordPress %s installation.",'gotmls'), $wp_version).' (for more info '.$lt.'a target="_blank" href="http://gotmls.net/tag/wp-core-files/"'.$gt.__("read my blog",'gotmls').$lt.'/a'.$gt.').'.$lt.'/p'.$gt:$lt.'br /'.$gt)).$lt.'/ul'.$gt;
if (!($dir = implode(GOTMLS_slash(), array_slice($dirs, 0, -1 * (2 + $_REQUEST["scan_what"]))))) $dir = "/";
GOTMLS_update_scan_log(array("scan" => array("dir" => $dir, "start" => time(), "type" => htmlentities($_REQUEST["scan_type"]))));
echo GOTMLS_box($lt.'div style="float: right;"'.$gt.' ('.$GLOBALS["GOTMLS"]["log"]["scan"]["dir"].") $lt/div$gt".__("Scan Details:",'gotmls'), $scan_groups_UL);
$no_flush_LANGUAGE = __("Not flushing OB Handlers: %s",'gotmls');
if (isset($_REQUEST["no_ob_end_flush"]))
echo $lt.'div class="error"'.$gt.sprintf($no_flush_LANGUAGE, print_r(ob_list_handlers(), 1))."$lt/div$gt\n";
elseif (is_array($OB_handlers) && count($OB_handlers)) {
// $GOTMLS_OB_handlers = get_option("GOTMLS_OB_handlers", array());
foreach (array_reverse($OB_handlers) as $OB_handler) {
if (isset($GOTMLS_OB_handlers[$OB_handler]) && $GOTMLS_OB_handlers[$OB_handler] == "no_end_flush")
echo $lt.'div class="error"'.$gt.sprintf($no_flush_LANGUAGE, $OB_handler)."$lt/div$gt\n";
elseif (in_array($OB_handler, $OB_default_handlers)) {
// $GOTMLS_OB_handlers[$OB_handler] = "no_end_flush";
// update_option("GOTMLS_OB_handlers", $GOTMLS_OB_handlers);
@ob_end_flush();
// $GOTMLS_OB_handlers[$OB_handler] = "ob_end_flush";
// update_option("GOTMLS_OB_handlers", $GOTMLS_OB_handlers);
}
}
}
@ob_start();
if ($_REQUEST["scan_type"] == "Quick Scan")
$li_js = "\nfunction testComplete() {\n\tif (percent != 100)\n\t\talert('".__("The Quick Scan was unable to finish because of a shortage of memory or a problem accessing a file. Please try using the Complete Scan, it is slower but it will handle these errors better and continue scanning the rest of the files.",'gotmls')."');\n}\nwindow.onload=testComplete;\n$lt/script$gt\n$lt".'script type="text/javascript"'.$gt;
echo "\n{$lt}script type=\"text/javascript\"$gt$li_js\n/*{$lt}!--*"."/";
if (is_dir($dir)) {
$GOTMLS_dirs_at_depth[0] = 1;
$GOTMLS_dir_at_depth[0] = 0;
if (!(isset($GLOBALS["GOTMLS"]["tmp"]["settings_array"]['skip_quarantine']) && $GLOBALS["GOTMLS"]["tmp"]["settings_array"]['skip_quarantine'])) {
$GOTMLS_dirs_at_depth[0]++;
GOTMLS_readdir($GLOBALS["GOTMLS"]["tmp"]["quarantine_dir"]);
}
if (isset($_POST['scan_only']) && is_array($_POST['scan_only'])) {
$GOTMLS_dirs_at_depth[0] += (count($_POST['scan_only']) - 1);
foreach ($_POST['scan_only'] as $only_dir)
if (is_dir(GOTMLS_trailingslashit($dir).$only_dir))
GOTMLS_readdir(GOTMLS_trailingslashit($dir).$only_dir);
} else
GOTMLS_readdir($dir);
} else
echo GOTMLS_return_threat("errors", "blocked", $dir, GOTMLS_error_link("Not a valid directory!"));
if ($_REQUEST["scan_type"] == "Quick Scan")
echo GOTMLS_update_status(__("Completed!",'gotmls'), 100);
else {
echo GOTMLS_update_status(__("Starting Scan ...",'gotmls'))."/*--{$gt}*"."/";
echo "\nvar scriptSRC = '".GOTMLS_script_URI."&no_error_reporting&GOTMLS_scan=';\nvar scanfilesArKeys = new Array('".implode("','", array_keys($GOTMLS_scanfiles))."');\nvar scanfilesArNames = new Array('Scanning ".implode("','Scanning ", $GOTMLS_scanfiles)."');".'
var scanfilesI = 0;
var stopScanning;
var gotStuckOn = "";
function scanNextDir(gotStuck) {
clearTimeout(stopScanning);
if (gotStuck > -1) {
if (scanfilesArNames[gotStuck].substr(0, 3) != "Re-") {
if (scanfilesArNames[gotStuck].substr(0, 9) == "Checking ") {
scanfilesArNames.push(scanfilesArNames[gotStuck]);
scanfilesArKeys.push(scanfilesArKeys[gotStuck]+"&GOTMLS_skip_file[]="+encodeURIComponent(scanfilesArNames[gotStuck].substr(9)));
} else {
scanfilesArNames.push("Re-"+scanfilesArNames[gotStuck]);
scanfilesArKeys.push(scanfilesArKeys[gotStuck]+"&GOTMLS_only_file=");
}
} else {
scanfilesArNames.push("Got Stuck "+scanfilesArNames[gotStuck]);
scanfilesArKeys.push(scanfilesArKeys[gotStuck]+"&GOTMLS_skip_dir="+scanfilesArKeys[gotStuck]);
}
}
if (document.getElementById("resume_button").value != "Pause") {
stopScanning=setTimeout("scanNextDir(-1)", 1000);
startTime++;
}
else if (scanfilesI < scanfilesArKeys.length) {
document.getElementById("status_text").innerHTML = scanfilesArNames[scanfilesI];
var newscript = document.createElement("script");
newscript.setAttribute("src", scriptSRC+scanfilesArKeys[scanfilesI]);
divx = document.getElementById("found_scanned");
if (divx)
divx.appendChild(newscript);
stopScanning=setTimeout("scanNextDir("+(scanfilesI++)+")",'.$GLOBALS["GOTMLS"]["tmp"]['execution_time'].'000);
}
}
startTime = ('.ceil(time()-$GLOBALS["GOTMLS"]["log"]["scan"]["start"]).'+3);
stopScanning=setTimeout("scanNextDir(-1)",3000);
function pauseresume(butt) {
if (butt.value == "Resume")
butt.value = "Pause";
else
butt.value = "Resume";
}
showhide("pause_button", true);'."\n/*{$lt}!--*"."/";
}
if (@ob_get_level()) {