Plugin Directory

Changeset 3270008


Ignore:
Timestamp:
04/09/2025 09:18:51 PM (11 months ago)
Author:
marcusbs
Message:

3.0.1

Location:
wp-mailing-group/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • wp-mailing-group/trunk/lib/mailinggroupclass.php

    r3268122 r3270008  
    5353
    5454                $placeholders = implode(",", $placeholders);
    55                 $sSQL = $wpdb->prepare("INSERT INTO %s ($field) VALUES ($placeholders)", $tblname, $values);
     55                $sSQL = $wpdb->prepare("INSERT INTO `" . $wpdb->_real_escape($tblname) . "` ($field) VALUES ($placeholders)", $values);
    5656
    5757                $wpdb->query($sSQL);
     
    6767
    6868        function updRowV2($tblname,$grpinfo,$fields)
    69 
    7069        {
    71 
    7270            global $wpdb;
    7371
     
    7674            if($count>0)
    7775            {
    78 
    7976                $field = "";
    8077
     
    8279
    8380                foreach($fields as $key)
    84 
    8581                {
    86                 if(!isset($grpinfo[$key])){$grpinfo[$key] = '';}
     82                    if(!isset($grpinfo[$key])){$grpinfo[$key] = '';}
    8783                    if(is_array($grpinfo[$key])) {
    8884
     
    9086
    9187                        if($field=="" && $key!="id")
    92 
    93                         {
    94 
     88                        {
    9589                            $field = "`".$key."` = %s";
    9690
     
    10094
    10195                        else if($key!="id")
    102 
    103                         {
    104 
     96                        {
    10597                            $field = $field.",`".$key."` = %s";
    10698
     
    112104
    113105                        if($field=="" && $key!="id")
    114 
    115                         {
    116 
     106                        {
    117107                            $field = "`".$key."` = %s";
    118108
     
    122112
    123113                        else if($key!="id")
    124 
    125                         {
    126 
     114                        {
    127115                            $field = $field.",`".$key."` = %s";
    128116
     
    135123                }
    136124
    137 
    138 
    139                 // Add the table name and ID to the values array
    140                 array_unshift($values, $tblname);
     125                // Add only the ID to the values array
    141126                $values[] = intval($grpinfo["id"]);
    142127
    143                 $sSQL = $wpdb->prepare("UPDATE %s SET " . $field . " WHERE id = %d", $values);
     128                $sSQL = $wpdb->prepare("UPDATE `" . $wpdb->_real_escape($tblname) . "` SET " . $field . " WHERE id = %d", $values);
    144129                $wpdb->query($sSQL);
    145130
     
    151136
    152137            {
    153 
    154138                return false;
    155 
    156             }
    157 
     139            }
    158140        }
    159141
    160142
    161143        function selectRowsV2($tblname,$id="",$extra="")
    162 
    163144        {
    164 
    165145            global $wpdb;
    166146
     
    182162            $res = $wpdb->get_results($sSQL);
    183163            return $res;
    184 
    185164        }
    186165
     
    220199
    221200                $sSQL = "SELECT * FROM `" . $wpdb->_real_escape($tblname) . "` WHERE " . $where_clause;
     201
     202                if (!empty($values)) {
     203                    $sSQL = $wpdb->prepare($sSQL, $values);
     204                }
     205
    222206                $res = $wpdb->get_results($sSQL);
    223 
    224                 return (sizeof($res) > 0);
    225             } else {
    226                 return false;
    227             }
    228         }
    229 
    230 
    231         function getUserGroupV2($tblname,$id,$type='0') {
    232             global $wpdb;
    233 
    234             $sSQL = $wpdb->prepare("SELECT * FROM %s WHERE user_id = %d", $tblname, $id);
    235             $res = $wpdb->get_results($sSQL);
    236             $arrresult = array();
    237 
    238             if(count($res)>0) {
    239                 foreach($res as $resg) {
    240                     $arrresult[$resg->group_id] = $resg->group_email_format;
    241                 }
    242             }
    243             return $arrresult;
    244         }
    245 
    246         function getGroupUserCountV2($tblname,$id) {
    247             global $wpdb;
    248 
    249             $sSQL = $wpdb->prepare("SELECT * FROM %s WHERE group_id = %d", $tblname, $id);
    250             return $wpdb->get_results($sSQL);
    251         }
    252 
    253 
    254         function getCompleteUserGroupsV2($tblname, $tblnameuser,$id) {
    255             global $wpdb;
    256 
    257             $sSQL = $wpdb->prepare(
    258                 "select t1.*,t2.* from `" . $wpdb->_real_escape($tblname) . "` t1 inner join `" . $wpdb->_real_escape($tblnameuser) . "` t2 on t1.group_id = t2.id and t1.user_id = %d",
    259                 $id
    260             );
    261             $res = $wpdb->get_results($sSQL);
    262 
    263             if(count($res)>0) {
    264                 foreach($res as $resg) {
    265                     $arrresult[] = $resg;
    266                 }
    267                 return $arrresult;
    268             }
    269         }
    270 
    271         function addUserGroupV2($tblname,$id,$grpinfo) {
    272             global $wpdb;
    273 
    274             $myFields="id,user_id,group_id,group_email_format";
    275 
    276             if(count($grpinfo['group_name'])>0) {
    277                 foreach($grpinfo['group_name'] as $key => $group_id) {
    278                     $emailformat = $grpinfo['email_format_'.$group_id];
    279 
    280                     $sSQL = $wpdb->prepare(
    281                         "INSERT INTO `" . $wpdb->_real_escape($tblname) . "` ($myFields) VALUES ('', %d, %d, %s)",
    282                         $id,
    283                         $group_id,
    284                         $emailformat
    285                     );
    286                     $wpdb->query($sSQL);
    287                 }
    288             }
    289             return true;
    290         }
    291 
    292         function getGroupSerialized($grpinfo) {
    293 
    294             global $wpdb;
    295 
    296             if(count($grpinfo['group_name'])>0) {
    297 
    298                 foreach($grpinfo['group_name'] as $key => $group_id) {
    299 
    300                     $emailformat = $grpinfo['email_format_'.$group_id];
    301 
    302                     $arrresult[$group_id] = $emailformat;
    303 
    304                 }
    305 
    306             }
    307 
    308             return $arrresult;
    309 
    310         }
    311 
    312 
    313         function deleteUserGroupV2($tblname,$groupid,$userid) {
    314             global $wpdb;
    315 
    316             if($groupid!='' && $userid!='') {
    317                 $sSQL = $wpdb->prepare("DELETE FROM %s WHERE user_id = %d AND group_id = %d", $tblname, $userid, $groupid);
    318                 $wpdb->query($sSQL);
    319             }
    320             return true;
    321         }
    322 
    323 
    324         function updUserGroupV2($tblname,$id,$grpinfo) {
    325             global $wpdb;
    326 
    327             $myFields="id,user_id,group_id,group_email_format";
    328 
    329             $getCurrentGroups = $this->getUserGroupV2($tblname,$id,'1');
    330 
    331             if(count($grpinfo['group_name'])>0 && $getCurrentGroups) {
    332                 foreach($grpinfo['group_name'] as $key => $group_id) {
    333                     $emailformat = $grpinfo['email_format_'.$group_id];
    334 
    335                     if(!in_array($group_id,$getCurrentGroups)) {
    336                         $sSQL = $wpdb->prepare(
    337                             "INSERT INTO `" . $wpdb->_real_escape($tblname) . "` ($myFields) VALUES ('', %d, %d, %s)",
    338                             $id,
    339                             $group_id,
    340                             $emailformat
    341                         );
    342                         $wpdb->query($sSQL);
    343                     }
    344                 }
    345             }
    346             return true;
    347         }
    348 
    349         function addUserGroupTaxonomyV2($tblname, $id, $arrtoInsert) {
    350             global $wpdb;
    351             if(count($arrtoInsert)>0) {
    352                 $myFields = "id,user_id,group_id,group_email_format";
    353 
    354                 foreach($arrtoInsert as $group_id => $emailformat) {
    355                     // Check if record exists using prepared statement with direct table name
    356                     $sSQL = "SELECT * FROM `" . $wpdb->_real_escape($tblname) . "` WHERE user_id = %d AND group_id = %d";
    357                     $sSQL = $wpdb->prepare($sSQL, $id, $group_id);
    358                     $res = $wpdb->get_results($sSQL);
    359                    
    360                     if(count($res)>0) {
    361                         // Delete existing record using prepared statement with direct table name
    362                         $sSQLdel = "DELETE FROM `" . $wpdb->_real_escape($tblname) . "` WHERE user_id = %d";
    363                         $sSQLdel = $wpdb->prepare($sSQLdel, $id);
    364                         $wpdb->query($sSQLdel);
    365                        
    366                         // Insert new record using prepared statement with direct table name
    367                         $uSQL = "INSERT INTO `" . $wpdb->_real_escape($tblname) . "` ($myFields) VALUES ('', %d, %d, %s)";
    368                         $uSQL = $wpdb->prepare($uSQL, $id, $group_id, $emailformat);
    369                         $wpdb->query($uSQL);
    370                     } else {
    371                         // Insert new record using prepared statement with direct table name
    372                         $sSQL = "INSERT INTO `" . $wpdb->_real_escape($tblname) . "` ($myFields) VALUES ('', %d, %d, %s)";
    373                         $sSQL = $wpdb->prepare($sSQL, $id, $group_id, $emailformat);
    374                         $wpdb->query($sSQL);
    375                     }
    376                 }
    377             }
    378         }
    379 
    380         function updUserGroupTaxonomyV2($tblname, $id, $arrtoInsert) {
    381             global $wpdb;
    382 
    383             // Delete existing records using prepared statement with direct table name
    384             $sSQLdel = "DELETE FROM `" . $wpdb->_real_escape($tblname) . "` WHERE user_id = %d";
    385             $sSQLdel = $wpdb->prepare($sSQLdel, $id);
    386             $wpdb->query($sSQLdel);
    387 
    388             if(count($arrtoInsert)>0) {
    389                 $myFields = "id,user_id,group_id,group_email_format";
    390 
    391                 foreach($arrtoInsert as $group_id => $emailformat) {
    392                     // Insert new record using prepared statement with direct table name
    393                     $sSQL = "INSERT INTO `" . $wpdb->_real_escape($tblname) . "` ($myFields) VALUES ('', %d, %d, %s)";
    394                     $sSQL = $wpdb->prepare($sSQL, $id, $group_id, $emailformat);
    395                     $wpdb->query($sSQL);
    396                 }
    397             }
    398         }
    399 
     207                return $res;
     208            }
     209
     210            return false;
     211        }
    400212    }
  • wp-mailing-group/trunk/mailing-group-module.php

    r3268122 r3270008  
    11<?php /**
    22* @package Mailing_group_module
    3 * @version 3.0.0
     3* @version 3.0.1
    44*/
    55/*
     
    99Author: Yamna Khawaja
    1010Author URI: https://www.wpmailinggroup.com/
    11 Version: 3.0.0
     11Version: 3.0.1
    1212License: GPL v2 or later
    1313License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    3939
    4040$WPMG_SETTINGS = get_option("WPMG_SETTINGS");
    41 $MG_VERSION_NO = '3.0.0';
     41$MG_VERSION_NO = '3.0.1';
    4242$WPMG_SETTINGS['MG_VERSION_NO']  = $MG_VERSION_NO;
    4343$WPMG_SETTINGS['MG_PLUGIN_TYPE'] = 'FREE';
     
    142142    $MG_SUPPORT_EMAIL    = (isset($wpmgs['MG_SUPPORT_EMAIL']) && $wpmgs['MG_SUPPORT_EMAIL']!=''?esc_html($wpmgs['MG_SUPPORT_EMAIL']):'[email protected]');
    143143    $MG_SUPPORT_PHONE    = (isset($wpmgs['MG_SUPPORT_PHONE']) && $wpmgs['MG_SUPPORT_PHONE']!=''?esc_html($wpmgs['MG_SUPPORT_PHONE']):'1800-123-1234');
    144     $MG_VERSION_NO       = (isset($wpmgs['MG_VERSION_NO'])    && $wpmgs['MG_VERSION_NO']!=''?esc_html($wpmgs['MG_VERSION_NO']):'3.0.0');
     144    $MG_VERSION_NO       = (isset($wpmgs['MG_VERSION_NO'])    && $wpmgs['MG_VERSION_NO']!=''?esc_html($wpmgs['MG_VERSION_NO']):'3.0.1');
    145145   
    146146    $wpmg_setting = array(
     
    789789    global $wpdb, $objMem, $_POST, $table_name_group;
    790790    $_POST = stripslashes_deep( $_POST );
    791     $addme      = sanitize_text_field($_POST["addme"]);
     791    parse_str($_POST['data'], $parsedData);
     792    $addme = isset($parsedData['addme']) ? absint($parsedData['addme']) : null;
    792793    $WPMG_SETTINGS = get_option("WPMG_SETTINGS");
    793794    $plugintype = $WPMG_SETTINGS["MG_PLUGIN_TYPE"];
  • wp-mailing-group/trunk/readme.txt

    r3259883 r3270008  
    66Tested up to: 6.7
    77Tested up to PHP: 8.2
    8 Stable tag: 3.0.0
     8Stable tag: 3.0.1
    99License: GPLv2 or later
    1010License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    132132== Changelog ==
    133133
     134=3.0.1 =
     135*Fixed bug in mailing group not updating.
     136
    134137=3.0.0 =
    135138*Fixed all problems in the plugin to comply to Wordpress coding standards.
Note: See TracChangeset for help on using the changeset viewer.