Version Description
- Premium Feature: Password Auditing. Audit the strength of your admin and user-level passwords against our GPU based auditing cluster. Easily alert users to weak passwords or force a password change.
- Feature: Activity email summary. See options page to enable a weekly, bi-weekly or monthly activity summary.
- Feature: Activity summary dashboard widget.
- Fix: Fixed bug on plugin activation where the configuration table was being queried before it was created.
- Improvement: Added .htaccess to wfcache directory.
- Improvement: Switched to using wp_remote_post for Wordfence cloud API calls to improved SSL support and a more standards based approach.
Download this release
Release Info
Developer | mmaunder |
Plugin | ![]() |
Version | 5.3.9 |
Comparing to | |
See all releases |
Code changes from version 5.3.8 to 5.3.9
- css/activity-report-widget.css +90 -0
- css/main.css +60 -31
- js/admin.js +1864 -1592
- lib/email_passwdChanged.php +23 -0
- lib/email_pleaseChangePasswd.php +23 -0
- lib/menu_countryBlocking.php +3 -3
- lib/menu_options.php +47 -2
- lib/menu_passwd.php +186 -0
- lib/wfAPI.php +69 -148
- lib/wfActivityReport.php +462 -0
- lib/wfCache.php +23 -1
- lib/wfConfig.php +43 -11
- lib/wfCrypt.php +46 -0
- lib/wfDirectoryIterator.php +74 -0
- lib/wfHelperString.php +22 -0
- lib/wfLog.php +3 -0
- lib/wfScanEngine.php +4 -0
- lib/wfSchema.php +7 -0
- lib/wfUpdateCheck.php +133 -0
- lib/wfView.php +127 -0
- lib/wordfenceClass.php +349 -95
- lib/wordfenceConstants.php +1 -1
- readme.txt +10 -1
- views/reports/activity-report-email-inline.php +330 -0
- views/reports/activity-report-email.php +465 -0
- views/reports/activity-report.php +195 -0
- wordfence.php +2 -2
css/activity-report-widget.css
ADDED
@@ -0,0 +1,90 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
#wordfence_activity_report_widget .inside h1,
|
2 |
+
#wordfence_activity_report_widget .inside h2,
|
3 |
+
#wordfence_activity_report_widget .inside h3,
|
4 |
+
#wordfence_activity_report_widget .inside h4 {
|
5 |
+
margin: 20px 0 4px;
|
6 |
+
color: #222 !important;
|
7 |
+
}
|
8 |
+
|
9 |
+
#wordfence_activity_report_widget .inside h1 {
|
10 |
+
float: right;
|
11 |
+
text-align: right;
|
12 |
+
font-size: 30px;
|
13 |
+
color: #444444 !important;
|
14 |
+
line-height: 1.1;
|
15 |
+
}
|
16 |
+
|
17 |
+
#wordfence_activity_report_widget .inside h2 {
|
18 |
+
font-size: 20px;
|
19 |
+
}
|
20 |
+
|
21 |
+
#wordfence_activity_report_widget .inside h4 {
|
22 |
+
font-size: 16px;
|
23 |
+
color: #666666 !important;
|
24 |
+
}
|
25 |
+
|
26 |
+
#wordfence_activity_report_widget .inside code {
|
27 |
+
background-color: transparent;
|
28 |
+
}
|
29 |
+
|
30 |
+
#wordfence_activity_report_widget table.wf-table {
|
31 |
+
width: 100%;
|
32 |
+
max-width: 100%;
|
33 |
+
border-collapse: collapse;
|
34 |
+
}
|
35 |
+
|
36 |
+
#wordfence_activity_report_widget table.wf-table th,
|
37 |
+
#wordfence_activity_report_widget table.wf-table td {
|
38 |
+
text-align: left;
|
39 |
+
padding: 6px 4px;
|
40 |
+
border: 1px solid #cccccc;
|
41 |
+
}
|
42 |
+
|
43 |
+
#wordfence_activity_report_widget table.wf-table thead th,
|
44 |
+
#wordfence_activity_report_widget table.wf-table thead td {
|
45 |
+
background-color: #222;
|
46 |
+
color: #FFFFFF;
|
47 |
+
font-weight: bold;
|
48 |
+
border-color: #474747;
|
49 |
+
}
|
50 |
+
|
51 |
+
#wordfence_activity_report_widget table.wf-table tbody tr.even td {
|
52 |
+
background-color: #eeeeee;
|
53 |
+
}
|
54 |
+
|
55 |
+
#wordfence_activity_report_widget .loginFailValidUsername {
|
56 |
+
color: #00c000;
|
57 |
+
font-weight: bold;
|
58 |
+
}
|
59 |
+
|
60 |
+
#wordfence_activity_report_widget .loginFailInvalidUsername {
|
61 |
+
color: #e74a2a;
|
62 |
+
font-weight: bold;
|
63 |
+
}
|
64 |
+
|
65 |
+
#wordfence_activity_report_widget .display-file-table-cell {
|
66 |
+
overflow: hidden;
|
67 |
+
}
|
68 |
+
|
69 |
+
#wordfence_activity_report_widget .display-file {
|
70 |
+
margin: 0px;
|
71 |
+
display: block;
|
72 |
+
font-size: 12px;
|
73 |
+
width: 100%;
|
74 |
+
overflow: auto;
|
75 |
+
white-space: nowrap;
|
76 |
+
}
|
77 |
+
|
78 |
+
#wordfence_activity_report_widget .recently-modified-files {
|
79 |
+
table-layout: fixed;
|
80 |
+
}
|
81 |
+
|
82 |
+
#wordfence_activity_report_widget .recently-modified-files th:nth-child(1),
|
83 |
+
#wordfence_activity_report_widget .recently-modified-files td:nth-child(1) {
|
84 |
+
width: 30%;
|
85 |
+
}
|
86 |
+
|
87 |
+
#wordfence_activity_report_widget .recently-modified-files th:nth-child(2),
|
88 |
+
#wordfence_activity_report_widget .recently-modified-files td:nth-child(2) {
|
89 |
+
width: 70%;
|
90 |
+
}
|
css/main.css
CHANGED
@@ -142,8 +142,8 @@ div.wordfenceScanButton input.button-wf-grey {
|
|
142 |
}
|
143 |
table.wfSummaryParent { font-family: sans-serif; font-size: 14px; color: #000; z-index: 9;}
|
144 |
table.wfSummaryParent td { vertical-align: top; padding: 0; margin: 0; }
|
145 |
-
table.wfSummaryParent table.wfSummaryChild th { font-weight: bold; text-align: right; font-family: Georgia, serif; color: #000; padding: 5px 10px 5px 0; border-top: 1px solid #CCC; }
|
146 |
-
table.wfSummaryParent table.wfSummaryChild td { font-weight: normal; text-align: left; padding: 5px 0 5px 0; border-top: 1px solid #CCC; }
|
147 |
table.wfSummaryParent table.wfSC1 td { width: 300px; padding: 0px 25px 10px 0; }
|
148 |
table.wfSummaryParent table.wfSC2 th { width: 80px; }
|
149 |
table.wfSummaryParent table.wfSC2 td { width: 100px; }
|
@@ -155,8 +155,8 @@ div.wfIssue table.wfIssue td { padding: 2px; margin: 0; border-width: 0px; text-
|
|
155 |
div.wfIssue table.wfIssue th { padding: 2px; margin: 0; font-weight: bold; text-align: left; color: #777; }
|
156 |
div.wfIssue h2 { margin: 0px 0 5px 0; padding: 0; }
|
157 |
div.wfIssue table.wfIssueLinks td { border-width: 0px; text-align: left; padding-right: 10px; }
|
158 |
-
.wfIssueOptions {
|
159 |
-
border-top: 1px solid #CCC;
|
160 |
padding: 10px;
|
161 |
}
|
162 |
.wfIssueOptions a {
|
@@ -241,11 +241,11 @@ h3.wfConfigHeading {
|
|
241 |
width: 800px;
|
242 |
}
|
243 |
.consoleHeadText {
|
244 |
-
font-size: 18px;
|
245 |
-
font-family: Georgia, serif;
|
246 |
-
font-style: italic;
|
247 |
-
color: #555;
|
248 |
-
font-weight: bold;
|
249 |
-webkit-font-smoothing: antialiased;
|
250 |
|
251 |
}
|
@@ -253,7 +253,7 @@ h3.wfConfigHeading {
|
|
253 |
.consoleInner { height: 116px; overflow: auto; z-index: 1; }
|
254 |
.bevelDiv1 { border: 1px solid #EFEFEF; }
|
255 |
.bevelDiv2 { border: 1px solid #AAA; }
|
256 |
-
.bevelDiv3 { border: 1px solid #555;
|
257 |
background-color: #FFFFE0; /* #FFFFF0; /* #FFEBCD; #FFFACD; */
|
258 |
color: #000; padding: 5px; font-family: Arial; -webkit-font-smoothing: none; }
|
259 |
|
@@ -276,9 +276,9 @@ h3.wfConfigHeading {
|
|
276 |
clear: both;
|
277 |
visibility: hidden;
|
278 |
}
|
279 |
-
.wfSummaryFinal {
|
280 |
-webkit-font-smoothing: antialiased;
|
281 |
-
font-weight: bold;
|
282 |
color: #555;
|
283 |
}
|
284 |
input.wfStartScanButton { width: 160px; text-align: left; padding-left: 20px; }
|
@@ -287,16 +287,16 @@ input.wfStartScanButton { width: 160px; text-align: left; padding-left: 20px; }
|
|
287 |
}
|
288 |
#wordfenceWorking {
|
289 |
padding: 2px 8px 2px 24px;
|
290 |
-
z-index: 100000;
|
291 |
-
position: fixed;
|
292 |
-
right: 2px;
|
293 |
-
bottom: 2px;
|
294 |
-
border: 1px solid #000;
|
295 |
-
background-color: #F00;
|
296 |
-
color: #FFF;
|
297 |
-
font-size: 12px;
|
298 |
-
font-weight: bold;
|
299 |
-
font-family: Arial;
|
300 |
text-align: center;
|
301 |
background-image: url('../images/icons/ajaxRed16.gif');
|
302 |
background-position: 2px 2px;
|
@@ -322,10 +322,10 @@ input.wfStartScanButton { width: 160px; text-align: left; padding-left: 20px; }
|
|
322 |
width: 1px;
|
323 |
}
|
324 |
.wfPaidOnlyNotice {
|
325 |
-
width: 500px;
|
326 |
-
background-color: #FFFFE0;
|
327 |
-
border: 1px solid #000;
|
328 |
-
padding: 10px;
|
329 |
margin: 20px;
|
330 |
}
|
331 |
.wfFalconNotice {
|
@@ -415,10 +415,10 @@ input.wfStartScanButton { width: 160px; text-align: left; padding-left: 20px; }
|
|
415 |
border: 2px solid #999999 !important ; border-radius: 19px !important ;
|
416 |
position: absolute !important ; top: 0 !important ; bottom: 0 !important ; right: 46px !important ;
|
417 |
-moz-transition: all 0.3s ease-in 0s !important ; -webkit-transition: all 0.3s ease-in 0s !important ;
|
418 |
-
-o-transition: all 0.3s ease-in 0s !important ; transition: all 0.3s ease-in 0s !important ;
|
419 |
-
background-image: -moz-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%) !important ;
|
420 |
-
background-image: -webkit-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%) !important ;
|
421 |
-
background-image: -o-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%) !important ;
|
422 |
background-image: linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%) !important ;
|
423 |
box-shadow: 0 1px 1px white inset !important ;
|
424 |
}
|
@@ -426,9 +426,38 @@ input.wfStartScanButton { width: 160px; text-align: left; padding-left: 20px; }
|
|
426 |
margin-left: 0 !important ;
|
427 |
}
|
428 |
.wfOnOffSwitch-checkbox:checked + .wfOnOffSwitch-label .wfOnOffSwitch-switch {
|
429 |
-
right: 0px !important ;
|
430 |
}
|
431 |
#wordfenceConfigWarning {
|
432 |
clear: left;
|
433 |
margin-top: 5px;
|
434 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
142 |
}
|
143 |
table.wfSummaryParent { font-family: sans-serif; font-size: 14px; color: #000; z-index: 9;}
|
144 |
table.wfSummaryParent td { vertical-align: top; padding: 0; margin: 0; }
|
145 |
+
table.wfSummaryParent table.wfSummaryChild th { font-weight: bold; text-align: right; font-family: Georgia, serif; color: #000; padding: 5px 10px 5px 0; border-top: 1px solid #CCC; }
|
146 |
+
table.wfSummaryParent table.wfSummaryChild td { font-weight: normal; text-align: left; padding: 5px 0 5px 0; border-top: 1px solid #CCC; }
|
147 |
table.wfSummaryParent table.wfSC1 td { width: 300px; padding: 0px 25px 10px 0; }
|
148 |
table.wfSummaryParent table.wfSC2 th { width: 80px; }
|
149 |
table.wfSummaryParent table.wfSC2 td { width: 100px; }
|
155 |
div.wfIssue table.wfIssue th { padding: 2px; margin: 0; font-weight: bold; text-align: left; color: #777; }
|
156 |
div.wfIssue h2 { margin: 0px 0 5px 0; padding: 0; }
|
157 |
div.wfIssue table.wfIssueLinks td { border-width: 0px; text-align: left; padding-right: 10px; }
|
158 |
+
.wfIssueOptions {
|
159 |
+
border-top: 1px solid #CCC;
|
160 |
padding: 10px;
|
161 |
}
|
162 |
.wfIssueOptions a {
|
241 |
width: 800px;
|
242 |
}
|
243 |
.consoleHeadText {
|
244 |
+
font-size: 18px;
|
245 |
+
font-family: Georgia, serif;
|
246 |
+
font-style: italic;
|
247 |
+
color: #555;
|
248 |
+
font-weight: bold;
|
249 |
-webkit-font-smoothing: antialiased;
|
250 |
|
251 |
}
|
253 |
.consoleInner { height: 116px; overflow: auto; z-index: 1; }
|
254 |
.bevelDiv1 { border: 1px solid #EFEFEF; }
|
255 |
.bevelDiv2 { border: 1px solid #AAA; }
|
256 |
+
.bevelDiv3 { border: 1px solid #555;
|
257 |
background-color: #FFFFE0; /* #FFFFF0; /* #FFEBCD; #FFFACD; */
|
258 |
color: #000; padding: 5px; font-family: Arial; -webkit-font-smoothing: none; }
|
259 |
|
276 |
clear: both;
|
277 |
visibility: hidden;
|
278 |
}
|
279 |
+
.wfSummaryFinal {
|
280 |
-webkit-font-smoothing: antialiased;
|
281 |
+
font-weight: bold;
|
282 |
color: #555;
|
283 |
}
|
284 |
input.wfStartScanButton { width: 160px; text-align: left; padding-left: 20px; }
|
287 |
}
|
288 |
#wordfenceWorking {
|
289 |
padding: 2px 8px 2px 24px;
|
290 |
+
z-index: 100000;
|
291 |
+
position: fixed;
|
292 |
+
right: 2px;
|
293 |
+
bottom: 2px;
|
294 |
+
border: 1px solid #000;
|
295 |
+
background-color: #F00;
|
296 |
+
color: #FFF;
|
297 |
+
font-size: 12px;
|
298 |
+
font-weight: bold;
|
299 |
+
font-family: Arial;
|
300 |
text-align: center;
|
301 |
background-image: url('../images/icons/ajaxRed16.gif');
|
302 |
background-position: 2px 2px;
|
322 |
width: 1px;
|
323 |
}
|
324 |
.wfPaidOnlyNotice {
|
325 |
+
width: 500px;
|
326 |
+
background-color: #FFFFE0;
|
327 |
+
border: 1px solid #000;
|
328 |
+
padding: 10px;
|
329 |
margin: 20px;
|
330 |
}
|
331 |
.wfFalconNotice {
|
415 |
border: 2px solid #999999 !important ; border-radius: 19px !important ;
|
416 |
position: absolute !important ; top: 0 !important ; bottom: 0 !important ; right: 46px !important ;
|
417 |
-moz-transition: all 0.3s ease-in 0s !important ; -webkit-transition: all 0.3s ease-in 0s !important ;
|
418 |
+
-o-transition: all 0.3s ease-in 0s !important ; transition: all 0.3s ease-in 0s !important ;
|
419 |
+
background-image: -moz-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%) !important ;
|
420 |
+
background-image: -webkit-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%) !important ;
|
421 |
+
background-image: -o-linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%) !important ;
|
422 |
background-image: linear-gradient(center top, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0) 80%) !important ;
|
423 |
box-shadow: 0 1px 1px white inset !important ;
|
424 |
}
|
426 |
margin-left: 0 !important ;
|
427 |
}
|
428 |
.wfOnOffSwitch-checkbox:checked + .wfOnOffSwitch-label .wfOnOffSwitch-switch {
|
429 |
+
right: 0px !important ;
|
430 |
}
|
431 |
#wordfenceConfigWarning {
|
432 |
clear: left;
|
433 |
margin-top: 5px;
|
434 |
}
|
435 |
+
|
436 |
+
table.wf-table {
|
437 |
+
width: 100%;
|
438 |
+
max-width: 100%;
|
439 |
+
border-collapse: collapse;
|
440 |
+
}
|
441 |
+
table.wf-table th,
|
442 |
+
table.wf-table td {
|
443 |
+
padding: 6px 4px;
|
444 |
+
border: 1px solid #ccc;
|
445 |
+
}
|
446 |
+
table.wf-table thead th,
|
447 |
+
table.wf-table thead td {
|
448 |
+
background-color: #222;
|
449 |
+
color: #fff;
|
450 |
+
font-weight: bold;
|
451 |
+
border-color: #474747;
|
452 |
+
text-align: left;
|
453 |
+
}
|
454 |
+
table.wf-table tbody tr td {
|
455 |
+
background-color: #fff;
|
456 |
+
}
|
457 |
+
table.wf-table tbody tr.even td,
|
458 |
+
table.wf-table tbody tr:nth-child(2n) td {
|
459 |
+
background-color: #eee;
|
460 |
+
}
|
461 |
+
table.wf-table tbody tr:hover td {
|
462 |
+
background-color: #fffbd8;
|
463 |
+
}
|
js/admin.js
CHANGED
@@ -1,1641 +1,1913 @@
|
|
1 |
-
|
2 |
-
window['wordfenceAdmin
|
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 |
-
this.
|
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 |
-
self
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
212 |
});
|
213 |
-
});
|
214 |
-
},
|
215 |
-
tourRedir: function(menuItem){
|
216 |
-
window.location.href = 'admin.php?page=' + menuItem;
|
217 |
-
},
|
218 |
-
updateConfig: function(key, val, cb){
|
219 |
-
this.ajax('wordfence_updateConfig', { key: key, val: val }, function(){ cb(); });
|
220 |
-
},
|
221 |
-
tourFinish: function(){
|
222 |
-
this.ajax('wordfence_tourClosed', {}, function(res){});
|
223 |
-
},
|
224 |
-
downgradeLicense: function(){
|
225 |
-
this.colorbox('400px', "Confirm Downgrade", "Are you sure you want to downgrade your Wordfence Premium License? This will disable all Premium features and return you to the free version of Wordfence. <a href=\"https://www.wordfence.com/manage-wordfence-api-keys/\" target=\"_blank\">Click here to renew your paid membership</a> or click the button below to confirm you want to downgrade.<br /><br /><input type=\"button\" value=\"Downgrade and disable Premium features\" onclick=\"WFAD.downgradeLicenseConfirm();\" /><br />");
|
226 |
-
},
|
227 |
-
downgradeLicenseConfirm: function(){
|
228 |
-
jQuery.colorbox.close();
|
229 |
-
this.ajax('wordfence_downgradeLicense', {}, function(res){ location.reload(true); });
|
230 |
-
},
|
231 |
-
tour: function(contentID, elemID, edge, align, buttonLabel, buttonCallback){
|
232 |
-
var self = this;
|
233 |
-
if(this.currentPointer){
|
234 |
-
this.currentPointer.pointer('destroy');
|
235 |
-
this.currentPointer = false;
|
236 |
-
}
|
237 |
-
var options = {
|
238 |
-
buttons: function(event, t){
|
239 |
-
var buttonElem = jQuery('<div id="wfTourButCont"><a id="pointer-close" style="margin-left:5px" class="button-secondary">End the Tour</a></div><div><a id="wfRateLink" href="http://wordpress.org/extend/plugins/wordfence/" target="_blank" style="font-size: 10px; font-family: Verdana;">Help spread the word by rating us 5★ on WordPress.org</a></div>');
|
240 |
-
buttonElem.find('#pointer-close').bind('click.pointer', function (evtObj) {
|
241 |
-
var evtSourceElem = evtObj.srcElement ? evtObj.srcElement : evtObj.target;
|
242 |
-
if(evtSourceElem.id == 'wfRateLink'){
|
243 |
-
return true;
|
244 |
-
}
|
245 |
-
self.tourFinish();
|
246 |
-
t.element.pointer('close');
|
247 |
-
return false;
|
248 |
-
});
|
249 |
-
return buttonElem;
|
250 |
-
},
|
251 |
-
close: function(){},
|
252 |
-
content: jQuery('#' + contentID).tmpl().html(),
|
253 |
-
pointerWidth: 400,
|
254 |
-
position: {
|
255 |
-
edge: edge,
|
256 |
-
align: align
|
257 |
-
}
|
258 |
-
};
|
259 |
-
this.currentPointer = jQuery('#' + elemID).pointer(options).pointer('open');
|
260 |
-
if(buttonLabel && buttonCallback){
|
261 |
-
jQuery('#pointer-close').after('<a id="pointer-primary" class="button-primary">' + buttonLabel + '</a>');
|
262 |
-
jQuery('#pointer-primary').click(buttonCallback);
|
263 |
-
}
|
264 |
-
},
|
265 |
-
startTourAgain: function(){
|
266 |
-
var self = this;
|
267 |
-
this.ajax('wordfence_startTourAgain', {}, function(res){
|
268 |
-
self.tourClosed = false;
|
269 |
-
self.scanTourStart();
|
270 |
-
});
|
271 |
-
},
|
272 |
-
showLoading: function(){
|
273 |
-
this.loadingCount++;
|
274 |
-
if(this.loadingCount == 1){
|
275 |
-
jQuery('<div id="wordfenceWorking">Wordfence is working...</div>').appendTo('body');
|
276 |
-
}
|
277 |
-
},
|
278 |
-
removeLoading: function(){
|
279 |
-
this.loadingCount--;
|
280 |
-
if(this.loadingCount == 0){
|
281 |
-
jQuery('#wordfenceWorking').remove();
|
282 |
-
}
|
283 |
-
},
|
284 |
-
startActivityLogUpdates: function(){
|
285 |
-
var self = this;
|
286 |
-
setInterval(function(){
|
287 |
-
self.updateActivityLog();
|
288 |
-
}, parseInt(WordfenceAdminVars.actUpdateInterval));
|
289 |
-
},
|
290 |
-
updateActivityLog: function(){
|
291 |
-
if(this.activityLogUpdatePending){
|
292 |
-
return;
|
293 |
-
}
|
294 |
-
this.activityLogUpdatePending = true;
|
295 |
-
var self = this;
|
296 |
-
this.ajax('wordfence_activityLogUpdate', {
|
297 |
-
lastctime: this.lastALogCtime
|
298 |
-
}, function(res){ self.doneUpdateActivityLog(res); }, function(){ self.activityLogUpdatePending = false; }, true);
|
299 |
|
300 |
-
|
301 |
-
|
302 |
-
|
303 |
-
|
304 |
-
|
305 |
-
|
306 |
-
|
307 |
-
this.processActQueue(res.currentScanID);
|
308 |
-
}
|
309 |
-
}
|
310 |
-
this.activityLogUpdatePending = false;
|
311 |
-
},
|
312 |
-
processActQueue: function(currentScanID){
|
313 |
-
if(this.activityQueue.length > 0){
|
314 |
-
this.addActItem(this.activityQueue.shift());
|
315 |
-
this.totalActAdded++;
|
316 |
-
if(this.totalActAdded > this.maxActivityLogItems){
|
317 |
-
jQuery('#consoleActivity div:first').remove();
|
318 |
-
this.totalActAdded--;
|
319 |
-
}
|
320 |
-
var timeTillNextUpdate = this.actNextUpdateAt - (new Date()).getTime();
|
321 |
-
var maxRate = 50 / 1000; //Rate per millisecond
|
322 |
-
var bulkTotal = 0;
|
323 |
-
while(this.activityQueue.length > 0 && this.activityQueue.length / timeTillNextUpdate > maxRate ){
|
324 |
-
var item = this.activityQueue.shift();
|
325 |
-
if(item){
|
326 |
-
bulkTotal++;
|
327 |
-
this.addActItem(item);
|
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 |
-
jQuery('#wfStartingScan').addClass('wfSummaryOK').html('Done.');
|
360 |
-
} else if(this.debugOn || item.level < 4){
|
361 |
-
|
362 |
-
var html = '<div class="wfActivityLine';
|
363 |
-
if(this.debugOn){
|
364 |
-
html += ' wf' + item.type;
|
365 |
-
}
|
366 |
-
html += '">[' + item.date + '] ' + item.msg + '</div>';
|
367 |
-
jQuery('#consoleActivity').append(html);
|
368 |
-
if(/Scan complete\./i.test(item.msg)){
|
369 |
-
this.loadIssues();
|
370 |
-
}
|
371 |
-
}
|
372 |
-
},
|
373 |
-
processSummaryLine: function(item){
|
374 |
-
var msg, summaryUpdated;
|
375 |
-
if(item.msg.indexOf('SUM_START:') != -1){
|
376 |
-
msg = item.msg.replace('SUM_START:', '');
|
377 |
-
jQuery('#consoleSummary').append('<div class="wfSummaryLine"><div class="wfSummaryDate">[' + item.date + ']</div><div class="wfSummaryMsg">' + msg + '</div><div class="wfSummaryResult"><div class="wfSummaryLoading"></div></div><div class="wfClear"></div>');
|
378 |
-
summaryUpdated = true;
|
379 |
-
} else if(item.msg.indexOf('SUM_ENDBAD') != -1){
|
380 |
-
msg = item.msg.replace('SUM_ENDBAD:', '');
|
381 |
-
jQuery('div.wfSummaryMsg:contains("' + msg + '")').next().addClass('wfSummaryBad').html('Problems found.');
|
382 |
-
summaryUpdated = true;
|
383 |
-
} else if(item.msg.indexOf('SUM_ENDFAILED') != -1){
|
384 |
-
msg = item.msg.replace('SUM_ENDFAILED:', '');
|
385 |
-
jQuery('div.wfSummaryMsg:contains("' + msg + '")').next().addClass('wfSummaryBad').html('Failed.');
|
386 |
-
summaryUpdated = true;
|
387 |
-
} else if(item.msg.indexOf('SUM_ENDOK') != -1){
|
388 |
-
msg = item.msg.replace('SUM_ENDOK:', '');
|
389 |
-
jQuery('div.wfSummaryMsg:contains("' + msg + '")').next().addClass('wfSummaryOK').html('Secure.');
|
390 |
-
summaryUpdated = true;
|
391 |
-
} else if(item.msg.indexOf('SUM_ENDSUCCESS') != -1){
|
392 |
-
msg = item.msg.replace('SUM_ENDSUCCESS:', '');
|
393 |
-
jQuery('div.wfSummaryMsg:contains("' + msg + '")').next().addClass('wfSummaryOK').html('Success.');
|
394 |
-
summaryUpdated = true;
|
395 |
-
} else if(item.msg.indexOf('SUM_ENDERR') != -1){
|
396 |
-
msg = item.msg.replace('SUM_ENDERR:', '');
|
397 |
-
jQuery('div.wfSummaryMsg:contains("' + msg + '")').next().addClass('wfSummaryErr').html('An error occurred.');
|
398 |
-
summaryUpdated = true;
|
399 |
-
} else if(item.msg.indexOf('SUM_DISABLED:') != -1){
|
400 |
-
msg = item.msg.replace('SUM_DISABLED:', '');
|
401 |
-
jQuery('#consoleSummary').append('<div class="wfSummaryLine"><div class="wfSummaryDate">[' + item.date + ']</div><div class="wfSummaryMsg">' + msg + '</div><div class="wfSummaryResult">Disabled [<a href="admin.php?page=WordfenceSecOpt">Visit Options to Enable</a>]</div><div class="wfClear"></div>');
|
402 |
-
summaryUpdated = true;
|
403 |
-
} else if(item.msg.indexOf('SUM_PAIDONLY:') != -1){
|
404 |
-
msg = item.msg.replace('SUM_PAIDONLY:', '');
|
405 |
-
jQuery('#consoleSummary').append('<div class="wfSummaryLine"><div class="wfSummaryDate">[' + item.date + ']</div><div class="wfSummaryMsg">' + msg + '</div><div class="wfSummaryResult"><a href="https://www.wordfence.com/wordfence-signup/" target="_blank">Paid Members Only</a></div><div class="wfClear"></div>');
|
406 |
-
summaryUpdated = true;
|
407 |
-
} else if(item.msg.indexOf('SUM_FINAL:') != -1){
|
408 |
-
msg = item.msg.replace('SUM_FINAL:', '');
|
409 |
-
jQuery('#consoleSummary').append('<div class="wfSummaryLine"><div class="wfSummaryDate">[' + item.date + ']</div><div class="wfSummaryMsg wfSummaryFinal">' + msg + '</div><div class="wfSummaryResult wfSummaryOK">Scan Complete.</div><div class="wfClear"></div>');
|
410 |
-
} else if(item.msg.indexOf('SUM_PREP:') != -1){
|
411 |
-
msg = item.msg.replace('SUM_PREP:', '');
|
412 |
-
jQuery('#consoleSummary').empty().html('<div class="wfSummaryLine"><div class="wfSummaryDate">[' + item.date + ']</div><div class="wfSummaryMsg">' + msg + '</div><div class="wfSummaryResult" id="wfStartingScan"><div class="wfSummaryLoading"></div></div><div class="wfClear"></div>');
|
413 |
-
} else if(item.msg.indexOf('SUM_KILLED:') != -1){
|
414 |
-
msg = item.msg.replace('SUM_KILLED:', '');
|
415 |
-
jQuery('#consoleSummary').empty().html('<div class="wfSummaryLine"><div class="wfSummaryDate">[' + item.date + ']</div><div class="wfSummaryMsg">' + msg + '</div><div class="wfSummaryResult wfSummaryOK">Scan Complete.</div><div class="wfClear"></div>');
|
416 |
-
}
|
417 |
-
},
|
418 |
-
processActQueueItem: function(){
|
419 |
-
var item = this.activityQueue.shift();
|
420 |
-
if(item){
|
421 |
-
jQuery('#consoleActivity').append('<div class="wfActivityLine wf' + item.type + '">[' + item.date + '] ' + item.msg + '</div>');
|
422 |
-
this.totalActAdded++;
|
423 |
-
if(this.totalActAdded > this.maxActivityLogItems){
|
424 |
-
jQuery('#consoleActivity div:first').remove();
|
425 |
-
this.totalActAdded--;
|
426 |
-
}
|
427 |
-
if(item.msg == 'Scan complete.'){
|
428 |
-
this.loadIssues();
|
429 |
-
}
|
430 |
-
}
|
431 |
-
},
|
432 |
-
updateTicker: function(forceUpdate){
|
433 |
-
if( (! forceUpdate) && this.tickerUpdatePending){
|
434 |
-
return;
|
435 |
-
}
|
436 |
-
this.tickerUpdatePending = true;
|
437 |
-
var self = this;
|
438 |
-
var alsoGet = '';
|
439 |
-
var otherParams = '';
|
440 |
-
if(this.mode == 'activity' && /^(?:404|hit|human|ruser|gCrawler|crawler|loginLogout)#x2F;.test(this.activityMode)){
|
441 |
-
alsoGet = 'logList_' + this.activityMode;
|
442 |
-
otherParams = this.newestActivityTime;
|
443 |
-
} else if(this.mode == 'perfStats'){
|
444 |
-
alsoGet = 'perfStats';
|
445 |
-
otherParams = this.newestActivityTime;
|
446 |
-
}
|
447 |
-
this.ajax('wordfence_ticker', {
|
448 |
-
alsoGet: alsoGet,
|
449 |
-
otherParams: otherParams
|
450 |
-
}, function(res){ self.handleTickerReturn(res); }, function(){ self.tickerUpdatePending = false; }, true);
|
451 |
-
},
|
452 |
-
handleTickerReturn: function(res){
|
453 |
-
this.tickerUpdatePending = false;
|
454 |
-
var newMsg = "";
|
455 |
-
var oldMsg = jQuery('#wfLiveStatus').text();
|
456 |
-
if( res.msg ){
|
457 |
-
newMsg = res.msg;
|
458 |
-
} else {
|
459 |
-
newMsg = "Idle";
|
460 |
-
}
|
461 |
-
if(newMsg && newMsg != oldMsg){
|
462 |
-
jQuery('#wfLiveStatus').hide().html(newMsg).fadeIn(200);
|
463 |
-
}
|
464 |
-
var haveEvents, newElem;
|
465 |
-
if(this.mode == 'activity'){
|
466 |
-
if(res.alsoGet != 'logList_' + this.activityMode){ return; } //user switched panels since ajax request started
|
467 |
-
if(res.events.length > 0){
|
468 |
-
this.newestActivityTime = res.events[0]['ctime'];
|
469 |
-
}
|
470 |
-
haveEvents = false;
|
471 |
-
if(jQuery('#wfActivity_' + this.activityMode + ' .wfActEvent').length > 0){
|
472 |
-
haveEvents = true;
|
473 |
-
}
|
474 |
-
if(res.events.length > 0){
|
475 |
-
if(! haveEvents){
|
476 |
-
jQuery('#wfActivity_' + this.activityMode).empty();
|
477 |
-
}
|
478 |
-
for(i = res.events.length - 1; i >= 0; i--){
|
479 |
-
var elemID = '#wfActEvent_' + res.events[i].id;
|
480 |
-
if(jQuery(elemID).length < 1){
|
481 |
-
res.events[i]['activityMode'] = this.activityMode;
|
482 |
-
if(this.activityMode == 'loginLogout'){
|
483 |
-
newElem = jQuery('#wfLoginLogoutEventTmpl').tmpl(res.events[i]);
|
484 |
-
} else {
|
485 |
-
newElem = jQuery('#wfHitsEventTmpl').tmpl(res.events[i]);
|
486 |
}
|
487 |
-
|
488 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
489 |
}
|
|
|
|
|
|
|
490 |
}
|
491 |
-
|
492 |
-
|
493 |
-
if
|
494 |
-
|
|
|
495 |
}
|
496 |
-
|
497 |
-
|
498 |
-
|
499 |
-
|
500 |
-
|
501 |
-
|
502 |
-
haveEvents = false;
|
503 |
-
if(jQuery('#wfPerfStats .wfPerfEvent').length > 0){
|
504 |
-
haveEvents = true;
|
505 |
-
}
|
506 |
-
if(res.events.length > 0){
|
507 |
-
if(! haveEvents){
|
508 |
-
jQuery('#wfPerfStats').empty();
|
509 |
-
}
|
510 |
-
var curLength = parseInt(jQuery('#wfPerfStats').css('width'));
|
511 |
-
if(res.longestLine > curLength){
|
512 |
-
jQuery('#wfPerfStats').css('width', (res.longestLine + 200) + 'px');
|
513 |
-
}
|
514 |
-
this.newestActivityTime = res.events[0]['ctime'];
|
515 |
-
for(var i = res.events.length - 1; i >= 0; i--){
|
516 |
-
res.events[i]['scale'] = this.performanceScale;
|
517 |
-
res.events[i]['min'] = this.performanceMinWidth;
|
518 |
-
newElem = jQuery('#wfPerfStatTmpl').tmpl(res.events[i]);
|
519 |
-
jQuery(newElem).find('.wfTimeAgo').data('wfctime', res.events[i].ctime);
|
520 |
-
newElem.prependTo('#wfPerfStats').fadeIn();
|
521 |
-
}
|
522 |
-
} else {
|
523 |
-
if(! haveEvents){
|
524 |
-
jQuery('#wfPerfStats').html('<p>No events to report yet.</p>');
|
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 |
-
this.ajax('wordfence_reverseLookup', {
|
551 |
-
ips: uniqueIPs.join(',')
|
552 |
-
},
|
553 |
-
function(res){
|
554 |
-
if(res.ok){
|
555 |
-
jQuery('.wfReverseLookup').each(function(idx, elem){
|
556 |
-
var txt = jQuery(elem).text();
|
557 |
-
for(var ip in res.ips){
|
558 |
-
if(txt == ip){
|
559 |
-
if(res.ips[ip]){
|
560 |
-
jQuery(elem).html('<strong>Hostname:</strong> ' + res.ips[ip]);
|
561 |
-
} else {
|
562 |
-
jQuery(elem).html('');
|
563 |
-
}
|
564 |
-
}
|
565 |
-
}
|
566 |
-
});
|
567 |
}
|
568 |
-
|
569 |
-
|
570 |
-
|
571 |
-
|
572 |
-
|
573 |
-
|
574 |
-
|
575 |
-
|
576 |
-
|
577 |
-
|
578 |
-
|
579 |
-
},
|
580 |
-
startScan: function(){
|
581 |
-
var scanReqAnimation = setInterval(function(){
|
582 |
-
var str = jQuery('#wfStartScanButton1').prop('value');
|
583 |
-
var ch = str.charAt(str.length - 1);
|
584 |
-
if(ch == '/'){ ch = '-'; }
|
585 |
-
else if(ch == '-'){ ch = '\\'; }
|
586 |
-
else if(ch == '\\'){ ch = '|'; }
|
587 |
-
else if(ch == '|'){ ch = '/'; }
|
588 |
-
else {ch = '/'; }
|
589 |
-
jQuery('#wfStartScanButton1,#wfStartScanButton2').prop('value', "Requesting a New Scan " + ch);
|
590 |
-
}, 100);
|
591 |
-
setTimeout(function(res){
|
592 |
-
clearInterval(scanReqAnimation);
|
593 |
-
jQuery('#wfStartScanButton1,#wfStartScanButton2').prop('value', "Start a Wordfence Scan");
|
594 |
-
}, 3000);
|
595 |
-
this.ajax('wordfence_scan', {}, function(res){ } );
|
596 |
-
},
|
597 |
-
loadIssues: function(callback){
|
598 |
-
if(this.mode != 'scan'){
|
599 |
-
return;
|
600 |
-
}
|
601 |
-
var self = this;
|
602 |
-
this.ajax('wordfence_loadIssues', { }, function(res){
|
603 |
-
self.displayIssues(res, callback);
|
604 |
-
});
|
605 |
-
},
|
606 |
-
sev2num: function(str){
|
607 |
-
if(/wfProbSev1/.test(str)){
|
608 |
-
return 1;
|
609 |
-
} else if(/wfProbSev2/.test(str)){
|
610 |
-
return 2;
|
611 |
-
} else {
|
612 |
-
return 0;
|
613 |
-
}
|
614 |
-
},
|
615 |
-
displayIssues: function(res, callback){
|
616 |
-
var self = this;
|
617 |
-
try {
|
618 |
-
res.summary['lastScanCompleted'] = res['lastScanCompleted'];
|
619 |
-
} catch(err){
|
620 |
-
res.summary['lastScanCompleted'] = 'Never';
|
621 |
-
}
|
622 |
-
jQuery('.wfIssuesContainer').hide();
|
623 |
-
for(var issueStatus in res.issuesLists){
|
624 |
-
var containerID = 'wfIssues_dataTable_' + issueStatus;
|
625 |
-
var tableID = 'wfIssuesTable_' + issueStatus;
|
626 |
-
if(jQuery('#' + containerID).length < 1){
|
627 |
-
//Invalid issue status
|
628 |
-
continue;
|
629 |
-
}
|
630 |
-
if(res.issuesLists[issueStatus].length < 1){
|
631 |
-
if(issueStatus == 'new'){
|
632 |
-
if(res.lastScanCompleted == 'ok'){
|
633 |
-
jQuery('#' + containerID).html('<p style="font-size: 20px; color: #0A0;">Congratulations! No security problems were detected by Wordfence.</p>');
|
634 |
-
} else if(res['lastScanCompleted']){
|
635 |
-
//jQuery('#' + containerID).html('<p style="font-size: 12px; color: #A00;">The latest scan failed: ' + res.lastScanCompleted + '</p>');
|
636 |
} else {
|
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 |
-
var tmplName = 'issueTmpl_' + obj.aData.type;
|
675 |
-
return jQuery('#' + tmplName).tmpl(obj.aData).html();
|
676 |
-
}
|
677 |
-
}
|
678 |
-
]
|
679 |
-
});
|
680 |
-
}
|
681 |
-
if(callback){
|
682 |
-
jQuery('#wfIssues_' + this.visibleIssuesPanel).fadeIn(500, function(){ callback(); });
|
683 |
-
} else {
|
684 |
-
jQuery('#wfIssues_' + this.visibleIssuesPanel).fadeIn(500);
|
685 |
-
}
|
686 |
-
return true;
|
687 |
-
},
|
688 |
-
ajax: function(action, data, cb, cbErr, noLoading){
|
689 |
-
if(typeof(data) == 'string'){
|
690 |
-
if(data.length > 0){
|
691 |
-
data += '&';
|
692 |
-
}
|
693 |
-
data += 'action=' + action + '&nonce=' + this.nonce;
|
694 |
-
} else if(typeof(data) == 'object'){
|
695 |
-
data['action'] = action;
|
696 |
-
data['nonce'] = this.nonce;
|
697 |
-
}
|
698 |
-
if(! cbErr){
|
699 |
-
cbErr = function(){};
|
700 |
-
}
|
701 |
-
var self = this;
|
702 |
-
if(! noLoading){
|
703 |
-
this.showLoading();
|
704 |
-
}
|
705 |
-
jQuery.ajax({
|
706 |
-
type: 'POST',
|
707 |
-
url: WordfenceAdminVars.ajaxURL,
|
708 |
-
dataType: "json",
|
709 |
-
data: data,
|
710 |
-
success: function(json){
|
711 |
-
if(! noLoading){
|
712 |
-
self.removeLoading();
|
713 |
-
}
|
714 |
-
if(json && json.nonce){
|
715 |
-
self.nonce = json.nonce;
|
716 |
-
}
|
717 |
-
if(json && json.errorMsg){
|
718 |
-
self.colorbox('400px', 'An error occurred', json.errorMsg);
|
719 |
-
}
|
720 |
-
cb(json);
|
721 |
-
},
|
722 |
-
error: function(){
|
723 |
-
if(! noLoading){
|
724 |
-
self.removeLoading();
|
725 |
-
}
|
726 |
-
cbErr();
|
727 |
-
}
|
728 |
-
});
|
729 |
-
},
|
730 |
-
colorbox: function(width, heading, body){
|
731 |
-
this.colorboxQueue.push([width, heading, body]);
|
732 |
-
this.colorboxServiceQueue();
|
733 |
-
},
|
734 |
-
colorboxServiceQueue: function(){
|
735 |
-
if(this.colorboxIsOpen){ return; }
|
736 |
-
if(this.colorboxQueue.length < 1){ return; }
|
737 |
-
var elem = this.colorboxQueue.shift();
|
738 |
-
this.colorboxOpen(elem[0], elem[1], elem[2]);
|
739 |
-
},
|
740 |
-
colorboxOpen: function(width, heading, body){
|
741 |
-
this.colorboxIsOpen = true;
|
742 |
-
jQuery.colorbox({ width: width, html: "<h3>" + heading + "</h3><p>" + body + "</p>"});
|
743 |
-
},
|
744 |
-
scanRunningMsg: function(){ this.colorbox('400px', "A scan is running", "A scan is currently in progress. Please wait until it finishes before starting another scan."); },
|
745 |
-
errorMsg: function(msg){ this.colorbox('400px', "An error occurred:", msg); },
|
746 |
-
bulkOperation: function(op){
|
747 |
-
var self = this;
|
748 |
-
if(op == 'del' || op == 'repair'){
|
749 |
-
var ids = jQuery('input.wf' + op + 'Checkbox:checked').map(function(){ return jQuery(this).val(); }).get();
|
750 |
-
if(ids.length < 1){
|
751 |
-
this.colorbox('400px', "No files were selected", "You need to select files to perform a bulk operation. There is a checkbox in each issue that lets you select that file. You can then select a bulk operation and hit the button to perform that bulk operation.");
|
752 |
-
return;
|
753 |
-
}
|
754 |
-
if(op == 'del'){
|
755 |
-
this.colorbox('400px', "Are you sure you want to delete?", "Are you sure you want to delete a total of " + ids.length + " files? Do not delete files on your system unless you're ABSOLUTELY sure you know what you're doing. If you delete the wrong file it could cause your WordPress website to stop functioning and you will probably have to restore from backups. If you're unsure, Cancel and work with your hosting provider to clean your system of infected files.<br /><br /><input type=\"button\" value=\"Delete Files\" onclick=\"WFAD.bulkOperationConfirmed('" + op + "');\" /> <input type=\"button\" value=\"Cancel\" onclick=\"jQuery.colorbox.close();\" /><br />");
|
756 |
-
} else if(op == 'repair'){
|
757 |
-
this.colorbox('400px', "Are you sure you want to repair?", "Are you sure you want to repair a total of " + ids.length + " files? Do not repair files on your system unless you're sure you have reviewed the differences between the original file and your version of the file in the files you are repairing. If you repair a file that has been customized for your system by a developer or your hosting provider it may leave your system unusable. If you're unsure, Cancel and work with your hosting provider to clean your system of infected files.<br /><br /><input type=\"button\" value=\"Repair Files\" onclick=\"WFAD.bulkOperationConfirmed('" + op + "');\" /> <input type=\"button\" value=\"Cancel\" onclick=\"jQuery.colorbox.close();\" /><br />");
|
758 |
-
}
|
759 |
-
} else {
|
760 |
-
return;
|
761 |
-
}
|
762 |
-
},
|
763 |
-
bulkOperationConfirmed: function(op){
|
764 |
-
jQuery.colorbox.close();
|
765 |
-
var self = this;
|
766 |
-
this.ajax('wordfence_bulkOperation', {
|
767 |
-
op: op,
|
768 |
-
ids: jQuery('input.wf' + op + 'Checkbox:checked').map(function(){ return jQuery(this).val(); }).get()
|
769 |
-
}, function(res){ self.doneBulkOperation(res); });
|
770 |
-
},
|
771 |
-
doneBulkOperation: function(res){
|
772 |
-
var self = this;
|
773 |
-
if(res.ok){
|
774 |
-
this.loadIssues(function(){ self.colorbox('400px', res.bulkHeading, res.bulkBody); });
|
775 |
-
} else {
|
776 |
-
this.loadIssues(function(){});
|
777 |
-
}
|
778 |
-
},
|
779 |
-
deleteFile: function(issueID){
|
780 |
-
var self = this;
|
781 |
-
this.ajax('wordfence_deleteFile', {
|
782 |
-
issueID: issueID
|
783 |
-
}, function(res){ self.doneDeleteFile(res); });
|
784 |
-
},
|
785 |
-
doneDeleteFile: function(res){
|
786 |
-
var cb = false;
|
787 |
-
var self = this;
|
788 |
-
if(res.ok){
|
789 |
-
this.loadIssues(function(){ self.colorbox('400px', "Success deleting file", "The file " + res.file + " was successfully deleted."); });
|
790 |
-
} else if(res.cerrorMsg){
|
791 |
-
this.loadIssues(function(){ self.colorbox('400px', 'An error occurred', res.cerrorMsg); });
|
792 |
-
}
|
793 |
-
},
|
794 |
-
restoreFile: function(issueID){
|
795 |
-
var self = this;
|
796 |
-
this.ajax('wordfence_restoreFile', {
|
797 |
-
issueID: issueID
|
798 |
-
}, function(res){ self.doneRestoreFile(res); });
|
799 |
-
},
|
800 |
-
doneRestoreFile: function(res){
|
801 |
-
var self = this;
|
802 |
-
if(res.ok){
|
803 |
-
this.loadIssues(function(){ self.colorbox("400px", "File restored OK", "The file " + res.file + " was restored succesfully."); });
|
804 |
-
} else if(res.cerrorMsg){
|
805 |
-
this.loadIssues(function(){ self.colorbox('400px', 'An error occurred', res.cerrorMsg); });
|
806 |
-
}
|
807 |
-
},
|
808 |
-
deleteIssue: function(id){
|
809 |
-
var self = this;
|
810 |
-
this.ajax('wordfence_deleteIssue', { id: id }, function(res){
|
811 |
-
self.loadIssues();
|
812 |
-
});
|
813 |
-
},
|
814 |
-
updateIssueStatus: function(id, st){
|
815 |
-
var self = this;
|
816 |
-
this.ajax('wordfence_updateIssueStatus', { id: id, 'status': st }, function(res){
|
817 |
-
if(res.ok){
|
818 |
-
self.loadIssues();
|
819 |
-
}
|
820 |
-
});
|
821 |
-
},
|
822 |
-
updateAllIssues: function(op){ // deleteIgnored, deleteNew, ignoreAllNew
|
823 |
-
var head = "Please confirm";
|
824 |
-
var body;
|
825 |
-
if(op == 'deleteIgnored'){
|
826 |
-
body = "You have chosen to remove all ignored issues. Once these issues are removed they will be re-scanned by Wordfence and if they have not been fixed, they will appear in the 'new issues' list. Are you sure you want to do this?";
|
827 |
-
} else if(op == 'deleteNew'){
|
828 |
-
body = "You have chosen to mark all new issues as fixed. If you have not really fixed these issues, they will reappear in the new issues list on the next scan. If you have not fixed them and want them excluded from scans you should choose to 'ignore' them instead. Are you sure you want to mark all new issues as fixed?";
|
829 |
-
} else if(op == 'ignoreAllNew'){
|
830 |
-
body = "You have chosen to ignore all new issues. That means they will be excluded from future scans. You should only do this if you're sure all new issues are not a problem. Are you sure you want to ignore all new issues?";
|
831 |
-
} else {
|
832 |
-
return;
|
833 |
-
}
|
834 |
-
this.colorbox('450px', head, body + '<br /><br /><center><input type="button" name="but1" value="Cancel" onclick="jQuery.colorbox.close();" /> <input type="button" name="but2" value="Yes I\'m sure" onclick="jQuery.colorbox.close(); WFAD.confirmUpdateAllIssues(\'' + op + '\');" /><br />');
|
835 |
-
},
|
836 |
-
confirmUpdateAllIssues: function(op){
|
837 |
-
var self = this;
|
838 |
-
this.ajax('wordfence_updateAllIssues', { op: op }, function(res){ self.loadIssues(); });
|
839 |
-
},
|
840 |
-
es: function(val){
|
841 |
-
if(val){
|
842 |
-
return val;
|
843 |
-
} else {
|
844 |
-
return "";
|
845 |
-
}
|
846 |
-
},
|
847 |
-
noQuotes: function(str){
|
848 |
-
return str.replace(/"/g,'"').replace(/\'/g, '‘');
|
849 |
-
},
|
850 |
-
commify: function(num){
|
851 |
-
return ("" + num).replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
|
852 |
-
},
|
853 |
-
switchToLiveTab: function(elem){
|
854 |
-
jQuery('.wfTab1').removeClass('selected');
|
855 |
-
jQuery(elem).addClass('selected');
|
856 |
-
jQuery('.wfDataPanel').hide();
|
857 |
-
var self = this;
|
858 |
-
jQuery('#wfActivity').fadeIn(function(){ self.completeLiveTabSwitch(); });
|
859 |
-
},
|
860 |
-
completeLiveTabSwitch: function(){
|
861 |
-
this.ajax('wordfence_loadActivityLog', {}, function(res){
|
862 |
-
var html = '<a href="#" class="wfALogMailLink" onclick="WFAD.emailActivityLog(); return false;"></a><a href="#" class="wfALogReloadLink" onclick="WFAD.reloadActivityData(); return false;"></a>';
|
863 |
-
if(res.events && res.events.length > 0){
|
864 |
-
jQuery('#wfActivity').empty();
|
865 |
-
for(var i = 0; i < res.events.length; i++){
|
866 |
-
var timeTaken = '0.0000';
|
867 |
-
if(res.events[i + 1]){
|
868 |
-
timeTaken = (res.events[i].ctime - res.events[i + 1].ctime).toFixed(4);
|
869 |
-
}
|
870 |
-
var red = "";
|
871 |
-
if(res.events[i].type == 'error'){
|
872 |
-
red = ' class="wfWarn" ';
|
873 |
-
}
|
874 |
-
html += '<div ' + red + 'class="wfALogEntry"><span ' + red + 'class="wfALogTime">[' + res.events[i].type + ' : ' + timeTaken + ' : ' + res.events[i].timeAgo + ' ago]</span> ' + res.events[i].msg + "</div>";
|
875 |
-
}
|
876 |
-
jQuery('#wfActivity').html(html);
|
877 |
-
} else {
|
878 |
-
jQuery('#wfActivity').html("<p> No activity to report yet. Please complete your first scan.</p>");
|
879 |
-
}
|
880 |
-
});
|
881 |
-
},
|
882 |
-
emailActivityLog: function(){
|
883 |
-
this.colorbox('400px', 'Email Wordfence Activity Log', "Enter the email address you would like to send the Wordfence activity log to. Note that the activity log may contain thousands of lines of data. This log is usually only sent to a member of the Wordfence support team. It also contains your PHP configuration from the phpinfo() function for diagnostic data.<br /><br /><input type='text' value='support@wordfence.com' size='20' id='wfALogRecip' /><input type='button' value='Send' onclick=\"WFAD.completeEmailActivityLog();\" /><input type='button' value='Cancel' onclick='jQuery.colorbox.close();' /><br /><br />");
|
884 |
-
},
|
885 |
-
completeEmailActivityLog: function(){
|
886 |
-
jQuery.colorbox.close();
|
887 |
-
var email = jQuery('#wfALogRecip').val();
|
888 |
-
if(! /^[^@]+@[^@]+#x2F;.test(email)){
|
889 |
-
alert("Please enter a valid email address.");
|
890 |
-
return;
|
891 |
-
}
|
892 |
-
var self = this;
|
893 |
-
this.ajax('wordfence_sendActivityLog', { email: jQuery('#wfALogRecip').val() }, function(res){
|
894 |
-
if(res.ok){
|
895 |
-
self.colorbox('400px', 'Activity Log Sent', "Your Wordfence activity log was sent to " + email + "<br /><br /><input type='button' value='Close' onclick='jQuery.colorbox.close();' /><br /><br />");
|
896 |
-
}
|
897 |
-
});
|
898 |
-
},
|
899 |
-
reloadActivityData: function(){
|
900 |
-
jQuery('#wfActivity').html('<div class="wfLoadingWhite32"></div>'); // <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br /> <br />
|
901 |
-
this.completeLiveTabSwitch();
|
902 |
-
},
|
903 |
-
switchToSummaryTab: function(elem){
|
904 |
-
jQuery('.wfTab1').removeClass('selected');
|
905 |
-
jQuery(elem).addClass('selected');
|
906 |
-
jQuery('.wfDataPanel').hide();
|
907 |
-
jQuery('#wfSummaryTables').fadeIn();
|
908 |
-
},
|
909 |
-
switchIssuesTab: function(elem, type){
|
910 |
-
jQuery('.wfTab2').removeClass('selected');
|
911 |
-
jQuery('.wfIssuesContainer').hide();
|
912 |
-
jQuery(elem).addClass('selected');
|
913 |
-
this.visibleIssuesPanel = type;
|
914 |
-
jQuery('#wfIssues_' + type).fadeIn();
|
915 |
-
},
|
916 |
-
switchTab: function(tabElement, tabClass, contentClass, selectedContentID, callback){
|
917 |
-
jQuery('.' + tabClass).removeClass('selected');
|
918 |
-
jQuery(tabElement).addClass('selected');
|
919 |
-
jQuery('.' + contentClass).hide().html('<div class="wfLoadingWhite32"></div>');
|
920 |
-
var func = function(){};
|
921 |
-
if(callback){
|
922 |
-
func = function(){ callback(); };
|
923 |
-
}
|
924 |
-
jQuery('#' + selectedContentID).fadeIn(func);
|
925 |
-
},
|
926 |
-
activityTabChanged: function(){
|
927 |
-
var mode = jQuery('.wfDataPanel:visible')[0].id.replace('wfActivity_','');
|
928 |
-
if(! mode){ return; }
|
929 |
-
this.activityMode = mode;
|
930 |
-
this.reloadActivities();
|
931 |
-
},
|
932 |
-
reloadActivities: function(){
|
933 |
-
jQuery('#wfActivity_' + this.activityMode).html('<div class="wfLoadingWhite32"></div>');
|
934 |
-
this.newestActivityTime = 0;
|
935 |
-
this.updateTicker(true);
|
936 |
-
},
|
937 |
-
staticTabChanged: function(){
|
938 |
-
var mode = jQuery('.wfDataPanel:visible')[0].id.replace('wfActivity_','');
|
939 |
-
if(! mode){ return; }
|
940 |
-
this.activityMode = mode;
|
941 |
-
|
942 |
-
var self = this;
|
943 |
-
this.ajax('wordfence_loadStaticPanel', {
|
944 |
-
mode: this.activityMode
|
945 |
-
}, function(res){
|
946 |
-
self.completeLoadStaticPanel(res);
|
947 |
-
});
|
948 |
-
},
|
949 |
-
completeLoadStaticPanel: function(res){
|
950 |
-
var contentElem = '#wfActivity_' + this.activityMode;
|
951 |
-
jQuery(contentElem).empty();
|
952 |
-
if(res.results && res.results.length > 0){
|
953 |
-
var tmpl;
|
954 |
-
if(this.activityMode == 'topScanners' || this.activityMode == 'topLeechers'){
|
955 |
-
tmpl = '#wfLeechersTmpl';
|
956 |
-
} else if(this.activityMode == 'blockedIPs'){
|
957 |
-
tmpl = '#wfBlockedIPsTmpl';
|
958 |
-
} else if(this.activityMode == 'lockedOutIPs'){
|
959 |
-
tmpl = '#wfLockedOutIPsTmpl';
|
960 |
-
} else if(this.activityMode == 'throttledIPs'){
|
961 |
-
tmpl = '#wfThrottledIPsTmpl';
|
962 |
-
} else { return; }
|
963 |
-
var i, j, chunk = 1000;
|
964 |
-
var bigArray = res.results.slice(0);
|
965 |
-
res.results = false;
|
966 |
-
for(i = 0, j = bigArray.length; i < j; i += chunk){
|
967 |
-
res.results = bigArray.slice(i, i + chunk);
|
968 |
-
jQuery(tmpl).tmpl(res).appendTo(contentElem);
|
969 |
-
}
|
970 |
-
this.reverseLookupIPs();
|
971 |
-
} else {
|
972 |
-
if(this.activityMode == 'topScanners' || this.activityMode == 'topLeechers'){
|
973 |
-
jQuery(contentElem).html("No site hits have been logged yet. Check back soon.");
|
974 |
-
} else if(this.activityMode == 'blockedIPs'){
|
975 |
-
jQuery(contentElem).html("No IP addresses have been blocked yet. If you manually block an IP address or if Wordfence automatically blocks one, it will appear here.");
|
976 |
-
} else if(this.activityMode == 'lockedOutIPs'){
|
977 |
-
jQuery(contentElem).html("No IP addresses have been locked out from signing in or using the password recovery system.");
|
978 |
-
} else if(this.activityMode == 'throttledIPs'){
|
979 |
-
jQuery(contentElem).html("No IP addresses have been throttled yet. If an IP address accesses the site too quickly and breaks one of the Wordfence rules, it will appear here.");
|
980 |
-
} else { return; }
|
981 |
-
}
|
982 |
-
},
|
983 |
-
ucfirst: function(str){
|
984 |
-
str = "" + str;
|
985 |
-
return str.charAt(0).toUpperCase() + str.slice(1);
|
986 |
-
},
|
987 |
-
makeIPTrafLink: function(IP){
|
988 |
-
return WordfenceAdminVars.siteBaseURL + '?_wfsf=IPTraf&nonce=' + this.nonce + '&IP=' + encodeURIComponent(IP);
|
989 |
-
},
|
990 |
-
makeDiffLink: function(dat){
|
991 |
-
return WordfenceAdminVars.siteBaseURL + '?_wfsf=diff&nonce=' + this.nonce +
|
992 |
-
'&file=' + encodeURIComponent(this.es(dat['file'])) +
|
993 |
-
'&cType=' + encodeURIComponent(this.es(dat['cType'])) +
|
994 |
-
'&cKey=' + encodeURIComponent(this.es(dat['cKey'])) +
|
995 |
-
'&cName=' + encodeURIComponent(this.es(dat['cName'])) +
|
996 |
-
'&cVersion=' + encodeURIComponent(this.es(dat['cVersion']));
|
997 |
-
},
|
998 |
-
makeViewFileLink: function(file){
|
999 |
-
return WordfenceAdminVars.siteBaseURL + '?_wfsf=view&nonce=' + this.nonce + '&file=' + encodeURIComponent(file);
|
1000 |
-
},
|
1001 |
-
makeTimeAgo: function(t){
|
1002 |
-
var months = Math.floor(t / (86400 * 30));
|
1003 |
-
var days = Math.floor(t / 86400);
|
1004 |
-
var hours = Math.floor(t / 3600);
|
1005 |
-
var minutes = Math.floor(t / 60);
|
1006 |
-
if(months > 0){
|
1007 |
-
days -= months * 30;
|
1008 |
-
return this.pluralize(months, 'month', days, 'day');
|
1009 |
-
} else if(days > 0){
|
1010 |
-
hours -= days * 24;
|
1011 |
-
return this.pluralize(days, 'day', hours, 'hour');
|
1012 |
-
} else if(hours > 0) {
|
1013 |
-
minutes -= hours * 60;
|
1014 |
-
return this.pluralize(hours, 'hour', minutes, 'min');
|
1015 |
-
} else if(minutes > 0) {
|
1016 |
-
//t -= minutes * 60;
|
1017 |
-
return this.pluralize(minutes, 'minute');
|
1018 |
-
} else {
|
1019 |
-
return Math.round(t) + " seconds";
|
1020 |
-
}
|
1021 |
-
},
|
1022 |
-
pluralize: function(m1, t1, m2, t2){
|
1023 |
-
if(m1 != 1) {
|
1024 |
-
t1 = t1 + 's';
|
1025 |
-
}
|
1026 |
-
if(m2 != 1) {
|
1027 |
-
t2 = t2 + 's';
|
1028 |
-
}
|
1029 |
-
if(m1 && m2){
|
1030 |
-
return m1 + ' ' + t1 + ' ' + m2 + ' ' + t2;
|
1031 |
-
} else {
|
1032 |
-
return m1 + ' ' + t1;
|
1033 |
-
}
|
1034 |
-
},
|
1035 |
-
calcRangeTotal: function(){
|
1036 |
-
var range = jQuery('#ipRange').val();
|
1037 |
-
if(! range){ return; }
|
1038 |
-
range = range.replace(/ /g, '');
|
1039 |
-
if(range && /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\s*\-\s*\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}#x2F;.test(range)){
|
1040 |
-
var ips = range.split('-');
|
1041 |
-
var total = this.inet_aton(ips[1]) - this.inet_aton(ips[0]) + 1;
|
1042 |
-
if(total < 1){
|
1043 |
-
jQuery('#wfShowRangeTotal').html("<span style=\"color: #F00;\">Invalid. Starting IP is greater than ending IP.</span>");
|
1044 |
-
return;
|
1045 |
-
}
|
1046 |
-
jQuery('#wfShowRangeTotal').html("<span style=\"color: #0A0;\">Valid: " + total + " addresses in range.</span>");
|
1047 |
-
} else {
|
1048 |
-
jQuery('#wfShowRangeTotal').empty();
|
1049 |
-
}
|
1050 |
-
},
|
1051 |
-
loadBlockRanges: function(){
|
1052 |
-
var self = this;
|
1053 |
-
this.ajax('wordfence_loadBlockRanges', {}, function(res){ self.completeLoadBlockRanges(res); });
|
1054 |
-
|
1055 |
-
},
|
1056 |
-
completeLoadBlockRanges: function(res){
|
1057 |
-
jQuery('#currentBlocks').empty();
|
1058 |
-
if(res.results && res.results.length > 0){
|
1059 |
-
jQuery('#wfBlockedRangesTmpl').tmpl(res).prependTo('#currentBlocks');
|
1060 |
-
} else {
|
1061 |
-
jQuery('#currentBlocks').html("You have not blocked any IP ranges or other patterns yet.");
|
1062 |
-
}
|
1063 |
-
},
|
1064 |
-
whois: function(val){
|
1065 |
-
val = val.replace(' ','');
|
1066 |
-
if( ! /\w+/.test(val)){
|
1067 |
-
this.colorbox('300px', "Enter a valid IP or domain", "Please enter a valid IP address or domain name for your whois lookup.");
|
1068 |
-
return;
|
1069 |
-
}
|
1070 |
-
var self = this;
|
1071 |
-
jQuery('#whoisbutton').attr('disabled', 'disabled');
|
1072 |
-
jQuery('#whoisbutton').attr('value', 'Loading...');
|
1073 |
-
this.ajax('wordfence_whois', {
|
1074 |
-
val: val
|
1075 |
-
}, function(res){
|
1076 |
-
jQuery('#whoisbutton').removeAttr('disabled');
|
1077 |
-
jQuery('#whoisbutton').attr('value', 'Look up IP or Domain');
|
1078 |
-
if(res.ok){
|
1079 |
-
self.completeWhois(res);
|
1080 |
-
}
|
1081 |
-
});
|
1082 |
-
},
|
1083 |
-
completeWhois: function(res){
|
1084 |
-
if(res.ok && res.result && res.result.rawdata && res.result.rawdata.length > 0){
|
1085 |
-
var rawhtml = "";
|
1086 |
-
for(var i = 0; i < res.result.rawdata.length; i++){
|
1087 |
-
res.result.rawdata[i] = jQuery('<div />').text(res.result.rawdata[i]).html();
|
1088 |
-
res.result.rawdata[i] = res.result.rawdata[i].replace(/([^\s\t\r\n:;]+@[^\s\t\r\n:;\.]+\.[^\s\t\r\n:;]+)/, "<a href=\"mailto:$1\">$1<\/a>");
|
1089 |
-
res.result.rawdata[i] = res.result.rawdata[i].replace(/(https?:\/\/[^\/]+[^\s\r\n\t]+)/, "<a target=\"_blank\" href=\"$1\">$1<\/a>");
|
1090 |
-
var redStyle = "";
|
1091 |
-
if(this.getQueryParam('wfnetworkblock')){
|
1092 |
-
redStyle = " style=\"color: #F00;\"";
|
1093 |
}
|
1094 |
var self = this;
|
1095 |
-
|
1096 |
-
|
1097 |
-
|
1098 |
-
|
1099 |
-
|
1100 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1101 |
}
|
1102 |
-
|
1103 |
-
|
1104 |
-
|
1105 |
-
|
1106 |
-
jQuery('#wfrawhtml').html(rawhtml);
|
1107 |
-
} else {
|
1108 |
-
jQuery('#wfrawhtml').html('<span style="color: #F00;">Sorry, but no data for that IP or domain was found.</span>');
|
1109 |
-
}
|
1110 |
-
},
|
1111 |
-
blockIPUARange: function(ipRange, uaRange, referer, reason){
|
1112 |
-
if(! /\w+/.test(reason)){
|
1113 |
-
this.colorbox('300px', "Please specify a reason", "You forgot to include a reason you're blocking this IP range. We ask you to include this for your own record keeping.");
|
1114 |
-
return;
|
1115 |
-
}
|
1116 |
-
ipRange = ipRange.replace(/ /g, '');
|
1117 |
-
if(ipRange){
|
1118 |
-
if(! /^\d+\.\d+\.\d+\.\d+\-\d+\.\d+\.\d+\.\d+#x2F;.test(ipRange)){
|
1119 |
-
this.colorbox('300px', 'Specify a valid IP range', "Please specify a valid IP address range in the form of \"1.2.3.4 - 1.2.3.5\" without quotes. Make sure the dash between the IP addresses in a normal dash (a minus sign on your keyboard) and not another character that looks like a dash.");
|
1120 |
-
return;
|
1121 |
-
}
|
1122 |
-
}
|
1123 |
-
if( ! (/\w+/.test(ipRange) || /\w+/.test(uaRange) || /\w+/.test(referer)) ){
|
1124 |
-
this.colorbox('300px', 'Specify an IP range or Browser pattern', "Please specify either an IP address range or a web browser pattern to match.");
|
1125 |
-
return;
|
1126 |
-
}
|
1127 |
-
var self = this;
|
1128 |
-
this.ajax('wordfence_blockIPUARange', {
|
1129 |
-
ipRange: ipRange,
|
1130 |
-
uaRange: uaRange,
|
1131 |
-
referer: referer,
|
1132 |
-
reason: reason
|
1133 |
-
}, function(res){
|
1134 |
-
if(res.ok){
|
1135 |
-
self.loadBlockRanges();
|
1136 |
-
return;
|
1137 |
}
|
1138 |
-
|
1139 |
-
|
1140 |
-
|
1141 |
-
|
1142 |
-
|
1143 |
-
|
1144 |
-
}, function(res){
|
1145 |
-
self.loadBlockRanges();
|
1146 |
-
});
|
1147 |
-
},
|
1148 |
-
blockIP: function(IP, reason){
|
1149 |
-
var self = this;
|
1150 |
-
this.ajax('wordfence_blockIP', {
|
1151 |
-
IP: IP,
|
1152 |
-
reason: reason
|
1153 |
-
}, function(res){
|
1154 |
-
if(res.errorMsg){
|
1155 |
-
return;
|
1156 |
} else {
|
1157 |
-
self.reloadActivities();
|
1158 |
-
}
|
1159 |
-
});
|
1160 |
-
},
|
1161 |
-
blockIPTwo: function(IP, reason, perm){
|
1162 |
-
var self = this;
|
1163 |
-
this.ajax('wordfence_blockIP', {
|
1164 |
-
IP: IP,
|
1165 |
-
reason: reason,
|
1166 |
-
perm: (perm ? '1' : '0')
|
1167 |
-
}, function(res){
|
1168 |
-
if(res.errorMsg){
|
1169 |
return;
|
1170 |
-
} else {
|
1171 |
-
self.staticTabChanged();
|
1172 |
}
|
1173 |
-
|
1174 |
-
|
1175 |
-
|
1176 |
-
|
1177 |
-
|
1178 |
-
|
1179 |
-
|
1180 |
-
|
1181 |
-
unblockIP: function(IP){
|
1182 |
-
var self = this;
|
1183 |
-
this.ajax('wordfence_unblockIP', {
|
1184 |
-
IP: IP
|
1185 |
-
}, function(res){
|
1186 |
-
self.reloadActivities();
|
1187 |
-
});
|
1188 |
-
},
|
1189 |
-
unblockIPTwo: function(IP){
|
1190 |
-
var self = this;
|
1191 |
-
this.ajax('wordfence_unblockIP', {
|
1192 |
-
IP: IP
|
1193 |
-
}, function(res){
|
1194 |
-
self.staticTabChanged();
|
1195 |
});
|
1196 |
-
|
1197 |
-
|
1198 |
-
|
1199 |
-
|
1200 |
-
|
1201 |
-
|
1202 |
-
|
1203 |
-
|
1204 |
-
return 'wfElemGen' + this.elementGeneratorIter++;
|
1205 |
-
},
|
1206 |
-
pulse: function(sel){
|
1207 |
-
jQuery(sel).fadeIn(function(){
|
1208 |
-
setTimeout(function(){ jQuery(sel).fadeOut(); }, 2000);
|
1209 |
-
});
|
1210 |
-
},
|
1211 |
-
getCacheStats: function(){
|
1212 |
-
var self = this;
|
1213 |
-
this.ajax('wordfence_getCacheStats', {}, function(res){
|
1214 |
-
if(res.ok){
|
1215 |
-
self.colorbox('400px', res.heading, res.body);
|
1216 |
-
}
|
1217 |
-
});
|
1218 |
-
},
|
1219 |
-
clearPageCache: function(){
|
1220 |
-
var self = this;
|
1221 |
-
this.ajax('wordfence_clearPageCache', {}, function(res){
|
1222 |
-
if(res.ok){
|
1223 |
-
self.colorbox('400px', res.heading, res.body);
|
1224 |
-
}
|
1225 |
-
});
|
1226 |
-
},
|
1227 |
-
switchToFalcon: function(){
|
1228 |
-
var self = this;
|
1229 |
-
this.ajax('wordfence_checkFalconHtaccess', {
|
1230 |
-
}, function(res){
|
1231 |
-
if(res.ok){
|
1232 |
-
self.colorbox('400px', "Enabling Falcon Engine", 'First read this <a href="http://www.wordfence.com/introduction-to-wordfence-falcon-engine/" target="_blank">Introduction to Falcon Engine</a>. Falcon modifies your website configuration file which is called your .htaccess file. To enable Falcon we ask that you make a backup of this file. This is a safety precaution in case for some reason Falcon is not compatible with your site.<br /><br /><a href="' + WordfenceAdminVars.ajaxURL + '?action=wordfence_downloadHtaccess&nonce=' + self.nonce + '" onclick="jQuery(\'#wfNextBut\').prop(\'disabled\', false); return true;">Click here to download a backup copy of your .htaccess file now</a><br /><br /><input type="button" name="but1" id="wfNextBut" value="Click to Enable Falcon Engine" disabled="disabled" onclick="WFAD.confirmSwitchToFalcon(0);" />');
|
1233 |
-
} else if(res.nginx){
|
1234 |
-
self.colorbox('400px', "Enabling Falcon Engine", 'You are using an Nginx web server and using a FastCGI processor like PHP5-FPM. To use Falcon you will need to manually modify your nginx.conf configuration file and reload your Nginx server for the changes to take effect. You can find the <a href="http://www.wordfence.com/blog/2014/05/nginx-wordfence-falcon-engine-php-fpm-fastcgi-fast-cgi/" target="_blank">rules you need to make these changes to nginx.conf on this page on wordfence.com</a>. Once you have made these changes, compressed cached files will be served to your visitors directly from Nginx making your site extremely fast. When you have made the changes and reloaded your Nginx server, you can click the button below to enable Falcon.<br /><br /><input type="button" name="but1" id="wfNextBut" value="Click to Enable Falcon Engine" onclick="WFAD.confirmSwitchToFalcon(1);" />');
|
1235 |
-
} else if(res.err){
|
1236 |
-
self.colorbox('400px', "We encountered a problem", "We can't modify your .htaccess file for you because: " + res.err + "<br /><br />Advanced users: If you would like to manually enable Falcon yourself by editing your .htaccess, you can add the rules below to the beginning of your .htaccess file. Then click the button below to enable Falcon. Don't do this unless you understand website configuration.<br /><textarea style='width: 300px; height:100px;' readonly>" + jQuery('<div/>').text(res.code).html() + "</textarea><br /><input type='button' value='Enable Falcon after manually editing .htaccess' onclick='WFAD.confirmSwitchToFalcon(1);' />");
|
1237 |
-
}
|
1238 |
-
});
|
1239 |
-
},
|
1240 |
-
confirmSwitchToFalcon: function(noEditHtaccess){
|
1241 |
-
jQuery.colorbox.close();
|
1242 |
-
var cacheType = 'falcon';
|
1243 |
-
var self = this;
|
1244 |
-
this.ajax('wordfence_saveCacheConfig', {
|
1245 |
-
cacheType: cacheType,
|
1246 |
-
noEditHtaccess: noEditHtaccess
|
1247 |
-
}, function(res){
|
1248 |
-
if(res.ok){
|
1249 |
-
self.colorbox('400px', res.heading, res.body);
|
1250 |
}
|
1251 |
-
|
1252 |
-
|
1253 |
-
|
1254 |
-
|
1255 |
-
|
1256 |
-
|
1257 |
-
|
1258 |
-
|
1259 |
-
|
1260 |
-
|
1261 |
-
|
1262 |
-
}, function(res){
|
1263 |
-
if(res.ok){
|
1264 |
-
self.colorbox('400px', res.heading, res.body);
|
1265 |
}
|
1266 |
-
|
1267 |
-
|
1268 |
-
|
1269 |
-
|
1270 |
-
|
1271 |
-
|
1272 |
-
|
1273 |
-
|
1274 |
-
|
1275 |
-
}, function(res){
|
1276 |
-
if(res.updateErr){
|
1277 |
-
self.colorbox('400px', "You need to manually update your .htaccess", res.updateErr + "<br />Your option was updated but you need to change the Wordfence code in your .htaccess to the following:<br /><textarea style='width: 300px; height: 120px;'>" + jQuery('<div/>').text(res.code).html() + '</textarea>');
|
1278 |
}
|
1279 |
-
|
1280 |
-
|
1281 |
-
},
|
1282 |
-
saveConfig: function(){
|
1283 |
-
var qstr = jQuery('#wfConfigForm').serialize();
|
1284 |
-
var self = this;
|
1285 |
-
jQuery('.wfSavedMsg').hide();
|
1286 |
-
jQuery('.wfAjax24').show();
|
1287 |
-
this.ajax('wordfence_saveConfig', qstr, function(res){
|
1288 |
-
jQuery('.wfAjax24').hide();
|
1289 |
-
if(res.ok){
|
1290 |
-
if(res['paidKeyMsg']){
|
1291 |
-
self.colorbox('400px', "Congratulations! You have been upgraded to Premium Scanning.", "You have upgraded to a Premium API key. Once this page reloads, you can choose which premium scanning options you would like to enable and then click save. Click the button below to reload this page now.<br /><br /><center><input type='button' name='wfReload' value='Reload page and enable Premium options' onclick='window.location.reload(true);' /></center>");
|
1292 |
return;
|
1293 |
-
}
|
1294 |
-
|
|
|
|
|
|
|
|
|
|
|
1295 |
return;
|
1296 |
-
} else {
|
1297 |
-
self.pulse('.wfSavedMsg');
|
1298 |
}
|
1299 |
-
} else if(res.errorMsg){
|
1300 |
-
return;
|
1301 |
-
} else {
|
1302 |
-
self.colorbox('400px', 'An error occurred', 'We encountered an error trying to save your changes.');
|
1303 |
-
}
|
1304 |
-
});
|
1305 |
-
},
|
1306 |
-
changeSecurityLevel: function(){
|
1307 |
-
var level = jQuery('#securityLevel').val();
|
1308 |
-
for(var k in WFSLevels[level].checkboxes){
|
1309 |
-
if(k != 'liveTraf_ignorePublishers'){
|
1310 |
-
jQuery('#' + k).prop("checked", WFSLevels[level].checkboxes[k]);
|
1311 |
-
}
|
1312 |
-
}
|
1313 |
-
for(var k in WFSLevels[level].otherParams){
|
1314 |
-
if(! /^(?:apiKey|securityLevel|alertEmails|liveTraf_ignoreUsers|liveTraf_ignoreIPs|liveTraf_ignoreUA|liveTraf_hitsMaxSize|maxMem|maxExecutionTime|actUpdateInterval)#x2F;.test(k)){
|
1315 |
-
jQuery('#' + k).val(WFSLevels[level].otherParams[k]);
|
1316 |
-
}
|
1317 |
-
}
|
1318 |
-
},
|
1319 |
-
clearAllBlocked: function(op){
|
1320 |
-
if(op == 'blocked'){
|
1321 |
-
body = "Are you sure you want to clear all blocked IP addresses and allow visitors from those addresses to access the site again?";
|
1322 |
-
} else if(op == 'locked'){
|
1323 |
-
body = "Are you sure you want to clear all locked IP addresses and allow visitors from those addresses to sign in again?";
|
1324 |
-
} else {
|
1325 |
-
return;
|
1326 |
-
}
|
1327 |
-
this.colorbox('450px', "Please confirm", body +
|
1328 |
-
'<br /><br /><center><input type="button" name="but1" value="Cancel" onclick="jQuery.colorbox.close();" /> ' +
|
1329 |
-
'<input type="button" name="but2" value="Yes I\'m sure" onclick="jQuery.colorbox.close(); WFAD.confirmClearAllBlocked(\'' + op + '\');"><br />');
|
1330 |
-
},
|
1331 |
-
confirmClearAllBlocked: function(op){
|
1332 |
-
var self = this;
|
1333 |
-
this.ajax('wordfence_clearAllBlocked', { op: op }, function(res){
|
1334 |
-
self.staticTabChanged();
|
1335 |
-
});
|
1336 |
-
},
|
1337 |
-
setOwnCountry: function(code){
|
1338 |
-
this.ownCountry = (code + "").toUpperCase();
|
1339 |
-
},
|
1340 |
-
loadBlockedCountries: function(str){
|
1341 |
-
var codes = str.split(',');
|
1342 |
-
for(var i = 0; i < codes.length; i++){
|
1343 |
-
jQuery('#wfCountryCheckbox_' + codes[i]).prop('checked', true);
|
1344 |
-
}
|
1345 |
-
},
|
1346 |
-
saveCountryBlocking: function(){
|
1347 |
-
var action = jQuery('#wfBlockAction').val();
|
1348 |
-
var redirURL = jQuery('#wfRedirURL').val();
|
1349 |
-
var bypassRedirURL = jQuery('#wfBypassRedirURL').val();
|
1350 |
-
var bypassRedirDest = jQuery('#wfBypassRedirDest').val();
|
1351 |
-
var bypassViewURL = jQuery('#wfBypassViewURL').val();
|
1352 |
-
|
1353 |
-
if(action == 'redir' && (! /^https?:\/\/[^\/]+/i.test(redirURL))){
|
1354 |
-
this.colorbox('400px', "Please enter a URL for redirection", "You have chosen to redirect blocked countries to a specific page. You need to enter a URL in the text box provided that starts with http:// or https://");
|
1355 |
-
return;
|
1356 |
-
}
|
1357 |
-
if( bypassRedirURL || bypassRedirDest ){
|
1358 |
-
if(! (bypassRedirURL && bypassRedirDest)){
|
1359 |
-
this.colorbox('400px', "Missing data from form", "If you want to set up a URL that will bypass country blocking, you must enter a URL that a visitor can hit and the destination they will be redirected to. You have only entered one of these components. Please enter both.");
|
1360 |
-
return;
|
1361 |
-
}
|
1362 |
-
if(bypassRedirURL == bypassRedirDest){
|
1363 |
-
this.colorbox('400px', "URLs are the same", "The URL that a user hits to bypass country blocking and the URL they are redirected to are the same. This would cause a circular redirect. Please fix this.");
|
1364 |
-
return;
|
1365 |
-
}
|
1366 |
-
}
|
1367 |
-
if(bypassRedirURL && (! /^(?:\/|http:\/\/)/.test(bypassRedirURL))){ this.invalidCountryURLMsg(bypassRedirURL); return; }
|
1368 |
-
if(bypassRedirDest && (! /^(?:\/|http:\/\/)/.test(bypassRedirDest))){ this.invalidCountryURLMsg(bypassRedirDest); return; }
|
1369 |
-
if(bypassViewURL && (! /^(?:\/|http:\/\/)/.test(bypassViewURL))){ this.invalidCountryURLMsg(bypassViewURL); return; }
|
1370 |
|
1371 |
-
|
1372 |
-
|
1373 |
-
|
1374 |
-
|
1375 |
-
|
1376 |
-
|
1377 |
-
|
1378 |
-
|
1379 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1380 |
}
|
1381 |
-
|
1382 |
-
|
1383 |
-
|
1384 |
-
|
1385 |
-
|
1386 |
-
|
1387 |
-
|
1388 |
-
|
1389 |
-
|
1390 |
-
|
1391 |
-
|
1392 |
-
|
1393 |
-
|
1394 |
-
|
1395 |
-
confirmSaveCountryBlocking: function(){
|
1396 |
-
var action = jQuery('#wfBlockAction').val();
|
1397 |
-
var redirURL = jQuery('#wfRedirURL').val();
|
1398 |
-
var loggedInBlocked = jQuery('#wfLoggedInBlocked').is(':checked') ? '1' : '0';
|
1399 |
-
var loginFormBlocked = jQuery('#wfLoginFormBlocked').is(':checked') ? '1' : '0';
|
1400 |
-
var restOfSiteBlocked = jQuery('#wfRestOfSiteBlocked').is(':checked') ? '1' : '0';
|
1401 |
-
var bypassRedirURL = jQuery('#wfBypassRedirURL').val();
|
1402 |
-
var bypassRedirDest = jQuery('#wfBypassRedirDest').val();
|
1403 |
-
var bypassViewURL = jQuery('#wfBypassViewURL').val();
|
1404 |
|
1405 |
-
|
1406 |
-
|
1407 |
-
|
1408 |
-
|
1409 |
-
|
1410 |
-
|
1411 |
-
|
1412 |
-
|
1413 |
-
|
1414 |
-
|
1415 |
-
|
1416 |
-
|
1417 |
-
|
1418 |
-
|
1419 |
-
|
1420 |
});
|
1421 |
-
|
1422 |
-
|
1423 |
-
|
1424 |
-
|
1425 |
-
|
1426 |
-
|
1427 |
-
|
1428 |
-
|
1429 |
-
|
1430 |
-
|
1431 |
-
|
1432 |
-
|
1433 |
-
|
1434 |
-
|
1435 |
-
|
1436 |
-
|
1437 |
-
|
1438 |
-
|
1439 |
-
|
1440 |
-
|
1441 |
-
|
1442 |
-
|
1443 |
-
|
1444 |
-
|
1445 |
-
|
1446 |
-
|
1447 |
-
|
1448 |
-
|
1449 |
-
|
1450 |
-
|
1451 |
-
|
1452 |
-
|
1453 |
-
|
1454 |
-
|
1455 |
-
|
1456 |
-
|
1457 |
-
|
1458 |
-
|
1459 |
-
|
1460 |
-
|
1461 |
-
|
1462 |
-
|
1463 |
-
|
1464 |
-
|
1465 |
-
|
1466 |
-
|
1467 |
-
|
1468 |
-
|
1469 |
-
|
1470 |
-
|
1471 |
-
|
1472 |
-
|
1473 |
-
|
1474 |
-
|
1475 |
-
var
|
1476 |
-
|
1477 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1478 |
}
|
1479 |
-
}
|
1480 |
-
}
|
1481 |
|
1482 |
-
|
1483 |
-
|
1484 |
-
|
1485 |
-
|
1486 |
-
|
1487 |
-
|
1488 |
-
|
1489 |
-
|
1490 |
-
|
1491 |
-
|
1492 |
-
|
1493 |
-
|
1494 |
-
|
1495 |
-
|
1496 |
-
|
1497 |
-
|
1498 |
-
|
1499 |
-
|
1500 |
-
|
1501 |
-
|
1502 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1503 |
});
|
1504 |
-
|
1505 |
-
|
1506 |
-
|
1507 |
-
|
1508 |
-
|
1509 |
-
|
1510 |
-
|
1511 |
-
|
1512 |
-
|
1513 |
-
|
1514 |
-
username: username,
|
1515 |
-
phone: phone
|
1516 |
-
}, function(res){
|
1517 |
-
if(res.ok){
|
1518 |
-
self.twoFacStatus('User added! Check the user\'s phone to get the activation code.');
|
1519 |
-
jQuery('<div id="twoFacCont_' + res.userID + '">' + jQuery('#wfTwoFacUserTmpl').tmpl(res).html() + '</div>').prependTo(jQuery('#wfTwoFacUsers'));
|
1520 |
-
}
|
1521 |
-
});
|
1522 |
-
},
|
1523 |
-
twoFacActivate: function(userID, code){
|
1524 |
-
var self = this;
|
1525 |
-
this.ajax('wordfence_twoFacActivate', {
|
1526 |
-
userID: userID,
|
1527 |
-
code: code
|
1528 |
-
}, function(res){
|
1529 |
-
if(res.ok){
|
1530 |
-
jQuery('#twoFacCont_' + res.userID).html(
|
1531 |
-
jQuery('#wfTwoFacUserTmpl').tmpl(res)
|
1532 |
);
|
1533 |
-
|
1534 |
-
|
1535 |
-
|
1536 |
-
|
1537 |
-
|
1538 |
-
|
1539 |
-
|
1540 |
-
|
1541 |
-
|
1542 |
-
|
1543 |
-
|
1544 |
-
|
1545 |
-
|
1546 |
-
|
1547 |
-
|
1548 |
-
|
1549 |
-
|
1550 |
-
|
1551 |
-
|
1552 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1553 |
}
|
1554 |
-
|
1555 |
-
|
1556 |
-
|
1557 |
-
|
1558 |
-
|
1559 |
-
|
1560 |
-
|
1561 |
-
|
1562 |
-
|
1563 |
-
|
1564 |
-
|
1565 |
-
|
1566 |
-
|
1567 |
-
|
1568 |
-
|
1569 |
-
var d = dot.split('.');
|
1570 |
-
return ((((((+d[0])*256)+(+d[1]))*256)+(+d[2]))*256)+(+d[3]);
|
1571 |
-
},
|
1572 |
-
inet_ntoa: function(num){
|
1573 |
-
var d = num % 256;
|
1574 |
-
for(var i = 3; i > 0; i--) {
|
1575 |
-
num = Math.floor(num/256);
|
1576 |
-
d = num%256 + '.' + d;
|
1577 |
-
}
|
1578 |
-
return d;
|
1579 |
-
},
|
1580 |
-
removeCacheExclusion: function(id){
|
1581 |
-
this.ajax('wordfence_removeCacheExclusion', { id: id }, function(res){ window.location.reload(true); });
|
1582 |
-
},
|
1583 |
-
addCacheExclusion: function(patternType, pattern){
|
1584 |
-
if(/^https?:\/\//.test(pattern)){
|
1585 |
-
this.colorbox('400px', "Incorrect pattern for exclusion", "You can not enter full URL's for exclusion from caching. You entered a full URL that started with http:// or https://. You must enter relative URL's e.g. /exclude/this/page/. You can also enter text that might be contained in the path part of a URL or at the end of the path part of a URL.");
|
1586 |
-
return;
|
1587 |
-
}
|
1588 |
-
|
1589 |
-
this.ajax('wordfence_addCacheExclusion', {
|
1590 |
-
patternType: patternType,
|
1591 |
-
pattern: pattern
|
1592 |
-
}, function(res){
|
1593 |
-
if(res.ok){ //Otherwise errorMsg will get caught
|
1594 |
window.location.reload(true);
|
|
|
|
|
|
|
|
|
|
|
|
|
1595 |
}
|
1596 |
-
});
|
1597 |
-
},
|
1598 |
-
loadCacheExclusions: function(){
|
1599 |
-
this.ajax('wordfence_loadCacheExclusions', {}, function(res){
|
1600 |
-
if(res.ex instanceof Array && res.ex.length > 0){
|
1601 |
-
for(var i = 0; i < res.ex.length; i++){
|
1602 |
-
var newElem = jQuery('#wfCacheExclusionTmpl').tmpl(res.ex[i]);
|
1603 |
-
newElem.prependTo('#wfCacheExclusions').fadeIn();
|
1604 |
-
}
|
1605 |
-
jQuery('<h2>Cache Exclusions</h2>').prependTo('#wfCacheExclusions');
|
1606 |
-
} else {
|
1607 |
-
jQuery('<h2>Cache Exclusions</h2><p style="width: 500px;">There are not currently any exclusions. If you have a site that does not change often, it is perfectly normal to not have any pages you want to exclude from the cache.</p>').prependTo('#wfCacheExclusions');
|
1608 |
-
}
|
1609 |
|
1610 |
-
|
1611 |
-
|
1612 |
-
|
1613 |
-
|
1614 |
-
|
1615 |
-
|
1616 |
-
|
1617 |
-
|
1618 |
-
|
1619 |
-
|
1620 |
-
|
1621 |
-
|
1622 |
-
|
1623 |
-
|
1624 |
-
|
1625 |
-
|
1626 |
-
|
1627 |
-
|
1628 |
-
|
1629 |
-
|
1630 |
-
|
1631 |
-
|
1632 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1633 |
}
|
1634 |
-
|
|
|
1635 |
}
|
1636 |
-
|
1637 |
-
|
1638 |
-
|
1639 |
-
jQuery
|
1640 |
-
wordfenceAdmin.init();
|
1641 |
-
});
|
1 |
+
(function($) {
|
2 |
+
if (!window['wordfenceAdmin']) { //To compile for checking: java -jar /usr/local/bin/closure.jar --js=admin.js --js_output_file=test.js
|
3 |
+
window['wordfenceAdmin'] = {
|
4 |
+
loading16: '<div class="wfLoading16"></div>',
|
5 |
+
loadingCount: 0,
|
6 |
+
dbCheckTables: [],
|
7 |
+
dbCheckCount_ok: 0,
|
8 |
+
dbCheckCount_skipped: 0,
|
9 |
+
dbCheckCount_errors: 0,
|
10 |
+
issues: [],
|
11 |
+
ignoreData: false,
|
12 |
+
iconErrorMsgs: [],
|
13 |
+
scanIDLoaded: 0,
|
14 |
+
colorboxQueue: [],
|
15 |
+
mode: '',
|
16 |
+
visibleIssuesPanel: 'new',
|
17 |
+
preFirstScanMsgsLoaded: false,
|
18 |
+
newestActivityTime: 0, //must be 0 to force loading of all initially
|
19 |
+
elementGeneratorIter: 1,
|
20 |
+
reloadConfigPage: false,
|
21 |
+
nonce: false,
|
22 |
+
tickerUpdatePending: false,
|
23 |
+
activityLogUpdatePending: false,
|
24 |
+
lastALogCtime: 0,
|
25 |
+
activityQueue: [],
|
26 |
+
totalActAdded: 0,
|
27 |
+
maxActivityLogItems: 1000,
|
28 |
+
scanReqAnimation: false,
|
29 |
+
debugOn: false,
|
30 |
+
blockedCountriesPending: [],
|
31 |
+
ownCountry: "",
|
32 |
+
schedStartHour: false,
|
33 |
+
currentPointer: false,
|
34 |
+
countryMap: false,
|
35 |
+
countryCodesToSave: "",
|
36 |
+
performanceScale: 3,
|
37 |
+
performanceMinWidth: 20,
|
38 |
+
tourClosed: false,
|
39 |
+
welcomeClosed: false,
|
40 |
+
passwdAuditUpdateInt: false,
|
41 |
+
init: function() {
|
42 |
+
this.nonce = WordfenceAdminVars.firstNonce;
|
43 |
+
this.debugOn = WordfenceAdminVars.debugOn == '1' ? true : false;
|
44 |
+
this.tourClosed = WordfenceAdminVars.tourClosed == '1' ? true : false;
|
45 |
+
this.welcomeClosed = WordfenceAdminVars.welcomeClosed == '1' ? true : false;
|
46 |
+
var startTicker = false;
|
47 |
+
var self = this;
|
48 |
+
if (jQuery('#wordfenceMode_scan').length > 0) {
|
49 |
+
this.mode = 'scan';
|
50 |
+
jQuery('#wfALogViewLink').prop('href', WordfenceAdminVars.siteBaseURL + '?_wfsf=viewActivityLog&nonce=' + this.nonce);
|
51 |
+
jQuery('#consoleActivity').scrollTop(jQuery('#consoleActivity').prop('scrollHeight'));
|
52 |
+
jQuery('#consoleScan').scrollTop(jQuery('#consoleScan').prop('scrollHeight'));
|
53 |
+
this.noScanHTML = jQuery('#wfNoScanYetTmpl').tmpl().html();
|
54 |
+
this.loadIssues();
|
55 |
+
this.startActivityLogUpdates();
|
56 |
+
if (this.needTour()) {
|
57 |
+
this.scanTourStart();
|
58 |
+
}
|
59 |
+
} else if (jQuery('#wordfenceMode_activity').length > 0) {
|
60 |
+
this.mode = 'activity';
|
61 |
+
this.setupSwitches('wfLiveTrafficOnOff', 'liveTrafficEnabled', function() {
|
62 |
+
});
|
63 |
+
jQuery('#wfLiveTrafficOnOff').change(function() {
|
64 |
+
if (/^(?:falcon|php)#x2F;.test(WordfenceAdminVars.cacheType)) {
|
65 |
+
jQuery('#wfLiveTrafficOnOff').attr('checked', false);
|
66 |
+
self.colorbox('400px', "Live Traffic not available in high performance mode", "Please note that you can't enable live traffic when Falcon Engine or basic caching is enabled. This is done for performance reasons. If you want live traffic, go to the 'Performance Setup' menu and disable caching.");
|
67 |
+
} else {
|
68 |
+
self.updateSwitch('wfLiveTrafficOnOff', 'liveTrafficEnabled', function() {
|
69 |
+
window.location.reload(true);
|
70 |
+
});
|
71 |
+
}
|
72 |
+
});
|
73 |
|
74 |
+
if (WordfenceAdminVars.liveTrafficEnabled) {
|
75 |
+
this.activityMode = 'hit';
|
76 |
+
} else {
|
77 |
+
this.activityMode = 'loginLogout';
|
78 |
+
this.switchTab(jQuery('#wfLoginLogoutTab'), 'wfTab1', 'wfDataPanel', 'wfActivity_loginLogout', function() {
|
79 |
+
WFAD.activityTabChanged();
|
80 |
+
});
|
81 |
+
}
|
82 |
+
startTicker = true;
|
83 |
+
if (this.needTour()) {
|
84 |
+
this.tour('wfWelcomeContent3', 'wfHeading', 'top', 'left', "Learn about Site Performance", function() {
|
85 |
+
self.tourRedir('WordfenceSitePerf');
|
86 |
+
});
|
87 |
+
}
|
88 |
+
} else if (jQuery('#wordfenceMode_options').length > 0) {
|
89 |
+
this.mode = 'options';
|
90 |
+
jQuery('.wfConfigElem').change(function() {
|
91 |
+
jQuery('#securityLevel').val('CUSTOM');
|
92 |
+
});
|
93 |
+
this.updateTicker(true);
|
94 |
+
startTicker = true;
|
95 |
+
if (this.needTour()) {
|
96 |
+
this.tour('wfContentBasicOptions', 'wfMarkerBasicOptions', 'top', 'left', "Learn about Live Traffic Options", function() {
|
97 |
+
self.tour('wfContentLiveTrafficOptions', 'wfMarkerLiveTrafficOptions', 'bottom', 'left', "Learn about Scanning Options", function() {
|
98 |
+
self.tour('wfContentScansToInclude', 'wfMarkerScansToInclude', 'bottom', 'left', "Learn about Firewall Rules", function() {
|
99 |
+
self.tour('wfContentFirewallRules', 'wfMarkerFirewallRules', 'bottom', 'left', "Learn about Login Security", function() {
|
100 |
+
self.tour('wfContentLoginSecurity', 'wfMarkerLoginSecurity', 'bottom', 'left', "Learn about Other Options", function() {
|
101 |
+
self.tour('wfContentOtherOptions', 'wfMarkerOtherOptions', 'bottom', 'left', false, false);
|
102 |
+
});
|
103 |
});
|
104 |
});
|
105 |
});
|
106 |
});
|
107 |
+
}
|
108 |
+
} else if (jQuery('#wordfenceMode_blockedIPs').length > 0) {
|
109 |
+
this.mode = 'blocked';
|
110 |
+
this.staticTabChanged();
|
111 |
+
this.updateTicker(true);
|
112 |
+
startTicker = true;
|
113 |
+
if (this.needTour()) {
|
114 |
+
this.tour('wfWelcomeContent4', 'wfHeading', 'top', 'left', "Learn about Auditing Passwords", function() {
|
115 |
+
self.tourRedir('WordfencePasswdAudit');
|
116 |
+
});
|
117 |
+
}
|
118 |
+
} else if (jQuery('#wordfenceMode_passwd').length > 0) {
|
119 |
+
this.mode = 'passwd';
|
120 |
+
startTicker = false;
|
121 |
+
this.doPasswdAuditUpdate();
|
122 |
+
if (this.needTour()) {
|
123 |
+
this.tour('wfWelcomePasswd', 'wfHeading', 'top', 'left', "Learn about Cellphone Sign-in", function() {
|
124 |
+
self.tourRedir('WordfenceTwoFactor');
|
125 |
+
});
|
126 |
+
}
|
127 |
+
} else if (jQuery('#wordfenceMode_twoFactor').length > 0) {
|
128 |
+
this.mode = 'twoFactor';
|