Plugin Directory

Changeset 1222565


Ignore:
Timestamp:
08/17/2015 10:03:03 AM (10 years ago)
Author:
wp.kytten
Message:

Updated version to 0.9

Location:
wp-password-policy-manager/trunk
Files:
59 added
6 edited

Legend:

Unmodified
Added
Removed
  • wp-password-policy-manager/trunk/js/front.js

    r1041264 r1222565  
    1 jQuery(document).ready(function(){
     1jQuery(function($){
     2    "use strict";
    23    if(wppm_ModifyForm){
    34        var d = wppm_ModifyForm;
    45
    56        // update form fields
    6         jQuery('#user_login').val('').val(d.CurrentUserLogin).attr('readonly', true);
    7         var p = jQuery('#user_pass').val(d.CurrentUserPass).attr('readonly', true).parents('p:first');
     7        $('#user_login').val('').val(d.CurrentUserLogin).attr('readonly', true);
     8        var p = $('#user_pass').val(d.CurrentUserPass).attr('readonly', true).parents('p:first');
    89        p.find('label').contents()[0].textContent = d.TextOldPass;
    910
    1011        // update form button
    11         jQuery('#wp-submit').val(d.BtnChangeAndLogin);
     12        $('#wp-submit').val(d.BtnChangeAndLogin);
    1213
    1314        // update form width + add rules
    1415        var w = 280;
    1516        if(d.NewPasswordRules.length){
    16             jQuery('#login').width(jQuery('#login').width() + w);
    17             jQuery('#loginform').css({'padding-right': w, 'position': 'relative'});
    18             var u = jQuery('<ul/>').css({'list-style': 'inside disc'});
     17            $('#login').width($('#login').width() + w);
     18            $('#loginform').css({'padding-right': w, 'position': 'relative'});
     19            var u = $('<ul/>').css({'list-style': 'inside disc'});
    1920            for(var i in d.NewPasswordRules)
    20                 u.append(jQuery('<li/>').text(d.NewPasswordRules[i]));
    21             jQuery('#loginform').append(
    22                 jQuery('<div/>').css({
     21                u.append($('<li/>').text(d.NewPasswordRules[i]));
     22            $('#loginform').append(
     23                $('<div/>').css({
    2324                    'position': 'absolute',
    2425                    'right': '24px',
     
    2627                    'width': (w - 48) + 'px'
    2728                }).append(
    28                     jQuery('<label/>').text(d.NewPassRulesHead),
    29                     u, jQuery('<div/>').html(d.NewPassRulesFoot).css({
     29                    $('<label/>').text(d.NewPassRulesHead),
     30                    u, $('<div/>').html(d.NewPassRulesFoot).css({
    3031                        'margin-top': '24px',
    3132                        'font-size': '10px',
  • wp-password-policy-manager/trunk/js/reset.js

    r1041264 r1222565  
    11jQuery(function($){
     2    "use strict";
    23    if(wppm_ModifyForm) {
    34        var form = $('#resetpassform'),data = form.html(), d = wppm_ModifyForm;
  • wp-password-policy-manager/trunk/js/wppm.js

    r1032367 r1222565  
    1 jQuery(document).ready(function(){
     1jQuery(function($){
     2    "use strict";
    23    var RemoveSecToken = function(){
    3         var $this = jQuery(this).parents('span:first');
     4        var $this = $(this).parents('span:first');
    45        $this.addClass('sectoken-del').fadeOut('fast', function(){
    56            $this.remove();
    67        });
    78    };
    8    
    9     jQuery('#ExemptTokenQueryBox').keydown(function(event){
     9
     10    $('#ExemptTokenQueryBox').keydown(function(event){
    1011        if(event.keyCode === 13) {
    11             jQuery('#ExemptTokenQueryAdd').click();
     12            $('#ExemptTokenQueryAdd').click();
    1213            return false;
    1314        }
    1415    });
    15    
    16     jQuery('#ExemptTokenQueryAdd').click(function(){
    17         var value = jQuery.trim(jQuery('#ExemptTokenQueryBox').val());
    18         var existing = jQuery('#ExemptTokenList input').filter(function() { return this.value === value; });
    19        
     16
     17    $('#ExemptTokenQueryAdd').click(function(){
     18        var value = $.trim($('#ExemptTokenQueryBox').val());
     19        var existing = $('#ExemptTokenList input').filter(function() { return this.value === value; });
     20
    2021        if(!value || existing.length)return; // if value is empty or already used, stop here
    21        
    22         jQuery('#ExemptTokenQueryBox, #ExemptTokenQueryAdd').attr('disabled', true);
    23         jQuery.post(jQuery('#ajaxurl').val(), {action: 'check_security_token', token: value}, function(data){
    24             jQuery('#ExemptTokenQueryBox, #ExemptTokenQueryAdd').attr('disabled', false);
     22
     23        $('#ExemptTokenQueryBox, #ExemptTokenQueryAdd').attr('disabled', true);
     24        $.post($('#ajaxurl').val(), {action: 'check_security_token', token: value}, function(data){
     25            $('#ExemptTokenQueryBox, #ExemptTokenQueryAdd').attr('disabled', false);
    2526            if(data==='other' && !confirm('The specified token is not a user nor a role, do you still want to add it?'))return;
    26             jQuery('#ExemptTokenQueryBox').val('');
    27             jQuery('#ExemptTokenList').append(jQuery('<span class="sectoken-'+data+'"/>').text(value).append(
    28                 jQuery('<input type="hidden" name="ExemptTokens[]"/>').val(value),
    29                 jQuery('<a href="javascript:;" title="Remove">&times;</a>').click(RemoveSecToken)
     27            $('#ExemptTokenQueryBox').val('');
     28            $('#ExemptTokenList').append($('<span class="sectoken-'+data+'"/>').text(value).append(
     29                $('<input type="hidden" name="ExemptTokens[]"/>').val(value),
     30                $('<a href="javascript:;" title="Remove">&times;</a>').click(RemoveSecToken)
    3031            ));
    3132        });
    3233    });
    33    
    34     jQuery('#ExemptTokenList>span>a').click(RemoveSecToken);
     34
     35    $('#ExemptTokenList>span>a').click(RemoveSecToken);
    3536});
  • wp-password-policy-manager/trunk/languages/wp-password-policy-manager.pot

    r1066802 r1222565  
    11# Copyright (C) 2015 WordPress Password Policy Manager
    22# This file is distributed under the same license as the WordPress Password Policy Manager package.
     3#, fuzzy
    34msgid ""
    45msgstr ""
    5 "Project-Id-Version: WordPress Password Policy Manager 0.6\n"
     6"Project-Id-Version: WordPress Password Policy Manager 0.9\n"
    67"Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-password-policy-manager\n"
    7 "POT-Creation-Date: 2015-01-13 09:07:33+00:00\n"
     8"POT-Creation-Date: 2015-08-17 12:32+0300\n"
    89"MIME-Version: 1.0\n"
    910"Content-Type: text/plain; charset=UTF-8\n"
     
    1112"PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n"
    1213"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
    13 "Language-Team: LANGUAGE <[email protected]>\n"
    14 
    15 #: wp-password-policy-manager.php:108
     14"Language-Team: wp-kitten <[email protected]>\n"
     15"X-Generator: Poedit 1.8.4\n"
     16"X-Poedit-SourceCharset: UTF-8\n"
     17"X-Poedit-Basepath: ..\n"
     18"X-Poedit-KeywordsList: __;_e;_n;_x\n"
     19"X-Poedit-SearchPath-0: .\n"
     20"X-Poedit-SearchPathExcluded-0: css\n"
     21"X-Poedit-SearchPathExcluded-1: img\n"
     22"X-Poedit-SearchPathExcluded-2: js\n"
     23
     24#: wp-password-policy-manager.php:124
    1625msgid "not be the same as your username"
    1726msgstr ""
    1827
    19 #: wp-password-policy-manager.php:112
     28#: wp-password-policy-manager.php:128
     29#, php-format
    2030msgid "not be one of the previous %d used passwords."
    2131msgstr ""
    2232
    23 #: wp-password-policy-manager.php:114
     33#: wp-password-policy-manager.php:131
    2434msgid "not be the same as the previous one"
    2535msgstr ""
    2636
    27 #: wp-password-policy-manager.php:118
     37#: wp-password-policy-manager.php:135
     38#, php-format
    2839msgid "be at least %d characters long"
    2940msgstr ""
    3041
    31 #: wp-password-policy-manager.php:120
     42#: wp-password-policy-manager.php:137
    3243msgid "contain mixed case characters"
    3344msgstr ""
    3445
    35 #: wp-password-policy-manager.php:122
     46#: wp-password-policy-manager.php:139
    3647msgid "contain numeric digits"
    3748msgstr ""
    3849
    39 #: wp-password-policy-manager.php:124
     50#: wp-password-policy-manager.php:141
    4051msgid "contain special characters"
    4152msgstr ""
    4253
    43 #: wp-password-policy-manager.php:170
     54#: wp-password-policy-manager.php:190
     55msgid "Old Password"
     56msgstr ""
     57
     58#: wp-password-policy-manager.php:191
     59msgid "Change & Log in"
     60msgstr ""
     61
     62#: wp-password-policy-manager.php:193 wp-password-policy-manager.php:453
     63msgid "New password must..."
     64msgstr ""
     65
     66#: wp-password-policy-manager.php:194 wp-password-policy-manager.php:313
     67#: wp-password-policy-manager.php:454
     68msgid "WordPress Password Policies by"
     69msgstr ""
     70
     71#: wp-password-policy-manager.php:196 wp-password-policy-manager.php:315
     72#: wp-password-policy-manager.php:456
     73msgid "WP Password Policy Manager"
     74msgstr ""
     75
     76#: wp-password-policy-manager.php:202 wp-password-policy-manager.php:204
    4477msgid "New Password"
    4578msgstr ""
    4679
    47 #: wp-password-policy-manager.php:174
     80#: wp-password-policy-manager.php:208 wp-password-policy-manager.php:210
    4881msgid "Verify Password"
    4982msgstr ""
    5083
    51 #: wp-password-policy-manager.php:183
    52 msgid "Old Password"
    53 msgstr ""
    54 
    55 #: wp-password-policy-manager.php:184
    56 msgid "Change & Log in"
    57 msgstr ""
    58 
    59 #: wp-password-policy-manager.php:186 wp-password-policy-manager.php:423
    60 msgid "New password must..."
    61 msgstr ""
    62 
    63 #: wp-password-policy-manager.php:187 wp-password-policy-manager.php:289
    64 #: wp-password-policy-manager.php:424
    65 msgid "WordPress Password Policies by"
    66 msgstr ""
    67 
    68 #: wp-password-policy-manager.php:189 wp-password-policy-manager.php:291
    69 #: wp-password-policy-manager.php:426
    70 msgid "WP Password Policy Manager"
    71 msgstr ""
    72 
    73 #: wp-password-policy-manager.php:197
     84#: wp-password-policy-manager.php:219
    7485msgid "Invalid Request"
    7586msgstr ""
    7687
    77 #: wp-password-policy-manager.php:215
     88#: wp-password-policy-manager.php:237 wp-password-policy-manager.php:364
    7889msgid "<strong>ERROR</strong>: The new password cannot be empty."
    7990msgstr ""
    8091
    81 #: wp-password-policy-manager.php:217
     92#: wp-password-policy-manager.php:239 wp-password-policy-manager.php:369
    8293msgid "<strong>ERROR</strong>: Both new passwords must match."
    8394msgstr ""
    8495
    85 #: wp-password-policy-manager.php:219
     96#: wp-password-policy-manager.php:241 wp-password-policy-manager.php:383
    8697msgid "<strong>ERROR</strong>: New password cannot be the same as the old one."
    8798msgstr ""
    8899
    89 #: wp-password-policy-manager.php:221 wp-password-policy-manager.php:467
     100#: wp-password-policy-manager.php:243 wp-password-policy-manager.php:389
     101#: wp-password-policy-manager.php:497
     102msgid "<strong>ERROR</strong>: New password cannot be the same as the username."
     103msgstr ""
     104
     105#: wp-password-policy-manager.php:245 wp-password-policy-manager.php:395
     106#: wp-password-policy-manager.php:501
     107msgid "<strong>ERROR</strong>: New password cannot be the same as the email."
     108msgstr ""
     109
     110#: wp-password-policy-manager.php:248 wp-password-policy-manager.php:401
     111#: wp-password-policy-manager.php:506
     112#, php-format
     113msgid "<strong>ERROR</strong>: New password must contain at least %d characters."
     114msgstr ""
     115
     116#: wp-password-policy-manager.php:251 wp-password-policy-manager.php:407
     117#: wp-password-policy-manager.php:512
     118msgid "<strong>ERROR</strong>: New password must contain both uppercase and lowercase characters."
     119msgstr ""
     120
     121#: wp-password-policy-manager.php:254 wp-password-policy-manager.php:413
     122#: wp-password-policy-manager.php:518
     123msgid "<strong>ERROR</strong>: New password must contain numbers."
     124msgstr ""
     125
     126#: wp-password-policy-manager.php:257 wp-password-policy-manager.php:419
     127#: wp-password-policy-manager.php:524
     128msgid "<strong>ERROR</strong>: New password must contain special characters."
     129msgstr ""
     130
     131#: wp-password-policy-manager.php:263 wp-password-policy-manager.php:433
     132#: wp-password-policy-manager.php:534
     133#, php-format
     134msgid "<strong>ERROR</strong>: New password must not be one of the previous %d used passwords."
     135msgstr ""
     136
     137#: wp-password-policy-manager.php:280
     138msgid "1 minute"
     139msgstr ""
     140
     141#: wp-password-policy-manager.php:283
     142#, php-format
     143msgid "<strong>ERROR</strong>: The password you entered expired %s ago."
     144msgstr ""
     145
     146#: wp-password-policy-manager.php:295 wp-password-policy-manager.php:298
     147msgid "Current Password"
     148msgstr ""
     149
     150#: wp-password-policy-manager.php:300
     151msgid "Type your current password to be able to change your password."
     152msgstr ""
     153
     154#: wp-password-policy-manager.php:305
     155msgid "New password must"
     156msgstr ""
     157
     158#: wp-password-policy-manager.php:375
     159msgid "<strong>ERROR</strong>: Please enter the current password in the Current Password field."
     160msgstr ""
     161
     162#: wp-password-policy-manager.php:425
     163msgid "<strong>ERROR</strong>: Current password is incorrect."
     164msgstr ""
     165
     166#: wp-password-policy-manager.php:465
     167msgid "The form is not valid. Please refresh the page and try again."
     168msgstr ""
     169
     170#: wp-password-policy-manager.php:469
     171msgid "Please provide your new password."
     172msgstr ""
     173
     174#: wp-password-policy-manager.php:473
     175msgid "Please confirm your new password."
     176msgstr ""
     177
     178#: wp-password-policy-manager.php:481
     179msgid "Passwords must match."
     180msgstr ""
     181
     182#: wp-password-policy-manager.php:487
     183msgid "The new password cannot be the same as the current one."
     184msgstr ""
     185
     186#: wp-password-policy-manager.php:664
     187msgid "Password policy expiration time is not valid."
     188msgstr ""
     189
     190#: wp-password-policy-manager.php:791 wp-password-policy-manager.php:804
     191#: wp-password-policy-manager.php:829
     192msgid "Security check failed"
     193msgstr ""
     194
     195#: wp-password-policy-manager.php:923
     196#, php-format
     197msgid "<p>Your password for <strong>%s</strong> has been reset.</p>"
     198msgstr ""
     199
     200#: wp-password-policy-manager.php:924
     201#, php-format
     202msgid "<p>New Password: <strong>%s</strong></p>"
     203msgstr ""
     204
     205#: wp-password-policy-manager.php:925
     206msgid "<p>Please log in and change your password:"
     207msgstr ""
     208
     209#: wp-password-policy-manager.php:958 wp-password-policy-manager.php:962
     210msgid "Invalid request"
     211msgstr ""
     212
     213#: wp-password-policy-manager.php:989
     214msgid "Password has been reset"
     215msgstr ""
     216
     217#: wp-password-policy-manager.php:1017
     218msgid "You do not have sufficient permissions to access this page."
     219msgstr ""
     220
     221#: wp-password-policy-manager.php:1045
     222msgid "Settings saved."
     223msgstr ""
     224
     225#: wp-password-policy-manager.php:1056
    90226msgid ""
    91 "<strong>ERROR</strong>: New password cannot be the same as the username."
    92 msgstr ""
    93 
    94 #: wp-password-policy-manager.php:223 wp-password-policy-manager.php:471
    95 msgid "<strong>ERROR</strong>: New password cannot be the same as the email."
    96 msgstr ""
    97 
    98 #: wp-password-policy-manager.php:226 wp-password-policy-manager.php:371
    99 #: wp-password-policy-manager.php:476
     227"Request registered. All passwords will be reset using WP Cron in 10\n"
     228"                                         minutes for blog ID: "
     229msgstr ""
     230
     231#: wp-password-policy-manager.php:1065
     232msgid "All passwords have been reset."
     233msgstr ""
     234
     235#: wp-password-policy-manager.php:1070
     236msgid "Unexpected form submission content."
     237msgstr ""
     238
     239#: wp-password-policy-manager.php:1073
     240msgid "Error"
     241msgstr ""
     242
     243#: wp-password-policy-manager.php:1078
     244msgid "WordPress Password Policy Manager Settings"
     245msgstr ""
     246
     247#: wp-password-policy-manager.php:1098
     248msgid "Password Expiration Policy"
     249msgstr ""
     250
     251#: wp-password-policy-manager.php:1102
     252msgid "Examples: <code>5 days</code> <code>20 days 6 hours</code> <code>3 weeks</code>"
     253msgstr ""
     254
     255#: wp-password-policy-manager.php:1103
     256msgid "Leave blank to disable Password Expiry policy."
     257msgstr ""
     258
     259#: wp-password-policy-manager.php:1107
     260msgid "Password Length Policy"
     261msgstr ""
     262
     263#: wp-password-policy-manager.php:1117
     264msgid "characters"
     265msgstr ""
     266
     267#: wp-password-policy-manager.php:1118
     268msgid "Leave blank to disable Password Length policy."
     269msgstr ""
     270
     271#: wp-password-policy-manager.php:1122 wp-password-policy-manager.php:1125
     272msgid "Mixed Case Policy"
     273msgstr ""
     274
     275#: wp-password-policy-manager.php:1129
     276msgid "Password must contain a mix of uppercase and lowercase characters."
     277msgstr ""
     278
     279#: wp-password-policy-manager.php:1135 wp-password-policy-manager.php:1138
     280msgid "Numeric Digits Policy"
     281msgstr ""
     282
     283#: wp-password-policy-manager.php:1142
     284msgid "Password must contain numeric digits (<code>0-9</code>)."
     285msgstr ""
     286
     287#: wp-password-policy-manager.php:1148 wp-password-policy-manager.php:1151
     288msgid "Special Characters Policy"
     289msgstr ""
     290
     291#: wp-password-policy-manager.php:1155
     292msgid "Password must contain special characters (eg: <code>.,!#$_+</code>)."
     293msgstr ""
     294
     295#: wp-password-policy-manager.php:1161 wp-password-policy-manager.php:1164
     296msgid "Current Password Policy"
     297msgstr ""
     298
     299#: wp-password-policy-manager.php:1168
     300msgid "When changing password on the profile page, the user must supply the current password."
     301msgstr ""
     302
     303#: wp-password-policy-manager.php:1174
     304msgid "Password History Policy"
     305msgstr ""
     306
     307#: wp-password-policy-manager.php:1177
     308msgid "Remember"
     309msgstr ""
     310
     311#: wp-password-policy-manager.php:1186
     312msgid "old passwords"
     313msgstr ""
     314
     315#: wp-password-policy-manager.php:1187
     316msgid "Leave blank to disable password history policy."
     317msgstr ""
     318
     319#: wp-password-policy-manager.php:1195 wp-password-policy-manager.php:1198
     320msgid "Disable Admins Access"
     321msgstr ""
     322
     323#: wp-password-policy-manager.php:1206
     324msgid "Disallow site administrators from modifying the plugin's settings."
     325msgstr ""
     326
     327#: wp-password-policy-manager.php:1215
     328msgid "Users and Roles Exempt From Policies"
     329msgstr ""
     330
     331#: wp-password-policy-manager.php:1223
     332msgid "Users and Roles in this list are free of all Password Policies."
     333msgstr ""
     334
     335#: wp-password-policy-manager.php:1239
     336msgid "Reset All Users' Passwords"
     337msgstr ""
     338
     339#: wp-password-policy-manager.php:1245
     340msgid "All sites on network:"
     341msgstr ""
     342
     343#: wp-password-policy-manager.php:1250
     344msgid "Specific site on Network:"
     345msgstr ""
     346
     347#: wp-password-policy-manager.php:1252
     348msgid "Search for a site"
     349msgstr ""
     350
     351#: wp-password-policy-manager.php:1327
     352msgid "Are you sure you want to reset all passwords?"
     353msgstr ""
     354
     355#: wp-password-policy-manager.php:1347
     356msgid "Reset All Passwords"
     357msgstr ""
     358
     359#: wp-password-policy-manager.php:1352
     360msgid "Use WP Cron"
     361msgstr ""
     362
     363#: wp-password-policy-manager.php:1359
     364msgid "Only check this option if your site has many users."
     365msgstr ""
     366
     367#: wp-password-policy-manager.php:1369
     368msgid "Save Changes"
     369msgstr ""
     370
     371#: wp-password-policy-manager.php:1495 wp-password-policy-manager.php:1529
     372msgid "Configure Password Policies"
     373msgstr ""
     374
     375#: wp-password-policy-manager.php:1501 wp-password-policy-manager.php:1504
     376#: wp-password-policy-manager.php:1505
     377msgid "Password Policies"
     378msgstr ""
     379
     380#: wp-password-policy-manager.php:1530
    100381msgid ""
    101 "<strong>ERROR</strong>: New password must contain at least %d characters."
    102 msgstr ""
    103 
    104 #: wp-password-policy-manager.php:229 wp-password-policy-manager.php:377
    105 #: wp-password-policy-manager.php:482
    106 msgid ""
    107 "<strong>ERROR</strong>: New password must contain both uppercase and "
    108 "lowercase characters."
    109 msgstr ""
    110 
    111 #: wp-password-policy-manager.php:232 wp-password-policy-manager.php:383
    112 #: wp-password-policy-manager.php:488
    113 msgid "<strong>ERROR</strong>: New password must contain numbers."
    114 msgstr ""
    115 
    116 #: wp-password-policy-manager.php:235 wp-password-policy-manager.php:389
    117 #: wp-password-policy-manager.php:494
    118 msgid "<strong>ERROR</strong>: New password must contain special characters."
    119 msgstr ""
    120 
    121 #: wp-password-policy-manager.php:241 wp-password-policy-manager.php:403
    122 #: wp-password-policy-manager.php:504
    123 msgid ""
    124 "<strong>ERROR</strong>: New password must not be one of the previous %d used "
    125 "passwords."
    126 msgstr ""
    127 
    128 #: wp-password-policy-manager.php:258
    129 msgid "1 minute"
    130 msgstr ""
    131 
    132 #: wp-password-policy-manager.php:261
    133 msgid "<strong>ERROR</strong>: The password you entered expired %s ago."
    134 msgstr ""
    135 
    136 #: wp-password-policy-manager.php:273
    137 msgid "Current Password"
    138 msgstr ""
    139 
    140 #: wp-password-policy-manager.php:276
    141 msgid "Type your current password to be able to change your password."
    142 msgstr ""
    143 
    144 #: wp-password-policy-manager.php:281
    145 msgid "New password must"
    146 msgstr ""
    147 
    148 #: wp-password-policy-manager.php:395
    149 msgid "<strong>ERROR</strong>: Current password is incorrect."
    150 msgstr ""
    151 
    152 #: wp-password-policy-manager.php:435
    153 msgid "The form is not valid. Please refresh the page and try again."
    154 msgstr ""
    155 
    156 #: wp-password-policy-manager.php:439
    157 msgid "Please provide your new password."
    158 msgstr ""
    159 
    160 #: wp-password-policy-manager.php:443
    161 msgid "Please confirm your new password."
    162 msgstr ""
    163 
    164 #: wp-password-policy-manager.php:451
    165 msgid "Passwords must match."
    166 msgstr ""
    167 
    168 #: wp-password-policy-manager.php:457
    169 msgid "The new password cannot be the same as the current one."
    170 msgstr ""
    171 
    172 #: wp-password-policy-manager.php:637
    173 msgid "Password policy expiration time is not valid."
    174 msgstr ""
    175 
    176 #: wp-password-policy-manager.php:742
    177 msgid "<p>Your password for <strong>%s</strong> has been reset.</p>"
    178 msgstr ""
    179 
    180 #: wp-password-policy-manager.php:743
    181 msgid "<p>New Password: <strong>%s</strong></p>"
    182 msgstr ""
    183 
    184 #: wp-password-policy-manager.php:744
    185 msgid "<p>Please log in and change your password:"
    186 msgstr ""
    187 
    188 #: wp-password-policy-manager.php:759
    189 msgid "Password has been reset"
    190 msgstr ""
    191 
    192 #: wp-password-policy-manager.php:783
    193 msgid "You do not have sufficient permissions to access this page."
    194 msgstr ""
    195 
    196 #: wp-password-policy-manager.php:791
    197 msgid "Settings saved."
    198 msgstr ""
    199 
    200 #: wp-password-policy-manager.php:795
    201 msgid "All passwords have been reset."
    202 msgstr ""
    203 
    204 #: wp-password-policy-manager.php:806
    205 msgid "WordPress Password Policy Manager Settings"
    206 msgstr ""
    207 
    208 #: wp-password-policy-manager.php:824
    209 msgid "Password Expiration Policy"
    210 msgstr ""
    211 
    212 #: wp-password-policy-manager.php:828
    213 msgid ""
    214 "Examples: <code>5 days</code> <code>20 days 6 hours</code> <code>3 weeks</"
    215 "code>"
    216 msgstr ""
    217 
    218 #: wp-password-policy-manager.php:829
    219 msgid "Leave blank to disable Password Expiry policy."
    220 msgstr ""
    221 
    222 #: wp-password-policy-manager.php:833
    223 msgid "Password Length Policy"
    224 msgstr ""
    225 
    226 #: wp-password-policy-manager.php:843
    227 msgid "characters"
    228 msgstr ""
    229 
    230 #: wp-password-policy-manager.php:844
    231 msgid "Leave blank to disable Password Length policy."
    232 msgstr ""
    233 
    234 #: wp-password-policy-manager.php:848 wp-password-policy-manager.php:851
    235 msgid "Mixed Case Policy"
    236 msgstr ""
    237 
    238 #: wp-password-policy-manager.php:855
    239 msgid "Password must contain a mix of uppercase and lowercase characters."
    240 msgstr ""
    241 
    242 #: wp-password-policy-manager.php:861 wp-password-policy-manager.php:864
    243 msgid "Numeric Digits Policy"
    244 msgstr ""
    245 
    246 #: wp-password-policy-manager.php:868
    247 msgid "Password must contain numeric digits (<code>0-9</code>)."
    248 msgstr ""
    249 
    250 #: wp-password-policy-manager.php:874 wp-password-policy-manager.php:877
    251 msgid "Special Characters Policy"
    252 msgstr ""
    253 
    254 #: wp-password-policy-manager.php:881
    255 msgid "Password must contain special characters (eg: <code>.,!#$_+</code>)."
    256 msgstr ""
    257 
    258 #: wp-password-policy-manager.php:887 wp-password-policy-manager.php:890
    259 msgid "Current Password Policy"
    260 msgstr ""
    261 
    262 #: wp-password-policy-manager.php:894
    263 msgid ""
    264 "When changing password on the profile page, the user must supply the current "
    265 "password."
    266 msgstr ""
    267 
    268 #: wp-password-policy-manager.php:900
    269 msgid "Password History Policy"
    270 msgstr ""
    271 
    272 #: wp-password-policy-manager.php:903
    273 msgid "Remember"
    274 msgstr ""
    275 
    276 #: wp-password-policy-manager.php:912
    277 msgid "old passwords"
    278 msgstr ""
    279 
    280 #: wp-password-policy-manager.php:913
    281 msgid "Leave blank to disable password history policy."
    282 msgstr ""
    283 
    284 #: wp-password-policy-manager.php:918
    285 msgid "Users and Roles Exempt From Policies"
    286 msgstr ""
    287 
    288 #: wp-password-policy-manager.php:925
    289 msgid "Users and Roles in this list are free of all Password Policies."
    290 msgstr ""
    291 
    292 #: wp-password-policy-manager.php:940
    293 msgid "Reset All Users' Passwords"
    294 msgstr ""
    295 
    296 #: wp-password-policy-manager.php:1075 wp-password-policy-manager.php:1100
    297 msgid "Configure Password Policies"
    298 msgstr ""
    299 
    300 #: wp-password-policy-manager.php:1081 wp-password-policy-manager.php:1084
    301 #: wp-password-policy-manager.php:1085
    302 msgid "Password Policies"
    303 msgstr ""
    304 
    305 #: wp-password-policy-manager.php:1101
    306 msgid ""
    307 "You have just installed WP Password Policy manager. All password policies "
    308 "are disabled by default. Click the button below to configure the WordPress "
    309 "password policies."
    310 msgstr ""
    311 
    312 #: wp-password-policy-manager.php:1102
     382"You have just installed WP Password Policy manager. All password policies are disabled by "
     383"default. Click the button below to configure the WordPress password policies."
     384msgstr ""
     385
     386#: wp-password-policy-manager.php:1531
    313387msgid "Configure Policies"
    314388msgstr ""
    315389
    316 #: wp-password-policy-manager.php:1118
     390#: wp-password-policy-manager.php:1547
    317391msgid "Access Denied."
    318392msgstr ""
    319393
    320 #: wp-password-policy-manager.php:1120
     394#: wp-password-policy-manager.php:1549
    321395msgid "Token parameter expected."
    322396msgstr ""
    323397
    324 #. Plugin Name of the plugin/theme
    325 msgid "WordPress Password Policy Manager"
    326 msgstr ""
    327 
    328 #. Plugin URI of the plugin/theme
    329 msgid ""
    330 "http://www.wpwhitesecurity.com/wordpress-security-plugins/wordpress-password-"
    331 "policy-manager-plugin/"
    332 msgstr ""
    333 
    334 #. Description of the plugin/theme
    335 msgid ""
    336 "WordPress Password Policy Manager allows WordPress administrators to "
    337 "configure password policies for WordPress users to use strong passwords."
    338 msgstr ""
    339 
    340 #. Author of the plugin/theme
    341 msgid "WP White Security"
    342 msgstr ""
    343 
    344 #. Author URI of the plugin/theme
    345 msgid "http://www.wpwhitesecurity.com/"
    346 msgstr ""
     398#: wp-password-policy-manager.php:1610
     399msgid "Once Every 10 Minutes"
     400msgstr ""
  • wp-password-policy-manager/trunk/readme.txt

    r1166318 r1222565  
    55License URI: http://www.gnu.org/licenses/gpl.html
    66Tags: wordpress password policy, password policy, password policy manager, wordpress password, password strength, password, authentication, security, wordpress user password, strong password, strong wordpress password, authentication, password security, password expire, strong wordpress password plugin
    7 Requires at least: 3.6.0
    8 Tested up to: 4.2.2
    9 Stable tag: 0.8
     7Requires at least: 4.0
     8Tested up to: 4.3
     9Stable tag: 0.9
    1010
    1111Configure WordPress password policies to ensure all WordPress users use strong passwords and improve the security of your WordPress.
     
    5555
    5656= WP Password Policy Manager in Your Language =
    57 We need help translating the plugin. If you're good at translating, please drop us an email on [[email protected]](mailto:plugins@wpwhitesecurity.com). WP Password Policy Manager is available in:
     57We need help translating the plugin. If you're good at translating, please drop us an email on [[email protected]](mailto:wp.kytten@gmail.com). WP Password Policy Manager is available in:
    5858
    59 Italian thanks to [Marco Borla](https://www.peopleinside.it/)
    60 Dutch thanks to [Anne Jan Roeleveld](http://www.annejanroeleveld.nl/)
    61 Polish thanks to [Piotr Matuszewski](http://www.megaweb.pl)
    62 Serbo-Croatian thanks to Borisa Djuraskovic from [Web Hosting Hub](http://www.webhostinghub.com/)
     59Italian thanks to [Marco Borla](https://www.peopleinside.it/),
     60Dutch thanks to [Anne Jan Roeleveld](http://www.annejanroeleveld.nl/),
     61Polish thanks to [Piotr Matuszewski](http://www.megaweb.pl),
     62Serbo-Croatian thanks to Borisa Djuraskovic from [Web Hosting Hub](http://www.webhostinghub.com/),
     63Spanish thanks to [Apasionados](http://apasionados.es/)
    6364
    6465= Plugin Newsletter =
     
    9091== Changelog ==
    9192
     93= 0.9 (2015-08-17) =
     94* **New features**
     95    * Implemented the MultiSite feature
     96    * Updated strings for translation
     97    * Added missing text domain to translation functions
     98    * Fixes js error when resetting all passwords
     99    * Add new option so administrators can use WP Cron to reset passwords if the site has many users
     100    * Updated "Requires at least" entry
     101    * Updated "Tested up to" entry
     102    * Updated .pot file
     103    * Added language files for English
     104    * Updated javascript files
     105
     106* **New Translations**
     107    * Added Spanish translation
     108
     109
    92110= 0.8 (2015-05-23) =
    93 * ** Updated plugin ownership **
     111* **Updated plugin ownership**
    94112    * Changed ownership of the plugin
    95113    * Updated "Tested up to" entry
     
    98116* **New Feature**
    99117    * Added nonces to the plugin form to avoid an issue where an attacker could trick an authenticated / logged in user to reset all passwords or make other changes.
    100    
     118
    101119* **New Translations**
    102120    * The following translatoins have been added; Italian, Dutch, Polish and Serbo-Croatian.
     
    109127* **New Features**
    110128    * Administrators can now enforce a user to specify the current password in profile page when changing the password - Administrators are exempt from this requirement so they can easily reset other users' password. Thanks to [Jens Nilson](https://profiles.wordpress.org/jensnilsson) for recommending this feature and for helping in developing it.
    111    
     129
    112130* **Improvements**
    113131    * Removed the need to write to /js/wppmpp.tmp.js and using built-in wp_localize_script. Update by [Jens Nilson](https://profiles.wordpress.org/jensnilsson)
    114    
     132
    115133* **Bug Fixes**
    116134    * Fixed an issue when user was redirected to password reset page when an incorrect user was specified
    117     * Fixed 
     135    * Fixed
    118136= 0.4 (2014-12-1) =
    119137* **Bug Fix**
  • wp-password-policy-manager/trunk/wp-password-policy-manager.php

    r1166318 r1222565  
    5454    const OPT_USER_PWDS = 'wppm_lst_pwd';
    5555    const OPT_USER_RST_PWD = 'wppm_rst_pwd';
     56    //@since 0.8
     57    const OPT_DISABLE_ADMINS = 'wppm_daa';
     58    //@since 0.9
     59    private static $_instance = null;
    5660
    5761    // </editor-fold>
     
    6266        foreach(array(
    6367                    array('admin_menu', 0),
     68                    array('admin_init', 1),
    6469                    array('network_admin_menu', 0),
    6570                    array('admin_enqueue_scripts', 0),
     
    96101     * @return \self Returns the current plugin instance.
    97102     */
    98     public static function GetInstance()
    99     {
    100         static $instance = null;
    101         if (!$instance) $instance = new self();
    102         return $instance;
    103     }
    104     // </editor-fold>
    105 
    106 
    107     // <editor-fold desc="WP Internals">
     103    public static function GetInstance(){
     104        if(is_null(self::$_instance) || !(self::$_instance instanceof self)){
     105            self::$_instance = new self;
     106        }
     107        return self::$_instance;
     108    }
     109// </editor-fold desc=">>> Entry Points">
     110
     111
     112// <editor-fold desc=">>> WP Internals">
     113
    108114
    109115    /**
     
    121127        if ($_nMaxSamePass) {
    122128            $rules[] = sprintf(__('not be one of the previous %d used passwords.', 'wp-password-policy-manager'), $_nMaxSamePass);
    123         } else {
     129        }
     130        else {
    124131            $rules[] = __('not be the same as the previous one', 'wp-password-policy-manager');
    125132        }
     
    176183            return;
    177184        }
    178         ?>
    179         <p>
    180             <label for="user_pass_new"><?php _e('New Password', 'wp-password-policy-manager') ?><br />
    181                 <input type="password" name="user_pass_new" id="user_pass_new" class="input" value="<?php echo ''; ?>" size="25" /></label>
    182         </p>
    183         <p>
    184             <label for="user_pass_vfy"><?php _e('Verify Password', 'wp-password-policy-manager') ?><br />
    185                 <input type="password" name="user_pass_vfy" id="user_pass_vfy" class="input" value="<?php echo ''; ?>" size="25" /></label>
    186         </p>
    187         <?php
    188185
    189186        wp_enqueue_script('front-js', $this->GetBaseUrl().'js/front.js', array('jquery'), rand(1,1234));
     
    196193            'NewPassRulesHead' => __('New password must...', 'wp-password-policy-manager'),
    197194            'NewPassRulesFoot' => __('WordPress Password Policies by', 'wp-password-policy-manager')
    198                 . '<br/><a href="http://www.wpwhitesecurity.com/wordpress-security-plugins/wp-password-policy-manager/" target="_blank">'
    199                     . __('WP Password Policy Manager', 'wp-password-policy-manager')
    200                 . '</a>'
     195                                  . '<br/><a href="http://www.wpwhitesecurity.com/wordpress-security-plugins/wp-password-policy-manager/" target="_blank">'
     196                                  . __('WP Password Policy Manager', 'wp-password-policy-manager')
     197                                  . '</a>'
    201198        ));
     199
     200        ?>
     201        <p>
     202            <label for="user_pass_new"><?php _e('New Password', 'wp-password-policy-manager'); ?><br />
     203                <input type="password" name="user_pass_new" id="user_pass_new" class="input"
     204                       placeholder="<?php _e('New Password', 'wp-password-policy-manager'); ?>"
     205                       value="<?php echo ''; ?>" size="25" /></label>
     206        </p>
     207        <p>
     208            <label for="user_pass_vfy"><?php _e('Verify Password', 'wp-password-policy-manager'); ?><br />
     209                <input type="password" name="user_pass_vfy" id="user_pass_vfy" class="input"
     210                       placeholder="<?php _e('Verify Password', 'wp-password-policy-manager'); ?>"
     211                       value="<?php echo ''; ?>" size="25" /></label>
     212        </p>
     213        <?php
    202214    }
    203215
     
    266278            else{
    267279                if($wasReset){
    268                     $diff = __('1 minute');
     280                    $diff = __('1 minute', 'wp-password-policy-manager');
    269281                }
    270282                else { $diff = human_time_diff(strtotime($this->GetPasswordTtl(), $this->GetPasswordLastModTime($user->ID)), current_time('timestamp')); }
     
    281293            <?php if($this->IsPolicyEnabled(self::POLICY_OLDPASSWORD) && !$this->UserCanSkipOldPwdPolicy()) { ?>
    282294            <tr>
    283                 <th><label for="wppmoldpass"><?php _e('Current Password', 'wp-password-policy-manager') ;?></label></th>
     295                <th><label for="wppmoldpass"><?php _e('Current Password', 'wp-password-policy-manager');?></label></th>
    284296                <td>
    285                     <input type="password" name="wppmoldpass" id="wppmoldpass" class="regular-text" size="16" value="" autocomplete="off"><br>
     297                    <input type="password" name="wppmoldpass" id="wppmoldpass" class="regular-text" size="16" value=""
     298                           placeholder="<?php _e('Current Password', 'wp-password-policy-manager');?>"
     299                           autocomplete="off"><br>
    286300                    <span class="description"><?php _e('Type your current password to be able to change your password.', 'wp-password-policy-manager'); ?></span>
    287301                </td>
     
    312326        $pass2 = (isset($_REQUEST['pass2']) ? $_REQUEST['pass2'] : '');
    313327        $oldpass = '';
    314         if($this->IsPolicyEnabled(self::POLICY_OLDPASSWORD) && !$this->UserCanSkipOldPwdPolicy($user)) {
     328        if($this->IsPolicyEnabled(self::POLICY_OLDPASSWORD) && !$this->UserCanSkipOldPwdPolicy()) {
    315329            $oldpass = (isset($_REQUEST['wppmoldpass']) ? $_REQUEST['wppmoldpass'] : '');
    316330        }
     
    347361            {
    348362                if(empty($pass1) || empty($pass2)){
    349                     $errors->add('expired_password', '<strong>ERROR</strong>: The new password cannot be empty.', 'wp-password-policy-manager');
     363                    $errors->add('expired_password',
     364                        __('<strong>ERROR</strong>: The new password cannot be empty.','wp-password-policy-manager'));
    350365                    return $errors;
    351366                }
    352367                if($pass1 <> $pass2){
    353                     $errors->add('expired_password', '<strong>ERROR</strong>: Both new passwords must match.', 'wp-password-policy-manager');
     368                    $errors->add('expired_password',
     369                        __('<strong>ERROR</strong>: Both new passwords must match.', 'wp-password-policy-manager'));
    354370                    return $errors;
    355371                }
    356372                $validateOldPass = ($this->IsPolicyEnabled(self::POLICY_OLDPASSWORD) && !$this->UserCanSkipOldPwdPolicy());
    357373                if($validateOldPass && empty($oldpass)){
    358                     $errors->add('expired_password', '<strong>ERROR</strong>: Please enter the current password in the Current Password field.', 'wp-password-policy-manager');
     374                    $errors->add('expired_password',
     375                        __('<strong>ERROR</strong>: Please enter the current password in the Current Password field.','wp-password-policy-manager'));
    359376                    return $errors;
    360377                }
     
    363380                $crtPwd = $userInfo->user_pass;
    364381                if(wp_check_password($pass1, $crtPwd, $user->ID)){
    365                     $errors->add('expired_password', '<strong>ERROR</strong>: New password cannot be the same as the old one.', 'wp-password-policy-manager');
     382                    $errors->add('expired_password',
     383                        __('<strong>ERROR</strong>: New password cannot be the same as the old one.','wp-password-policy-manager'));
    366384                    return $errors;
    367385                }
    368386                // new password cannot be the same as the username
    369387                if($pass1 == $userInfo->user_login){
    370                     $errors->add('expired_password', '<strong>ERROR</strong>: New password cannot be the same as the username.', 'wp-password-policy-manager');
     388                    $errors->add('expired_password',
     389                        __('<strong>ERROR</strong>: New password cannot be the same as the username.','wp-password-policy-manager'));
    371390                    return $errors;
    372391                }
    373392                // new password cannot be the same as the email
    374393                if($pass1 == $userInfo->user_email){
    375                     $errors->add('expired_password', '<strong>ERROR</strong>: New password cannot be the same as the email.', 'wp-password-policy-manager');
     394                    $errors->add('expired_password',
     395                        __('<strong>ERROR</strong>: New password cannot be the same as the email.','wp-password-policy-manager'));
    376396                    return $errors;
    377397                }
     
    527547    }
    528548
    529     // </editor-fold>
    530 
    531 
    532     // <editor-fold desc="Wordpress Extensions">
     549// </editor-fold desc=">>> WP Internals">
     550
     551
     552// <editor-fold desc="WordPress Extensions">
    533553    /**
    534554     * Get a global (across multiple sites) option.
     
    557577        $fn($name);
    558578    }
    559 
    560579    /**
    561580     * Get a user-specific option.
     
    608627        return current_user_can('manage_options');
    609628    }
    610 // </editor-fold>
    611 
    612     // <editor-fold desc="Misc Functionality">
    613 
     629// </editor-fold desc="WordPress Extensions">
     630
     631// <editor-fold desc="Misc Functionality">
    614632    public function UserCanSkipOldPwdPolicy(){
    615633        $user = wp_get_current_user();
     
    620638        return user_can($user->ID, 'manage_options');
    621639    }
    622 
    623640    /**
    624641     * @return string Password policy time to live as a string.
     
    711728    public function SetMaxSamePass($value){
    712729        $this->SetGlobalOption(self::OPT_NAME_MSP, $value);
     730    }
     731    //@since 0.8
     732    public function DisableAdminsAccess($value){
     733        $this->SetGlobalOption(self::OPT_DISABLE_ADMINS, $value);
     734    }
     735    //@since 0.8
     736    public function IsAdminAccessDisabled(){
     737        if(is_super_admin()){
     738            return false;
     739        }
     740        return (bool)$this->GetGlobalOption(self::OPT_DISABLE_ADMINS);
    713741    }
    714742    protected function EchoIdent($name){
     
    737765            $this->SetPolicyState(self::POLICY_OLDPASSWORD, $this->IsPostIdent('opw'));
    738766            $this->SetExemptTokens(isset($_REQUEST['ExemptTokens']) ? $_REQUEST['ExemptTokens'] : array());
    739             if($this->IsPostIdent('msp'))
    740                 $this->SetMaxSamePass((int)$this->GetPostIdent('msp'));
    741         } else {
     767            if($this->IsPostIdent('msp')) {
     768                $this->SetMaxSamePass( (int)$this->GetPostIdent( 'msp' ) );
     769            }
     770            if($this->IsMultisite()){
     771                if($this->IsPostIdent('daa'))
     772                    $this->DisableAdminsAccess((int)$this->GetPostIdent('daa'));
     773                else $this->DisableAdminsAccess(0);
     774            }
     775            // since v0.9
     776            // Will reset passwords for users using WP Cron
     777            // Useful when there are many users
     778            // see: https://wordpress.org/support/topic/timeout-when-resetting-all-passwords
     779            // requirement: WP_CRON must be available
     780            $bid = null;
     781            if(isset($_POST['WPPM_BID'])){
     782                $bid = intval($_POST['WPPM_BID']);
     783            }
     784            if($this->IsPostIdent('wpcron')){
     785                //exit('INDENT FOUND');
     786                $this->SetGlobalOption(self::CRON_RESET_PWD_OPT_NAME, 1);
     787                $this->SetGlobalOption(self::CRON_RESET_PWD_BID_OPT_NAME, $bid);
     788            }
     789        }
     790        else {
    742791            throw new Exception(__('Security check failed', 'wp-password-policy-manager'));
    743792        }
    744793    }
    745794
    746     protected function ResetWpPasswords()
     795    protected function ResetWpPasswords($blogId = null)
    747796    {
    748         if (!empty($_REQUEST['_wpnonce']) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'nonce_form' )) {
    749             $users = new WP_User_Query(array('blog_id' => 0));
    750             foreach ($users->get_results() as $user) {
    751                 $new_password = wp_generate_password();
     797        if (!empty($_REQUEST['_wpnonce']) && wp_verify_nonce( $_REQUEST['_wpnonce'], 'nonce_form' ))
     798        {
     799            //#Implements #4
     800            // When the site admin clicks "reset all passwords" all the passwords for that site only should be reset
     801
     802            // Make sure this is a valid request
     803            if($this->IsAdminAccessDisabled()){
     804                throw new Exception(__('Security check failed', 'wp-password-policy-manager'));
     805            }
     806
     807            // If this is a request coming from the Super Admin
     808            $isSuperAdminReq = is_super_admin();
     809
     810            // All blogs in the network
     811            if(empty($blogId)){
     812                global $wpdb;
     813                $query = "SELECT DISTINCT(blog_id) FROM ".$wpdb->blogs.' WHERE spam = 0 AND deleted = 0';
     814                $blogs = $wpdb->get_results($query, ARRAY_A);
     815                if(empty($blogs)){
     816                    error_log(__FUNCTION__.'() Error: no blogs found.');
     817                    return false;
     818                }
     819                foreach($blogs as $blog){
     820                    $this->_resetPasswordsHelper($blog['blog_id'], $isSuperAdminReq);
     821                }
     822            }
     823            // Specific site
     824            else {
     825                $this->_resetPasswordsHelper(get_current_blog_id(), $isSuperAdminReq);
     826            }
     827        }
     828        else {
     829            throw new Exception(__('Security check failed', 'wp-password-policy-manager'));
     830        }
     831    }
     832
     833    private function _resetPasswordsHelper($blogId = 0, $exceptSuperAdmin = true, $usingCron = false)
     834    {
     835//        if(defined( 'DOING_CRON' )){
     836//            error_log(__METHOD__.'() triggered by wp cron.');
     837//        }
     838
     839        // Select users for the specified blog
     840        $queryData = null;
     841        if($blogId){
     842            $queryData = array('blog_id' => (int)$blogId);
     843        }
     844        $usersQuery = new WP_User_Query($queryData);
     845        if($usersQuery){
     846            $users = $usersQuery->get_results();
     847        }
     848        if(empty($users)){
     849            error_log('No users found for blog id: '.$blogId);
     850            return;
     851        }
     852//error_log('Blog ID: '.$blogId);
     853//error_log('Users found: '.count($users));
     854//error_log(str_repeat('-',80));
     855
     856
     857
     858        $letters = range('a','z');
     859        $specials = array('~', '!', '@', '#', '$', '%', '^', '&', '*', '-', '+', '=', '.', ',');
     860
     861        foreach ($users as $user)
     862        {
     863//error_log('PROCESSING USERS OF BLOG: '.$blogId);
     864//error_log(str_repeat('-',80));
     865            if(! isset($user->ID)){
     866                error_log('USER ID NOT FOUND');
     867                continue;
     868            }
     869            $userInfo = $user->data;
     870
     871            $also = ($usingCron ? true : $exceptSuperAdmin);
     872
     873            // Ignore Super Admins
     874            if(is_super_admin($user->ID) && $also) {
     875//error_log('The user is super admin ('.$user->ID.', '.$userInfo->user_nicename.') Ignoring request for password change.');
     876                continue;
     877            }
     878
     879            // @since v0.9
     880            // In case wp cron fails to do this in one request and will have to go through
     881            // all suers all again, make sure it will only process those that didn't make it
     882            // in the first run
     883            $updated =  $this->GetGlobalOption(self::OPT_USER_RST_PWD . '_' . $user->ID);
     884            if($updated){
     885//error_log('USER PASSWORD ALREADY UPDATED FOR THIS USER: ('.$user->ID.', '.$userInfo->user_nicename.'). Skipping.');
     886                continue;
     887            }
     888
     889            $new_password = wp_generate_password();
     890
     891            // Ensure the generated password follows the plugin's policies
     892            if($this->IsPolicyEnabled(self::POLICY_MIXCASE)){
     893                if(strtolower($new_password) == $new_password){
     894                    $new_password .= strtoupper($letters[ array_rand($letters) ]);
     895                }
     896            }
     897            if($this->IsPolicyEnabled(self::POLICY_NUMBERS)){
     898                if(!preg_match('/[0-9]/', $new_password)){
     899                    $new_password .= rand(0,9);
     900                }
     901            }
     902            if($this->IsPolicyEnabled(self::POLICY_SPECIAL)){
     903                if(!preg_match('/[_\W]/', $new_password)){
     904                    $new_password .= strtoupper($specials[ array_rand($specials) ]);
     905                }
     906            }
     907
     908            $new_password = str_shuffle($new_password);
     909            $_nMaxSamePass = $this->GetMaxSamePass();
     910            if($_nMaxSamePass){
     911                while($this->_pwdHasBeenUsed($user->ID, $new_password)){
     912                    $new_password = str_shuffle($new_password);
     913                }
     914            }
     915
     916            // The blogname option is escaped with esc_html on the way into the database in sanitize_option
     917            // we want to reverse this for the plain text arena of emails.
     918            $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
     919
     920//error_log('Blog ID: '.$blogId.' ('.$blogname.'). Password changed for user: '.$userInfo->user_nicename.'. New password is: ' .$new_password);
     921
     922            $message = '<!DOCTYPE html><html><head><meta charset="UTF-8"/></head><body>';
     923            $message .= sprintf(__('<p>Your password for <strong>%s</strong> has been reset.</p>', 'wp-password-policy-manager'), $blogname) . "\r\n\r\n";
     924            $message .= sprintf(__('<p>New Password: <strong>%s</strong></p>', 'wp-password-policy-manager'), $new_password) . "\r\n\r\n";
     925            $message .= sprintf(__('<p>Please log in and change your password:', 'wp-password-policy-manager')) . "\r\n";
     926            $message .= wp_login_url() . "</p>\r\n";
     927            $message .= '</body></html>';
     928            $result = self::SendNotificationEmail($user->user_email, $message);
     929            if ($result) {
     930                // Set the new password
    752931                wp_set_password($new_password, $user->ID);
    753                 // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    754                 // we want to reverse this for the plain text arena of emails.
    755                 $blogname = wp_specialchars_decode(get_option('blogname'), ENT_QUOTES);
    756 
    757                 $message = '<!DOCTYPE html><html><head><meta charset="UTF-8"/></head><body>';
    758                 $message .= sprintf(__('<p>Your password for <strong>%s</strong> has been reset.</p>', 'wp-password-policy-manager'), $blogname) . "\r\n\r\n";
    759                 $message .= sprintf(__('<p>New Password: <strong>%s</strong></p>', 'wp-password-policy-manager'), $new_password) . "\r\n\r\n";
    760                 $message .= sprintf(__('<p>Please log in and change your password:', 'wp-password-policy-manager')) . "\r\n";
    761                 $message .= wp_login_url() . "</p>\r\n";
    762                 $message .= '</body></html>';
    763                 $result = self::SendNotificationEmail($user->user_email, $message);
    764                 if ($result) {
    765                     // reset & expire
    766                     $this->SetGlobalOption(self::OPT_USER_RST_PWD . '_' . $user->ID, true);
    767                     update_user_option($user->ID, self::OPT_NAME_UPM, current_time('timestamp'));
    768                 }
    769             }
    770         } else {
    771             throw new Exception(__('Security check failed', 'wp-password-policy-manager'));
    772         }
    773     }
     932
     933                // reset & expire
     934                $this->SetGlobalOption(self::OPT_USER_RST_PWD . '_' . $user->ID, true);
     935                update_user_option($user->ID, self::OPT_NAME_UPM, current_time('timestamp'));
     936
     937//error_log('Username: '.$userInfo->user_nicename);
     938//error_log('Email: '.$user->user_email);
     939//error_log($message);
     940//error_log(str_repeat('-',80));
     941            }
     942        }
     943        // Cleanup
     944        // @since v0.9
     945        $this->DeleteGlobalOption(self::CRON_RESET_PWD_OPT_NAME);
     946        $this->DeleteGlobalOption(self::CRON_RESET_PWD_BID_OPT_NAME);
     947    }
     948
     949    /**
     950     * Retrieve a blog through an AJAX call
     951     *
     952     * @since 0.8
     953     */
     954    public function get_blogs_ajax(){
     955        check_ajax_referer( 'nonce_form', 'nonce' );
     956
     957        if(! isset($_POST) || empty($_POST)){
     958            wp_send_json_error(__('Invalid request', 'wp-password-policy-manager'));
     959        }
     960
     961        if(! isset($_POST['q'])){
     962            wp_send_json_error(__('Invalid request', 'wp-password-policy-manager'));
     963        }
     964
     965        global $wpdb;
     966
     967        $q = esc_sql($_POST['q']);
     968
     969        $query = "SELECT * FROM ".$wpdb->blogs." WHERE domain like '%".$q."%' AND spam = 0 AND deleted = 0 ORDER BY blog_id";
     970        $data = $wpdb->get_results($query);
     971        if(empty($data)){
     972            wp_send_json_success( array() );
     973        }
     974        $out = array();
     975        foreach($data as $entry){
     976            $blogDetails = get_blog_details($entry->blog_id, true);
     977            array_push($out, array(
     978                'id' => $entry->blog_id,
     979                'name' => $blogDetails->blogname
     980            ));
     981        }
     982        wp_send_json_success( $out );
     983    }
     984
    774985    protected function SendNotificationEmail($emailAddress, $message){
    775986        $headers = sprintf('From: %s <%s>', get_bloginfo('name'), get_bloginfo('admin_email'))."\r\n";
     
    787998    protected function GetTokenType($token){
    788999        $users = array();
    789         foreach(get_users('blog_id=0&fields[]=user_login') as $obj)
     1000
     1001        $blogId = ($this->IsMultisite() ? 0 : get_current_blog_id());
     1002
     1003        foreach(get_users('blog_id='.$blogId.'&fields[]=user_login') as $obj)
    7901004            $users[] = $obj->user_login;
    7911005        $roles = array_keys(get_editable_roles());
     
    7971011     * Renders WordPress settings page.
    7981012     */
    799     public function ManageWpOptions(){
     1013    public function ManageWpOptions()
     1014    {
    8001015        // control access to plugin
    801         if (!$this->IsManagingAdmin()) {
     1016        if (!$this->IsManagingAdmin() || $this->IsAdminAccessDisabled()) {
    8021017            wp_die(__('You do not have sufficient permissions to access this page.', 'wp-password-policy-manager'));
    8031018        }
    8041019        // update submitted settings
    805         if(isset($_POST) && count($_POST)){
     1020        if(isset($_POST) && count($_POST))
     1021        {
     1022            //since 0.8
     1023            if($this->IsMultisite() && is_super_admin()){
     1024                $__blogId = 0;
     1025                $__allBlogs = false;
     1026                if(isset($_POST['wppm-reset-sites'])){
     1027                    if($_POST['wppm-reset-sites'] < 1){
     1028                        $__allBlogs = true;
     1029                    }
     1030                    else {
     1031                        $__blogId = $_POST['wppm-reset-sites'];
     1032                    }
     1033                }
     1034                $bid = ($__allBlogs ? 0 : $__blogId);
     1035            }
     1036            else {
     1037                $bid = get_current_blog_id();
     1038            }
     1039            $_POST['WPPM_BID'] = $bid;
     1040
    8061041            try {
    8071042                switch(true){
     
    8111046                        break;
    8121047                    case isset($_POST[self::DEF_PFX.'_rst']):
    813                         $this->ResetWpPasswords();
    814                         ?><div class="updated"><p><strong><?php _e('All passwords have been reset.', 'wp-password-policy-manager'); ?></strong></p></div><?php
     1048                        if(! is_null($bid)){
     1049                            // since v0.9
     1050                            // Check if cron enabled
     1051                            if($this->IsPostIdent('wpcron')){
     1052                                // REGISTER ACTION
     1053                                $this->SetGlobalOption(self::CRON_RESET_PWD_BID_OPT_NAME, $bid);
     1054                                $this->SetGlobalOption(self::CRON_RESET_PWD_OPT_NAME, 1);
     1055                                ?><div class="updated"><p><strong>
     1056                                        <?php _e('Request registered. Passwords will be reset using WP Cron in 10 minutes.','wp-password-policy-manager');?>
     1057                                    </strong></p></div>
     1058                                <?php
     1059                            }
     1060                            else {
     1061                                $this->DeleteGlobalOption(self::CRON_RESET_PWD_OPT_NAME);
     1062                                $this->DeleteGlobalOption(self::CRON_RESET_PWD_BID_OPT_NAME);
     1063                                $this->ResetWpPasswords($bid);
     1064                                ?><div class="updated"><p><strong><?php _e('All passwords have been reset.', 'wp-password-policy-manager'); ?></strong></p></div><?php
     1065                            }
     1066                        }
    8151067                        break;
    8161068                    default:
    817                         throw new Exception('Unexpected form submission content.', 'wp-password-policy-manager');
     1069                        throw new Exception(__('Unexpected form submission content.', 'wp-password-policy-manager'));
    8181070                }
    8191071            } catch (Exception $ex) {
    820                 ?><div class="error"><p><strong><?php _e(__('Error', 'wp-password-policy-manager').': '.$ex->getMessage()); ?></strong></p></div><?php
     1072                ?><div class="error"><p><strong><?php echo __('Error', 'wp-password-policy-manager').': '.$ex->getMessage(); ?></strong></p></div><?php
    8211073            }
    8221074        }
    8231075        // display settings page
    8241076        ?><div class="wrap">
    825         <h2><?php echo __('WordPress Password Policy Manager Settings'); ?></h2>
     1077        <h2><?php _e('WordPress Password Policy Manager Settings', 'wp-password-policy-manager'); ?></h2>
    8261078        <form method="post" id="wppm_settings">
    8271079            <input type="hidden" name="page" value="<?php echo esc_attr($_REQUEST['page']); ?>" />
    8281080            <input type="hidden" id="ajaxurl" value="<?php echo esc_attr(admin_url('admin-ajax.php')); ?>" />
     1081            <?php wp_nonce_field( 'nonce_form' ); ?>
     1082
    8291083            <div id="wppm-adverts">
    8301084                <a href="http://www.wpwhitesecurity.com/plugins-premium-extensions/email-notifications-wordpress/?utm_source=wppmplugin&utm_medium=settingspage&utm_campaign=notifications" target="_blank">
     
    8521106                    <th scope="row"><label for="<?php $this->EchoIdent('len'); ?>"><?php _e('Password Length Policy', 'wp-password-policy-manager'); ?></label></th>
    8531107                    <td>
    854                         <select type="text" id="<?php $this->EchoIdent('len'); ?>" name="<?php $this->EchoIdent('len'); ?>"><?php
     1108                        <select id="<?php $this->EchoIdent('len'); ?>" name="<?php $this->EchoIdent('len'); ?>"><?php
    8551109                            $curr = $this->GetPasswordLen();
    8561110                            foreach(array_merge(array(0), range(4, 16)) as $value){
     
    9171171                </tr>
    9181172                <tr valign="top">
    919                     <th><label for="<?php $this->EchoIdent('msp'); ?>"><?php _e('Password History Policy', 'wp-password-policy-manager'); ?></label></th>
     1173                    <th><label for="<?php $this->EchoIdent('msp'); ?>"><?php _e('Password History Policy','wp-password-policy-manager'); ?></label></th>
    9201174                    <td>
    9211175                        <fieldset>
    922                             <?php _e('Remember'); ?>
    923                             <select type="text" id="<?php $this->EchoIdent('msp'); ?>" name="<?php $this->EchoIdent('msp'); ?>"><?php
    924                                 $curr = $this->GetMaxSamePass();
     1176                            <?php _e('Remember','wp-password-policy-manager'); ?>
     1177                            <select id="<?php $this->EchoIdent('msp'); ?>" name="<?php $this->EchoIdent('msp'); ?>"><?php
     1178                                $crt = $this->GetMaxSamePass();
    9251179                                foreach(array_merge(array(0), range(2, 10)) as $value){
    926                                     $sel = ($value == $curr) ? ' selected="selected"' : '';
     1180                                    $sel = ($value == $crt) ? ' selected="selected"' : '';
    9271181                                    ?><option value="<?php echo $value; ?>"<?php echo $sel; ?>>
    9281182                                    <?php echo ($value == 0 ? '' : $value); ?>
     
    9341188                    </td>
    9351189                </tr>
     1190
     1191
     1192<?php if($this->IsMultisite() && is_super_admin()) :?>
     1193                <tr valign="top">
     1194                    <th><label for="<?php $this->EchoIdent('daa'); ?>"><?php _e('Disable Admins Access','wp-password-policy-manager'); ?></label></th>
     1195                    <td>
     1196                        <fieldset>
     1197                            <legend class="screen-reader-text"><span><?php _e('Disable Admins Access', 'wp-password-policy-manager'); ?></span></legend>
     1198                            <label for="<?php $this->EchoIdent('daa'); ?>">
     1199                                <input type="checkbox"
     1200                                        value="1"
     1201                                        id="<?php $this->EchoIdent('daa');?>"
     1202                                        name="<?php $this->EchoIdent('daa');?>"
     1203                                        <?php echo (((bool)$this->GetGlobalOption(self::OPT_DISABLE_ADMINS)) ? 'checked="checked"' : '');?>
     1204                                    />
     1205                                <?php _e("Disallow site administrators from modifying the plugin's settings.",'wp-password-policy-manager'); ?>
     1206                            </label>
     1207                        </fieldset>
     1208                    </td>
     1209                </tr>
     1210<?php endif; /* End if is multisite */?>
     1211
     1212
    9361213                <tr>
    9371214                    <th><label for="ExemptTokenQueryBox"><?php _e('Users and Roles Exempt From Policies', 'wp-password-policy-manager'); ?></label></th>
     
    9411218                            <input type="button" id="ExemptTokenQueryAdd" style="float: left; display: block;" class="button-primary" value="Add">
    9421219                            <br style="clear: both;"/>
    943                             <p class="description"><?php
    944                                 _e('Users and Roles in this list are free of all Password Policies.', 'wp-password-policy-manager');
    945                                 ?></p>
     1220                            <p class="description">
     1221                                <?php
     1222                                    _e('Users and Roles in this list are free of all Password Policies.', 'wp-password-policy-manager');
     1223                                ?>
     1224                            </p>
    9461225                            <div id="ExemptTokenList"><?php
    9471226                                foreach($this->GetExemptTokens() as $item){
     
    9491228                                    <input type="hidden" name="ExemptTokens[]" value="<?php echo esc_attr($item); ?>"/>
    9501229                                    <?php echo esc_html($item); ?>
    951                                     <a href="javascript:;" title="Remove">&times;</a>
     1230                                    <a href="javascript:return false;" title="Remove">&times;</a>
    9521231                                    </span><?php
    9531232                                }
     
    9581237                <tr valign="top">
    9591238                    <th scope="row"><label for="rst-submit-button"><?php _e("Reset All Users' Passwords", 'wp-password-policy-manager');?></label></th>
    960                     <td><input id="rst-submit-button" type="submit" name="<?php $this->EchoIdent('rst'); ?>" class="button-secondary" value="<?php esc_attr_e(__('Reset All Passwords', 'wp-password-policy-manager')); ?>"
    961                                onclick="return confirm(<?php esc_attr_e(json_encode(__('Are you sure you want to reset all passwords?', 'wp-password-policy-manager'))); ?>);"/></td>
     1239                    <td>
     1240<?php if($this->IsMultisite() && is_super_admin()){ ?>
     1241<div id="sa_options_container" style="margin: 10px 0 10px 0;">
     1242    <div>
     1243        <label for="wppm-all-sites">
     1244            <?php _e('All sites on network:', 'wp-password-policy-manager');?>
     1245            <input id="wppm-all-sites" name="wppm-reset-sites" type="radio" value="-1" style="margin-left: 10px;"/>
     1246        </label>
     1247        <br/>
     1248        <label for="wppm-specific-site">
     1249            <?php _e('Specific site on Network:', 'wp-password-policy-manager');?>
     1250            <input id="wppm-specific-site" name="wppm-reset-sites" type="radio" style="margin-left: 10px;"
     1251                   placeholder="<?php _e('Search for a site', 'wp-password-policy-manager');?>"/>
     1252        </label>
     1253    </div>
     1254</div>
     1255<script type="text/javascript">
     1256    jQuery(function($)
     1257    {
     1258        var inputSelect = $("#wppm-specific-site");
     1259        inputSelect.select2({
     1260            minimumInputLength: 2,
     1261            ajax: { // Select2's convenient helper
     1262                url: ajaxurl,
     1263                type: "POST",
     1264                dataType: 'json',
     1265                quietMillis: 250,
     1266                data: function (term, page) {
     1267                    return {
     1268                        q: term // search term
     1269                        ,action: 'get_blogs_ajax'
     1270                        ,nonce: $('#_wpnonce').val()
     1271                    };
     1272                },
     1273                results: function (data, page) { // parse the results into the format expected by Select2.
     1274                    // since we are using custom formatting functions we do not need to alter the remote JSON data
     1275                    return { results: data.data };
     1276                },
     1277                cache: false
     1278            },
     1279            initSelection: function(element, callback) {
     1280                var id = $(element).val();
     1281                if (id !== "") {
     1282                    $.post(ajaxurl, {
     1283                        q: <?php echo get_current_blog_id();?>
     1284                        ,action: 'get_blogs_ajax'
     1285                        ,nonce: $('#_wpnonce').val()
     1286                    }).done(function(data) { callback(data); });
     1287                }
     1288            },
     1289            formatResult: function(entry){
     1290                return entry.name
     1291            },
     1292            formatSelection: function(entry){
     1293                return entry.name
     1294            },
     1295            dropdownAutoWidth : true,
     1296            escapeMarkup: function (m) { return m; } // no escaping needed
     1297        })
     1298            .on("select2-close", function() {
     1299                // check value
     1300                var v = parseInt(inputSelect.select2("val"), 10);
     1301                if(isNaN(v) || v < 1){
     1302                    setTimeout(function(){
     1303                        $('#wppm-all-sites').prop('checked', true);
     1304                    }, 250);
     1305                }
     1306            })
     1307            .on("select2-focus", function(e) {
     1308                $('#wppm-all-sites').removeAttr('checked');
     1309            })
     1310            .on("select2-open", function() {
     1311                $('#wppm-all-sites').removeAttr('checked');
     1312            });
     1313
     1314        // Set the default value
     1315        inputSelect.select2("val", 0);
     1316
     1317        // Check the first option
     1318        $('#wppm-all-sites').prop('checked', true);
     1319    });
     1320</script>
     1321<?php };  /* End if is multisite && SA */?>
     1322<script type="text/javascript">
     1323    jQuery(function($){
     1324        $('#rst-submit-button').on('click', function()
     1325        {
     1326            if(confirm("<?php esc_attr_e(__('Are you sure you want to reset all passwords?', 'wp-password-policy-manager'));?>")){
     1327                if($('#wppm-all-sites').prop('checked') == true) {
     1328                    return true;
     1329                }
     1330                else {
     1331                    var input = $('#wppm-specific-site'),
     1332                        value = input.select2("val");
     1333                    if(input && !isNaN(value) && value >= 1){
     1334                        input.prop('checked','checked').val(value);
     1335                        return true;
     1336                    }
     1337                }
     1338            }
     1339            return false;
     1340        });
     1341    });
     1342</script>
     1343                        <input id="rst-submit-button" type="submit"
     1344                               name="<?php $this->EchoIdent('rst'); ?>"
     1345                               class="button-secondary"
     1346                               value="<?php esc_attr_e(__('Reset All Passwords', 'wp-password-policy-manager')); ?>"/>
     1347                        </td>
     1348                    </tr>
     1349                <?php if(!defined('DISABLE_WP_CRON') || !DISABLE_WP_CRON) { ?>
     1350                <tr valign="top">
     1351                    <th scope="row"><label for="<?php $this->EchoIdent('wpcron');?>"><?php _e("Use WP Cron",'wp-password-policy-manager');?></label></th>
     1352                    <td>
     1353                        <?php
     1354                            $wpUseCron = $this->GetGlobalOption(self::CRON_RESET_PWD_OPT_NAME);
     1355                        ?>
     1356                        <input type="checkbox" name="<?php $this->EchoIdent('wpcron');?>"
     1357                               id="<?php $this->EchoIdent('wpcron');?>" <?php checked($wpUseCron);?> />
     1358                        <p class="description"><?php _e('Only check this option if your site has many users.','wp-password-policy-manager'); ?></p>
     1359                    </td>
    9621360                </tr>
    963 
     1361                <?php } ?>
    9641362                </tbody>
    9651363            </table>
    966             <?php wp_nonce_field( 'nonce_form' ); ?>
    9671364            <!-- Policy Flags: <?php echo $this->_policy_flag_cache; ?> -->
    9681365            <p class="submit">
    969                 <input type="submit" name="<?php $this->EchoIdent('snt'); ?>" class="button-primary" value="<?php esc_attr_e(__('Save Changes', 'wp-password-policy-manager')); ?>" />
     1366                <input type="submit" name="<?php $this->EchoIdent('snt'); ?>" class="button-primary"
     1367                       value="<?php esc_attr_e(__('Save Changes', 'wp-password-policy-manager')); ?>" />
    9701368            </p>
    9711369        </form>
    9721370        </div><?php
    9731371    }
     1372
    9741373    /**
    9751374     * Returns whether policies for specified user are applicable or not.
     
    10721471        return self::_DeleteGlobalOption(self::_getPwdListOptName($uid));
    10731472    }
    1074     // </editor-fold>
    1075 
    1076     // <editor-fold desc="WordPress Hooks and Filters">
    1077 
     1473// </editor-fold desc="Misc Functionality">
     1474
     1475// <editor-fold desc="WordPress Hooks and Filters">
    10781476    public function profile_update($user_id){
    10791477        $this->_addPwdToList($user_id, get_userdata($user_id)->user_pass);
     
    11061504    }
    11071505    public function admin_enqueue_scripts(){
    1108         wp_enqueue_style('wppm', $this->GetBaseUrl() . 'css/wppm.css', array(), filemtime($this->GetBaseDir() . 'css/wppm.css'));
     1506        $baseUrl = trailingslashit($this->GetBaseUrl());
     1507        $baseDir = trailingslashit($this->GetBaseDir());
     1508        wp_enqueue_style('wppm', $baseUrl.'css/wppm.css', array(), filemtime($baseDir.'css/wppm.css'));
     1509
     1510        //since 0.8
     1511        if($this->IsMultisite() && is_super_admin()){
     1512            wp_enqueue_style('wppm-select2-css', $baseUrl.'js/select2/select2.css', array(), filemtime($baseDir.'js/select2/select2.css'));
     1513            wp_enqueue_style('wppm-select2-bs-css', $baseUrl.'js/select2/select2-bootstrap.css', array(), filemtime($baseDir.'js/select2/select2-bootstrap.css'));
     1514            wp_enqueue_script('wppm-select2-min-js', $baseUrl.'js/select2/select2.min.js', array('jquery'), filemtime($baseDir.'js/select2/select2.min.js'));
     1515        }
    11091516    }
    11101517    public function admin_footer(){
     
    11481555            self::ClearUserPrevPwds($user->ID);
    11491556    }
    1150     // </editor-fold>
     1557
     1558    /**
     1559     * Register the ajax request
     1560     * @since 0.8
     1561     */
     1562    public function admin_init() {
     1563        add_action('wp_ajax_get_blogs_ajax', array($this,'get_blogs_ajax'));
     1564    }
     1565// </editor-fold desc="WordPress Hooks and Filters">
     1566
     1567
     1568//<editor-fold desc="::: WP Cron">
     1569    const WP_CRON_ACTION = 'wppm_cron_task';
     1570    const CRON_RESET_PWD_BID_OPT_NAME = 'wppm_cron_reset_pwd_bid';
     1571    const CRON_RESET_PWD_OPT_NAME = 'wppm_cron_reset_pwds';
     1572
     1573
     1574    public function _cronSchedule(){
     1575        if( !wp_next_scheduled( self::WP_CRON_ACTION ) ) {
     1576            wp_schedule_event( time(), 'ten_minutes', self::WP_CRON_ACTION );
     1577//            error_log('CRON TASK SCHEDULED');
     1578        }
     1579    }
     1580    public function _cronUnschedule(){
     1581        // find out when the last event was scheduled
     1582        $timestamp = wp_next_scheduled (self::WP_CRON_ACTION);
     1583        // unschedule previous event if any
     1584        wp_unschedule_event($timestamp, self::WP_CRON_ACTION);
     1585    }
     1586    public function _cronDoAction(){
     1587        $blogId = $this->GetGlobalOption(self::CRON_RESET_PWD_BID_OPT_NAME);
     1588        if(false !== $blogId){
     1589            global $wpdb;
     1590            $query = "SELECT DISTINCT(blog_id) FROM ".$wpdb->blogs.' WHERE spam = 0 AND deleted = 0';
     1591            $blogs = $wpdb->get_results($query, ARRAY_A);
     1592            if(empty($blogs)){
     1593//                error_log(__FUNCTION__.'() Error: no blogs found.');
     1594                return false;
     1595            }
     1596            foreach($blogs as $blog){
     1597                $this->_resetPasswordsHelper($blog['blog_id'], false, true);
     1598            }
     1599        }
     1600    }
     1601    public function _cronAddCustomInterval($schedules){
     1602        if(! is_array($schedules)){
     1603            $schedules = array();
     1604        }
     1605        $schedules['ten_minutes'] = array(
     1606            'interval'  => 600, // Number of seconds, 600 in 10 minutes
     1607            'display'   => __('Once Every 10 Minutes','wp-password-policy-manager')
     1608        );
     1609        return $schedules;
     1610    }
     1611//</editor-fold desc="::: WP Cron">
    11511612}
     1613
     1614$wppm = WpPasswordPolicyManager::GetInstance();
     1615
     1616/*
     1617 * WP Cron
     1618 */
     1619add_filter( 'cron_schedules', array($wppm, '_cronAddCustomInterval'), 98, 1 );
     1620add_action( 'wp', array($wppm, '_cronSchedule') ); // frontend
     1621add_action( 'plugins_loaded', array($wppm, '_cronSchedule') ); // backend
     1622add_action( $wppm::WP_CRON_ACTION, array($wppm, '_cronDoAction') );
     1623register_deactivation_hook( __FILE__, array($wppm, '_cronUnschedule') );
     1624
    11521625register_uninstall_hook(__FILE__, array('WpPasswordPolicyManager', 'on_uninstall'));
    1153 // Create & Run the plugin
    1154 return WpPasswordPolicyManager::GetInstance();
     1626
     1627// Instantiate & Run the plugin
     1628return $wppm;
Note: See TracChangeset for help on using the changeset viewer.