Changeset 1222565
- Timestamp:
- 08/17/2015 10:03:03 AM (10 years ago)
- Location:
- wp-password-policy-manager/trunk
- Files:
-
- 59 added
- 6 edited
-
js/front.js (modified) (2 diffs)
-
js/reset.js (modified) (1 diff)
-
js/select2 (added)
-
js/select2/CONTRIBUTING.md (added)
-
js/select2/LICENSE (added)
-
js/select2/README.md (added)
-
js/select2/select2-bootstrap.css (added)
-
js/select2/select2-spinner.gif (added)
-
js/select2/select2.css (added)
-
js/select2/select2.js (added)
-
js/select2/select2.min.js (added)
-
js/select2/select2.png (added)
-
js/select2/select2_locale_ar.js (added)
-
js/select2/select2_locale_az.js (added)
-
js/select2/select2_locale_bg.js (added)
-
js/select2/select2_locale_ca.js (added)
-
js/select2/select2_locale_cs.js (added)
-
js/select2/select2_locale_da.js (added)
-
js/select2/select2_locale_de.js (added)
-
js/select2/select2_locale_el.js (added)
-
js/select2/select2_locale_en.js.template (added)
-
js/select2/select2_locale_es.js (added)
-
js/select2/select2_locale_et.js (added)
-
js/select2/select2_locale_eu.js (added)
-
js/select2/select2_locale_fa.js (added)
-
js/select2/select2_locale_fi.js (added)
-
js/select2/select2_locale_fr.js (added)
-
js/select2/select2_locale_gl.js (added)
-
js/select2/select2_locale_he.js (added)
-
js/select2/select2_locale_hr.js (added)
-
js/select2/select2_locale_hu.js (added)
-
js/select2/select2_locale_id.js (added)
-
js/select2/select2_locale_is.js (added)
-
js/select2/select2_locale_it.js (added)
-
js/select2/select2_locale_ja.js (added)
-
js/select2/select2_locale_ka.js (added)
-
js/select2/select2_locale_ko.js (added)
-
js/select2/select2_locale_lt.js (added)
-
js/select2/select2_locale_lv.js (added)
-
js/select2/select2_locale_mk.js (added)
-
js/select2/select2_locale_ms.js (added)
-
js/select2/select2_locale_nb.js (added)
-
js/select2/select2_locale_nl.js (added)
-
js/select2/select2_locale_pl.js (added)
-
js/select2/select2_locale_pt-BR.js (added)
-
js/select2/select2_locale_pt-PT.js (added)
-
js/select2/select2_locale_ro.js (added)
-
js/select2/select2_locale_rs.js (added)
-
js/select2/select2_locale_ru.js (added)
-
js/select2/select2_locale_sk.js (added)
-
js/select2/select2_locale_sv.js (added)
-
js/select2/select2_locale_th.js (added)
-
js/select2/select2_locale_tr.js (added)
-
js/select2/select2_locale_ug-CN.js (added)
-
js/select2/select2_locale_uk.js (added)
-
js/select2/select2_locale_vi.js (added)
-
js/select2/select2_locale_zh-CN.js (added)
-
js/select2/select2_locale_zh-TW.js (added)
-
js/select2/select2x2.png (added)
-
js/wppm.js (modified) (1 diff)
-
languages/wp-password-policy-manager-es_ES.mo (added)
-
languages/wp-password-policy-manager-es_ES.po (added)
-
languages/wp-password-policy-manager.pot (modified) (2 diffs)
-
readme.txt (modified) (5 diffs)
-
wp-password-policy-manager.php (modified) (29 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-password-policy-manager/trunk/js/front.js
r1041264 r1222565 1 jQuery(document).ready(function(){ 1 jQuery(function($){ 2 "use strict"; 2 3 if(wppm_ModifyForm){ 3 4 var d = wppm_ModifyForm; 4 5 5 6 // 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'); 8 9 p.find('label').contents()[0].textContent = d.TextOldPass; 9 10 10 11 // update form button 11 jQuery('#wp-submit').val(d.BtnChangeAndLogin);12 $('#wp-submit').val(d.BtnChangeAndLogin); 12 13 13 14 // update form width + add rules 14 15 var w = 280; 15 16 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'}); 19 20 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({ 23 24 'position': 'absolute', 24 25 'right': '24px', … … 26 27 'width': (w - 48) + 'px' 27 28 }).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({ 30 31 'margin-top': '24px', 31 32 'font-size': '10px', -
wp-password-policy-manager/trunk/js/reset.js
r1041264 r1222565 1 1 jQuery(function($){ 2 "use strict"; 2 3 if(wppm_ModifyForm) { 3 4 var form = $('#resetpassform'),data = form.html(), d = wppm_ModifyForm; -
wp-password-policy-manager/trunk/js/wppm.js
r1032367 r1222565 1 jQuery(document).ready(function(){ 1 jQuery(function($){ 2 "use strict"; 2 3 var RemoveSecToken = function(){ 3 var $this = jQuery(this).parents('span:first');4 var $this = $(this).parents('span:first'); 4 5 $this.addClass('sectoken-del').fadeOut('fast', function(){ 5 6 $this.remove(); 6 7 }); 7 8 }; 8 9 jQuery('#ExemptTokenQueryBox').keydown(function(event){9 10 $('#ExemptTokenQueryBox').keydown(function(event){ 10 11 if(event.keyCode === 13) { 11 jQuery('#ExemptTokenQueryAdd').click();12 $('#ExemptTokenQueryAdd').click(); 12 13 return false; 13 14 } 14 15 }); 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 20 21 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); 25 26 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">×</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">×</a>').click(RemoveSecToken) 30 31 )); 31 32 }); 32 33 }); 33 34 jQuery('#ExemptTokenList>span>a').click(RemoveSecToken);34 35 $('#ExemptTokenList>span>a').click(RemoveSecToken); 35 36 }); -
wp-password-policy-manager/trunk/languages/wp-password-policy-manager.pot
r1066802 r1222565 1 1 # Copyright (C) 2015 WordPress Password Policy Manager 2 2 # This file is distributed under the same license as the WordPress Password Policy Manager package. 3 #, fuzzy 3 4 msgid "" 4 5 msgstr "" 5 "Project-Id-Version: WordPress Password Policy Manager 0. 6\n"6 "Project-Id-Version: WordPress Password Policy Manager 0.9\n" 6 7 "Report-Msgid-Bugs-To: http://wordpress.org/tag/wp-password-policy-manager\n" 7 "POT-Creation-Date: 2015-0 1-13 09:07:33+00:00\n"8 "POT-Creation-Date: 2015-08-17 12:32+0300\n" 8 9 "MIME-Version: 1.0\n" 9 10 "Content-Type: text/plain; charset=UTF-8\n" … … 11 12 "PO-Revision-Date: 2015-MO-DA HO:MI+ZONE\n" 12 13 "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 16 25 msgid "not be the same as your username" 17 26 msgstr "" 18 27 19 #: wp-password-policy-manager.php:112 28 #: wp-password-policy-manager.php:128 29 #, php-format 20 30 msgid "not be one of the previous %d used passwords." 21 31 msgstr "" 22 32 23 #: wp-password-policy-manager.php:1 1433 #: wp-password-policy-manager.php:131 24 34 msgid "not be the same as the previous one" 25 35 msgstr "" 26 36 27 #: wp-password-policy-manager.php:118 37 #: wp-password-policy-manager.php:135 38 #, php-format 28 39 msgid "be at least %d characters long" 29 40 msgstr "" 30 41 31 #: wp-password-policy-manager.php:1 2042 #: wp-password-policy-manager.php:137 32 43 msgid "contain mixed case characters" 33 44 msgstr "" 34 45 35 #: wp-password-policy-manager.php:1 2246 #: wp-password-policy-manager.php:139 36 47 msgid "contain numeric digits" 37 48 msgstr "" 38 49 39 #: wp-password-policy-manager.php:1 2450 #: wp-password-policy-manager.php:141 40 51 msgid "contain special characters" 41 52 msgstr "" 42 53 43 #: wp-password-policy-manager.php:170 54 #: wp-password-policy-manager.php:190 55 msgid "Old Password" 56 msgstr "" 57 58 #: wp-password-policy-manager.php:191 59 msgid "Change & Log in" 60 msgstr "" 61 62 #: wp-password-policy-manager.php:193 wp-password-policy-manager.php:453 63 msgid "New password must..." 64 msgstr "" 65 66 #: wp-password-policy-manager.php:194 wp-password-policy-manager.php:313 67 #: wp-password-policy-manager.php:454 68 msgid "WordPress Password Policies by" 69 msgstr "" 70 71 #: wp-password-policy-manager.php:196 wp-password-policy-manager.php:315 72 #: wp-password-policy-manager.php:456 73 msgid "WP Password Policy Manager" 74 msgstr "" 75 76 #: wp-password-policy-manager.php:202 wp-password-policy-manager.php:204 44 77 msgid "New Password" 45 78 msgstr "" 46 79 47 #: wp-password-policy-manager.php: 17480 #: wp-password-policy-manager.php:208 wp-password-policy-manager.php:210 48 81 msgid "Verify Password" 49 82 msgstr "" 50 83 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 74 85 msgid "Invalid Request" 75 86 msgstr "" 76 87 77 #: wp-password-policy-manager.php:2 1588 #: wp-password-policy-manager.php:237 wp-password-policy-manager.php:364 78 89 msgid "<strong>ERROR</strong>: The new password cannot be empty." 79 90 msgstr "" 80 91 81 #: wp-password-policy-manager.php:2 1792 #: wp-password-policy-manager.php:239 wp-password-policy-manager.php:369 82 93 msgid "<strong>ERROR</strong>: Both new passwords must match." 83 94 msgstr "" 84 95 85 #: wp-password-policy-manager.php:2 1996 #: wp-password-policy-manager.php:241 wp-password-policy-manager.php:383 86 97 msgid "<strong>ERROR</strong>: New password cannot be the same as the old one." 87 98 msgstr "" 88 99 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 102 msgid "<strong>ERROR</strong>: New password cannot be the same as the username." 103 msgstr "" 104 105 #: wp-password-policy-manager.php:245 wp-password-policy-manager.php:395 106 #: wp-password-policy-manager.php:501 107 msgid "<strong>ERROR</strong>: New password cannot be the same as the email." 108 msgstr "" 109 110 #: wp-password-policy-manager.php:248 wp-password-policy-manager.php:401 111 #: wp-password-policy-manager.php:506 112 #, php-format 113 msgid "<strong>ERROR</strong>: New password must contain at least %d characters." 114 msgstr "" 115 116 #: wp-password-policy-manager.php:251 wp-password-policy-manager.php:407 117 #: wp-password-policy-manager.php:512 118 msgid "<strong>ERROR</strong>: New password must contain both uppercase and lowercase characters." 119 msgstr "" 120 121 #: wp-password-policy-manager.php:254 wp-password-policy-manager.php:413 122 #: wp-password-policy-manager.php:518 123 msgid "<strong>ERROR</strong>: New password must contain numbers." 124 msgstr "" 125 126 #: wp-password-policy-manager.php:257 wp-password-policy-manager.php:419 127 #: wp-password-policy-manager.php:524 128 msgid "<strong>ERROR</strong>: New password must contain special characters." 129 msgstr "" 130 131 #: wp-password-policy-manager.php:263 wp-password-policy-manager.php:433 132 #: wp-password-policy-manager.php:534 133 #, php-format 134 msgid "<strong>ERROR</strong>: New password must not be one of the previous %d used passwords." 135 msgstr "" 136 137 #: wp-password-policy-manager.php:280 138 msgid "1 minute" 139 msgstr "" 140 141 #: wp-password-policy-manager.php:283 142 #, php-format 143 msgid "<strong>ERROR</strong>: The password you entered expired %s ago." 144 msgstr "" 145 146 #: wp-password-policy-manager.php:295 wp-password-policy-manager.php:298 147 msgid "Current Password" 148 msgstr "" 149 150 #: wp-password-policy-manager.php:300 151 msgid "Type your current password to be able to change your password." 152 msgstr "" 153 154 #: wp-password-policy-manager.php:305 155 msgid "New password must" 156 msgstr "" 157 158 #: wp-password-policy-manager.php:375 159 msgid "<strong>ERROR</strong>: Please enter the current password in the Current Password field." 160 msgstr "" 161 162 #: wp-password-policy-manager.php:425 163 msgid "<strong>ERROR</strong>: Current password is incorrect." 164 msgstr "" 165 166 #: wp-password-policy-manager.php:465 167 msgid "The form is not valid. Please refresh the page and try again." 168 msgstr "" 169 170 #: wp-password-policy-manager.php:469 171 msgid "Please provide your new password." 172 msgstr "" 173 174 #: wp-password-policy-manager.php:473 175 msgid "Please confirm your new password." 176 msgstr "" 177 178 #: wp-password-policy-manager.php:481 179 msgid "Passwords must match." 180 msgstr "" 181 182 #: wp-password-policy-manager.php:487 183 msgid "The new password cannot be the same as the current one." 184 msgstr "" 185 186 #: wp-password-policy-manager.php:664 187 msgid "Password policy expiration time is not valid." 188 msgstr "" 189 190 #: wp-password-policy-manager.php:791 wp-password-policy-manager.php:804 191 #: wp-password-policy-manager.php:829 192 msgid "Security check failed" 193 msgstr "" 194 195 #: wp-password-policy-manager.php:923 196 #, php-format 197 msgid "<p>Your password for <strong>%s</strong> has been reset.</p>" 198 msgstr "" 199 200 #: wp-password-policy-manager.php:924 201 #, php-format 202 msgid "<p>New Password: <strong>%s</strong></p>" 203 msgstr "" 204 205 #: wp-password-policy-manager.php:925 206 msgid "<p>Please log in and change your password:" 207 msgstr "" 208 209 #: wp-password-policy-manager.php:958 wp-password-policy-manager.php:962 210 msgid "Invalid request" 211 msgstr "" 212 213 #: wp-password-policy-manager.php:989 214 msgid "Password has been reset" 215 msgstr "" 216 217 #: wp-password-policy-manager.php:1017 218 msgid "You do not have sufficient permissions to access this page." 219 msgstr "" 220 221 #: wp-password-policy-manager.php:1045 222 msgid "Settings saved." 223 msgstr "" 224 225 #: wp-password-policy-manager.php:1056 90 226 msgid "" 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: " 229 msgstr "" 230 231 #: wp-password-policy-manager.php:1065 232 msgid "All passwords have been reset." 233 msgstr "" 234 235 #: wp-password-policy-manager.php:1070 236 msgid "Unexpected form submission content." 237 msgstr "" 238 239 #: wp-password-policy-manager.php:1073 240 msgid "Error" 241 msgstr "" 242 243 #: wp-password-policy-manager.php:1078 244 msgid "WordPress Password Policy Manager Settings" 245 msgstr "" 246 247 #: wp-password-policy-manager.php:1098 248 msgid "Password Expiration Policy" 249 msgstr "" 250 251 #: wp-password-policy-manager.php:1102 252 msgid "Examples: <code>5 days</code> <code>20 days 6 hours</code> <code>3 weeks</code>" 253 msgstr "" 254 255 #: wp-password-policy-manager.php:1103 256 msgid "Leave blank to disable Password Expiry policy." 257 msgstr "" 258 259 #: wp-password-policy-manager.php:1107 260 msgid "Password Length Policy" 261 msgstr "" 262 263 #: wp-password-policy-manager.php:1117 264 msgid "characters" 265 msgstr "" 266 267 #: wp-password-policy-manager.php:1118 268 msgid "Leave blank to disable Password Length policy." 269 msgstr "" 270 271 #: wp-password-policy-manager.php:1122 wp-password-policy-manager.php:1125 272 msgid "Mixed Case Policy" 273 msgstr "" 274 275 #: wp-password-policy-manager.php:1129 276 msgid "Password must contain a mix of uppercase and lowercase characters." 277 msgstr "" 278 279 #: wp-password-policy-manager.php:1135 wp-password-policy-manager.php:1138 280 msgid "Numeric Digits Policy" 281 msgstr "" 282 283 #: wp-password-policy-manager.php:1142 284 msgid "Password must contain numeric digits (<code>0-9</code>)." 285 msgstr "" 286 287 #: wp-password-policy-manager.php:1148 wp-password-policy-manager.php:1151 288 msgid "Special Characters Policy" 289 msgstr "" 290 291 #: wp-password-policy-manager.php:1155 292 msgid "Password must contain special characters (eg: <code>.,!#$_+</code>)." 293 msgstr "" 294 295 #: wp-password-policy-manager.php:1161 wp-password-policy-manager.php:1164 296 msgid "Current Password Policy" 297 msgstr "" 298 299 #: wp-password-policy-manager.php:1168 300 msgid "When changing password on the profile page, the user must supply the current password." 301 msgstr "" 302 303 #: wp-password-policy-manager.php:1174 304 msgid "Password History Policy" 305 msgstr "" 306 307 #: wp-password-policy-manager.php:1177 308 msgid "Remember" 309 msgstr "" 310 311 #: wp-password-policy-manager.php:1186 312 msgid "old passwords" 313 msgstr "" 314 315 #: wp-password-policy-manager.php:1187 316 msgid "Leave blank to disable password history policy." 317 msgstr "" 318 319 #: wp-password-policy-manager.php:1195 wp-password-policy-manager.php:1198 320 msgid "Disable Admins Access" 321 msgstr "" 322 323 #: wp-password-policy-manager.php:1206 324 msgid "Disallow site administrators from modifying the plugin's settings." 325 msgstr "" 326 327 #: wp-password-policy-manager.php:1215 328 msgid "Users and Roles Exempt From Policies" 329 msgstr "" 330 331 #: wp-password-policy-manager.php:1223 332 msgid "Users and Roles in this list are free of all Password Policies." 333 msgstr "" 334 335 #: wp-password-policy-manager.php:1239 336 msgid "Reset All Users' Passwords" 337 msgstr "" 338 339 #: wp-password-policy-manager.php:1245 340 msgid "All sites on network:" 341 msgstr "" 342 343 #: wp-password-policy-manager.php:1250 344 msgid "Specific site on Network:" 345 msgstr "" 346 347 #: wp-password-policy-manager.php:1252 348 msgid "Search for a site" 349 msgstr "" 350 351 #: wp-password-policy-manager.php:1327 352 msgid "Are you sure you want to reset all passwords?" 353 msgstr "" 354 355 #: wp-password-policy-manager.php:1347 356 msgid "Reset All Passwords" 357 msgstr "" 358 359 #: wp-password-policy-manager.php:1352 360 msgid "Use WP Cron" 361 msgstr "" 362 363 #: wp-password-policy-manager.php:1359 364 msgid "Only check this option if your site has many users." 365 msgstr "" 366 367 #: wp-password-policy-manager.php:1369 368 msgid "Save Changes" 369 msgstr "" 370 371 #: wp-password-policy-manager.php:1495 wp-password-policy-manager.php:1529 372 msgid "Configure Password Policies" 373 msgstr "" 374 375 #: wp-password-policy-manager.php:1501 wp-password-policy-manager.php:1504 376 #: wp-password-policy-manager.php:1505 377 msgid "Password Policies" 378 msgstr "" 379 380 #: wp-password-policy-manager.php:1530 100 381 msgid "" 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." 384 msgstr "" 385 386 #: wp-password-policy-manager.php:1531 313 387 msgid "Configure Policies" 314 388 msgstr "" 315 389 316 #: wp-password-policy-manager.php:1 118390 #: wp-password-policy-manager.php:1547 317 391 msgid "Access Denied." 318 392 msgstr "" 319 393 320 #: wp-password-policy-manager.php:1 120394 #: wp-password-policy-manager.php:1549 321 395 msgid "Token parameter expected." 322 396 msgstr "" 323 397 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 399 msgid "Once Every 10 Minutes" 400 msgstr "" -
wp-password-policy-manager/trunk/readme.txt
r1166318 r1222565 5 5 License URI: http://www.gnu.org/licenses/gpl.html 6 6 Tags: 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.08 Tested up to: 4. 2.29 Stable tag: 0. 87 Requires at least: 4.0 8 Tested up to: 4.3 9 Stable tag: 0.9 10 10 11 11 Configure WordPress password policies to ensure all WordPress users use strong passwords and improve the security of your WordPress. … … 55 55 56 56 = 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:57 We 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: 58 58 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/) 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/), 63 Spanish thanks to [Apasionados](http://apasionados.es/) 63 64 64 65 = Plugin Newsletter = … … 90 91 == Changelog == 91 92 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 92 110 = 0.8 (2015-05-23) = 93 * ** Updated plugin ownership**111 * **Updated plugin ownership** 94 112 * Changed ownership of the plugin 95 113 * Updated "Tested up to" entry … … 98 116 * **New Feature** 99 117 * 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 101 119 * **New Translations** 102 120 * The following translatoins have been added; Italian, Dutch, Polish and Serbo-Croatian. … … 109 127 * **New Features** 110 128 * 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 112 130 * **Improvements** 113 131 * 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 115 133 * **Bug Fixes** 116 134 * Fixed an issue when user was redirected to password reset page when an incorrect user was specified 117 * Fixed 135 * Fixed 118 136 = 0.4 (2014-12-1) = 119 137 * **Bug Fix** -
wp-password-policy-manager/trunk/wp-password-policy-manager.php
r1166318 r1222565 54 54 const OPT_USER_PWDS = 'wppm_lst_pwd'; 55 55 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; 56 60 57 61 // </editor-fold> … … 62 66 foreach(array( 63 67 array('admin_menu', 0), 68 array('admin_init', 1), 64 69 array('network_admin_menu', 0), 65 70 array('admin_enqueue_scripts', 0), … … 96 101 * @return \self Returns the current plugin instance. 97 102 */ 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 108 114 109 115 /** … … 121 127 if ($_nMaxSamePass) { 122 128 $rules[] = sprintf(__('not be one of the previous %d used passwords.', 'wp-password-policy-manager'), $_nMaxSamePass); 123 } else { 129 } 130 else { 124 131 $rules[] = __('not be the same as the previous one', 'wp-password-policy-manager'); 125 132 } … … 176 183 return; 177 184 } 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 <?php188 185 189 186 wp_enqueue_script('front-js', $this->GetBaseUrl().'js/front.js', array('jquery'), rand(1,1234)); … … 196 193 'NewPassRulesHead' => __('New password must...', 'wp-password-policy-manager'), 197 194 '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>' 201 198 )); 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 202 214 } 203 215 … … 266 278 else{ 267 279 if($wasReset){ 268 $diff = __('1 minute' );280 $diff = __('1 minute', 'wp-password-policy-manager'); 269 281 } 270 282 else { $diff = human_time_diff(strtotime($this->GetPasswordTtl(), $this->GetPasswordLastModTime($user->ID)), current_time('timestamp')); } … … 281 293 <?php if($this->IsPolicyEnabled(self::POLICY_OLDPASSWORD) && !$this->UserCanSkipOldPwdPolicy()) { ?> 282 294 <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> 284 296 <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> 286 300 <span class="description"><?php _e('Type your current password to be able to change your password.', 'wp-password-policy-manager'); ?></span> 287 301 </td> … … 312 326 $pass2 = (isset($_REQUEST['pass2']) ? $_REQUEST['pass2'] : ''); 313 327 $oldpass = ''; 314 if($this->IsPolicyEnabled(self::POLICY_OLDPASSWORD) && !$this->UserCanSkipOldPwdPolicy( $user)) {328 if($this->IsPolicyEnabled(self::POLICY_OLDPASSWORD) && !$this->UserCanSkipOldPwdPolicy()) { 315 329 $oldpass = (isset($_REQUEST['wppmoldpass']) ? $_REQUEST['wppmoldpass'] : ''); 316 330 } … … 347 361 { 348 362 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')); 350 365 return $errors; 351 366 } 352 367 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')); 354 370 return $errors; 355 371 } 356 372 $validateOldPass = ($this->IsPolicyEnabled(self::POLICY_OLDPASSWORD) && !$this->UserCanSkipOldPwdPolicy()); 357 373 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')); 359 376 return $errors; 360 377 } … … 363 380 $crtPwd = $userInfo->user_pass; 364 381 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')); 366 384 return $errors; 367 385 } 368 386 // new password cannot be the same as the username 369 387 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')); 371 390 return $errors; 372 391 } 373 392 // new password cannot be the same as the email 374 393 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')); 376 396 return $errors; 377 397 } … … 527 547 } 528 548 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"> 533 553 /** 534 554 * Get a global (across multiple sites) option. … … 557 577 $fn($name); 558 578 } 559 560 579 /** 561 580 * Get a user-specific option. … … 608 627 return current_user_can('manage_options'); 609 628 } 610 // </editor-fold> 611 612 // <editor-fold desc="Misc Functionality"> 613 629 // </editor-fold desc="WordPress Extensions"> 630 631 // <editor-fold desc="Misc Functionality"> 614 632 public function UserCanSkipOldPwdPolicy(){ 615 633 $user = wp_get_current_user(); … … 620 638 return user_can($user->ID, 'manage_options'); 621 639 } 622 623 640 /** 624 641 * @return string Password policy time to live as a string. … … 711 728 public function SetMaxSamePass($value){ 712 729 $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); 713 741 } 714 742 protected function EchoIdent($name){ … … 737 765 $this->SetPolicyState(self::POLICY_OLDPASSWORD, $this->IsPostIdent('opw')); 738 766 $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 { 742 791 throw new Exception(__('Security check failed', 'wp-password-policy-manager')); 743 792 } 744 793 } 745 794 746 protected function ResetWpPasswords( )795 protected function ResetWpPasswords($blogId = null) 747 796 { 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 752 931 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 774 985 protected function SendNotificationEmail($emailAddress, $message){ 775 986 $headers = sprintf('From: %s <%s>', get_bloginfo('name'), get_bloginfo('admin_email'))."\r\n"; … … 787 998 protected function GetTokenType($token){ 788 999 $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) 790 1004 $users[] = $obj->user_login; 791 1005 $roles = array_keys(get_editable_roles()); … … 797 1011 * Renders WordPress settings page. 798 1012 */ 799 public function ManageWpOptions(){ 1013 public function ManageWpOptions() 1014 { 800 1015 // control access to plugin 801 if (!$this->IsManagingAdmin() ) {1016 if (!$this->IsManagingAdmin() || $this->IsAdminAccessDisabled()) { 802 1017 wp_die(__('You do not have sufficient permissions to access this page.', 'wp-password-policy-manager')); 803 1018 } 804 1019 // 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 806 1041 try { 807 1042 switch(true){ … … 811 1046 break; 812 1047 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 } 815 1067 break; 816 1068 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')); 818 1070 } 819 1071 } catch (Exception $ex) { 820 ?><div class="error"><p><strong><?php _e(__('Error', 'wp-password-policy-manager').': '.$ex->getMessage()); ?></strong></p></div><?php1072 ?><div class="error"><p><strong><?php echo __('Error', 'wp-password-policy-manager').': '.$ex->getMessage(); ?></strong></p></div><?php 821 1073 } 822 1074 } 823 1075 // display settings page 824 1076 ?><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> 826 1078 <form method="post" id="wppm_settings"> 827 1079 <input type="hidden" name="page" value="<?php echo esc_attr($_REQUEST['page']); ?>" /> 828 1080 <input type="hidden" id="ajaxurl" value="<?php echo esc_attr(admin_url('admin-ajax.php')); ?>" /> 1081 <?php wp_nonce_field( 'nonce_form' ); ?> 1082 829 1083 <div id="wppm-adverts"> 830 1084 <a href="http://www.wpwhitesecurity.com/plugins-premium-extensions/email-notifications-wordpress/?utm_source=wppmplugin&utm_medium=settingspage&utm_campaign=notifications" target="_blank"> … … 852 1106 <th scope="row"><label for="<?php $this->EchoIdent('len'); ?>"><?php _e('Password Length Policy', 'wp-password-policy-manager'); ?></label></th> 853 1107 <td> 854 <select type="text"id="<?php $this->EchoIdent('len'); ?>" name="<?php $this->EchoIdent('len'); ?>"><?php1108 <select id="<?php $this->EchoIdent('len'); ?>" name="<?php $this->EchoIdent('len'); ?>"><?php 855 1109 $curr = $this->GetPasswordLen(); 856 1110 foreach(array_merge(array(0), range(4, 16)) as $value){ … … 917 1171 </tr> 918 1172 <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> 920 1174 <td> 921 1175 <fieldset> 922 <?php _e('Remember' ); ?>923 <select type="text"id="<?php $this->EchoIdent('msp'); ?>" name="<?php $this->EchoIdent('msp'); ?>"><?php924 $c urr= $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(); 925 1179 foreach(array_merge(array(0), range(2, 10)) as $value){ 926 $sel = ($value == $c urr) ? ' selected="selected"' : '';1180 $sel = ($value == $crt) ? ' selected="selected"' : ''; 927 1181 ?><option value="<?php echo $value; ?>"<?php echo $sel; ?>> 928 1182 <?php echo ($value == 0 ? '' : $value); ?> … … 934 1188 </td> 935 1189 </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 936 1213 <tr> 937 1214 <th><label for="ExemptTokenQueryBox"><?php _e('Users and Roles Exempt From Policies', 'wp-password-policy-manager'); ?></label></th> … … 941 1218 <input type="button" id="ExemptTokenQueryAdd" style="float: left; display: block;" class="button-primary" value="Add"> 942 1219 <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> 946 1225 <div id="ExemptTokenList"><?php 947 1226 foreach($this->GetExemptTokens() as $item){ … … 949 1228 <input type="hidden" name="ExemptTokens[]" value="<?php echo esc_attr($item); ?>"/> 950 1229 <?php echo esc_html($item); ?> 951 <a href="javascript: ;" title="Remove">×</a>1230 <a href="javascript:return false;" title="Remove">×</a> 952 1231 </span><?php 953 1232 } … … 958 1237 <tr valign="top"> 959 1238 <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> 962 1360 </tr> 963 1361 <?php } ?> 964 1362 </tbody> 965 1363 </table> 966 <?php wp_nonce_field( 'nonce_form' ); ?>967 1364 <!-- Policy Flags: <?php echo $this->_policy_flag_cache; ?> --> 968 1365 <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')); ?>" /> 970 1368 </p> 971 1369 </form> 972 1370 </div><?php 973 1371 } 1372 974 1373 /** 975 1374 * Returns whether policies for specified user are applicable or not. … … 1072 1471 return self::_DeleteGlobalOption(self::_getPwdListOptName($uid)); 1073 1472 } 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"> 1078 1476 public function profile_update($user_id){ 1079 1477 $this->_addPwdToList($user_id, get_userdata($user_id)->user_pass); … … 1106 1504 } 1107 1505 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 } 1109 1516 } 1110 1517 public function admin_footer(){ … … 1148 1555 self::ClearUserPrevPwds($user->ID); 1149 1556 } 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"> 1151 1612 } 1613 1614 $wppm = WpPasswordPolicyManager::GetInstance(); 1615 1616 /* 1617 * WP Cron 1618 */ 1619 add_filter( 'cron_schedules', array($wppm, '_cronAddCustomInterval'), 98, 1 ); 1620 add_action( 'wp', array($wppm, '_cronSchedule') ); // frontend 1621 add_action( 'plugins_loaded', array($wppm, '_cronSchedule') ); // backend 1622 add_action( $wppm::WP_CRON_ACTION, array($wppm, '_cronDoAction') ); 1623 register_deactivation_hook( __FILE__, array($wppm, '_cronUnschedule') ); 1624 1152 1625 register_uninstall_hook(__FILE__, array('WpPasswordPolicyManager', 'on_uninstall')); 1153 // Create & Run the plugin 1154 return WpPasswordPolicyManager::GetInstance(); 1626 1627 // Instantiate & Run the plugin 1628 return $wppm;
Note: See TracChangeset
for help on using the changeset viewer.