Changeset 3153912
- Timestamp:
- 09/18/2024 11:40:43 AM (15 months ago)
- Location:
- sg-security/trunk
- Files:
-
- 6 edited
-
core/Block_Service/Block_Service.php (modified) (4 diffs)
-
core/Helper/Helper.php (modified) (5 diffs)
-
core/Install_Service/Install_1_2_0.php (modified) (3 diffs)
-
core/Options_Service/Options_Service.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
-
sg-security.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
sg-security/trunk/core/Block_Service/Block_Service.php
r2904929 r3153912 8 8 */ 9 9 class Block_Service { 10 11 /** 12 * The Database placeholder. 13 */ 14 public $wpdb; 15 10 16 /** 11 17 * Block user if IP has a block flag set in the visitors table. … … 29 35 ); 30 36 31 // Continue if ipis not blocked.37 // Continue if IP is not blocked. 32 38 if ( is_null( $result ) ) { 33 39 return; … … 164 170 165 171 /** 166 * Get visitor ipby visitor id.172 * Get visitor IP by visitor id. 167 173 * 168 174 * @since 1.0.0 … … 264 270 public function unblock_user( $id ) { 265 271 global $wpdb; 266 267 $wpdb->update( 268 $wpdb->sgs_visitors, 272 $this->wpdb = $wpdb; 273 274 $this->wpdb->update( 275 $this->wpdb->sgs_visitors, 269 276 array( 270 277 'block' => 0, -
sg-security/trunk/core/Helper/Helper.php
r2854174 r3153912 13 13 14 14 /** 15 * The Database placeholder. 16 */ 17 public static $wpdb; 18 19 /** 15 20 * Get the current user's IP address. 16 21 * 17 22 * @since 1.0.0 18 23 * 19 * @return string The user s's IP.24 * @return string The user's IP. 20 25 */ 21 26 public static function get_current_user_ip() { … … 38 43 continue; 39 44 } 40 // Return the user s's IP Address.45 // Return the user's IP Address. 41 46 return preg_replace( '/^::1$/', '127.0.0.1', $_SERVER[ $key ] ); //phpcs:ignore 42 47 } … … 55 60 56 61 /** 57 * Get the path without home urlpath.62 * Get the path without home URL path. 58 63 * 59 64 * @since 1.0.0 … … 64 69 */ 65 70 public static function get_url_path( $url ) { 66 // Get the site urlparts.67 $url_parts = parse_url( Helper_Service::get_site_url() );71 // Get the site URL parts. 72 $url_parts = wp_parse_url( Helper_Service::get_site_url() ); 68 73 // Get the home path. 69 74 $home_path = ! empty( $url_parts['path'] ) ? trailingslashit( $url_parts['path'] ) : '/'; 70 75 71 // Remove the query args from the url.76 // Remove the query args from the URL. 72 77 $url = explode( '?', preg_replace( '|//+|', '/', $url ) ); 73 // Get the urlpath.74 $path = parse_url( $url[0], PHP_URL_PATH );78 // Get the URL path. 79 $path = wp_parse_url( $url[0], PHP_URL_PATH ); 75 80 // Return the path without home path. 76 81 return str_replace( $home_path, '', $path ); … … 121 126 public static function table_exists( $table_name ) { 122 127 global $wpdb; 128 self::$wpdb = $wpdb; 123 129 124 130 // Bail if table doesn't exist. 125 if ( $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) {131 if ( self::$wpdb->get_var( self::$wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ) !== $table_name ) { //phpcs:ignore 126 132 return false; 127 133 } -
sg-security/trunk/core/Install_Service/Install_1_2_0.php
r2685886 r3153912 3 3 4 4 /** 5 * The instal ation package version class.5 * The installation package version class. 6 6 */ 7 7 class Install_1_2_0 extends Install { … … 19 19 20 20 /** 21 * The Database placeholder. 22 */ 23 public $wpdb; 24 25 /** 21 26 * Run the install procedure. 22 27 * … … 25 30 public function install() { 26 31 global $wpdb; 32 $this->wpdb = $wpdb; 27 33 28 34 // Change the the events and visitors tables charset. 29 $ wpdb->query( "ALTER TABLE `{$wpdb->prefix}sgs_log_events` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;");30 $ wpdb->query( "ALTER TABLE `{$wpdb->prefix}sgs_log_visitors` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;");35 $this->wpdb->query( 'ALTER TABLE `' . esc_sql( $this->wpdb->prefix . 'sgs_log_events' ) . '` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;' ); 36 $this->wpdb->query( 'ALTER TABLE `' . esc_sql( $this->wpdb->prefix . 'sgs_log_visitors' ) . '` CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_520_ci;' ); 31 37 32 38 // Setting the notification email option for Weekly emails. -
sg-security/trunk/core/Options_Service/Options_Service.php
r2539990 r3153912 6 6 */ 7 7 class Options_Service { 8 9 /** 10 * The Database placeholder. 11 */ 12 public $wpdb; 8 13 9 14 /** … … 109 114 110 115 /** 111 * Checks if the `option_key` paramet her exists in rest data.116 * Checks if the `option_key` parameter exists in rest data. 112 117 * 113 118 * @since 1.0.0 … … 136 141 global $wpdb; 137 142 global $blog_id; 143 $this->wpdb = $wpdb; 138 144 139 $prefix = $ wpdb->get_blog_prefix( $blog_id );145 $prefix = $this->wpdb->get_blog_prefix( $blog_id ); 140 146 141 147 $options = array(); 142 148 143 $ site_options = $wpdb->get_results(144 " 145 SELECT REPLACE( option_name, 'sg_security_', '' ) AS name, option_value AS value146 FROM {$prefix}options147 WHERE option_name LIKE '%sg_security_%'148 "149 $query = $this->wpdb->prepare( 150 "SELECT REPLACE( option_name, 'sg_security_', '' ) AS name, option_value AS value 151 FROM " . esc_sql( $prefix . 'options' ) . " 152 WHERE option_name LIKE %s 153 ", 154 '%' . $this->wpdb->esc_like( 'sg_security_' ) . '%' 149 155 ); 156 157 $site_options = $this->wpdb->get_results( $query ); //phpcs:ignore 150 158 151 159 foreach ( $site_options as $option ) { -
sg-security/trunk/readme.txt
r3149177 r3153912 5 5 Tested up to: 6.6 6 6 Requires PHP: 7.0 7 Stable tag: 1.5. 47 Stable tag: 1.5.5 8 8 License: GPLv3 9 9 License URI: http://www.gnu.org/licenses/gpl-3.0.html … … 144 144 145 145 == Changelog == 146 = Version 1.5.5 = 147 Release Date: Sep 18th, 2024 148 149 * Options improvements. 150 * Block Service improvements. 146 151 147 152 = Version 1.5.4 = -
sg-security/trunk/sg-security.php
r3149177 r3153912 11 11 * Plugin URI: https://siteground.com 12 12 * Description: Security Optimizer by SiteGround is the all-in-one security solution for your WordPress website. With the carefully selected and easy to configure functions the plugin provides everything you need to secure your website and prevent a number of threats such as brute-force attacks, compromised login, data leaks and more. 13 * Version: 1.5. 413 * Version: 1.5.5 14 14 * Author: SiteGround 15 15 * Author URI: https://www.siteground.com … … 33 33 // Define version constant. 34 34 if ( ! defined( __NAMESPACE__ . '\VERSION' ) ) { 35 define( __NAMESPACE__ . '\VERSION', '1.5. 4' );35 define( __NAMESPACE__ . '\VERSION', '1.5.5' ); 36 36 } 37 37
Note: See TracChangeset
for help on using the changeset viewer.