Changeset 3270008
- Timestamp:
- 04/09/2025 09:18:51 PM (11 months ago)
- Location:
- wp-mailing-group/trunk
- Files:
-
- 3 edited
-
lib/mailinggroupclass.php (modified) (12 diffs)
-
mailing-group-module.php (modified) (5 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wp-mailing-group/trunk/lib/mailinggroupclass.php
r3268122 r3270008 53 53 54 54 $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); 56 56 57 57 $wpdb->query($sSQL); … … 67 67 68 68 function updRowV2($tblname,$grpinfo,$fields) 69 70 69 { 71 72 70 global $wpdb; 73 71 … … 76 74 if($count>0) 77 75 { 78 79 76 $field = ""; 80 77 … … 82 79 83 80 foreach($fields as $key) 84 85 81 { 86 if(!isset($grpinfo[$key])){$grpinfo[$key] = '';}82 if(!isset($grpinfo[$key])){$grpinfo[$key] = '';} 87 83 if(is_array($grpinfo[$key])) { 88 84 … … 90 86 91 87 if($field=="" && $key!="id") 92 93 { 94 88 { 95 89 $field = "`".$key."` = %s"; 96 90 … … 100 94 101 95 else if($key!="id") 102 103 { 104 96 { 105 97 $field = $field.",`".$key."` = %s"; 106 98 … … 112 104 113 105 if($field=="" && $key!="id") 114 115 { 116 106 { 117 107 $field = "`".$key."` = %s"; 118 108 … … 122 112 123 113 else if($key!="id") 124 125 { 126 114 { 127 115 $field = $field.",`".$key."` = %s"; 128 116 … … 135 123 } 136 124 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 141 126 $values[] = intval($grpinfo["id"]); 142 127 143 $sSQL = $wpdb->prepare("UPDATE %sSET " . $field . " WHERE id = %d", $values);128 $sSQL = $wpdb->prepare("UPDATE `" . $wpdb->_real_escape($tblname) . "` SET " . $field . " WHERE id = %d", $values); 144 129 $wpdb->query($sSQL); 145 130 … … 151 136 152 137 { 153 154 138 return false; 155 156 } 157 139 } 158 140 } 159 141 160 142 161 143 function selectRowsV2($tblname,$id="",$extra="") 162 163 144 { 164 165 145 global $wpdb; 166 146 … … 182 162 $res = $wpdb->get_results($sSQL); 183 163 return $res; 184 185 164 } 186 165 … … 220 199 221 200 $sSQL = "SELECT * FROM `" . $wpdb->_real_escape($tblname) . "` WHERE " . $where_clause; 201 202 if (!empty($values)) { 203 $sSQL = $wpdb->prepare($sSQL, $values); 204 } 205 222 206 $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 } 400 212 } -
wp-mailing-group/trunk/mailing-group-module.php
r3268122 r3270008 1 1 <?php /** 2 2 * @package Mailing_group_module 3 * @version 3.0. 03 * @version 3.0.1 4 4 */ 5 5 /* … … 9 9 Author: Yamna Khawaja 10 10 Author URI: https://www.wpmailinggroup.com/ 11 Version: 3.0. 011 Version: 3.0.1 12 12 License: GPL v2 or later 13 13 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 39 39 40 40 $WPMG_SETTINGS = get_option("WPMG_SETTINGS"); 41 $MG_VERSION_NO = '3.0. 0';41 $MG_VERSION_NO = '3.0.1'; 42 42 $WPMG_SETTINGS['MG_VERSION_NO'] = $MG_VERSION_NO; 43 43 $WPMG_SETTINGS['MG_PLUGIN_TYPE'] = 'FREE'; … … 142 142 $MG_SUPPORT_EMAIL = (isset($wpmgs['MG_SUPPORT_EMAIL']) && $wpmgs['MG_SUPPORT_EMAIL']!=''?esc_html($wpmgs['MG_SUPPORT_EMAIL']):'[email protected]'); 143 143 $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'); 145 145 146 146 $wpmg_setting = array( … … 789 789 global $wpdb, $objMem, $_POST, $table_name_group; 790 790 $_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; 792 793 $WPMG_SETTINGS = get_option("WPMG_SETTINGS"); 793 794 $plugintype = $WPMG_SETTINGS["MG_PLUGIN_TYPE"]; -
wp-mailing-group/trunk/readme.txt
r3259883 r3270008 6 6 Tested up to: 6.7 7 7 Tested up to PHP: 8.2 8 Stable tag: 3.0. 08 Stable tag: 3.0.1 9 9 License: GPLv2 or later 10 10 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 132 132 == Changelog == 133 133 134 =3.0.1 = 135 *Fixed bug in mailing group not updating. 136 134 137 =3.0.0 = 135 138 *Fixed all problems in the plugin to comply to Wordpress coding standards.
Note: See TracChangeset
for help on using the changeset viewer.