Plugin Directory

Changeset 2646428


Ignore:
Timestamp:
12/19/2021 03:47:02 PM (3 years ago)
Author:
aigenseer
Message:

Fix save settings by duplicate entries

Location:
qr-scanner-redirect/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • qr-scanner-redirect/trunk/index.php

    r2622277 r2646428  
    44 * Plugin URI:        https://github.com/aigenseer/qr-scanner-redirect
    55 * Description:       Wordpress web qr-scanner with redirect function
    6  * Version:           1.2.2
     6 * Version:           1.2.3
    77 * Requires at least: 5.2
    88 * Requires PHP:      7.2
  • qr-scanner-redirect/trunk/readme.txt

    r2622277 r2646428  
    55Tested up to: 5.8.1
    66Requires PHP: 5.2.4
    7 Stable tag: 1.2.1
     7Stable tag: 1.2.3
    88License: GPLv3 or later
    99License URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    5050== Changelog ==
    5151
     52= 1.2.3 =
     53* cd
     54
    5255= 1.2.2 =
    5356* Fix display metabox
  • qr-scanner-redirect/trunk/sql/pluginsettings.class.php

    r2604068 r2646428  
    4949     * @return boolean
    5050     */
    51     public function is($name='')
    52     {
    53       $str = "SELECT COUNT(`id`) as count FROM `%s` WHERE `name` like '%s'";
    54       $sql = sprintf($str, $this->tablename, $name);
     51
     52    /**
     53     * [return the boolean if the entry value exist]
     54     * @param  string  $name [name of value]
     55     * @param $group
     56     * @return bool
     57     */
     58    public function is($name='', $group)
     59    {
     60      $str = "SELECT COUNT(`id`) as count FROM `%s` WHERE `name` like '%s' AND `group` like '%s'";
     61      $sql = sprintf($str, $this->tablename, $name, $group);
    5562      return intval($this->wpdb->get_var($sql))>0;
    5663    }
     
    6774        $group = $this->DEFAULT_GROUP;
    6875      }
    69       if(!$this->is($name)){
     76      if(!$this->is($name, $group)){
    7077        $str = "INSERT INTO `%s` (`name`, `data`, `group`) values('%s', '%s', '%s') ";
    7178        $sql = sprintf($str, $this->tablename, $name, $data, $group);
     
    225232      $_values = $this->mergeWithDefaultValues($post, $group, false);
    226233      foreach ($_values as $key => $value) {
    227         if(!$value->change && $this->is($key)){
     234        if(!$value->change && $this->is($key, $group)){
    228235          switch ($value->type) {
    229236            case 'boolean':
Note: See TracChangeset for help on using the changeset viewer.