Plugin Directory

Changeset 3469312


Ignore:
Timestamp:
02/25/2026 10:20:27 AM (5 weeks ago)
Author:
jamesdlow
Message:

1.5.0

  • Fix displaying of options in settingslib

1.4.9

  • Update cachelib to use wpdb::prepare
Location:
pageapp
Files:
36 added
4 edited

Legend:

Unmodified
Added
Removed
  • pageapp/trunk/inc/cachelib.php

    r3469278 r3469312  
    3232            $option = $this->prefix.'version';
    3333            $version = get_option($option);
    34             $expiry = $this->expiry;
     34            $expiry = esc_sql($this->expiry);
    3535            if ($version != $plugin['Version']) {
    3636                global $wpdb;
     
    5454            global $wpdb;
    5555            $table = $this->table();
    56             $wpdb->query("DELETE FROM $table;");
     56            $query = $wpdb->prepare("DELETE FROM $table WHERE %d = %d;", 1, 1);
     57            $wpdb->query($query);
    5758        }
    5859    }
     
    6263            global $wpdb;
    6364            $table = $this->table();
    64             $wpdb->query("DELETE FROM $table WHERE expires < NOW();");
     65            $query = $wpdb->prepare("DELETE FROM $table WHERE expires < DATE_ADD(NOW(), INTERVAL %d SECOND);", 0);
     66            $wpdb->query($query);
    6567        }
    6668    }
     
    6971            global $wpdb;
    7072            $table = $this->table();
    71             $name = esc_sql($name);
    72             $wpdb->query("DELETE FROM $table WHERE name = '$name';");
     73            $query = $wpdb->prepare("DELETE FROM $table WHERE name = %s;", $name);
     74            $wpdb->query($query);
    7375        }
    7476    }
     
    7779            global $wpdb;
    7880            $table = $this->table();
    79             $name = esc_sql($name);
    80             return $wpdb->get_var("SELECT data FROM $table WHERE name = '$name' AND expires > NOW();");
     81            $query = $wpdb->prepare("SELECT data FROM $table WHERE name = %s AND expires > NOW();", $name);
     82            return $wpdb->get_var($query);
    8183        }
    8284    }
     
    8688            $table = $this->table();
    8789            $expiry = esc_sql($expiry ? $expiry : $this->expiry);
    88             $name = esc_sql($name);
    89             $value = esc_sql($value);
    90             $sql = "INSERT INTO $table (name, expires, data)
    91                     VALUES ('$name', DATE_ADD(NOW(), INTERVAL $expiry), '$value')
    92                     ON DUPLICATE KEY UPDATE data = '$value', expires = DATE_ADD(NOW(), INTERVAL $expiry)
    93             ;";
    94             $wpdb->query($sql);
     90            $query = $wpdb->prepare(
     91                "INSERT INTO $table (name, expires, data)
     92                    VALUES (%s, DATE_ADD(NOW(), INTERVAL $expiry), %s)
     93                    ON DUPLICATE KEY UPDATE data = %s, expires = DATE_ADD(NOW(), INTERVAL $expiry)
     94            ;",
     95                $name,
     96                $value,
     97                $value
     98            );
     99            $wpdb->query($query);
    95100        }
    96101        return $value;
  • pageapp/trunk/inc/settingslib.php

    r3469278 r3469312  
    9898    public static function settings($setting) {
    9999        //TODO: add select
     100        $allow = array(
     101            'tr' => array(
     102                'valign' => array(),
     103                'class' => array()
     104            ),
     105            'th' => array(
     106                'scope' => array()
     107            ),
     108            'td' => array(),
     109            'div' => array(
     110                'style' => array()
     111            ),
     112            'select' => array(
     113                'id' => array(),
     114                'name' => array()
     115            ),
     116            'input' => array(
     117                'id' => array(),
     118                'name' => array(),
     119                'type' => array(),
     120                'checked' => array(),
     121                'value' => array(),
     122                'style' => array(),
     123                'placeholder' => array()
     124            ),
     125            'textarea' => array(
     126                'id' => array(),
     127                'name' => array(),
     128                'rows' => array(),
     129                'cols' => array()
     130            ),
     131            'option' => array(
     132                'value' => array(),
     133                'selected' => array()
     134            ),
     135            'label' => array(
     136                'for' => array(),
     137                'name' => array()
     138            )
     139        );
    100140        $setting = (object) $setting;
    101141        if ($setting->type == 'boolean') {
    102             echo wp_kses(self::settings_checkbox($setting), array('tr', 'td', 'th', 'input', 'label'));
     142            echo wp_kses(self::settings_checkbox($setting), $allow);
    103143        } elseif ($setting->type == 'select') {
    104             echo wp_kses(self::settings_select($setting), array('tr', 'td', 'th', 'select', 'option'));
     144            echo wp_kses(self::settings_select($setting), $allow);
    105145        } elseif ($setting->type == 'text') {
    106             echo wp_kses(self::settings_text($setting), array('tr', 'td', 'th', 'textarea'));
     146            echo wp_kses(self::settings_text($setting), $allow);
    107147        } elseif ($setting->type == 'title') {
    108             echo wp_kses(self::settings_row($setting), array('tr', 'td', 'th'));
     148            echo wp_kses(self::settings_row($setting), $allow);
    109149        } else {
    110             echo wp_kses(self::settings_input($setting), array('tr', 'td', 'th', 'input'));
     150            echo wp_kses(self::settings_input($setting), $allow);
    111151        }
    112152    }
  • pageapp/trunk/pageapp.php

    r3469278 r3469312  
    44Plugin URI: https://wordpress.org/plugins/pageapp/
    55Description: Extensions to Wordpress wp-json for the PageApp API and mobile framework
    6 Version: 1.4.8
     6Version: 1.5.0
    77Author: PageApp
    88Author URI: https://www.thirteen.com/
  • pageapp/trunk/readme.txt

    r3469278 r3469312  
    44Requires at least: 4.0
    55Tested up to: 6.9.1
    6 Stable tag: 1.4.8
     6Stable tag: 1.5.0
    77License: MIT License
    88Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_xclick&business=K6VKWB3HZB2T2&item_name=Donation%20to%20jameslow%2ecom&currency_code=USD&bn=PP%2dDonationsBF&charset=UTF%2d8
     
    2929== Changelog ==
    3030
     31= 1.5.0 =
     32* Fix displaying of options in settingslib
     33
     34= 1.4.9 =
     35* Update cachelib to use wpdb::prepare
     36
    3137= 1.4.8 =
    3238* Update/fixes for Wordpress best practices:
     
    3642    * Variables and options must be escaped when echo'd
    3743    * Allowing direct file access to plugin files
    38     * TODO: Unsafe SQL calls
     44    * Unsafe SQL calls
    3945    * Plugin Check Report fixes:
    4046        * ERROR: trunk_stable_tag
Note: See TracChangeset for help on using the changeset viewer.