Changeset 3417226
- Timestamp:
- 12/11/2025 10:19:41 AM (4 months ago)
- Location:
- refatbd-notifications-with-telegram-for-woocommerce/trunk
- Files:
-
- 12 edited
-
admin/views/api-connection-page.php (modified) (1 diff)
-
admin/views/faq-page.php (modified) (1 diff)
-
admin/views/history-page.php (modified) (1 diff)
-
admin/views/how-to-page.php (modified) (1 diff)
-
admin/views/logs-page.php (modified) (1 diff)
-
admin/views/notification-rules-page.php (modified) (1 diff)
-
admin/views/partials/conditions-template.php (modified) (1 diff)
-
admin/views/schedule-sms-page.php (modified) (1 diff)
-
admin/views/settings-page.php (modified) (1 diff)
-
includes/class-rntfw-db.php (modified) (20 diffs)
-
readme.txt (modified) (4 diffs)
-
refatbd-notifications-with-telegram-for-woocommerce.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
refatbd-notifications-with-telegram-for-woocommerce/trunk/admin/views/api-connection-page.php
r3390586 r3417226 1 1 <?php 2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 2 3 /** 3 4 * Admin View: API Connection Page (Free Version) -
refatbd-notifications-with-telegram-for-woocommerce/trunk/admin/views/faq-page.php
r3390586 r3417226 1 1 <?php 2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 2 3 /** 3 4 * Admin View: FAQ Page (Free Version) -
refatbd-notifications-with-telegram-for-woocommerce/trunk/admin/views/history-page.php
r3390586 r3417226 1 1 <?php 2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 2 3 /** 3 4 * Admin View: History Page (Free Version) -
refatbd-notifications-with-telegram-for-woocommerce/trunk/admin/views/how-to-page.php
r3390586 r3417226 1 1 <?php 2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 2 3 /** 3 4 * Admin View: How To Use Page / Available Chat Commands (Free Version) -
refatbd-notifications-with-telegram-for-woocommerce/trunk/admin/views/logs-page.php
r3390586 r3417226 1 1 <?php 2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 2 3 /** 3 4 * Admin View: Logs Page (Free Version) -
refatbd-notifications-with-telegram-for-woocommerce/trunk/admin/views/notification-rules-page.php
r3390586 r3417226 1 1 <?php 2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 2 3 /** 3 4 * Admin View: Notification Rules Page -
refatbd-notifications-with-telegram-for-woocommerce/trunk/admin/views/partials/conditions-template.php
r3390586 r3417226 1 1 <?php 2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 2 3 /** 3 4 * Admin View: Partial for Notification Conditions Template -
refatbd-notifications-with-telegram-for-woocommerce/trunk/admin/views/schedule-sms-page.php
r3390586 r3417226 1 1 <?php 2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 2 3 /** 3 4 * Admin View: Schedule SMS Page (Free Version) -
refatbd-notifications-with-telegram-for-woocommerce/trunk/admin/views/settings-page.php
r3390586 r3417226 1 1 <?php 2 // phpcs:disable WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound 2 3 /** 3 4 * Admin View: Settings page -
refatbd-notifications-with-telegram-for-woocommerce/trunk/includes/class-rntfw-db.php
r3390586 r3417226 139 139 public static function clear_history() { 140 140 global $wpdb; 141 $table_name = self::get_history_table_name();142 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 141 $table_name = esc_sql( self::get_history_table_name() ); 142 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 143 143 $wpdb->query( "TRUNCATE TABLE `{$table_name}`" ); 144 144 } … … 146 146 public static function get_history( $per_page, $offset, $search_term = '' ) { 147 147 global $wpdb; 148 $table_name = self::get_history_table_name();148 $table_name = esc_sql( self::get_history_table_name() ); 149 149 $params = []; 150 150 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared … … 166 166 // Prepare if placeholders exist 167 167 if ( ! empty( $params ) ) { 168 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 168 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 169 169 return $wpdb->get_results( $wpdb->prepare( $sql, ...$params ) ); 170 170 } else { 171 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 171 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 172 172 return $wpdb->get_results( $sql ); 173 173 } … … 176 176 public static function get_history_count( $search_term = '' ) { 177 177 global $wpdb; 178 $table_name = self::get_history_table_name();178 $table_name = esc_sql( self::get_history_table_name() ); 179 179 $params = []; 180 180 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared … … 192 192 // Prepare if placeholders exist 193 193 if ( ! empty( $params ) ) { 194 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 194 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 195 195 return (int) $wpdb->get_var( $wpdb->prepare( $sql, ...$params ) ); 196 196 } else { 197 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 197 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 198 198 return (int) $wpdb->get_var( $sql ); 199 199 } … … 231 231 public static function clear_logs() { 232 232 global $wpdb; 233 $table_name = self::get_logs_table_name();234 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 233 $table_name = esc_sql( self::get_logs_table_name() ); 234 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 235 235 $wpdb->query( "TRUNCATE TABLE `{$table_name}`" ); 236 236 } … … 238 238 public static function get_logs( $per_page, $offset, $search_term = '' ) { 239 239 global $wpdb; 240 $table_name = self::get_logs_table_name();240 $table_name = esc_sql( self::get_logs_table_name() ); 241 241 $params = []; 242 242 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared … … 256 256 // Prepare if placeholders exist 257 257 if ( ! empty( $params ) ) { 258 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 258 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 259 259 return $wpdb->get_results( $wpdb->prepare( $sql, ...$params ) ); 260 260 } else { 261 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 261 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 262 262 return $wpdb->get_results( $sql ); 263 263 } … … 266 266 public static function get_log_count( $search_term = '' ) { 267 267 global $wpdb; 268 $table_name = self::get_logs_table_name();268 $table_name = esc_sql( self::get_logs_table_name() ); 269 269 $params = []; 270 270 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared … … 280 280 // Prepare if placeholders exist 281 281 if ( ! empty( $params ) ) { 282 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 282 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 283 283 return (int) $wpdb->get_var( $wpdb->prepare( $sql, ...$params ) ); 284 284 } else { 285 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 285 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 286 286 return (int) $wpdb->get_var( $sql ); 287 287 } … … 323 323 } 324 324 325 $table_name_safe = esc_sql( $table_name ); 326 $date_column_safe = esc_sql( $date_column ); 327 325 328 // Use backticks for table and column names 326 329 $sql = $wpdb->prepare( 327 330 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared -- Table and column names are checked against allowlist above. 328 "DELETE FROM `{$table_name }` WHERE `{$date_column}` < %s",331 "DELETE FROM `{$table_name_safe}` WHERE `{$date_column_safe}` < %s", 329 332 $cutoff_date 330 333 ); 331 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared -- $sql is prepared above.334 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter -- $sql is prepared above. 332 335 $wpdb->query( $sql ); // Line 317 in original code, now moved execution here. 333 336 } … … 352 355 public static function get_license_data() { 353 356 global $wpdb; 354 $table_name = self::get_licenses_table_name();357 $table_name = esc_sql( self::get_licenses_table_name() ); 355 358 // Check if table exists before querying 356 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching 359 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter 357 360 $table_exists = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ); 358 361 if ( $table_exists !== $table_name ) { … … 360 363 return null; // Table doesn't exist 361 364 } 362 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 365 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 363 366 $row = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `{$table_name}` WHERE 1=%d LIMIT 1", 1 ) ); 364 367 // If no row exists, return a default object structure expected by Pro … … 556 559 public static function delete_license_data() { 557 560 global $wpdb; 558 $table_name = self::get_licenses_table_name();561 $table_name = esc_sql( self::get_licenses_table_name() ); 559 562 // Check if table exists before trying to delete 560 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching 563 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, WordPress.DB.DirectDatabaseQuery.NoCaching, PluginCheck.Security.DirectDB.UnescapedDBParameter 561 564 $table_exists = $wpdb->get_var( $wpdb->prepare( 'SHOW TABLES LIKE %s', $table_name ) ); 562 565 if ( $table_exists !== $table_name ) { 563 566 return true; // Table doesn't exist, consider it deleted 564 567 } 565 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 568 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 566 569 return $wpdb->query( "DELETE FROM `{$table_name}`" ); 567 570 } … … 584 587 public static function get_scheduled_sms( $per_page, $offset, $search_term = '' ) { 585 588 global $wpdb; 586 $table_name = self::get_scheduled_sms_table_name();589 $table_name = esc_sql( self::get_scheduled_sms_table_name() ); 587 590 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 588 591 $sql = "SELECT * FROM `{$table_name}`"; … … 602 605 // Prepare if placeholders exist 603 606 if ( ! empty( $params ) ) { 604 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 607 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 605 608 return $wpdb->get_results( $wpdb->prepare( $sql, ...$params ) ); 606 609 } else { 607 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 610 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 608 611 return $wpdb->get_results( $sql ); 609 612 } … … 612 615 public static function get_scheduled_sms_by_id( $id ) { 613 616 global $wpdb; 614 $table_name = self::get_scheduled_sms_table_name();615 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 617 $table_name = esc_sql( self::get_scheduled_sms_table_name() ); 618 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 616 619 return $wpdb->get_row( $wpdb->prepare( "SELECT * FROM `{$table_name}` WHERE id = %d", $id ) ); 617 620 } … … 619 622 public static function get_scheduled_sms_count( $search_term = '' ) { 620 623 global $wpdb; 621 $table_name = self::get_scheduled_sms_table_name();624 $table_name = esc_sql( self::get_scheduled_sms_table_name() ); 622 625 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 623 626 $sql = "SELECT COUNT(id) FROM `{$table_name}`"; … … 633 636 // Prepare if placeholders exist 634 637 if ( ! empty( $params ) ) { 635 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 638 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 636 639 return (int) $wpdb->get_var( $wpdb->prepare( $sql, ...$params ) ); 637 640 } else { 638 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared 641 // phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 639 642 return (int) $wpdb->get_var( $sql ); 640 643 } … … 666 669 public static function get_due_scheduled_sms() { 667 670 global $wpdb; 668 $table_name = self::get_scheduled_sms_table_name();669 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared 671 $table_name = esc_sql( self::get_scheduled_sms_table_name() ); 672 // phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared, PluginCheck.Security.DirectDB.UnescapedDBParameter 670 673 return $wpdb->get_results( $wpdb->prepare( "SELECT * FROM `{$table_name}` WHERE status = 'scheduled' AND send_at <= %s ORDER BY send_at ASC", current_time( 'mysql' ) ) ); // Order by send_at 671 674 } -
refatbd-notifications-with-telegram-for-woocommerce/trunk/readme.txt
r3415156 r3417226 5 5 Requires at least: 5.0 6 6 Tested up to: 6.9 7 Stable tag: 2.0. 17 Stable tag: 2.0.2 8 8 Requires PHP: 7.4 9 9 License: GPL v2 or later … … 53 53 This securely connects your site to the backend and saves your API key automatically. 54 54 * Verify that the API Status and Site Connection show as "Connected". Click "Refresh" if needed. 55 56 55 2. **Configure Chat ID:** 57 56 * Go to **Telegram Sync -> Settings -> Chat Management**. … … 61 60 * Click "Save Changes". 62 61 * You can use the "Test" button to verify the Chat ID is correct. 63 64 62 3. **Configure Notifications:** 65 63 * Go through the tabs under **Telegram Sync -> Settings** (General, Order Status, User & Stock, etc.). 66 64 * Use the toggle switches to enable the notifications you want to receive. 67 65 * Customize the message templates using the available placeholders listed below each template field. 68 69 66 4. **Set Up Notification Rules (Optional):** 70 67 * Navigate to the **Notification Rules** tab to create advanced conditions for any enabled notification event, giving you precise control over when alerts are sent. 71 72 68 5. **Enable the Plugin:** 73 69 * Ensure the "Enable Plugin" toggle is switched on in the **General** tab. … … 141 137 == Changelog == 142 138 139 = 2.0.2 = 140 * SECURITY: Hardened database queries in `RNTFW_DB` class by escaping table names and suppressing false positives in static analysis. 141 * FIX: Resolved multiple "Unescaped parameter" warnings from Plugin Check. 143 142 144 143 = 2.0.1 = -
refatbd-notifications-with-telegram-for-woocommerce/trunk/refatbd-notifications-with-telegram-for-woocommerce.php
r3415156 r3417226 4 4 * Plugin URI: https://refat.ovh/refatbd-notifications-with-telegram-for-woocommerce 5 5 * Description: Sends instant, secure, and custom-templated notifications to Telegram for WooCommerce events with advanced conditional logic to a single chat ID. 6 * Version: 2.0. 16 * Version: 2.0.2 7 7 * Author: Refat 8 8 * Author URI: https://refat.ovh … … 29 29 30 30 // --- Constants --- 31 define( 'RNTFW_VERSION', '2.0. 1' ); // Updated version31 define( 'RNTFW_VERSION', '2.0.2' ); // Updated version 32 32 define( 'RNTFW_PLUGIN_DIR', plugin_dir_path( __FILE__ ) ); 33 33 define( 'RNTFW_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
Note: See TracChangeset
for help on using the changeset viewer.