PluginProbe
Loginizer / 1.9.7
Loginizer v1.9.7
2.1.0 2.0.9 2.0.8 1.9.8 1.9.9 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 trunk 1.0 1.0.1 1.0.2 1.1.0 1.1.1 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 All 74 releases
loginizer / main / admin.php

admin.php in Loginizer 1.9.7, at main/admin.php

877 lines 32.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if(!defined('ABSPATH')){
4 die('Hacking Attempt!');
5 }
6
7 // HOOKS
8 add_action('admin_menu', 'loginizer_admin_menu');
9 add_action('admin_notices', 'loginizer_social_login_url_alert');
10 add_action('admin_footer', 'loginizer_social_interim_js');
11 add_action('admin_init', 'loginizer_admin_actions');
12 //add_filter("plugin_action_links_plugin_loginizer", 'loginizer_plugin_action_links');
13
14 function loginizer_admin_actions(){
15 global $loginizer;
16
17 if(defined('LOGINIZER_PREMIUM') && !defined('SITEPAD') && current_user_can('activate_plugins') && isset($_GET['page']) && strpos($_GET['page'], 'loginizer') !== FALSE){
18
19 $license_notice = get_option('loginizer_license_notice', 0);
20 if(empty($license_notice)){
21 $license_notice = time();
22 update_option('loginizer_license_notice', $license_notice);
23 }
24
25 $license = get_option('loginizer_license', []);
26
27 // Here we are making sure that we have a license and it has expiry time and has not been dismissed for 2 months
28 if(!empty($license) && !empty($license['expires']) && ($license_notice > 0 || (abs($license_notice) + MONTH_IN_SECONDS * 2) < time())){
29 $current_timestamp = time();
30 $expiration_timestamp = strtotime($license['expires']);
31 $timediff = $expiration_timestamp - $current_timestamp;
32
33 if($timediff <= WEEK_IN_SECONDS){
34 add_action('admin_notices', 'loginizer_check_expires');
35 }
36 }
37 }
38
39 // Notice to let user know about SoftWP.
40 if(
41 !defined('LOGINIZER_PREMIUM') &&
42 !defined('BACKUPLY_PRO') &&
43 !defined('SPEEDYCACHE_PRO') &&
44 !defined('PAGELAYER_PREMIUM') &&
45 !defined('GOSMTP_PREMIUM') &&
46 !defined('SITESEO_PREMIUM')
47 ){
48 add_action('admin_notices', 'loginizer_softwp_upgrader_notice');
49 }
50 }
51
52
53
54 // Add settings link on plugin page
55 function loginizer_plugin_action_links($links) {
56
57 if(!defined('LOGINIZER_PREMIUM')){
58 $links[] = '<a href="'.LOGINIZER_PRO_URL.'" style="color:#3db634;" target="_blank">'._x('Upgrade', 'Plugin action link label.', 'loginizer').'</a>';
59 }
60
61 $settings_link = '<a href="admin.php?page=loginizer">Settings</a>';
62 array_unshift($links, $settings_link);
63
64 return $links;
65 }
66
67 function loginizer_newsletter_subscribe(){
68
69 $newsletter_dismiss = get_option('loginizer_dismiss_newsletter');
70
71 if(!empty($newsletter_dismiss)){
72 return;
73 }
74
75 $env['url'] = 'https://loginizer.com/';
76
77 echo '
78 <style>
79 .newsletter_container{
80 color: #000000;
81 background: #FFFFFF;
82 text-align:center;
83 }
84 .subscribe_form_row{
85 color: #000000;
86 padding-bottom:0px !important;
87 }
88 .subscribe_heading{
89 font-size:22px;
90 }
91 </style>
92
93 <div class="notice my-loginizer-dismiss-notice is-dismissible" style="background:#FFF;padding:15px; border: 1px solid #ccd0d4; width:80%;margin-left:0px;margin:auto;">
94 <div class="container">
95 <div class="col-md-6 col-md-offset-3 text-center newsletter_container">
96 <h2 style="font-weight:100; margin-bottom:20px; margin-top:5px;" class="subscribe_heading">Subscribe to our Newsletter</h2>
97 <form class="form-inline" action="" method="POST">
98 <div class="row subscribe_form_row">
99 <div class="col-md-12">
100 <input type="email" name="email" size="40" id="subscribe_email" class="" placeholder="email@example.com" value="">&nbsp;
101 <input type="button" name="subscribe" id="subscribe_button" class="button button-primary" value="Subscribe" onclick="loginizer_email_subscribe();" style="margin-top:0px;">
102 </div>
103 <div class="col-md-3">
104 </div>
105 </div>
106 </form>
107 <p><b>Note :</b> If a Loginizer account does not exist it will be created.</p>
108 </div>
109 </div>
110 </div><br />
111
112 <script type="text/javascript">
113 function loginizer_dismiss_newsletter(){
114
115 var data = new Object();
116 data["action"] = "loginizer_dismiss_newsletter";
117 data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'";
118
119 var admin_url = "'.admin_url().'"+"admin-ajax.php";
120 jQuery.post(admin_url, data, function(response){
121
122 });
123
124 }
125
126 function loginizer_email_subscribe(){
127 var subs_location = "'.$env['url'].'?email="+encodeURIComponent(jQuery("#subscribe_email").val());
128 window.open(subs_location, "_blank");
129 }
130 jQuery(document).on("click", ".my-loginizer-dismiss-notice .notice-dismiss", loginizer_dismiss_newsletter);
131 </script>';
132
133 return true;
134 }
135
136 function loginizer_backuply_promo(){
137
138 $plugins = get_plugins();
139
140 // Dont show Backuply Promo if its already installed
141 if(array_key_exists('backuply-pro/backuply-pro.php', $plugins) || array_key_exists('backuply/backuply.php', $plugins)){
142 return;
143 }
144
145 if(isset($_REQUEST['install_backuply'])){
146 if(!wp_verify_nonce($_REQUEST['security'], 'loginizer_install_backuply') || !current_user_can('activate_plugins')){
147 die('Only Admin can access it');
148 }
149
150 loginizer_backuply_install();
151 return;
152 }
153
154 echo '<div class="notice is-dismissible lz-welcome-panel lz-backuply-dismissible" style="padding:20px; margin:0;">
155 <table>
156 <tr>
157 <th width="25%">
158 <img src="'.LOGINIZER_URL.'\assets\images\backuply-square.png" height="150px" width="150px"/>
159 </th>
160 <td width="75%">
161 <div class="inside" style="margin-left: 20px;">
162 <strong><i>'.__('Backups are the best form of security. Secure your WordPress site by creating backups with Backuply','loginizer').'</i>:</strong><br>
163 <ul class="lz-right-ul">
164 <li>'.__('Backup to remote locations like FTP, FTPS, SFTP, WebDAV, Google Drive, OneDrive, Dropbox, Amazon S3','loginizer').'</li>
165 <li>'.__('Auto Backups','loginizer').'</li>
166 <li>'.__('Easy One-Click restores','loginizer').'</li>
167 <li>'.__('Stress Free Migrations','loginizer').'</li>
168 </ul>
169 <a class="button button-primary" href="'.esc_url(admin_url('admin.php?page=loginizer&install_backuply=1&security='.wp_create_nonce('loginizer_install_backuply'))).'">'.__('Install Backuply', 'loginizer').'</a>&nbsp;&nbsp;<a class="button button-secondary" target="_blank" href="https://wordpress.org/plugins/backuply/">'.__('Visit Backuply','loginizer').'</a>
170 </div>
171 </td>
172 </tr>
173 </table>
174 </div><br />
175 <script type="text/javascript">
176 function loginizer_dismiss_backuply(){
177
178 var data = new Object();
179 data["action"] = "loginizer_dismiss_backuply";
180 data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'";
181
182 var admin_url = "'.admin_url().'"+"admin-ajax.php";
183 jQuery.post(admin_url, data, function(response){
184
185 });
186
187 }
188
189 jQuery(document).on("click", ".lz-backuply-dismissible .notice-dismiss", loginizer_dismiss_backuply);
190 </script>';
191
192 return true;
193 }
194
195 function loginizer_csrf_promo(){
196
197 echo '<div class="notice notice-success is-dismissible lz-csrf-dismissible"><p>Secure your WordPress site from CSRF attacks with our new feature <strong>CSRF Protection</strong> <a href="https://loginizer.com/docs/configuration-and-settings/how-to-enable-csrf-protection/" target="_blank" class="button button-primary">Read More</a></p></div>';
198
199 echo'<script type="text/javascript">
200 function loginizer_dismiss_csrf(){
201
202 var data = new Object();
203 data["action"] = "loginizer_dismiss_csrf";
204 data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'";
205
206 var admin_url = "'.admin_url().'"+"admin-ajax.php";
207 jQuery.post(admin_url, data, function(response){
208
209 });
210
211 }
212
213 jQuery(document).on("click", ".lz-csrf-dismissible", loginizer_dismiss_csrf);
214 </script>';
215 }
216
217 // Install Backuply
218 function loginizer_backuply_install(){
219
220 // Include the necessary stuff
221 include_once( ABSPATH . 'wp-admin/includes/plugin-install.php' );
222
223 // Includes necessary for Plugin_Upgrader and Plugin_Installer_Skin
224 include_once( ABSPATH . 'wp-admin/includes/file.php' );
225 include_once( ABSPATH . 'wp-admin/includes/misc.php' );
226 include_once( ABSPATH . 'wp-admin/includes/class-wp-upgrader.php' );
227
228 // Filter to prevent the activate text
229 add_filter('install_plugin_complete_actions', 'loginizer_backuply_install_complete_actions', 10, 3);
230
231 $upgrader = new Plugin_Upgrader( new Plugin_Installer_Skin() );
232 $installed = $upgrader->install('https://downloads.wordpress.org/plugin/backuply.zip');
233
234 if ( !is_wp_error( $installed ) && $installed ) {
235 echo 'Activating Backuply !';
236 $activate = activate_plugin('backuply/backuply.php');
237
238 if ( is_null($activate) ) {
239 echo '<div id="message" class="updated"><p>'. esc_html__('Done! Backuply is now installed and activated.', 'loginizer'). '</p></div><br /><br><br><b>'. esc_html__('Done! Backuply is now installed and activated.', 'loginizer').'</b>';
240 }
241 }
242
243 return $installed;
244 }
245
246 // Prevent pro activate text for installer
247 function loginizer_backuply_install_complete_actions($install_actions, $api, $plugin_file){
248
249 if($plugin_file == 'backuply/backuply.php'){
250 return array();
251 }
252
253 return $install_actions;
254 }
255
256 // The Loginizer Theme footer
257 function loginizer_page_footer(){
258
259 if(!loginizer_is_premium()){
260 echo '<script>
261 jQuery("[loginizer-premium-only]").each(function(index) {
262 jQuery(this).find( "input, textarea, select" ).attr("disabled", true);
263 });
264 </script>';
265 }
266
267 echo '</td>
268 <td width="200" valign="top" id="loginizer-right-bar">';
269
270 if(!defined('SITEPAD')){
271
272 if(!defined('LOGINIZER_PREMIUM')){
273
274 echo '
275 <div class="postbox" style="min-width:0px !important;">
276 <div class="postbox-header">
277 <h2 class="hndle ui-sortable-handle">
278 <span>'.__('Premium Version','loginizer').'</span>
279 </h2>
280 </div>
281
282 <div class="inside">
283 <i>'.__('Upgrade to the premium version and get the following features','loginizer').' </i>:<br>
284 <ul class="lz-right-ul">
285 <li>'.__('PasswordLess Login','loginizer').'</li>
286 <li>'.__('Two Factor Auth - Email','loginizer').'</li>
287 <li>'.__('Two Factor Auth - App','loginizer').'</li>
288 <li>'.__('Login Challenge Question','loginizer').'</li>
289 <li>'.__('reCAPTCHA','loginizer').'</li>
290 <li>'.__('Rename Login Page','loginizer').'</li>
291 <li>'.__('Disable XML-RPC','loginizer').'</li>
292 <li>'.__('And many more ...','loginizer').'</li>
293 </ul>
294 <center><a class="button button-primary" target="_blank" href="'.LOGINIZER_PRICING_URL.'">Upgrade</a></center>
295 </div>
296 </div>';
297
298 }else{
299
300 echo '
301 <div class="postbox" style="min-width:0px !important;">
302 <div class="postbox-header">
303 <h2 class="hndle ui-sortable-handle">
304 <span>'.__('Recommendations','loginizer').'</span>
305 </h2>
306 </div>
307 <div class="inside">
308 <i>'.__('We recommed that you enable atleast one of the following security features','loginizer').'</i>:<br>
309 <ul class="lz-right-ul">
310 <li>'.__('Rename Login Page','loginizer').'</li>
311 <li>'.__('Login Challenge Question','loginizer').'</li>
312 <li>'.__('reCAPTCHA','loginizer').'</li>
313 <li>'.__('Two Factor Auth - Email','loginizer').'</li>
314 <li>'.__('Two Factor Auth - App','loginizer').'</li>
315 <li>'.__('Change \'admin\' Username','loginizer').'</li>
316 </ul>
317 </div>
318 </div>';
319 }
320
321 echo '
322 <div class="postbox" style="min-width:0px !important;">
323 <div class="postbox-header">
324 <h2 class="hndle ui-sortable-handle">
325 <span><a target="_blank" href="https://backuply.com/?from=loginizer-plugin"><img src="'.LOGINIZER_URL.'/assets/images/backuply-black.png" width="100%" /></a></span>
326 </h2>
327 </div>
328 <div class="inside">
329 <i>'.__('Secure your WordPress site by creating backups with Backuply', 'loginizer').'</i>:<br>
330 <ul class="lz-right-ul">
331 <li>'.__('Remote Backup to 8 location','loginizer').'</li>
332 <li>'.__('Auto Backups', 'loginizer').'</li>
333 <li>'.__('Backup Rotation', 'loginizer').'</li>
334 <li>'.__('One-Click Restore', 'loginizer').'</li>
335 <li>'.__('Stress-free Migration', 'loginizer').'</li>
336 <li>'.__('Backup to Google Drive', 'loginizer').'</li>
337 <li>'.__('Backup to Amazon S3', 'loginizer').'</li>
338 <li>'.__('Backup to Dropbox', 'loginizer').'</li>
339 <li>'.__('Backup to FTP,FTPS and many more ...','loginizer').'</li>
340 </ul>
341 <center><a class="button button-primary" target="_blank" href="https://wordpress.org/plugins/backuply/">'.__('Visit Backuply','loginizer').'</a></center>
342 </div>
343 </div>';
344
345 echo '
346 <div class="postbox" style="min-width:0px !important;">
347 <div class="postbox-header">
348 <h2 class="hndle ui-sortable-handle">
349 <span><a target="_blank" href="https://pagelayer.com/?from=loginizer-plugin"><img src="'.LOGINIZER_URL.'/assets/images/pagelayer_product.png" width="100%" /></a></span>
350 </h2>
351 </div>
352 <div class="inside">
353 <i>'.__('Easily manage and make professional pages and content with our Pagelayer builder','loginizer').'</i>:<br>
354 <ul class="lz-right-ul">
355 <li>'.__('30+ Free Widgets','loginizer').'</li>
356 <li>'.__('60+ Premium Widgets','loginizer').'</li>
357 <li>'.__('400+ Premium Sections','loginizer').'</li>
358 <li>'.__('Theme Builder','loginizer').'</li>
359 <li>'.__('WooCommerce Builder','loginizer').'</li>
360 <li>'.__('Theme Creator and Exporter','loginizer').'</li>
361 <li>'.__('Form Builder','loginizer').'</li>
362 <li>'.__('Popup Builder','loginizer').'</li>
363 <li>'.__('And many more ...','loginizer').'</li>
364 </ul>
365 <center><a class="button button-primary" target="_blank" href="https://wordpress.org/plugins/pagelayer/">'.__('Visit Pagelayer','loginizer').'</a></center>
366 </div>
367 </div>';
368
369 }
370
371 echo '</td>
372 </tr>
373 </table>';
374
375 if(!defined('SITEPAD')){
376
377 echo '<br />
378 <div style="width:45%;background:#FFF;padding:15px; margin:auto">
379 <b>'.__('Let your friends know that you have secured your website :','loginizer').'</b>
380 <form method="get" action="https://twitter.com/intent/tweet" id="tweet" onsubmit="return dotweet(this);">
381 <textarea name="text" cols="45" row="3" style="resize:none;">'.__('I just secured my @WordPress site against #bruteforce using @loginizer','loginizer').'</textarea>
382 &nbsp; &nbsp; <input type="submit" value="Tweet!" class="button button-primary" onsubmit="return false;" id="twitter-btn" style="margin-top:20px;"/>
383 </form>
384
385 </div>
386 <br />
387
388 <script>
389 function dotweet(ele){
390 window.open(jQuery("#"+ele.id).attr("action")+"?"+jQuery("#"+ele.id).serialize(), "_blank", "scrollbars=no, menubar=no, height=400, width=500, resizable=yes, toolbar=no, status=no");
391 return false;
392 }
393 </script>
394
395 <hr />
396 <a href="http://loginizer.com" target="_blank">Loginizer</a> '.__('v'.LOGINIZER_VERSION.'. You can report any bugs ','loginizer').'<a href="http://wordpress.org/support/plugin/loginizer" target="_blank">'.__('here','loginizer').'</a>.';
397
398 }
399
400 echo '
401 </div>
402 </div>
403 </div>
404 </div>';
405
406 }
407
408 // The Loginizer Admin Options Page
409 function loginizer_page_header($title = 'Loginizer'){
410
411 global $loginizer;
412
413 ?>
414 <style>
415 .lz-right-ul{
416 padding-left: 10px !important;
417 }
418
419 .lz-right-ul li{
420 list-style: circle !important;
421 }
422 </style>
423 <?php
424
425 echo '<div style="margin: 10px 20px 0 2px;">
426 <div class="metabox-holder columns-2">
427 <div class="postbox-container">
428 <div id="top-sortables" class="meta-box-sortables ui-sortable">
429
430 <table cellpadding="2" cellspacing="1" width="100%" class="fixed" border="0">
431 <tr>
432 <td valign="top"><h3>'.$loginizer['prefix'].$title.'</h3></td>';
433
434 if(!defined('SITEPAD')){
435
436 echo '<td align="right"><a href="https://www.softaculous.com/clients?ca=affiliate" class="button button-primary" target="_blank">'. __('Refer and Earn', 'loginizer'). '</a> <a target="_blank" class="button button-primary" href="https://wordpress.org/support/view/plugin-reviews/loginizer">'.__('Review Loginizer', 'loginizer').'</a></td>
437 <td align="right" width="40"><a target="_blank" href="https://twitter.com/loginizer"><img src="'.LOGINIZER_URL.'/assets/images/twitter.png" /></a></td>
438 <td align="right" width="40"><a target="_blank" href="https://www.facebook.com/Loginizer-815504798591884"><img src="'.LOGINIZER_URL.'/assets/images/facebook.png" /></a></td>';
439
440 }
441
442 echo '
443 </tr>
444 </table>
445 <hr />
446
447 <!--Main Table-->
448 <table cellpadding="8" cellspacing="1" width="100%" class="fixed">
449 <tr>
450 <td valign="top">';
451
452 if(defined('LOGINIZER_PREMIUM') && !empty($loginizer['enable_csrf_protection']) && !loginizer_is_csrf_prot_mod_set()){
453
454 $lz_error['csrf_mod'] = esc_html__('You have enabled CSRF protection but the .htaccess file has not been updated', 'loginizer');
455
456 if(!empty($lz_error)){
457 lz_report_error($lz_error);echo '<br />';
458 }
459 }
460
461 }
462
463 // Shows the admin menu of Loginizer
464 function loginizer_admin_menu() {
465
466 global $wp_version, $loginizer;
467
468 if(!defined('SITEPAD')){
469
470 // Add the menu page
471 add_menu_page(__('Loginizer Dashboard', 'loginizer'), __('Loginizer Security', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_dashboard');
472
473 // Dashboard
474 add_submenu_page('loginizer', __('Loginizer Dashboard', 'loginizer'), __('Dashboard', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_dashboard');
475
476 }else{
477
478 // Add the menu page
479 add_menu_page(__('Security', 'loginizer'), __('Security', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_security_settings', 'dashicons-shield', 85);
480
481 // Rename Login
482 add_submenu_page('loginizer', __('Security Settings', 'loginizer'), __('Rename Login', 'loginizer'), 'activate_plugins', 'loginizer', 'loginizer_security_settings');
483
484 }
485
486 // Brute Force
487 add_submenu_page('loginizer', __('Brute Force Settings', 'loginizer'), __('Brute Force', 'loginizer'), 'activate_plugins', 'loginizer_brute_force', 'loginizer_brute_force_settings');
488
489 // PasswordLess
490 add_submenu_page('loginizer', __($loginizer['prefix'].'PasswordLess Settings', 'loginizer'), __('PasswordLess', 'loginizer'), 'activate_plugins', 'loginizer_passwordless', 'loginizer_passwordless_settings');
491
492 // Security Settings
493 if(!defined('SITEPAD')){
494
495 // Two Factor Auth
496 add_submenu_page('loginizer', __($loginizer['prefix'].' Two Factor Authentication', 'loginizer'), __('Two Factor Auth', 'loginizer'), 'activate_plugins', 'loginizer_2fa', 'loginizer_2fa_settings');
497
498 }
499
500 // reCaptcha
501 add_submenu_page('loginizer', __($loginizer['prefix'].'reCAPTCHA Settings', 'loginizer'), __('reCAPTCHA', 'loginizer'), 'activate_plugins', 'loginizer_recaptcha', 'loginizer_recaptcha_settings');
502
503 // Temporary Login
504 add_submenu_page('loginizer', __($loginizer['prefix'].'SSO', 'loginizer'), __('Single Sign On', 'loginizer'). ((time() < strtotime('30 November 2023')) ? ' <span style="color:yellow;">Update</span>' : ''), 'activate_plugins', 'loginizer_sso', 'loginizer_sso_settings');
505
506 // Social Login
507 $hook_name = add_submenu_page('loginizer', __($loginizer['prefix'].'social_login', 'loginizer'), __('Social Login', 'loginizer') . ((time() < strtotime('30 July 2024')) ? ' <span style="color:red;">New</span>' : ''), 'activate_plugins', 'loginizer_social_login', 'loginizer_social_login_settings');
508
509 // Security Settings
510 if(!defined('SITEPAD')){
511
512 // Security Settings
513 add_submenu_page('loginizer', __($loginizer['prefix'].'Security Settings', 'loginizer'), __('Security Settings', 'loginizer'), 'activate_plugins', 'loginizer_security', 'loginizer_security_settings');
514
515 // File Checksums
516 add_submenu_page('loginizer', __('Loginizer File Checksums', 'loginizer'), __('File Checksums', 'loginizer'), 'activate_plugins', 'loginizer_checksums', 'loginizer_checksums_settings');
517
518 }
519
520 if(!defined('LOGINIZER_PREMIUM') && !empty($loginizer['ins_time']) && $loginizer['ins_time'] < (time() - (30*24*3600))){
521
522 // Go Pro link
523 add_submenu_page('loginizer', __('Loginizer Go Pro', 'loginizer'), __('Go Pro', 'loginizer'), 'activate_plugins', LOGINIZER_PRO_URL);
524
525 }
526
527 // NOTE: This hook is just for Social Login for now,
528 // will need to change if we make different CSS files for every Menu page
529 // INFO:: Using this action helps is loading the CSS beforehand preventing any layout change on load.
530 add_action('load-'.$hook_name, 'loginizer_load_admin_assets');
531
532 }
533
534 // Loads assets like CSS and JS for admin Pages.
535 function loginizer_load_admin_assets(){
536 wp_enqueue_style('loginizer_social_style', LOGINIZER_URL . '/assets/css/social-admin.css', [], LOGINIZER_VERSION);
537 wp_enqueue_script('loginizer_social_script', LOGINIZER_URL . '/assets/js/social-admin.js', ['jquery', 'jquery-ui-sortable'], LOGINIZER_VERSION, true);
538 }
539
540 // Show the promo
541 function loginizer_promo(){
542
543 echo '
544 <style>
545 .lz_button {
546 background-color: #4CAF50; /* Green */
547 border: none;
548 color: white;
549 padding: 8px 16px;
550 text-align: center;
551 text-decoration: none;
552 display: inline-block;
553 font-size: 16px;
554 margin: 4px 2px;
555 -webkit-transition-duration: 0.4s; /* Safari */
556 transition-duration: 0.4s;
557 cursor: pointer;
558 }
559
560 .lz_button:focus{
561 border: none;
562 color: white;
563 }
564
565 .lz_button1 {
566 color: white;
567 background-color: #4CAF50;
568 border:3px solid #4CAF50;
569 }
570
571 .lz_button1:hover {
572 box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19);
573 color: white;
574 border:3px solid #4CAF50;
575 }
576
577 .lz_button2 {
578 color: white;
579 background-color: #0085ba;
580 }
581
582 .lz_button2:hover {
583 box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19);
584 color: white;
585 }
586
587 .lz_button3 {
588 color: white;
589 background-color: #365899;
590 }
591
592 .lz_button3:hover {
593 box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19);
594 color: white;
595 }
596
597 .lz_button4 {
598 color: white;
599 background-color: rgb(66, 184, 221);
600 }
601
602 .lz_button4:hover {
603 box-shadow: 0 6px 8px 0 rgba(0,0,0,0.24), 0 9px 25px 0 rgba(0,0,0,0.19);
604 color: white;
605 }
606
607 .loginizer_promo-close{
608 float:right;
609 text-decoration:none;
610 margin: 5px 10px 0px 0px;
611 }
612
613 .loginizer_promo-close:hover{
614 color: red;
615 }
616 </style>
617
618 <script>
619 jQuery(document).ready( function() {
620 (function($) {
621 $("#loginizer_promo .loginizer_promo-close").click(function(){
622 var data;
623
624 // Hide it
625 $("#loginizer_promo").hide();
626
627 // Save this preference
628 $.post("'.admin_url('?loginizer_promo=0').'", data, function(response) {
629 //alert(response);
630 });
631 });
632 })(jQuery);
633 });
634 </script>
635
636 <div class="notice notice-success" id="loginizer_promo" style="min-height:120px">
637 <a class="loginizer_promo-close" href="javascript:" aria-label="Dismiss this Notice">
638 <span class="dashicons dashicons-dismiss"></span> Dismiss
639 </a>
640 <img src="'.LOGINIZER_URL.'/assets/images/loginizer-200.png" style="float:left; margin:10px 20px 10px 10px" width="100" />
641 <p style="font-size:16px">We are glad you like Loginizer and have been using it since the past few days. It is time to take the next step </p>
642 <p>
643 <a class="lz_button lz_button1" target="_blank" href="https://loginizer.com/features">Upgrade to Pro</a>
644 <a class="lz_button lz_button2" target="_blank" href="https://wordpress.org/support/view/plugin-reviews/loginizer">Rate it 5�
645 \'s</a>
646 <a class="lz_button lz_button3" target="_blank" href="https://www.facebook.com/Loginizer-815504798591884/">Like Us on Facebook</a>
647 <a class="lz_button lz_button4" target="_blank" href="https://twitter.com/home?status='.rawurlencode('I use @loginizer to secure my #WordPress site - https://loginizer.com').'">Tweet about Loginizer</a>
648 </p>
649 </div>';
650
651 }
652
653
654 function loginizer_recaptcha_settings(){
655 include_once LOGINIZER_DIR . '/main/settings/recaptcha.php';
656 loginizer_page_recaptcha();
657 }
658
659 function loginizer_2fa_settings(){
660 include_once LOGINIZER_DIR . '/main/settings/2fa.php';
661 loginizer_page_2fa();
662 }
663
664 function loginizer_passwordless_settings(){
665 include_once LOGINIZER_DIR . '/main/settings/passwordless.php';
666 loginizer_page_passwordless();
667 }
668
669 function loginizer_security_settings(){
670 include_once LOGINIZER_DIR . '/main/settings/security.php';
671 loginizer_page_security();
672 }
673
674 function loginizer_brute_force_settings(){
675 include_once LOGINIZER_DIR . '/main/settings/brute-force.php';
676 loginizer_page_brute_force();
677 }
678
679 function loginizer_checksums_settings(){
680 include_once LOGINIZER_DIR . '/main/settings/checksum.php';
681 loginizer_page_checksums();
682 }
683
684 function loginizer_dashboard(){
685 include_once LOGINIZER_DIR . '/main/settings/dashboard.php';
686
687 loginizer_page_dashboard();
688 }
689
690 function loginizer_sso_settings(){
691 include_once LOGINIZER_DIR . '/main/settings/sso.php';
692
693 loginizer_sso();
694 }
695
696 function loginizer_social_login_settings(){
697 include_once LOGINIZER_DIR . '/main/settings/social_login.php';
698
699 loginizer_social_login();
700 }
701
702 // Hides the interim login poup after successful login.
703 function loginizer_social_interim_js(){
704
705 if(isset($_GET['interim_login']) && $_GET['interim_login'] === 'lz' && is_user_logged_in()){
706 echo '<script>
707 document.addEventListener("DOMContentLoaded", () => {
708 parent.document.querySelector("#wp-auth-check-wrap")?.classList.add("hidden");
709 });
710 </script>';
711 }
712 }
713
714 // Show alert when the login url gets changes from when the Loginizer social settings were setup.
715 function loginizer_social_login_url_alert(){
716
717 // We want to show this error to user which has sufficient privilage
718 if(!current_user_can('activate_plugins')){
719 return;
720 }
721
722 if(get_option('loginizer_social_login_url', '') === wp_login_url()){
723 return;
724 }
725
726 $provider_settings = get_option('loginizer_provider_settings', []);
727
728 // If we dont have any settings then it dosent matter what URL is set.
729 // As it will be updated once user saves the settings.
730 if(empty($provider_settings)){
731 return;
732 }
733
734 $has_enabled = false;
735 foreach($provider_settings as $provider){
736 if($provider['enabled']){
737 $has_enabled = true;
738 break;
739 }
740 }
741
742 // If we have no Provider enabled then just show the warning on the social login page.
743 if(empty($has_enabled) && (empty($_GET['page']) || $_GET['page'] !== 'loginizer_social_login')){
744 return;
745 }
746
747 echo '<div class="notice notice-error">
748 <h4>'.esc_html__('Your changed login slug!', 'loginizer').'</h4>
749 <p>'.esc_html__('You changed the login slug and have some social login apps enabled. These social login apps use the login URL as the redirect URI. This means that since the login URL has changed, the social login will now break.', 'loginizer').'</p>
750
751 <h4>'.esc_html__('How to fix:', 'loginizer').'</h4>
752 <p>'.esc_html__('When you created secret keys for the social apps, you also provided a Redirect URI. To fix this issue, you need to update that Redirect URI.', 'loginizer').'<br/>
753 You just need to update the <code>/wp-login.php</code> to the new slug you have.</p>
754 <p><button class="button button-primary" id="loginizer-social-login-alert">'.esc_html__('I have fixed this issue', 'loginizer').'</button></p>
755 </div>';
756
757
758 wp_register_script('loginizer_social_alert', '', ['jquery'], LOGINIZER_VERSION, true);
759 wp_enqueue_script('loginizer_social_alert');
760 wp_add_inline_script('loginizer_social_alert', '
761 jQuery("#loginizer-social-login-alert").on("click", function(){
762 jQuery(this).closest(".notice").slideToggle();
763
764 var data = new Object();
765 data["action"] = "loginizer_dismiss_social_alert";
766 data["nonce"] = "'.wp_create_nonce('loginizer_admin_ajax').'";
767
768 var admin_url = "'.admin_url().'"+"admin-ajax.php";
769 jQuery.post(admin_url, data, function(response){
770 });
771 });');
772 }
773
774 function loginizer_softwp_upgrader_notice(){
775
776 // We want to show this error to user which has sufficient privilage
777 if(!current_user_can('activate_plugins')){
778 return;
779 }
780
781 /*$notice_end_time = strtotime('31 March 2025');
782 if(!empty($notice_end_time) && time() > $notice_end_time){
783 return;
784 }*/
785
786 $softwp_upgrade = get_option('loginizer_softwp_upgrade', 0);
787
788 if(empty($softwp_upgrade) || $softwp_upgrade < 0){
789 return;
790 }
791
792 if(empty($_GET['page']) || !preg_match('/loginizer/is', $_GET['page'])){
793 return;
794 }
795
796 echo '<style>.loginizer_promo-close{float:right;text-decoration:none;margin: 5px 10px 0px 0px;}.loginizer_promo-close:hover{color: red;}</style>
797 <div class="notice notice-warning" id="loginizer_softwp_notice">
798 <a class="loginizer_promo-close" id="loginizer-softwp-promo-close" href="javascript:" aria-label="Dismiss Forever">
799 <span class="dashicons dashicons-dismiss"></span> '.esc_html__('Dismiss Forever', 'loginizer').'
800 </a>
801 <p>' . esc_html__('Hey, you might be eligible to access Premium plugins provided by Softaculous for Free ! Please refer to these documents for details on how to avail them.', 'loginizer').'
802 <a href="https://softwp.net/docs/admin/generate-softwp-license" target="_blank">' . esc_html__('Generate SoftWP License', 'loginizer') . '</a> | <a href="https://softwp.net/docs/admin/installing-plugins" target="_blank">' . esc_html__('How to Install the Pro plugins', 'loginizer') . '</a></p>
803 </div>';
804
805 wp_register_script('loginizer_softwp_alert', '', ['jquery'], LOGINIZER_VERSION, true);
806 wp_enqueue_script('loginizer_softwp_alert');
807 wp_add_inline_script('loginizer_softwp_alert', '
808 jQuery("#loginizer-softwp-promo-close").on("click", function(){
809 jQuery(this).closest("#loginizer_softwp_notice").slideToggle();
810
811 var data = new Object();
812 data["action"] = "loginizer_dismiss_softwp_alert";
813 data["security"] = "'.wp_create_nonce('loginizer_softwp_notice').'";
814
815 var admin_url = "'.admin_url().'"+"admin-ajax.php";
816 jQuery.post(admin_url, data, function(response){
817 });
818 });');
819 }
820
821 function loginizer_check_expires(){
822 global $loginizer;
823
824 // We do not want to show the expiry notice if the license is by SoftWP.
825 if(!empty($loginizer['license']) && !empty($loginizer['license']['has_plid'])){
826 return;
827 }
828
829 $current_timestamp = time();
830 $expiration_timestamp = strtotime($loginizer['license']['expires']);
831 $time_diff = $expiration_timestamp - $current_timestamp;
832
833 // Renew link
834 $loginizer_user_license = $loginizer['license']['license'];
835 $loginizer_user_plan = $loginizer['license']['plan'];
836 $loginizer_renew_url = 'https://www.softaculous.com/clients?ca=loginizer_buy&plan=' . $loginizer_user_plan . '&license=' . $loginizer_user_license;
837
838 if($time_diff > 0 && $time_diff <= WEEK_IN_SECONDS){
839 $human_time = human_time_diff($current_timestamp, $expiration_timestamp);
840
841 echo '<style>.loginizer_promo-close{float:right;text-decoration:none;margin: 5px 10px 0px 0px;}.loginizer_promo-close:hover{color: red;}</style>
842 <div class="notice notice-error" id="loginizer_license_notice">
843 <a class="loginizer_promo-close" id="loginizer-license-promo-close" href="javascript:" aria-label="Dismiss this Notice">
844 <span class="dashicons dashicons-dismiss"></span> '.esc_html__('Dismiss for 60 days', 'loginizer').'
845 </a>
846 <p>' . sprintf(esc_html__('Alert : Your Loginizer Premium license will expire in %s. Renew to keep getting updates!', 'loginizer'), esc_html($human_time)).'
847 <a href="' . esc_url($loginizer_renew_url) . '" target="_blank">' . esc_html__('Click here to renew', 'loginizer') . '</a>
848 </p>
849 </div>';
850
851 } else if($time_diff <= 0){
852 echo '<style>.loginizer_promo-close{float:right;text-decoration:none;margin: 5px 10px 0px 0px;}.loginizer_promo-close:hover{color: red;}</style>
853 <div class="notice notice-error" id="loginizer_license_notice">
854 <a class="loginizer_promo-close" id="loginizer-license-promo-close" href="javascript:" aria-label="Dismiss this Notice">
855 <span class="dashicons dashicons-dismiss"></span> '.esc_html__('Dismiss for 60 days', 'loginizer').'
856 </a>
857 <p>' . esc_html__('Alert: Your Loginizer Premium license has expired. Please renew immediately to keep getting updates ', 'loginizer').'
858 <a href="' . esc_url($loginizer_renew_url) . '" target="_blank">' . esc_html__('Click here to renew', 'loginizer') . '</a></p>
859 </div>';
860 }
861
862 wp_register_script('loginizer_license_alert', '', ['jquery'], LOGINIZER_VERSION, true);
863 wp_enqueue_script('loginizer_license_alert');
864 wp_add_inline_script('loginizer_license_alert', '
865 jQuery("#loginizer-license-promo-close").on("click", function(){
866 jQuery(this).closest("#loginizer_license_notice").slideToggle();
867
868 var data = new Object();
869 data["action"] = "loginizer_dismiss_license_alert";
870 data["security"] = "'.wp_create_nonce('loginizer_license_notice').'";
871
872 var admin_url = "'.admin_url().'"+"admin-ajax.php";
873 jQuery.post(admin_url, data, function(response){
874 });
875 });');
876 }
877