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_frontendajax.php +50 -7 1.5.3 → 1.5.9 View file →
@@ -32,9 +32,21 @@
32 32 if(isset($_POST['listing_post_id']))
33 33 $listing_post_id = sanitize_text_field($_POST['listing_post_id']);
34 34
35 35 $listing = $this->load->listing_m->get($listing_post_id, TRUE);
36 +
37 + if (!$listing || $listing->post_status != 'publish' || !empty($listing->post_password)) {
38 + return false;
39 + }
36 40
41 + /* protect check */
42 + if (
43 + !wdk_field_value('is_activated', $listing, false) || !wdk_field_value('is_approved', $listing,false)
44 + ) {
45 + $data['popup_content'] = __( 'Listing is not public', 'wpdirectorykit' );
46 + $this->output($data);
47 + }
48 +
37 49 $popup_layout = 'result_item_card';
38 50 if(!empty($_POST['custom_layout_id'])) {
39 51 $popup_layout = (int) sanitize_text_field($_POST['custom_layout_id']);
40 52 }
@@ -62,9 +74,21 @@
62 74 $listing_post_id = sanitize_text_field($_POST['listing_post_id']);
63 75
64 76 $listing = $this->load->listing_m->get($listing_post_id, TRUE);
65 77
78 +
79 + if (!$listing || $listing->post_status != 'publish' || !empty($listing->post_password)) {
80 + return false;
81 + }
66 82
83 + /* protect check */
84 + if (
85 + !wdk_field_value('is_activated', $listing, false) || !wdk_field_value('is_approved', $listing,false)
86 + ) {
87 + $data['popup_content'] = __( 'Listing is not public', 'wpdirectorykit' );
88 + $this->output($data);
89 + }
90 +
67 91 if(!empty($listing)) {
68 92 $data['popup_content'] = wdk_listing_card($listing, [], false, '<div class="infobox map-box">%1$s<div>', 'result_item_card_dash_edit');
69 93 } else {
70 94 $data['popup_content'] = __( 'Listing is missing', 'wpdirectorykit' );
@@ -303,8 +327,10 @@
303 327 $results[$ind_order]['value'] = $row;
304 328 }
305 329 } else {
306 330 $results[$ind_order]['value'] = $level_gen
331 + // Dynamic field values are registered in the translation catalog separately.
332 + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
307 333 .esc_html__(wmvc_show_data($attr_val, $row), 'wpdirectorykit');
308 334 }
309 335 $ind_order++;
310 336 }
@@ -334,8 +360,10 @@
334 360 .wmvc_show_data('display_name', $row);
335 361
336 362 } else {
337 363 $data['curr_val'] = $level_gen
364 + // Dynamic field values are registered in the translation catalog separately.
365 + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
338 366 .esc_html__(wmvc_show_data(wmvc_show_data('attribute_value', $parameters), $row), 'wpdirectorykit');
339 367 }
340 368
341 369
@@ -505,8 +533,10 @@
505 533 $level_gen = str_pad('', $row->level*12, '&nbsp;').'';
506 534
507 535 $results[$ind_order]['key'] = wmvc_show_data($attr_id, $row);
508 536 $results[$ind_order]['value'] = $level_gen
537 + // Dynamic field values are registered in the translation catalog separately.
538 + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
509 539 .esc_html__(wmvc_show_data($attr_val, $row), 'wpdirectorykit');
510 540 $ind_order++;
511 541 }
512 542
@@ -519,10 +549,11 @@
519 549 {
520 550 $level_gen='';
521 551 if(isset($row->level))
522 552 $level_gen = str_pad('', $row->level*12, '&nbsp;').'';
523 -
524 - $data['curr_val'] = $level_gen
553 + $data['curr_val'] = $level_gen
554 + // Dynamic field values are registered in the translation catalog separately.
555 + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
525 556 .esc_html__(wmvc_show_data(wmvc_show_data('attribute_value', $parameters), $row), 'wpdirectorykit');
526 557
527 558 }
528 559 else
@@ -666,9 +697,8 @@
666 697 }
667 698
668 699 $db_results_total = $this->$model_name->total($where);
669 700 $db_results = $this->$model_name->get_pagination($limit,$offset, $where);
670 - $data['output'] = $db_results;
671 701
672 702 if (!$db_results) {
673 703 $data['errors'] = '';
674 704 } else {
@@ -679,8 +709,10 @@
679 709 $level_gen = str_pad('', $row->level*12, '&nbsp;').'';
680 710
681 711 $results[] = [
682 712 'id'=> wmvc_show_data($key_column, $row),
713 + // Dynamic field values are registered in the translation catalog separately.
714 +// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
683 715 'text'=> $level_gen.esc_html__(trim(wmvc_show_data($print_column, $row)), 'wpdirectorykit'),
684 716 ];
685 717 }
686 718
@@ -730,9 +762,13 @@
730 762 $offset = (intval($parameters['page_result']) - 1) * $limit;
731 763 }
732 764
733 765 $this->load->model($model_name);
734 - $search_column = 'display_name,user_email,user_login,ID';
766 + $search_column = 'display_name,user_login,ID';
767 + if(current_user_can('administrator')) {
768 + $search_column = 'display_name,user_email,user_login,ID';
769 + }
770 +
735 771 $where = array();
736 772 if(!empty($_POST['q']['term']) && !empty($search_column)) {
737 773 $sql_search = '';
738 774 foreach (explode(',', $search_column) as $column) {
@@ -750,9 +786,8 @@
750 786 $like = "(meta_value LIKE '%wdk_%' )";
751 787 $db_results_total = $this->$model_name->total($where, NULL, $like);
752 788
753 789 $db_results = $this->$model_name->get_pagination($limit,$offset, $where, NULL, $like);
754 - $data['output'] = $db_results;
755 790
756 791 if (!$db_results) {
757 792 $data['errors'] = '';
758 793 } else {
@@ -902,8 +937,10 @@
902 937
903 938 foreach($db_results as $row) {
904 939 $results[] = [
905 940 'id'=> wmvc_show_data($key_column, $row),
941 + // Dynamic field values are registered in the translation catalog separately.
942 +// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
906 943 'text'=> esc_html__(trim(wmvc_show_data($print_column, $row)),'wpdirectorykit'),
907 944 ];
908 945 }
909 946
@@ -985,9 +1022,11 @@
985 1022 'field_key' => 'search_category',
986 1023 'value' => $row->category_title,
987 1024 'print' => [
988 1025 'parsed_content' => [
989 - 'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? wmvc_show_data('font_icon_code', $row) : 'fa fa-tag',
1026 + 'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? esc_attr(wmvc_show_data('font_icon_code', $row)): 'fa fa-tag',
1027 + // Dynamic field values are registered in the translation catalog separately.
1028 + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
990 1029 'title' => esc_html__($row->category_title, 'wpdirectorykit'),
991 1030 'sub_title' => '',
992 1031 'right_text' => __('Category', 'wpdirectorykit')
993 1032 ]
@@ -1038,10 +1077,14 @@
1038 1077 'field_key' => 'search_location',
1039 1078 'value' => $row->location_title,
1040 1079 'print' => [
1041 1080 'parsed_content' => [
1042 - 'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? wmvc_show_data('font_icon_code', $row) : 'fa fa-map-marker',
1081 + 'icon_class' => (!empty(wmvc_show_data('font_icon_code', $row, false))) ? esc_attr(wmvc_show_data('font_icon_code', $row)) : 'fa fa-map-marker',
1082 + // Dynamic field values are registered in the translation catalog separately.
1083 + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
1043 1084 'title' => esc_html__($row->location_title, 'wpdirectorykit'),
1085 + // Dynamic field values are registered in the translation catalog separately.
1086 + // phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
1044 1087 'sub_title' => esc_html__($subtitle, 'wpdirectorykit'),
1045 1088 'right_text' => __('Location', 'wpdirectorykit')
1046 1089 ]
1047 1090 ]