Plugin Directory

Changeset 3343759


Ignore:
Timestamp:
08/12/2025 06:50:32 PM (6 months ago)
Author:
solwininfotech
Message:

Timeline designer version 1.4.1 security update.

Location:
timeline-designer/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • timeline-designer/trunk/README.txt

    r3133261 r3343759  
    44Tags: Timeline Layout, Template, Posts,
    55Requires at least: 5.0
    6 Tested up to: 6.6.1
    7 Stable tag: 1.4
     6Requires PHP: 7.4
     7Tested up to: 6.7.3
     8Stable tag: 1.4.1
    89License: GPLv2 or later
    910License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    7980
    8081
    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
    8289
    8390= 1.4 =
  • timeline-designer/trunk/admin/assets/admin-shortcode-list.php

    r3116014 r3343759  
    3838$where    = '';
    3939$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 }
     40if ( 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
    4446
    4547if ( isset( $_POST['btnSearchShortcode'] ) || ( isset( $_POST['s'] ) && '' != $_POST['s'] ) ) {
     
    5961}
    6062$ord = 0;
    61 if ( isset( $_REQUEST['orderby'] ) && 0 == $_REQUEST['orderby'] ) {
     63if ( isset( $_REQUEST['orderby'] ) && 0 === (int) $_REQUEST['orderby'] ) {
    6264    $order_by    = 'desc';
    6365    $ord         = 1;
    6466    $order_field = 'shortcode_name';
    65 } elseif ( isset( $_REQUEST['orderby'] ) && 1 == $_REQUEST['orderby'] ) {
     67} elseif ( isset( $_REQUEST['orderby'] ) && 1 === (int) $_REQUEST['orderby'] ) {
    6668    $order_by    = 'asc';
    6769    $ord         = 0;
     
    7375
    7476
    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 );
    7679$num_of_pages = ceil( $total / $limit );
    7780
     
    8992
    9093// 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();
     96if ( '' !== $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 ) );
    92103?>
    93104<div class="wp-timeline-admin wrap wp-timeline-shortcode-list">
  • timeline-designer/trunk/admin/class-wp-timeline-lite-admin.php

    r3133261 r3343759  
    6969     */
    7070    public function __construct( $plugin_name, $version ) {
     71        add_action( 'admin_notices', array( $this, 'render_admin_notices' ) );
    7172        $this->plugin_name = $plugin_name;
    7273        $this->version     = $version;
     
    20732074        return $loaders;
    20742075    }
     2076
     2077
     2078public 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    }
    20752082}
     2083}
  • timeline-designer/trunk/admin/wtl-functions.php

    r3116014 r3343759  
    3131     */
    3232    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 );
    4564                }
     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 );
    4669            }
    4770        }
    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 );
    6085        }
    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;
    6290}
    6391
     
    481509    return $attr;
    482510}
     511}
  • timeline-designer/trunk/timeline-designer.php

    r3133261 r3343759  
    1616 * Plugin URI:        https://www.solwininfotech.com/product/wordpress-plugins/timeline-designer/
    1717 * Description:       Best WordPress Timeline Plugin to create a stunning timeline on your website.
    18  * Version:           1.4
     18 * Version:           1.4.1
    1919 * Author:            Solwin Infotech
    2020 * Author URI:        https://www.solwininfotech.com/
Note: See TracChangeset for help on using the changeset viewer.