Changeset 3343759
- Timestamp:
- 08/12/2025 06:50:32 PM (6 months ago)
- Location:
- timeline-designer/trunk
- Files:
-
- 5 edited
-
README.txt (modified) (2 diffs)
-
admin/assets/admin-shortcode-list.php (modified) (4 diffs)
-
admin/class-wp-timeline-lite-admin.php (modified) (2 diffs)
-
admin/wtl-functions.php (modified) (2 diffs)
-
timeline-designer.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
timeline-designer/trunk/README.txt
r3133261 r3343759 4 4 Tags: Timeline Layout, Template, Posts, 5 5 Requires at least: 5.0 6 Tested up to: 6.6.1 7 Stable tag: 1.4 6 Requires PHP: 7.4 7 Tested up to: 6.7.3 8 Stable tag: 1.4.1 8 9 License: GPLv2 or later 9 10 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 79 80 80 81 81 == Changelog == 82 \1 83 84 = 1.4.1 = 85 * Security: Fix SQL injection in admin shortcode list search (`s` param) using $wpdb->prepare and esc_like. 86 * Security: Sanitize `orderby` and use prepared statements for pagination queries. 87 * Maintenance: Update \"Tested up to\" to 6.7.3 and add \"Requires PHP: 7.4\". 88 82 89 83 90 = 1.4 = -
timeline-designer/trunk/admin/assets/admin-shortcode-list.php
r3116014 r3343759 38 38 $where = ''; 39 39 $search_p = ''; 40 if ( isset( $_REQUEST['s'] ) && '' != $_REQUEST['s'] ) { 41 $search_p = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); 42 $where = "WHERE shortcode_name LIKE '%$search_p%'"; 43 } 40 if ( isset( $_REQUEST['s'] ) && '' !== $_REQUEST['s'] ) { 41 $search_p = sanitize_text_field( wp_unslash( $_REQUEST['s'] ) ); 42 // Build a safe LIKE with esc_like and a placeholder. 43 $where = $wpdb->prepare( ' WHERE shortcode_name LIKE %s', '%' . $wpdb->esc_like( $search_p ) . '%' ); 44 } 45 44 46 45 47 if ( isset( $_POST['btnSearchShortcode'] ) || ( isset( $_POST['s'] ) && '' != $_POST['s'] ) ) { … … 59 61 } 60 62 $ord = 0; 61 if ( isset( $_REQUEST['orderby'] ) && 0 == $_REQUEST['orderby'] ) {63 if ( isset( $_REQUEST['orderby'] ) && 0 === (int) $_REQUEST['orderby'] ) { 62 64 $order_by = 'desc'; 63 65 $ord = 1; 64 66 $order_field = 'shortcode_name'; 65 } elseif ( isset( $_REQUEST['orderby'] ) && 1 == $_REQUEST['orderby'] ) {67 } elseif ( isset( $_REQUEST['orderby'] ) && 1 === (int) $_REQUEST['orderby'] ) { 66 68 $order_by = 'asc'; 67 69 $ord = 0; … … 73 75 74 76 75 $total = $wpdb->get_var( 'SELECT COUNT(`wtlid`) FROM ' . $wpdb->prefix . 'wtl_shortcodes ' . $where ); 77 $count_sql = 'SELECT COUNT(`wtlid`) FROM ' . $wpdb->prefix . 'wtl_shortcodes'; 78 $total = ( '' !== $where ) ? $wpdb->get_var( $count_sql . $where ) : $wpdb->get_var( $count_sql ); 76 79 $num_of_pages = ceil( $total / $limit ); 77 80 … … 89 92 90 93 // Get the shortcode information. 91 $shortcodes = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$wpdb->prefix}wtl_shortcodes $where order by $order_field $order_by limit %d , %d", $offset, $limit ) ); 94 $list_sql = 'SELECT * FROM ' . $wpdb->prefix . 'wtl_shortcodes'; 95 $list_args = array(); 96 if ( '' !== $where ) { 97 $list_sql .= $where; // $where already includes a prepared LIKE clause 98 } 99 $list_sql .= ' ORDER BY ' . $order_field . ' ' . $order_by . ' LIMIT %d , %d'; 100 $list_args[] = (int) $offset; 101 $list_args[] = (int) $limit; 102 $shortcodes = $wpdb->get_results( $wpdb->prepare( $list_sql, $list_args ) ); 92 103 ?> 93 104 <div class="wp-timeline-admin wrap wp-timeline-shortcode-list"> -
timeline-designer/trunk/admin/class-wp-timeline-lite-admin.php
r3133261 r3343759 69 69 */ 70 70 public function __construct( $plugin_name, $version ) { 71 add_action( 'admin_notices', array( $this, 'render_admin_notices' ) ); 71 72 $this->plugin_name = $plugin_name; 72 73 $this->version = $version; … … 2073 2074 return $loaders; 2074 2075 } 2076 2077 2078 public function render_admin_notices() { 2079 if ( isset( $_GET['message'] ) && 'shortcode_add_error' === $_GET['message'] ) { 2080 echo '<div class="notice notice-error"><p>' . esc_html__( 'Error adding shortcode. Please check the error log for details.', 'timeline-designer' ) . '</p></div>'; 2081 } 2075 2082 } 2083 } -
timeline-designer/trunk/admin/wtl-functions.php
r3116014 r3343759 31 31 */ 32 32 function wtl_insert_layout( $layout_name, $wtl_settings ) { 33 global $wpdb; 34 $wtl_table_name = $wpdb->prefix . 'wtl_shortcodes'; 35 if ( isset( $wtl_settings ) && ! empty( $wtl_settings ) ) { 36 foreach ( $wtl_settings as $single_key => $single_val ) { 37 if ( is_array( $single_val ) ) { 38 foreach ( $single_val as $s_key => $s_val ) { 39 $wtl_settings[ $single_key ][ $s_key ] = sanitize_text_field( $s_val ); 40 } 41 } elseif ( 'custom_css' === $single_key ) { 42 $wtl_settings[ $single_key ] = wp_strip_all_tags( $single_val ); 43 } else { 44 $wtl_settings[ $single_key ] = sanitize_text_field( $single_val ); 33 global $wpdb; 34 35 $table_name = $wpdb->prefix . 'wtl_shortcodes'; 36 37 // Ensure table exists 38 $expected = $table_name; 39 $exists = $wpdb->get_var( $wpdb->prepare( "SHOW TABLES LIKE %s", $expected ) ); 40 if ( $exists !== $expected ) { 41 $charset_collate = ''; 42 if ( ! empty( $wpdb->charset ) ) { 43 $charset_collate = "DEFAULT CHARACTER SET $wpdb->charset"; 44 } 45 if ( ! empty( $wpdb->collate ) ) { 46 $charset_collate .= " COLLATE $wpdb->collate"; 47 } 48 $sql = "CREATE TABLE $table_name ( 49 wtlid int(9) NOT NULL AUTO_INCREMENT, 50 shortcode_name tinytext NOT NULL, 51 wtlsettngs text NOT NULL, 52 UNIQUE KEY wtlid (wtlid) 53 ) $charset_collate;"; 54 require_once ABSPATH . 'wp-admin/includes/upgrade.php'; 55 dbDelta( $sql ); 56 } 57 58 // Sanitize settings 59 if ( isset( $wtl_settings ) && ! empty( $wtl_settings ) ) { 60 foreach ( $wtl_settings as $single_key => $single_val ) { 61 if ( is_array( $single_val ) ) { 62 foreach ( $single_val as $s_key => $s_val ) { 63 $wtl_settings[ $single_key ][ $s_key ] = sanitize_text_field( $s_val ); 45 64 } 65 } elseif ( 'custom_css' === $single_key ) { 66 $wtl_settings[ $single_key ] = wp_strip_all_tags( $single_val ); 67 } else { 68 $wtl_settings[ $single_key ] = sanitize_text_field( $single_val ); 46 69 } 47 70 } 48 $insert = $wpdb->insert( 49 $wtl_table_name, 50 array( 51 'shortcode_name' => sanitize_text_field( $layout_name ), 52 'wtlsettngs' => maybe_serialize( $wtl_settings ), 53 ), 54 array( '%s', '%s' ) 55 ); 56 if ( false === $insert ) { 57 return; 58 } else { 59 return $wpdb->insert_id; 71 } 72 73 $insert = $wpdb->insert( 74 $table_name, 75 array( 76 'shortcode_name' => sanitize_text_field( $layout_name ), 77 'wtlsettngs' => maybe_serialize( $wtl_settings ), 78 ), 79 array( '%s', '%s' ) 80 ); 81 82 if ( false === $insert ) { 83 if ( defined( 'WP_DEBUG_LOG' ) && WP_DEBUG_LOG ) { 84 error_log( '[Timeline Designer] Insert failed: ' . $wpdb->last_error ); 60 85 } 61 } 86 return new WP_Error( 'wtl_insert_failed', __( 'Database insert failed while adding shortcode.', 'timeline-designer' ), array( 'db_error' => $wpdb->last_error ) ); 87 } 88 89 return (int) $wpdb->insert_id; 62 90 } 63 91 … … 481 509 return $attr; 482 510 } 511 } -
timeline-designer/trunk/timeline-designer.php
r3133261 r3343759 16 16 * Plugin URI: https://www.solwininfotech.com/product/wordpress-plugins/timeline-designer/ 17 17 * Description: Best WordPress Timeline Plugin to create a stunning timeline on your website. 18 * Version: 1.4 18 * Version: 1.4.1 19 19 * Author: Solwin Infotech 20 20 * Author URI: https://www.solwininfotech.com/
Note: See TracChangeset
for help on using the changeset viewer.