PluginProbe
WP Directory Kit / 1.5.9
WP Directory Kit v1.5.9
1.5.9 1.5.7 1.5.6 1.5.5 1.5.4 1.5.3 trunk 1.1.0 1.1.6 1.1.8 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.8 All 37 releases
← All changes | application/controllers/Wdk_listing.php +15 -21 1.5.3 → 1.5.9 View file →
@@ -19,9 +19,9 @@
19 19 $this->load->model('categorieslistings_m');
20 20 $this->load->model('locationslistings_m');
21 21
22 22 $from_id = intval($_GET['from_id']);
23 - $to_lang = sanitize_text_field($_GET['to_lang']);
23 + $to_lang = sanitize_text_field(wp_unslash($_GET['to_lang']));
24 24
25 25 // fetch data
26 26 $listing_post = get_post( $from_id );
27 27
@@ -62,15 +62,15 @@
62 62 if(isset($listing_db_data->$field_name))
63 63 $listing_data[$field_name] = $listing_db_data->$field_name;
64 64 }
65 65
66 - $listing_data['date_modified'] = date('Y-m-d H:i:s');
66 + $listing_data['date_modified'] = gmdate('Y-m-d H:i:s');
67 67
68 68 // copy listing data
69 69 $this->listing_m->insert($listing_data, NULL);
70 70
71 71 if($this->db->last_error() != '')
72 - exit('DB Error: '.$this->db->last_error());
72 + exit('DB Error: '.esc_html($this->db->last_error()));
73 73
74 74 $this->data['listing_fields'] = $this->field_m->get();
75 75
76 76 foreach($this->data['listing_fields'] as $field_data)
@@ -191,26 +191,17 @@
191 191 $Winter_MVC_wdk_membership->model('subscription_user_m');
192 192 $Winter_MVC_wdk_membership->model('subscription_m');
193 193
194 194 $this->db->select('*');
195 - $this->db->join($Winter_MVC_wdk_membership->subscription_m->_table_name.' ON '.$Winter_MVC_wdk_membership->subscription_m->_table_name.'.idsubscription = '.$Winter_MVC_wdk_membership->subscription_user_m->_table_name.'.subscription_id');
196 195 $this->db->join($this->db->prefix.'wdk_categories ON '.$this->db->prefix.'wdk_categories.idcategory = '.$Winter_MVC_wdk_membership->subscription_m->_table_name.'.category_id', TRUE, 'LEFT');
197 196 $this->db->join($this->db->prefix.'wdk_locations ON '.$this->db->prefix.'wdk_locations.idlocation = '.$Winter_MVC_wdk_membership->subscription_m->_table_name.'.location_id', TRUE, 'LEFT');
198 - $this->db->where(array(
199 - '(date_expire > \''.current_time( 'mysql' ).'\')'=>NULL,
200 - '(user_id = \''.wmvc_show_data('user_id_editor', $this->data['db_data'], false).'\')'=>NULL,
201 - '(status = \'ACTIVE\')'=>NULL,
202 - )
203 - );
204 -
205 - $subscriptions = $Winter_MVC_wdk_membership->subscription_user_m->get();
197 + $subscriptions = $Winter_MVC_wdk_membership->subscription_m->get();
206 198 if (count($subscriptions) > 0) {
207 199 foreach($subscriptions as $subscription) {
208 - $this->data['subscriptions'][wdk_show_data('subscription_id',$subscription,'', TRUE, TRUE)] = wdk_show_data('subscription_id', $subscription,'', TRUE, TRUE)
200 + $this->data['subscriptions'][wdk_show_data('idsubscription', $subscription,'', TRUE, TRUE)] = wdk_show_data('idsubscription', $subscription,'', TRUE, TRUE)
209 201 .', '.wdk_show_data('subscription_name', $subscription,'', TRUE, TRUE)
210 202 .', '.wdk_show_data('location_title',$subscription, esc_html__('Any', 'wpdirectorykit'), TRUE, TRUE).' '. esc_html__('Location', 'wpdirectorykit')
211 - .', '.wdk_show_data('category_title',$subscription, esc_html__('Any', 'wpdirectorykit'), TRUE, TRUE).' '. esc_html__('Category', 'wpdirectorykit')
212 - .'('.wdk_get_date(wdk_show_data('date_expire', $subscription,'', TRUE, TRUE)).')';
203 + .', '.wdk_show_data('category_title',$subscription, esc_html__('Any', 'wpdirectorykit'), TRUE, TRUE).' '. esc_html__('Category', 'wpdirectorykit');
213 204 }
214 205 }
215 206 }
216 207
@@ -460,9 +451,9 @@
460 451 }
461 452
462 453 $image_url = wp_get_attachment_image_url($image_id, 'large');
463 454 if($image_url) {
464 - $parsed = parse_url($image_url);
455 + $parsed = wp_parse_url($image_url);
465 456 $next_path = substr($parsed['path'], strpos($parsed['path'], 'uploads/')+8);
466 457
467 458 if(!empty($listing_data['listing_images_path_medium']))
468 459 $listing_data['listing_images_path_medium'] .= ',';
@@ -470,8 +461,11 @@
470 461 $listing_data['listing_images_path_medium'] .= $next_path;
471 462 }
472 463 }
473 464 }
465 +
466 + /* add featured images */
467 + set_post_thumbnail($id, reset($image_ids));
474 468 }
475 469
476 470 if((wmvc_user_in_role('administrator') || current_user_can('wdk_listings_manage')) && $this->input->post('slug')) {
477 471 // update the post slug
@@ -501,9 +495,9 @@
501 495 $package = $Winter_MVC_wdk_payments->package_m->get(wmvc_show_data('package_id', $listing_data_field, false), TRUE);
502 496 if ($packages) {
503 497 if(!isset($listing_data['rank']) || empty($listing_data['rank']))
504 498 $listing_data['rank'] = wdk_show_data('featured_rank',$package, 0, TRUE, TRUE);
505 - $listing_data['date_package_expire'] = date('Y-m-d H:i:s', strtotime('+'.wdk_show_data('days_limit',$package, 0, TRUE, TRUE).'days'));
499 + $listing_data['date_package_expire'] = gmdate('Y-m-d H:i:s', strtotime('+'.wdk_show_data('days_limit',$package, 0, TRUE, TRUE).'days'));
506 500 }
507 501 }
508 502
509 503 /* dates set */
@@ -509,9 +503,9 @@
509 503 /* dates set */
510 504 if(isset($this->data['db_data']['date']))
511 505 $listing_data['date'] = $this->data['db_data']['date'];
512 506
513 - $listing_data['date_modified'] = date('Y-m-d H:i:s');
507 + $listing_data['date_modified'] = gmdate('Y-m-d H:i:s');
514 508
515 509 if(empty($listing_db_data))
516 510 {
517 511 $id_ret = $this->listing_m->insert($listing_data, NULL);
@@ -521,9 +515,9 @@
521 515 $id_ret = $this->listing_m->insert($listing_data, $id);
522 516 }
523 517
524 518 if($this->db->last_error() != '')
525 - exit('DB Error: '.$this->db->last_error());
519 + exit('DB Error: '.esc_html($this->db->last_error()));
526 520
527 521 //var_dump($id_ret);
528 522
529 523 // insert users/agents
@@ -600,15 +594,15 @@
600 594 $this->listingfield_m->insert_custom_fields($this->data['listing_fields'], $data, $id);
601 595 }
602 596
603 597 if($this->db->last_error() != '')
604 - exit('DB Error: '.$this->db->last_error());
598 + exit('DB Error: '.esc_html($this->db->last_error()));
605 599
606 600 $this->load->model('editlog_m');
607 601 $this->editlog_m->insert(array(
608 602 'user_id' => get_current_user_id(),
609 603 'post_id' => $id,
610 - 'date' => date('Y-m-d H:i:s'),
604 + 'date' => gmdate('Y-m-d H:i:s'),
611 605 'ip' => $_SERVER['REMOTE_ADDR']
612 606 ));
613 607
614 608