Changeset 3258796
- Timestamp:
- 03/19/2025 09:03:25 PM (12 months ago)
- Location:
- admintosh
- Files:
-
- 75 added
- 6 edited
-
tags/1.1.2 (added)
-
tags/1.1.2/admin (added)
-
tags/1.1.2/admin/Admin.php (added)
-
tags/1.1.2/admin/Admin_Hooks.php (added)
-
tags/1.1.2/admin/assets (added)
-
tags/1.1.2/admin/assets/css (added)
-
tags/1.1.2/admin/assets/css/admintosh-admin.css (added)
-
tags/1.1.2/admin/assets/css/dataTables.dataTables.css (added)
-
tags/1.1.2/admin/assets/css/jquery-ui.css (added)
-
tags/1.1.2/admin/assets/css/select2.min.css (added)
-
tags/1.1.2/admin/assets/img (added)
-
tags/1.1.2/admin/assets/img/color-1.png (added)
-
tags/1.1.2/admin/assets/img/color-2.png (added)
-
tags/1.1.2/admin/assets/img/color-3.png (added)
-
tags/1.1.2/admin/assets/img/color-4.png (added)
-
tags/1.1.2/admin/assets/js (added)
-
tags/1.1.2/admin/assets/js/admintosh-admin.js (added)
-
tags/1.1.2/admin/assets/js/dataTables.js (added)
-
tags/1.1.2/admin/assets/js/select2.min.js (added)
-
tags/1.1.2/admin/assets/js/wp-color-picker-alpha.js (added)
-
tags/1.1.2/admin/assets/trustpilot-author-name.png (added)
-
tags/1.1.2/admin/fields (added)
-
tags/1.1.2/admin/fields/Border.php (added)
-
tags/1.1.2/admin/fields/Color.php (added)
-
tags/1.1.2/admin/fields/Dimension.php (added)
-
tags/1.1.2/admin/fields/Heading.php (added)
-
tags/1.1.2/admin/fields/Image_Radio_Button.php (added)
-
tags/1.1.2/admin/fields/Media.php (added)
-
tags/1.1.2/admin/fields/Multi_Select.php (added)
-
tags/1.1.2/admin/fields/Number.php (added)
-
tags/1.1.2/admin/fields/Select.php (added)
-
tags/1.1.2/admin/fields/Switch.php (added)
-
tags/1.1.2/admin/fields/Text.php (added)
-
tags/1.1.2/admintosh.php (added)
-
tags/1.1.2/appsero (added)
-
tags/1.1.2/appsero/.editorconfig (added)
-
tags/1.1.2/appsero/.php-cs-fixer.dist.php (added)
-
tags/1.1.2/appsero/phpcs.xml.dist (added)
-
tags/1.1.2/appsero/readme.md (added)
-
tags/1.1.2/appsero/src (added)
-
tags/1.1.2/appsero/src/Client.php (added)
-
tags/1.1.2/appsero/src/Insights.php (added)
-
tags/1.1.2/appsero/src/License.php (added)
-
tags/1.1.2/classes (added)
-
tags/1.1.2/classes/Countries.php (added)
-
tags/1.1.2/classes/Email_Notifier.php (added)
-
tags/1.1.2/classes/Geolocation.php (added)
-
tags/1.1.2/classes/IP_API.php (added)
-
tags/1.1.2/classes/Recaptcha_Generator.php (added)
-
tags/1.1.2/inc (added)
-
tags/1.1.2/inc/Admin_Activity_Logs.php (added)
-
tags/1.1.2/inc/Country_Block.php (added)
-
tags/1.1.2/inc/Dashboard.php (added)
-
tags/1.1.2/inc/General_Settings.php (added)
-
tags/1.1.2/inc/Helper.php (added)
-
tags/1.1.2/inc/Hide_Login.php (added)
-
tags/1.1.2/inc/Limit_Login_Attempts.php (added)
-
tags/1.1.2/inc/Login_History.php (added)
-
tags/1.1.2/inc/Login_Page_Customize.php (added)
-
tags/1.1.2/inc/Modules_Setup.php (added)
-
tags/1.1.2/inc/Recaptcha.php (added)
-
tags/1.1.2/inc/functions.php (added)
-
tags/1.1.2/languages (added)
-
tags/1.1.2/languages/admintosh.pot (added)
-
tags/1.1.2/readme.txt (added)
-
tags/1.1.2/vendor (added)
-
tags/1.1.2/vendor/autoload.php (added)
-
tags/1.1.2/vendor/composer (added)
-
tags/1.1.2/vendor/composer/ClassLoader.php (added)
-
tags/1.1.2/vendor/composer/LICENSE (added)
-
tags/1.1.2/vendor/composer/autoload_classmap.php (added)
-
tags/1.1.2/vendor/composer/autoload_namespaces.php (added)
-
tags/1.1.2/vendor/composer/autoload_psr4.php (added)
-
tags/1.1.2/vendor/composer/autoload_real.php (added)
-
tags/1.1.2/vendor/composer/autoload_static.php (added)
-
trunk/admin/Admin.php (modified) (2 diffs)
-
trunk/admintosh.php (modified) (2 diffs)
-
trunk/inc/Admin_Activity_Logs.php (modified) (11 diffs)
-
trunk/inc/Recaptcha.php (modified) (7 diffs)
-
trunk/inc/functions.php (modified) (1 diff)
-
trunk/readme.txt (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
admintosh/trunk/admin/Admin.php
r3248536 r3258796 111 111 'anc_class' => 'admintosh-tab', 112 112 'data_attr' => 'login_recaptcha', 113 'title' => esc_html__( ' LoginreCAPTCHA', 'admintosh' )113 'title' => esc_html__( 'reCAPTCHA', 'admintosh' ) 114 114 ], 115 115 'login_attempts' => [ … … 524 524 'condition' => [ 'captcha_type' => ['google_captcha'] ] 525 525 ]); 526 527 $this->switcher_field([ 528 'title' => esc_html__( 'Captcha for Login Form', 'admintosh' ), 529 'name' => 'captcha_wp_login', 530 'description' => esc_html__( 'Captcha will work on wp login, WooCommerce login & EDD login form.', 'admintosh' ) 531 ]); 532 533 $this->switcher_field([ 534 'title' => esc_html__( 'Captcha on WP Registration Form', 'admintosh' ), 535 'name' => 'captcha_wp_registration', 536 'description' => esc_html__( 'Captcha will work on wp login, WooCommerce login & EDD login form.', 'admintosh' ) 537 ]); 538 539 $this->switcher_field([ 540 'title' => esc_html__( 'Captcha on Blog Comment Form', 'admintosh' ), 541 'name' => 'captcha_blog_comment', 542 'description' => esc_html__( 'Captcha will work on blog comment form.', 'admintosh' ) 543 ]); 544 526 545 ?> 527 546 -
admintosh/trunk/admintosh.php
r3248536 r3258796 4 4 Plugin URI: http://wpmobo.com/admintosh 5 5 Description: WordPress admin customization and security tools 6 Version: 1.1. 16 Version: 1.1.2 7 7 Author: wpmobo 8 8 Author URI: http://wpmobo.com … … 58 58 add_action( 'init', [ $this, 'client_insights' ] ); 59 59 $this->include(); 60 $this->init();60 add_action( 'plugins_loaded', [ $this, 'init' ] ); 61 61 } 62 62 -
admintosh/trunk/inc/Admin_Activity_Logs.php
r3248536 r3258796 18 18 19 19 add_action('wp_insert_post', [ $this, 'log_post_changes' ], 10, 3); 20 add_action('wp_trash_post', [ $this, 'log_post_trash' ], 10, 2); 20 21 add_action('before_delete_post', [ $this, 'log_post_deletion' ]); 21 add_action('set_user_role', [ $this, ' admintosh_log_user_role_change' ], 10, 3);22 add_action('set_user_role', [ $this, 'log_user_role_change' ], 10, 3); 22 23 23 24 add_action('activated_plugin', [ $this, 'log_plugin_status' ], 10, 2); … … 25 26 add_action('deactivated_plugin', [ $this, 'log_plugin_deactivation' ], 10, 2); 26 27 27 add_action('switch_theme', [ $this, 'log_theme_change' ] );28 add_action('switch_theme', [ $this, 'log_theme_change' ], 10, 3 ); 28 29 29 30 add_action('admin_menu', [ $this, 'add_activity_log_page' ] ); … … 53 54 'ip_address' => sanitize_text_field( $ip_address ), 54 55 'user_agent' => sanitize_text_field( $user_agent['user_agent'] ?? '' ), 55 'timestamp' => sanitize_text_field( current_time( ' mysql' ) )56 'timestamp' => sanitize_text_field( current_time( 'timestamp' ) ) 56 57 ], 57 58 ['%d', '%s', '%s', '%d', '%s', '%s', '%s', '%s'] … … 60 61 61 62 63 public function log_post_trash( $post_id, $previous_status ) { 64 65 if( !$post_id ) { 66 return; 67 } 68 69 $user_id = get_current_user_id(); 70 $title = get_the_title($post_id); 71 $post_type = get_post_type($post_id); 72 $action = 'trash'; 73 $message = "title: $title (ID: $post_id) move to $action."; 74 75 $this->admintosh_log_activity($user_id, $action, $post_type, $post_id, $message); 76 } 77 62 78 public function log_post_changes($post_id, $post, $update) { 63 79 if (wp_is_post_revision($post_id)) return; … … 65 81 $user_id = get_current_user_id(); 66 82 $action = $update ? 'updated' : 'created'; 67 $message = "Post '{$post->post_title}' (ID: $post_id) was $action."; 68 69 $this->admintosh_log_activity($user_id, $action, 'post', $post_id, $message); 83 $post_type = get_post_type($post_id); 84 $message = "title: {$post->post_title} (ID: $post_id) was $action."; 85 86 $this->admintosh_log_activity($user_id, $action, $post_type, $post_id, $message); 70 87 } 71 88 … … 73 90 public function log_post_deletion($post_id) { 74 91 $user_id = get_current_user_id(); 75 $message = "Post (ID: $post_id) was deleted."; 76 77 $this->admintosh_log_activity($user_id, 'deleted', 'post', $post_id, $message); 92 $post_type = get_post_type($post_id); 93 $title = get_the_title($post_id); 94 $message = "title: $title (ID: $post_id) was permanently deleted."; 95 96 $this->admintosh_log_activity($user_id, 'deleted', $post_type, $post_id, $message); 78 97 } 79 98 80 99 81 100 public function log_user_role_change($user_id, $new_roles, $old_roles) { 82 $message = "User (ID: $user_id) role changed from " . implode(', ', $old_roles) . " to " . implode(', ', $new_roles) . "."; 83 $this->admintosh_log_activity(get_current_user_id(), 'role_change', 'user', $user_id, $message); 101 102 if( !empty( $old_roles ) ) { 103 $message = "User (ID: $user_id) role changed from " . implode(', ', $old_roles) . " to " . $new_roles . "."; 104 $this->admintosh_log_activity(get_current_user_id(), 'role_change', 'user', $user_id, $message); 105 } 106 84 107 } 85 108 … … 103 126 } 104 127 105 public function log_theme_change($new_theme) { 106 $user_id = get_current_user_id(); 107 $message = "Theme changed to '{$new_theme->get('Name')}'."; 128 public function log_theme_change( $new_name, $new_theme, $old_theme ) { 129 130 $user_id = get_current_user_id(); 131 $message = "Theme changed '{$old_theme->get('Name')}' to $new_name."; 108 132 109 133 $this->admintosh_log_activity($user_id, 'theme_change', 'theme', 0, $message); … … 127 151 $table_name = $wpdb->prefix . 'ats_activity_logs'; 128 152 $logs = $wpdb->get_results("SELECT * FROM $table_name ORDER BY timestamp DESC LIMIT 50"); 153 // 154 $dateTimeFormat = get_option( 'date_format' ) . ' ' . get_option( 'time_format' ); 129 155 130 156 ?> … … 147 173 foreach ( $logs as $log ): 148 174 $user = get_user_by('ID', $log->user_id); 175 176 $display_name = !empty( $user->display_name ) ? $user->display_name : ''; 149 177 ?> 150 178 <tr> 151 <td><?php echo esc_html( " {$user->display_name}(ID: {$log->user_id})" ); ?></td>179 <td><?php echo esc_html( " $display_name (ID: {$log->user_id})" ); ?></td> 152 180 <td><?php echo esc_html( $log->action_type ); ?></td> 153 181 <td><?php echo esc_html( "{$log->object_type} (ID: {$log->object_id})" ); ?></td> 154 182 <td><?php echo esc_html( $log->message ); ?></td> 155 183 <td><?php echo esc_html( $log->ip_address ); ?></td> 156 <td><?php echo esc_html( $log->timestamp); ?></td>184 <td><?php echo esc_html( wp_date( $dateTimeFormat, $log->timestamp ) ); ?></td> 157 185 </tr> 158 186 <?php … … 170 198 } 171 199 172 p rotectedfunction create_database_table() {200 public function create_database_table() { 173 201 global $wpdb; 174 202 $table_name = $wpdb->prefix . 'ats_activity_logs'; … … 185 213 ip_address VARCHAR(45) NOT NULL, 186 214 user_agent TEXT NOT NULL, 187 timestamp DATETIMEDEFAULT CURRENT_TIMESTAMP215 timestamp TEXT DEFAULT CURRENT_TIMESTAMP 188 216 ) $charset_collate;"; 189 217 -
admintosh/trunk/inc/Recaptcha.php
r3152299 r3258796 14 14 protected $options; 15 15 16 protected $errorMsg; 17 16 18 /** 17 19 * Start up … … 21 23 $this->options = get_option( ADMINTOSH_OPTION_NAME ); 22 24 25 $this->errorMsg = esc_html__( 'CAPTCHA verification failed. Please try again.', 'admintosh' ); 26 23 27 $get_options = $this->options; 24 28 25 add_action('init', [ $this, 'init_session' ], 999);29 add_action('init', [ $this, 'init_session' ], 1 ); 26 30 if( !empty( $get_options['active_login_captcha'] ) ) { 27 add_action('login_form', [ $this, 'login_form_captcha' ], 999 ); 28 add_filter('wp_authenticate_user',[ $this, 'validate_login_captcha' ],10,2); 31 32 // WP login 33 if( !empty( $get_options['captcha_wp_login'] ) ) { 34 35 // wp login form 36 add_action('login_form', [ $this, 'login_form_captcha' ], 999 ); 37 38 // WooCommerce My account login 39 if( adtosh_is_woo_active() ) { 40 add_action('woocommerce_login_form', [ $this, 'add_recaptcha' ]); 41 } 42 43 // Edd Login 44 if( adtosh_is_edd_active() ) { 45 add_action('edd_login_fields_after', [ $this, 'add_recaptcha' ]); 46 add_action('edd_user_login', [ $this, 'edd_recaptcha_validate_login' ] ); 47 } 48 49 add_filter('wp_authenticate_user',[ $this, 'validate_login_captcha' ],10,2); 50 } 51 52 53 // WP registration 54 if( !empty( $get_options['captcha_wp_registration'] ) ) { 55 56 // wp reg 57 add_action('register_form', [ $this, 'login_form_captcha' ]); 58 add_filter('registration_errors', [ $this, 'validate_recaptcha_wp_registration' ], 10, 3); 59 60 // Edd register form 61 if( adtosh_is_edd_active() ) { 62 add_action('edd_register_form_fields_before_submit', [ $this, 'add_recaptcha' ]); 63 add_action('edd_process_register_form', [ $this, 'edd_recaptcha_validate_registration' ], 10 ); 64 } 65 66 // WooCommerce Registration form 67 if( adtosh_is_woo_active() ) { 68 add_action('woocommerce_register_form', [ $this, 'add_recaptcha' ] ); 69 add_action('woocommerce_register_post', [ $this, 'validate_recaptcha_wc_registration' ], 10, 3); 70 } 71 72 } 73 74 // blog comment 75 if( !empty( $get_options['captcha_blog_comment'] ) ) { 76 add_action('comment_form_submit_field', [ $this, 'add_comment_recaptcha' ] ); 77 add_filter('preprocess_comment', [ $this, 'verify_recaptcha_on_comment' ]); 78 } 79 80 29 81 } 30 82 … … 32 84 33 85 public function init_session() { 86 87 //session_destroy(); 34 88 if(!session_id()) { 35 89 session_start(); 36 90 } 37 38 91 } 39 92 … … 86 139 87 140 public function validate_login_captcha( $user, $password ) { 88 89 $return_value = $user; 141 142 if( !$this->is_validate_captch() ) { 143 return new \WP_Error( 'loginCaptchaError', $this->errorMsg ); 144 } 145 146 return $user; 147 } 148 149 public function is_validate_captch () { 150 90 151 $admintoshrev_options = $this->options; 152 153 $is_true = true; 91 154 92 155 // Check captcha type … … 109 172 110 173 if ($response->success != true) { 111 $ return_value = new \WP_Error( 'loginCaptchaError', esc_html__( 'Captcha Error. Please try again.', 'admintosh' ) );174 $is_true = false; 112 175 } 113 176 … … 116 179 if( !$this->check( sanitize_text_field( $_POST['adtosh_captcha_answer'] ) ) ) { 117 180 // if there is a mis-match 118 $ return_value = new \WP_Error( 'loginCaptchaError', esc_html__( 'Captcha Error. Please try again. ', 'admintosh' ) );119 120 }121 } 122 123 124 return $return_value; 181 $is_true = false; 182 } 183 } 184 185 return $is_true; 186 187 125 188 } 126 189 … … 158 221 } 159 222 223 public function validate_recaptcha_wp_registration( $errors, $sanitized_user_login, $user_email ) { 224 225 if( !$this->is_validate_captch() ) { 226 227 $errors->add('recaptcha_failed', $this->errorMsg ); 228 229 } 230 231 return $errors; 232 233 } 234 235 public function edd_recaptcha_validate_registration() { 236 237 if( !$this->is_validate_captch() ) { 238 edd_set_error('edd_recaptcha', $this->errorMsg ); 239 return false; 240 } 241 242 return true; 243 244 } 245 246 public function validate_recaptcha_wc_registration( $username, $email, $errors ) { 247 248 if( !$this->is_validate_captch() ) { 249 $errors->add('recaptcha_failed', $this->errorMsg ); 250 } 251 return $errors; 252 253 } 254 255 public function verify_recaptcha_on_comment( $commentdata ) { 256 257 if( !$this->is_validate_captch() ) { 258 259 wp_die('<div class="wp-die-message"><p><strong>Error:</strong> '.esc_html( $this->errorMsg ).'</p></div><p><a href="javascript:history.back()">« Back</a></p>'); 260 } 261 return $commentdata; 262 263 } 264 265 public function add_recaptcha() { 266 $this->login_form_captcha(); 267 } 268 269 public function add_comment_recaptcha( $submit_field ) { 270 271 ob_start(); 272 $this->login_form_captcha(); 273 $captch = ob_get_clean(); 274 275 return $captch.$submit_field; 276 277 } 278 279 public function edd_recaptcha_validate_login($login_data) { 280 if ( !$this->is_validate_captch() ) { 281 edd_set_error('edd_recaptcha', esc_html( $this->errorMsg ) ); 282 } 283 } 284 285 286 160 287 161 288 } -
admintosh/trunk/inc/functions.php
r3126611 r3258796 94 94 95 95 } 96 97 function adtosh_is_woo_active() { 98 return class_exists('WooCommerce'); 99 } 100 101 function adtosh_is_edd_active() { 102 return class_exists('Easy_Digital_Downloads'); 103 } -
admintosh/trunk/readme.txt
r3248536 r3258796 6 6 Requires at least: 6.5 7 7 Tested up to: 6.7.1 8 Stable tag: 1.1. 19 Version: 1.1. 18 Stable tag: 1.1.2 9 Version: 1.1.2 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 26 26 * **Customize Dashboard**: Customize the Dashboard and make it like your own brand all customization possibilities are here like background color, menu color, text color, link color, logo upload, etc. 27 27 28 * **Captcha**: Add captch into login, registration, lost password, comments Form etc. The plugin offer 3 types of Captcha Google reCaptcha ( Version 2 ), Random number Captcha and Math Captcha so you could use any one of them's to protection from remote digital entry by making sure only a human being with the right password can access the account.28 * **Captcha**: Add captch into login, registration, lost password, comments Form etc. It also supported **WooCommerce** & **EDD**. The plugin offer 3 types of Captcha Google reCaptcha ( Version 2 ), Random number Captcha and Math Captcha so you could use any one of them's to protection from remote digital entry by making sure only a human being with the right password can access the account. 29 29 30 30 * **Limit Login Attempts**: After a preset number of attempts has been exceeded, this feature automatically stops any more attempts from a specific Internet Protocol (IP) address and/or username. This considerably reduces the potency of brute force attacks on your website. … … 200 200 == Changelog == 201 201 202 = 1.1.2 = 203 204 - Added CAPTCHA support for WP Registration Form 205 - Added CAPTCHA support for Blog Post Comment Form 206 - Added CAPTCHA support for WooCommerce Login Form 207 - Added CAPTCHA support for WooCommerce Registration Form 208 - Added CAPTCHA support for EDD Login Form 209 - Added CAPTCHA support for EDD Registration Form 210 - Added an enable/disable switch for CAPTCHA 211 - Fixed an issue with Activity Logs errors 212 202 213 = 1.1.1 = 203 214
Note: See TracChangeset
for help on using the changeset viewer.