Changeset 3012663
- Timestamp:
- 12/21/2023 03:14:22 AM (2 years ago)
- Location:
- unauthorised-login-redirect
- Files:
-
- 15 added
- 5 edited
-
tags/0.3.9.1 (added)
-
tags/0.3.9.1/LICENSE.txt (added)
-
tags/0.3.9.1/README.txt (added)
-
tags/0.3.9.1/index.php (added)
-
tags/0.3.9.1/ulr (added)
-
tags/0.3.9.1/ulr/css (added)
-
tags/0.3.9.1/ulr/css/style.css (added)
-
tags/0.3.9.1/ulr/ulr-activate.php (added)
-
tags/0.3.9.1/ulr/ulr-admin-menu.php (added)
-
tags/0.3.9.1/ulr/ulr-admin-settings.php (added)
-
tags/0.3.9.1/ulr/ulr-deactivate.php (added)
-
tags/0.3.9.1/ulr/ulr-miscellaneous.php (added)
-
tags/0.3.9.1/ulr/ulr-option.php (added)
-
tags/0.3.9.1/ulr/ulr-redirect.php (added)
-
tags/0.3.9.1/unauthorised-login-redirect.php (added)
-
trunk/README.txt (modified) (3 diffs)
-
trunk/ulr/ulr-admin-settings.php (modified) (1 diff)
-
trunk/ulr/ulr-option.php (modified) (1 diff)
-
trunk/ulr/ulr-redirect.php (modified) (2 diffs)
-
trunk/unauthorised-login-redirect.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
unauthorised-login-redirect/trunk/README.txt
r2743490 r3012663 4 4 Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VXYAWTLPZYE7E 5 5 Requires at least: 4.3 6 Tested up to: 6. 06 Tested up to: 6.4.2 7 7 Stable tag: trunk 8 8 License: GPLv3 or later … … 31 31 32 32 == Changelog == 33 = 0.3.9.1 = 34 * Bug fixing. 35 33 36 = 0.3.9 = 34 37 * Testing with WordPress 6.0. … … 71 74 72 75 == Upgrade Notice == 76 = 0.3.9.1 = 77 * Bug fixing. 78 73 79 = 0.3.9 = 74 80 * Testing with WordPress 6.0. -
unauthorised-login-redirect/trunk/ulr/ulr-admin-settings.php
r1305780 r3012663 27 27 function rs_ulr_admin_init() { 28 28 $update = rs_ulr_update_settings(); 29 $option = rs_ulr_get_option(); ?>30 <div class="wrap">31 <h1><?php echo RS_ULR__PLUGIN_NAME; ?></h1>32 <?php if( $update == TRUE ) { ?><div id="message" class="updated notice is-dismissible"><p>Settings updated.</p></div><?php } ?>33 <form method="post" action="<?php echo RS_ULR__PLUGIN_ADMIN_URL; ?>">34 <table class="form-table">35 <tr>36 <th scope="row"><label for="redirect_status">Redirect status</label></th>37 <td><p><label><input name="redirect_status" type="radio" value="on" class="tog"<?php if( $option['redirect_status'] == 'on' ) { ?> checked="checked"<?php } ?> /> On</label></p>38 <p><label><input name="redirect_status" type="radio" value="off" class="tog"<?php if( $option['redirect_status'] == 'off' ) { ?> checked="checked"<?php } ?> /> Off</label></p></td>39 </tr>40 <tr>41 <th scope="row"><label for="login_path">Secret login path</label></th>42 <td><p>This defines the URL you'll be visiting to log in to your site.</p>43 <p><strong>NOTE:</strong> This should not be a path for a page which already exists.</p>44 <input name="login_path" type="text" id="login_path" value="<?php echo esc_html( stripslashes( $option['login_path'] ) ); ?>" class="regular-text" />45 <p>Current redirect login URL: <strong><?php echo home_url().esc_html( stripslashes( $option['login_path'] ) ); ?></strong> (you should bookmark this)</p></td>46 </tr>47 <tr>48 <th scope="row"><label for="secret_get_key">Secret GET key</label></th>49 <td><p>This is the parameter part of your new login URL. Without this parameter and the corresponding value below, anyone trying to access your login page will be redirected to the site you select below.</p>50 <input name="secret_get_key" type="text" id="secret_get_key" value="<?php echo esc_html( stripslashes( $option['secret_get_key'] ) ); ?>" class="regular-text" />51 <p>Current login URL: <?php echo wp_login_url().'?<strong>'.esc_html( stripslashes( $option['secret_get_key'] ) ).'</strong>='.esc_html( stripslashes( $option['secret_get_value'] ) ); ?></p></td>52 </tr>53 <tr>54 <th scope="row"><label for="secret_get_value">Secret GET value</label></th>55 <td><p>This is the value required for the parameter set above.</p>56 <input name="secret_get_value" type="text" id="secret_get_value" value="<?php echo esc_html( stripslashes( $option['secret_get_value'] ) ); ?>" class="regular-text" />57 <p>Current login URL: <?php echo wp_login_url().'?'.esc_html( stripslashes( $option['secret_get_key'] ) ).'=<strong>'.esc_html( stripslashes( $option['secret_get_value'] ) ).'</strong>'; ?></td>58 </tr>59 <tr>60 <th scope="row"><label for="redirect_url">Redirect destination</label></th>61 <td><select name="redirect_url" id="redirect_url"><?php rs_ulr_destination_options( $option['redirect_url'] ); ?></select></td>62 </tr>63 <tr>64 <th scope="row">Delete settings on deactivation?</th>65 <td><label for="delete_option_on_deactivate"><input name="delete_option_on_deactivate" type="checkbox" id="delete_option_on_deactivate" value="1"<?php if( $option['delete_option_on_deactivate'] == '1' ) { ?> checked="checked"<?php } ?> /> Check this box to delete your settings above when you deactivate the plugin.</label></td>66 </tr>67 </table>68 <p class="beer">Do you find this plugin useful? If you do and you'd like to buy me a beer to say thanks, <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VXYAWTLPZYE7E" onclick="window.open( this ); return false;">click here</a>. Thanks!</p>69 <?php wp_nonce_field( 'rs_ulr_update_settings' ); ?>70 <?php submit_button(); ?>71 </form>72 </div><?php29 $option = rs_ulr_get_option(); 30 echo '<div class="wrap">'; 31 echo '<h1>'.RS_ULR__PLUGIN_NAME.'</h1>'; 32 if( $update == TRUE ) { echo '<div id="message" class="updated notice is-dismissible"><p>Settings updated.</p></div>'; } 33 echo '<form method="post" action="'.RS_ULR__PLUGIN_ADMIN_URL.'">'; 34 echo '<table class="form-table">'; 35 echo '<tr>'; 36 echo '<th scope="row"><label for="redirect_status">Redirect status</label></th>'; 37 echo '<td><p><label><input name="redirect_status" type="radio" value="on" class="tog"'; if( $option['redirect_status'] == 'on' ) { echo ' checked="checked"'; } echo ' /> On</label></p>'; 38 echo '<p><label><input name="redirect_status" type="radio" value="off" class="tog"'; if( $option['redirect_status'] == 'off' ) { echo ' checked="checked"'; } echo ' /> Off</label></p></td>'; 39 echo '</tr>'; 40 echo '<tr>'; 41 echo '<th scope="row"><label for="login_path">Secret login path</label></th>'; 42 echo '<td><p>This defines the URL you\'ll be visiting to log in to your site.</p>'; 43 echo '<p><strong>NOTE:</strong> This should not be a path for a page which already exists.</p>'; 44 echo '<input name="login_path" type="text" id="login_path" value="'.esc_html( stripslashes( $option['login_path'] ) ).'" class="regular-text" />'; 45 echo '<p>Current redirect login URL: <strong>'.home_url().esc_html( stripslashes( $option['login_path'] ) ).'</strong> (you should bookmark this)</p></td>'; 46 echo '</tr>'; 47 echo '<tr>'; 48 echo '<th scope="row"><label for="secret_get_key">Secret GET key</label></th>'; 49 echo '<td><p>This is the parameter part of your new login URL. Without this parameter and the corresponding value below, anyone trying to access your login page will be redirected to the site you select below.</p>'; 50 echo '<input name="secret_get_key" type="text" id="secret_get_key" value="'.esc_html( stripslashes( $option['secret_get_key'] ) ).'" class="regular-text" />'; 51 echo '<p>Current login URL: '.wp_login_url().'?<strong>'.esc_html( stripslashes( $option['secret_get_key'] ) ).'</strong>='.esc_html( stripslashes( $option['secret_get_value'] ) ).'</p></td>'; 52 echo '</tr>'; 53 echo '<tr>'; 54 echo '<th scope="row"><label for="secret_get_value">Secret GET value</label></th>'; 55 echo '<td><p>This is the value required for the parameter set above.</p>'; 56 echo '<input name="secret_get_value" type="text" id="secret_get_value" value="'.esc_html( stripslashes( $option['secret_get_value'] ) ).'" class="regular-text" />'; 57 echo '<p>Current login URL: '.wp_login_url().'?'.esc_html( stripslashes( $option['secret_get_key'] ) ).'=<strong>'.esc_html( stripslashes( $option['secret_get_value'] ) ).'</strong></td>'; 58 echo '</tr>'; 59 echo '<tr>'; 60 echo '<th scope="row"><label for="redirect_url">Redirect destination</label></th>'; 61 echo '<td><select name="redirect_url" id="redirect_url">'; rs_ulr_destination_options( $option['redirect_url'] ); echo '</select></td>'; 62 echo '</tr>'; 63 echo '<tr>'; 64 echo '<th scope="row">Delete settings on deactivation?</th>'; 65 echo '<td><label for="delete_option_on_deactivate"><input name="delete_option_on_deactivate" type="checkbox" id="delete_option_on_deactivate" value="1"'; if( $option['delete_option_on_deactivate'] == '1' ) { echo ' checked="checked"'; } echo ' /> Check this box to delete your settings above when you deactivate the plugin.</label></td>'; 66 echo '</tr>'; 67 echo '</table>'; 68 echo '<p class="beer">Do you find this plugin useful? If you do and you\'d like to buy me a beer to say thanks, <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=VXYAWTLPZYE7E" onclick="window.open( this ); return false;">click here</a>. Thanks!</p>'; 69 wp_nonce_field( 'rs_ulr_update_settings' ); 70 submit_button(); 71 echo '</form>'; 72 echo '</div>'; 73 73 } -
unauthorised-login-redirect/trunk/ulr/ulr-option.php
r1305780 r3012663 25 25 26 26 function rs_ulr_option_exists() { 27 if( !rs_ulr_get_option() ) { return FALSE; } 28 else { return TRUE; } 27 $return = TRUE; 28 if( !rs_ulr_get_option() ) { $return = FALSE; } 29 return $return; 29 30 } 30 31 -
unauthorised-login-redirect/trunk/ulr/ulr-redirect.php
r2195823 r3012663 7 7 if( ( strpos( $path['full_uri'], 'wp-login.php' ) ) || ( ( !is_user_logged_in() ) && ( strpos( $path['full_uri'], 'wp-admin' ) ) ) && ( !strpos( $path['full_uri'], 'wp-admin/admin-ajax.php' ) ) ) { 8 8 $option = rs_ulr_get_option(); 9 if( $option['redirect_status'] == 'on' ) {9 if( $option['redirect_status'] === 'on' ) { 10 10 $get_key = $option['secret_get_key']; 11 11 $get_value = $option['secret_get_value']; 12 12 $redirect_url = $option['redirect_url']; 13 $home_url = str_replace( 'http:', '', str_replace( 'https:', '', home_url() ) ); 14 if( $_GET[$get_key] == $get_value ) { $continue = 1; } 15 if( ( isset( $_POST ) && ( $_GET['action'] == 'confirm_admin_email' ) ) ) { $continue = 1; } 16 if( ( strpos( wp_get_referer(), $home_url ) ) && ( $_GET['action'] == 'confirm_admin_email' ) && ( isset( $_GET['remind_me_later'] ) ) ) { $continue = 1; } 17 if( ( strpos( wp_get_referer(), $home_url ) ) && ( $_GET['action'] == 'logout' ) ) { $continue = 1; } 18 if( ( strpos( wp_get_referer(), $home_url ) ) && ( $_GET['action'] == 'lostpassword' ) ) { $continue = 1; } 19 if( ( strpos( wp_get_referer(), $home_url ) ) && ( $_GET['checkemail'] == 'confirm' ) ) { $continue = 1; } 20 if( ( strpos( wp_get_referer(), $home_url ) ) && ( $_GET['loggedout'] == 'true' ) ) { $continue = 1; } 21 if( ( strpos( wp_get_referer(), $home_url ) ) && ( strpos( wp_get_referer(), '/wp-login.php' ) ) ) { $continue = 1; } 22 if( $continue !== 1 ) { 13 $home_url = str_replace( array( 'http:', 'https:' ), '', home_url() ); 14 if( isset( $_GET[$get_key] ) ) { 15 if( sanitize_text_field( $_GET[$get_key] ) === $get_value ) { $continue = 1; } 16 } 17 if( isset( $_GET['action'] ) ) { 18 if( ( isset( $_POST ) && ( $_GET['action'] === 'confirm_admin_email' ) ) ) { $continue = 1; } 19 if( ( strpos( wp_get_referer(), $home_url ) !== FALSE ) && ( $_GET['action'] === 'confirm_admin_email' ) && ( isset( $_GET['remind_me_later'] ) ) ) { $continue = 1; } 20 if( ( strpos( wp_get_referer(), $home_url ) !== FALSE ) && ( $_GET['action'] === 'logout' ) ) { $continue = 1; } 21 if( ( strpos( wp_get_referer(), $home_url ) !== FALSE ) && ( $_GET['action'] === 'lostpassword' ) ) { $continue = 1; } 22 } 23 if( isset( $_GET['checkemail'] ) ) { 24 if( ( strpos( wp_get_referer(), $home_url ) !== FALSE ) && ( $_GET['checkemail'] === 'confirm' ) ) { $continue = 1; } 25 } 26 if( isset( $_GET['loggedout'] ) ) { 27 if( ( strpos( wp_get_referer(), $home_url ) !== FALSE ) && ( $_GET['loggedout'] === 'true' ) ) { $continue = 1; } 28 } 29 if( ( strpos( wp_get_referer(), $home_url ) !== FALSE ) && ( strpos( wp_get_referer(), '/wp-login.php' ) !== FALSE ) ) { $continue = 1; } 30 if( !isset( $continue ) ) { 23 31 wp_redirect( $redirect_url, 302 ); 24 32 exit; … … 31 39 $path = rs_ulr_get_current_path(); 32 40 $option = rs_ulr_get_option(); 33 if( $path['full_uri'] == home_url( $option['login_path'] ) ) {41 if( $path['full_uri'] === home_url( $option['login_path'] ) ) { 34 42 $get_key = $option['secret_get_key']; 35 43 $get_value = $option['secret_get_value']; -
unauthorised-login-redirect/trunk/unauthorised-login-redirect.php
r2743490 r3012663 3 3 Plugin Name: Unauthorised Login Redirect 4 4 Description: This plugin allows you to effectively hide your wp-login.php and wp-admin by requiring that you access it via a custom URL of your specification, with every other request being redirected to a different URL of your specification. 5 Version: 0.3.9 5 Version: 0.3.9.1 6 6 Author: RS 7 7 Author URI: https://rs.scot … … 43 43 define( 'RS_ULR__PLUGIN_SHORT_NAME', 'Login Redirect' ); 44 44 define( 'RS_ULR__PLUGIN_URL', plugin_dir_url( __FILE__ ) ); 45 define( 'RS_ULR__PLUGIN_VERSION', '0.3.9 ' );45 define( 'RS_ULR__PLUGIN_VERSION', '0.3.9.1' ); 46 46 47 47 foreach( glob( RS_ULR__PLUGIN_DIR.'*.php' ) as $file ) { require_once( $file ); }
Note: See TracChangeset
for help on using the changeset viewer.