Plugin Directory

Changeset 3751021


Ignore:
Timestamp:
10/16/2026 07:31:04 PM (6 weeks ago)
Author:
wpdirectorykit
Message:

v1.6.1

Location:
wpdirectorykit/trunk
Files:
14 edited

Legend:

Unmodified
Added
Removed
  • wpdirectorykit/trunk/README.txt

    r3738493 r3751021  
    169169
    170170propertyhive, hivepress, ulistings, opal and more...
     171
     172= Where do I report security bugs found in this plugin? =
     173
     174Please report security bugs found in the source code of the WP Directory Kit plugin through the [Patchstack Vulnerability Disclosure  Program](https://patchstack.com/database/vdp/9e5fbb82-876a-4ad4-95f4-c194a793a460). The Patchstack team will assist you with verification, CVE assignment, and notify the developers of this plugin.
    171175
    172176= Can we migrate from third party solution to Wp Directroy Kit? =
  • wpdirectorykit/trunk/application/controllers/Wdk_backendajax.php

    r3689937 r3751021  
    344344
    345345                if (!wdk_field_option($field_id, 'field_type', false)) {
    346                     $wpdb->query("ALTER TABLE {$this->listingfield_m->_table_name} DROP COLUMN $listingfield;");
     346                    if ( preg_match( '/^field_\d+_[A-Za-z0-9_]+$/', $listingfield ) ) {
     347                        $table_listing_fields = $this->listingfield_m->_table_name;
     348                        $wpdb->query(
     349                            $wpdb->prepare(
     350                                "ALTER TABLE `{$table_listing_fields}` DROP COLUMN `{$listingfield}`;"
     351                            )
     352                        );
     353                    }
    347354                }
    348355            }
    … …  
    365372                    && ($field->field_type == 'INPUTBOX' || $field->field_type == 'DROPDOWN' || $field->field_type == 'DROPDOWNMULTIPLE')
    366373                ) {
    367                     $wpdb->query("ALTER TABLE `{$this->listingfield_m->_table_name}` CHANGE  `$column_name` `$column_name` TEXT NULL DEFAULT NULL;");
     374                    $table_listing_fields = $this->listingfield_m->_table_name;
     375                    if ( preg_match( '/^field_\d+_[A-Za-z0-9_]+$/', $column_name ) ) {
     376                        $wpdb->query(
     377                            $wpdb->prepare(
     378                                "ALTER TABLE `{$table_listing_fields}` CHANGE `{$column_name}` `{$column_name}` TEXT NULL DEFAULT NULL;"
     379                            )
     380                        );
     381                    }
    368382                }
    369383            }
    … …  
    634648        $table_listing_fields = $wpdb->prefix . 'wdk_listings_fields';
    635649        if(!empty($existing_listing_fields)) foreach ($existing_listing_fields as $field_listing_col => $field_listing) {
    636             if(substr($field_listing_col, 0, 6) == 'field_') {
    637                 $wpdb->query( $wpdb->prepare( "ALTER TABLE `{$table_listing_fields}` DROP `$field_listing_col`;" ) );
     650            if ( preg_match( '/^field_\d+_[A-Za-z0-9_]+$/', $field_listing_col ) ) {
     651                $wpdb->query( $wpdb->prepare( "ALTER TABLE `{$table_listing_fields}` DROP `{$field_listing_col}`;" ) );
    638652            }
    639653        }
    … …  
    698712                $_listing['listing_dash_remove_url'] = '';
    699713                $_listing['listing_dash_edit_url'] = '';
    700                 if(function_exists(' wdk_dash_url')) {
     714                if(function_exists('wdk_dash_url')) {
    701715                    $_listing['listing_dash_remove_url'] = wdk_dash_url("dash_page=listings&table_action=table&action=delete&ids=" . wdk_field_value('post_id', $sublisting));
    702716                    $_listing['listing_dash_edit_url'] = wdk_dash_url("dash_page=listings&function=edit&id=" . wdk_field_value('post_id', $sublisting));
    … …  
    748762
    749763            if(isset($parent_listing->listing_related_ids) && !empty($parent_listing->listing_related_ids)) {
    750                 $related_ids = trim(str_replace(','.$listing_id.'','', ','.$parent_listing->listing_related_ids.','),',');
     764                $related_ids = implode(',', array_diff(wp_parse_id_list($parent_listing->listing_related_ids), array($listing_id)));
    751765                $this->listing_m->insert(array('listing_related_ids' => $related_ids), $listing->listing_parent_post_id);
    752766            }
  • wpdirectorykit/trunk/application/controllers/Wdk_frontendajax.php

    r3738493 r3751021  
    624624                }
    625625
    626                 $key_column = '';
    627                 $print_column = '';
    628                
    629                 $search_column = '';
    630                 if(empty($parameters['columns_search'])) {
    631                         switch ($model_name) {
    632                                 case 'category_m':
    633                                     $this->load->model($model_name);
    634                                         $search_column = $this->$model_name->_table_name.'.idcategory,'.$this->$model_name->_table_name.'.category_title, '.$this->$model_name->_table_name.'.titles_for_search';
    635                                         break;
    636                                 case 'location_m':
    637                                     $this->load->model($model_name);
    638                                         $search_column = $this->$model_name->_table_name.'.idlocation,'.$this->$model_name->_table_name.'.location_title, '.$this->$model_name->_table_name.'.titles_for_search';
    639                                         break;
    640                                
    641                                 default:
    642                                         # code...
    643                                         break;
    644                         }
    645                
    646                 } else {
    647                         $search_column = esc_sql(preg_replace('/[^a-z0-9_,]/i', '', $parameters['columns_search']));
    648                 }
    649 
    650                 if(empty($parameters['key_column'])) {
    651                         switch ($model_name) {
    652                                 case 'category_m':
    653                                         $key_column = 'idcategory';
    654                                         break;
    655                                 case 'location_m':
    656                                         $key_column = 'idlocation';
    657                                         break;
    658                                
    659                                 default:
    660                                         # code...
    661                                         break;
    662                         }
    663                 } else {
    664                         $key_column = $parameters['key_column'];
    665                 }
    666 
    667                 if(empty($parameters['print_column'])) {
    668                         switch ($model_name) {
    669                                 case 'category_m':
    670                                         $print_column = 'category_title';
    671                                         break;
    672                                 case 'location_m':
    673                                         $print_column = 'location_title';
    674                                         break;
    675                                
    676                                 default:
    677                                         # code...
    678                                         break;
    679                         }
    680                 } else {
    681                         $print_column = $parameters['print_column'];
     626                $public_columns = array(
     627                        'category_m' => array('idcategory', 'category_title', 'titles_for_search'),
     628                        'location_m' => array('idlocation', 'location_title', 'titles_for_search'),
     629                        'listing_m' => array('post_id', 'post_title', 'post_title'),
     630                );
     631                $key_column = $public_columns[$model_name][0];
     632                $print_column = $public_columns[$model_name][1];
     633                $this->load->model($model_name);
     634                $search_table = $model_name === 'listing_m' ? $this->db->prefix . 'posts' : $this->$model_name->_table_name;
     635                $search_column = $search_table . '.' . $print_column;
     636                if ($model_name !== 'listing_m') {
     637                        $search_column .= ',' . $search_table . '.' . $key_column . ',' . $search_table . '.' . $public_columns[$model_name][2];
    682638                }
    683639
    … …  
    686642                        $limit = intval($parameters['limit']);
    687643                }
     644                $limit = max(1, min(100, $limit));
    688645
    689646                $offset = NULL;
    … …  
    709666                }
    710667
     668                if ($model_name === 'listing_m') {
     669                        $where['post_status'] = 'publish';
     670                        $where[$this->db->prefix . "posts.post_password = ''"] = NULL;
     671                        $where['is_activated'] = 1;
     672                        $where['is_approved'] = 1;
     673                }
    711674                $db_results_total = $this->$model_name->total($where);
    712675                $db_results = $this->$model_name->get_pagination($limit,$offset, $where);
    … …  
    11121075                        $db_results = $this->db->where(array("address LIKE '%".esc_sql($search_text)."%'" => NULL));
    11131076                        $this->db->from($this->listing_m->_table_name);
     1077                        $this->restrict_public_suggestions($this->db, $this->listing_m->_table_name);
    11141078                        $this->db->group_by('address');
    11151079                        $this->db->limit($limit);
    … …  
    13211285                $this->load->model('listingfield_m');
    13221286                $this->load->model('category_m');
     1287                $public_where = array('post_status' => 'publish', "post_password = ''" => NULL, 'is_activated' => 1, 'is_approved' => 1);
    13231288               
    13241289                $data = array();
    … …  
    13401305                        $parameters[$key] = sanitize_text_field($value);
    13411306                }
     1307                $public_widgets = array();
     1308                foreach (array('el_results' => 'wdk-listings-results', 'el_map' => 'wdk-map') as $prefix => $widget_type) {
     1309                        if (!isset($parameters[$prefix . '_id'])) continue;
     1310                        $public_widgets[$prefix] = $this->public_widget($parameters, $prefix, $widget_type);
     1311                        if (!$public_widgets[$prefix]) {
     1312                                $data['message'] = __('The requested widget is not public.', 'wpdirectorykit');
     1313                                $this->output($data);
     1314                                return;
     1315                        }
     1316                }
    13421317
    13431318                $options = [
    … …  
    13651340                if(isset($parameters['el_results_id'])) {
    13661341                        wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters);
    1367                         $data['output']['listings_count'] = $this->listing_m->total(array('is_activated' => 1,'is_approved'=>1));
     1342                        $data['output']['listings_count'] = $this->listing_m->total($public_where);
    13681343                        $data['output']['listings_count_html'] = $data['output']['listings_count'].' '.esc_html__('Listings', 'wpdirectorykit');
    1369 
    1370                         if(defined( 'WP_DEBUG' ) && WP_DEBUG)
    1371                                 $data['listings_count_sql'] = $this->db->last_query();
    13721344
    13731345                        if(isset($custom_parameters['wmvc_paged']))
    13741346                                $options['current_page'] = intval(wmvc_xss_clean($custom_parameters['wmvc_paged']));
    13751347
    1376                         $get_settings_el_results = new WdkGetElementSettings($parameters['el_results_page_id'],$parameters['el_results_id'],$parameters['el_results_type']);
    1377                         $settings_el_results = $get_settings_el_results->get_settings();
    1378                         $settings_el_results = $settings_el_results['settings']  ?? [];
     1348                        $get_settings_el_results = $public_widgets['el_results']['loader'];
     1349                        $settings_el_results = $public_widgets['el_results']['settings'];
    13791350
    13801351                        if(wmvc_show_data('per_page', $settings_el_results, false)) {
    13811352                                $options['limit'] = wmvc_show_data('per_page', $settings_el_results, false);
    13821353                        }
     1354                        $options['limit'] = max(1, min(100, (int) $options['limit']));
    13831355
    13841356                        if(wmvc_show_data('layout_type', $settings_el_results, false)) {
    … …  
    14031375
    14041376                        wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters);
    1405                         $listings_result = $this->listing_m->get_pagination($options['limit'], $offset, array('is_activated' => 1,'is_approved'=>1));
    1406 
    1407                         if(defined( 'WP_DEBUG' ) && WP_DEBUG)
    1408                                 $data['listings_result_sql'] = $this->db->last_query();
     1377                        $listings_result = $this->listing_m->get_pagination($options['limit'], $offset, $public_where);
    14091378
    14101379                        if(wmvc_show_data('layout_type', $settings_el_results, false)) {
    … …  
    14161385                        if($listings_result) {
    14171386                                foreach ($listings_result as $key => $listing) {
     1387                                        if (!$this->is_public_listing($listing)) continue;
    14181388                                        $listing->card_view = '';
    14191389
    … …  
    14281398                                                        global $wdk_listing_id;
    14291399                                                        $wdk_listing_id = wmvc_show_data('post_id', $listing);
    1430                                                         if ($post_data) {
     1400                                                        if ($post_data && in_array($post_data->post_type, array('page', 'elementor_library'), true)
     1401                                                                && $post_data->post_status === 'publish' && !post_password_required($post_data)) {
    14311402                                                                if ($post_data->post_type == 'page' || $post_data->post_type == 'elementor_library') {
    14321403                                                                        $elementor_instance = \Elementor\Plugin::instance();
    … …  
    14451416                                                        global $wdk_listing_id;
    14461417                                                        $wdk_listing_id = wmvc_show_data('post_id', $listing);
    1447                                                         if ($post_data) {
     1418                                                        if ($post_data && in_array($post_data->post_type, array('page', 'elementor_library'), true)
     1419                                                                && $post_data->post_status === 'publish' && !post_password_required($post_data)) {
    14481420                                                                if ($post_data->post_type == 'page' || $post_data->post_type == 'elementor_library') {
    14491421                                                                        $elementor_instance = \Elementor\Plugin::instance();
    … …  
    14631435                                        }
    14641436
    1465                                         $data['output']['listings_result'][] = $listing;
     1437                                        $data['output']['listings_result'][] = array('post_id' => (int) $listing->post_id, 'card_view' => $listing->card_view);
    14661438                                }
    14671439                        } else {
    … …  
    14741446                if(isset($parameters['el_map_id'])) {
    14751447                        wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns, $custom_parameters);
    1476                         $map_results = $this->listing_m->get_pagination(NULL, NULL, array('is_activated' => 1,'is_approved'=>1));
    1477                         if(defined( 'WP_DEBUG' ) && WP_DEBUG)
    1478                                 $data['map_results_sql'] = $this->db->last_query();
    1479 
    1480                         $get_settings_el_map = new WdkGetElementSettings($parameters['el_map_page_id'],$parameters['el_map_id'],$parameters['el_map_type']);
    1481                         $settings_el_map = $get_settings_el_map->get_settings();
    1482                         $settings_el_map = $settings_el_map['settings'];
     1448                        $map_results = $this->listing_m->get_pagination(NULL, NULL, $public_where);
     1449
     1450                        $get_settings_el_map = $public_widgets['el_map']['loader'];
     1451                        $settings_el_map = $public_widgets['el_map']['settings'];
    14831452
    14841453                        foreach ($map_results as $key => $listing) {
     1454                                if (!$this->is_public_listing($listing)) continue;
    14851455                                $listing->inner_marker = '';
    14861456
    … …  
    14901460                                $pin_icon = (isset( $settings_el_map['conf_custom_map_pin'])) ? esc_url($settings_el_map['conf_custom_map_pin']['url']) : '';
    14911461                               
    1492                                 if(wmvc_show_data('conf_hide_real_location', $category) == 'yes') {
    1493                                         $listing->listing_lat = wdk_move_gps($listing->listing_lat);
    1494                                         $listing->listing_lng = wdk_move_gps($listing->listing_lng);
     1462                                if(wmvc_show_data('conf_hide_real_location', $settings_el_map) == 'yes') {
     1463                                        $listing->lat = wdk_move_gps($listing->lat);
     1464                                        $listing->lng = wdk_move_gps($listing->lng);
    14951465                                }
    14961466
    … …  
    15071477
    15081478                                if($pin_icon){
    1509                                         $listing->inner_marker = '<div class="wdk_marker-container wdk_marker-container-image"><img src='.$pin_icon.'></img></div>';
     1479                                        $listing->inner_marker = '<div class="wdk_marker-container wdk_marker-container-image"><img src="'.esc_url($pin_icon).'" alt=""></div>';
    15101480                                }elseif($font_icon && empty($font_class)){
    15111481                                        $listing->inner_marker = '<div class="wdk_marker-container category_id_'.esc_js(wmvc_show_data('category_id', $listing)).'"><div class="front wdk_face">'.$font_icon.'</div><div class="wdk_marker-card"><div class="wdk_marker-arrow"></div></div></div>';
    15121482                                }else{
    1513                                         $listing->inner_marker = '<div class="wdk_marker-container category_id_'.esc_js(wmvc_show_data('category_id', $listing)).'"><div class="front wdk_face"><i class="'.esc_html($font_class).'"></i></div><div class="wdk_marker-card"><div class="wdk_marker-arrow"></div></div></div>';
    1514                                 }
    1515 
    1516                                 $data['output']['map_results'][] = $listing;
     1483                                        $listing->inner_marker = '<div class="wdk_marker-container category_id_'.esc_attr(wmvc_show_data('category_id', $listing)).'"><div class="front wdk_face"><i class="'.esc_attr($font_class).'"></i></div><div class="wdk_marker-card"><div class="wdk_marker-arrow"></div></div></div>';
     1484                                }
     1485
     1486                                $data['output']['map_results'][] = array('post_id' => (int) $listing->post_id,
     1487                                        'lat' => $listing->lat, 'lng' => $listing->lng, 'inner_marker' => $listing->inner_marker);
    15171488                        }
    15181489                }
    … …  
    16181589                        $search_field_id = (int) trim($parameters['field_id']);
    16191590
    1620                 if(!empty($search_field_id) && wdk_field_option($search_field_id, 'field_type', false)) {
     1591                if(!empty($search_field_id) && wdk_field_option($search_field_id, 'field_type', false)
     1592                        && wdk_field_option($search_field_id, 'is_visible_frontend', false)) {
    16211593
    16221594                        /* listings by title suggestion */
    16231595                        $this->db->select("DISTINCT field_".$search_field_id."_".wdk_field_option($search_field_id, 'field_type', false)." as value");
    16241596                        $this->db->from($this->db->prefix.'wdk_listings_fields');
     1597                        $this->restrict_public_suggestions($this->db, $this->db->prefix.'wdk_listings_fields');
    16251598                        $this->db->where(array("field_".$search_field_id."_".wdk_field_option($search_field_id, 'field_type', false)." LIKE '%".esc_sql($search_text)."%'" => NULL));
    16261599
    … …  
    16801653                        $search_field_id = (int) trim($parameters['field_id']);
    16811654
    1682                 if(!empty($search_field_id) && wdk_field_option($search_field_id, 'field_type', false)) {
     1655                if(!empty($search_field_id) && wdk_field_option($search_field_id, 'field_type', false)
     1656                        && wdk_field_option($search_field_id, 'is_visible_frontend', false)) {
    16831657
    16841658                        /* listings by title suggestion */
    16851659                        $Winter_MVC_WDK->db->select("DISTINCT field_".$search_field_id."_".wdk_field_option($search_field_id, 'field_type', false)." as value");
    16861660                        $Winter_MVC_WDK->db->from($Winter_MVC_WDK->db->prefix.'wdk_listings_fields');
     1661                        $this->restrict_public_suggestions($Winter_MVC_WDK->db, $Winter_MVC_WDK->db->prefix.'wdk_listings_fields');
    16871662                        $Winter_MVC_WDK->db->where(array("field_".$search_field_id."_".wdk_field_option($search_field_id, 'field_type', false)." LIKE '%".esc_sql($search_text)."%'" => NULL));
    16881663
    … …  
    17241699    }
    17251700           
     1701        private function public_widget($parameters, $prefix, $widget_type) {
     1702                $page_id = isset($parameters[$prefix . '_page_id']) ? absint($parameters[$prefix . '_page_id']) : 0;
     1703                $page = $page_id ? get_post($page_id) : NULL;
     1704                if (!$page || $page->post_status !== 'publish' || post_password_required($page)
     1705                        || (!is_post_type_viewable($page->post_type) && $page->post_type !== 'elementor_library')) return false;
     1706                if (isset($parameters[$prefix . '_type']) && $parameters[$prefix . '_type'] !== $widget_type) return false;
     1707                $loader = new WdkGetElementSettings($page_id, $parameters[$prefix . '_id'], $widget_type);
     1708                $widget = $loader->get_settings();
     1709                if (!is_array($widget) || !isset($widget['id'], $widget['widgetType'], $widget['settings'])
     1710                        || $widget['id'] !== $parameters[$prefix . '_id'] || $widget['widgetType'] !== $widget_type
     1711                        || !is_array($widget['settings'])) return false;
     1712                return array('loader' => $loader, 'settings' => $widget['settings']);
     1713        }
     1714
     1715        private function is_public_listing($listing) {
     1716                return isset($listing->post_type, $listing->post_status, $listing->post_password)
     1717                        && $listing->post_type === 'wdk-listing' && $listing->post_status === 'publish'
     1718                        && $listing->post_password === '' && !empty($listing->is_activated) && !empty($listing->is_approved);
     1719        }
     1720
     1721        private function restrict_public_suggestions($db, $source_table) {
     1722                $prefix = $db->prefix;
     1723                $db->where("EXISTS (SELECT 1 FROM {$prefix}wdk_listings AS public_listing
     1724                        INNER JOIN {$prefix}posts AS public_post ON public_post.ID = public_listing.post_id
     1725                        WHERE public_listing.post_id = {$source_table}.post_id
     1726                        AND public_listing.is_activated = 1 AND public_listing.is_approved = 1
     1727                        AND public_post.post_type = 'wdk-listing' AND public_post.post_status = 'publish'
     1728                        AND public_post.post_password = '')", NULL);
     1729        }
     1730
    17261731        private function get_fa_icons() {
    17271732
    … …  
    17991804                "far fa-window-close","fas fa-window-maximize","far fa-window-maximize","fas fa-window-minimize","fas fa-window-restore","far fa-window-restore","fab fa-windows","fas fa-won-sign","fab fa-wordpress","fab fa-wordpress-simple",
    18001805                "fab fa-wpbeginner","fab fa-wpexplorer","fab fa-wpforms","fas fa-wrench","fab fa-xbox","fab fa-xing","fab fa-xing-square","fab fa-y-combinator","fab fa-yahoo","fab fa-yandex","fab fa-yandex-international","fab fa-yelp","fas fa-yen-sign","fab fa-yoast","fab fa-youtube","fas fa-school");
    1801 
    1802 
    1803                 /* icons font Awesome 4 */
    1804                 return array("fa fa-500px","fa fa-address-book","fa fa-address-book-o","fa fa-address-card","fa fa-address-card-o","fa fa-adjust","fa fa-adn","fa fa-align-center","fa fa-align-justify","fa fa-align-left","fa fa-align-right",
    1805                 "fa fa-amazon","fa fa-ambulance","fa fa-american-sign-language-interpreting","fa fa-anchor","fa fa-android","fa fa-angellist","fa fa-angle-double-down","fa fa-angle-double-left","fa fa-angle-double-right","fa fa-angle-double-up",
    1806                 "fa fa-angle-down","fa fa-angle-left","fa fa-angle-right","fa fa-angle-up","fa fa-apple","fa fa-archive","fa fa-area-chart","fa fa-arrow-circle-down","fa fa-arrow-circle-left","fa fa-arrow-circle-o-down","fa fa-arrow-circle-o-left",
    1807                 "fa fa-arrow-circle-o-right","fa fa-arrow-circle-o-up","fa fa-arrow-circle-right","fa fa-arrow-circle-up","fa fa-arrow-down","fa fa-arrow-left","fa fa-arrow-right","fa fa-arrow-up","fa fa-arrows","fa fa-arrows-alt","fa fa-arrows-h",
    1808                 "fa fa-arrows-v","fa fa-assistive-listening-systems","fa fa-asterisk","fa fa-at","fa fa-audio-description","fa fa-backward","fa fa-balance-scale","fa fa-ban","fa fa-bandcamp","fa fa-bar-chart","fa fa-barcode","fa fa-bars","fa fa-bath",
    1809                 "fa fa-battery-empty","fa fa-battery-full","fa fa-battery-half","fa fa-battery-quarter","fa fa-battery-three-quarters","fa fa-bed","fa fa-beer","fa fa-behance","fa fa-behance-square","fa fa-bell","fa fa-bell-o","fa fa-bell-slash",
    1810                 "fa fa-bell-slash-o","fa fa-bicycle","fa fa-binoculars","fa fa-birthday-cake","fa fa-bitbucket","fa fa-bitbucket-square","fa fa-black-tie","fa fa-blind","fa fa-bluetooth","fa fa-bluetooth-b","fa fa-bold","fa fa-bolt","fa fa-bomb","fa fa-book",
    1811                 "fa fa-bookmark","fa fa-bookmark-o","fa fa-braille","fa fa-briefcase","fa fa-btc","fa fa-bug","fa fa-building","fa fa-building-o","fa fa-bullhorn","fa fa-bullseye","fa fa-bus","fa fa-buysellads","fa fa-calculator","fa fa-calendar",
    1812                 "fa fa-calendar-check-o","fa fa-calendar-minus-o","fa fa-calendar-o","fa fa-calendar-plus-o","fa fa-calendar-times-o","fa fa-camera","fa fa-camera-retro","fa fa-car","fa fa-caret-down","fa fa-caret-left","fa fa-caret-right",
    1813                 "fa fa-caret-square-o-down","fa fa-caret-square-o-left","fa fa-caret-square-o-right","fa fa-caret-square-o-up","fa fa-caret-up","fa fa-cart-arrow-down","fa fa-cart-plus","fa fa-cc","fa fa-cc-amex","fa fa-cc-diners-club",
    1814                 "fa fa-cc-discover","fa fa-cc-jcb","fa fa-cc-mastercard","fa fa-cc-paypal","fa fa-cc-stripe","fa fa-cc-visa","fa fa-certificate","fa fa-chain-broken","fa fa-check","fa fa-check-circle","fa fa-check-circle-o","fa fa-check-square",
    1815                 "fa fa-check-square-o","fa fa-chevron-circle-down","fa fa-chevron-circle-left","fa fa-chevron-circle-right","fa fa-chevron-circle-up","fa fa-chevron-down","fa fa-chevron-left","fa fa-chevron-right","fa fa-chevron-up","fa fa-child",
    1816                 "fa fa-chrome","fa fa-circle","fa fa-circle-o","fa fa-circle-o-notch","fa fa-circle-thin","fa fa-clipboard","fa fa-clock-o","fa fa-clone","fa fa-cloud","fa fa-cloud-download","fa fa-cloud-upload","fa fa-code","fa fa-code-fork","fa fa-codepen",
    1817                 "fa fa-codiepie","fa fa-coffee","fa fa-cog","fa fa-cogs","fa fa-columns","fa fa-comment","fa fa-comment-o","fa fa-commenting","fa fa-commenting-o","fa fa-comments","fa fa-comments-o","fa fa-compass","fa fa-compress","fa fa-connectdevelop",
    1818                 "fa fa-contao","fa fa-copyright","fa fa-creative-commons","fa fa-credit-card","fa fa-credit-card-alt","fa fa-crop","fa fa-crosshairs","fa fa-css3","fa fa-cube","fa fa-cubes","fa fa-cutlery","fa fa-dashcube","fa fa-database","fa fa-deaf",
    1819                 "fa fa-delicious","fa fa-desktop","fa fa-deviantart","fa fa-diamond","fa fa-digg","fa fa-dot-circle-o","fa fa-download","fa fa-dribbble","fa fa-dropbox","fa fa-drupal","fa fa-edge","fa fa-eercast","fa fa-eject","fa fa-ellipsis-h","fa fa-ellipsis-v",
    1820                 "fa fa-empire","fa fa-envelope","fa fa-envelope-o","fa fa-envelope-open","fa fa-envelope-open-o","fa fa-envelope-square","fa fa-envira","fa fa-eraser","fa fa-etsy","fa fa-eur","fa fa-exchange","fa fa-exclamation","fa fa-exclamation-circle",
    1821                 "fa fa-exclamation-triangle","fa fa-expand","fa fa-expeditedssl","fa fa-external-link","fa fa-external-link-square","fa fa-eye","fa fa-eye-slash","fa fa-eyedropper","fa fa-facebook","fa fa-facebook-official","fa fa-facebook-square",
    1822                 "fa fa-fast-backward","fa fa-fast-forward","fa fa-fax","fa fa-female","fa fa-fighter-jet","fa fa-file","fa fa-file-archive-o","fa fa-file-audio-o","fa fa-file-code-o","fa fa-file-excel-o","fa fa-file-image-o","fa fa-file-o","fa fa-file-pdf-o",
    1823                 "fa fa-file-powerpoint-o","fa fa-file-text","fa fa-file-text-o","fa fa-file-video-o","fa fa-file-word-o","fa fa-files-o","fa fa-film","fa fa-filter","fa fa-fire","fa fa-fire-extinguisher","fa fa-firefox","fa fa-first-order","fa fa-flag",
    1824                 "fa fa-flag-checkered","fa fa-flag-o","fa fa-flask","fa fa-flickr","fa fa-floppy-o","fa fa-folder","fa fa-folder-o","fa fa-folder-open","fa fa-folder-open-o","fa fa-font","fa fa-font-awesome","fa fa-fonticons","fa fa-fort-awesome","fa fa-forumbee",
    1825                 "fa fa-forward","fa fa-foursquare","fa fa-free-code-camp","fa fa-frown-o","fa fa-futbol-o","fa fa-gamepad","fa fa-gavel","fa fa-gbp","fa fa-genderless","fa fa-get-pocket","fa fa-gg","fa fa-gg-circle","fa fa-gift","fa fa-git","fa fa-git-square",
    1826                 "fa fa-github","fa fa-github-alt","fa fa-github-square","fa fa-gitlab","fa fa-glass","fa fa-glide","fa fa-glide-g","fa fa-globe","fa fa-google","fa fa-google-plus","fa fa-google-plus-official","fa fa-google-plus-square","fa fa-google-wallet",
    1827                 "fa fa-graduation-cap","fa fa-gratipay","fa fa-grav","fa fa-h-square","fa fa-hacker-news","fa fa-hand-lizard-o","fa fa-hand-o-down","fa fa-hand-o-left","fa fa-hand-o-right","fa fa-hand-o-up","fa fa-hand-paper-o","fa fa-hand-peace-o",
    1828                 "fa fa-hand-pointer-o","fa fa-hand-rock-o","fa fa-hand-scissors-o","fa fa-hand-spock-o","fa fa-handshake-o","fa fa-hashtag","fa fa-hdd-o","fa fa-header","fa fa-headphones","fa fa-heart","fa fa-heart-o","fa fa-heartbeat","fa fa-history",
    1829                 "fa fa-home","fa fa-hospital-o","fa fa-hourglass","fa fa-hourglass-end","fa fa-hourglass-half","fa fa-hourglass-o","fa fa-hourglass-start","fa fa-houzz","fa fa-html5","fa fa-i-cursor","fa fa-id-badge","fa fa-id-card","fa fa-id-card-o",
    1830                 "fa fa-ils","fa fa-imdb","fa fa-inbox","fa fa-indent","fa fa-industry","fa fa-info","fa fa-info-circle","fa fa-inr","fa fa-instagram","fa fa-internet-explorer","fa fa-ioxhost","fa fa-italic","fa fa-joomla","fa fa-jpy","fa fa-jsfiddle","fa fa-key",
    1831                 "fa fa-keyboard-o","fa fa-krw","fa fa-language","fa fa-laptop","fa fa-lastfm","fa fa-lastfm-square","fa fa-leaf","fa fa-leanpub","fa fa-lemon-o","fa fa-level-down","fa fa-level-up","fa fa-life-ring","fa fa-lightbulb-o","fa fa-line-chart",
    1832                 "fa fa-link","fa fa-linkedin","fa fa-linkedin-square","fa fa-linode","fa fa-linux","fa fa-list","fa fa-list-alt","fa fa-list-ol","fa fa-list-ul","fa fa-location-arrow","fa fa-lock","fa fa-long-arrow-down","fa fa-long-arrow-left",
    1833                 "fa fa-long-arrow-right","fa fa-long-arrow-up","fa fa-low-vision","fa fa-magic","fa fa-magnet","fa fa-male","fa fa-map","fa fa-map-marker","fa fa-map-o","fa fa-map-pin","fa fa-map-signs","fa fa-mars","fa fa-mars-double","fa fa-mars-stroke",
    1834                 "fa fa-mars-stroke-h","fa fa-mars-stroke-v","fa fa-maxcdn","fa fa-meanpath","fa fa-medium","fa fa-medkit","fa fa-meetup","fa fa-meh-o","fa fa-mercury","fa fa-microchip","fa fa-microphone","fa fa-microphone-slash","fa fa-minus",
    1835                 "fa fa-minus-circle","fa fa-minus-square","fa fa-minus-square-o","fa fa-mixcloud","fa fa-mobile","fa fa-modx","fa fa-money","fa fa-moon-o","fa fa-motorcycle","fa fa-mouse-pointer","fa fa-music","fa fa-neuter","fa fa-newspaper-o",
    1836                 "fa fa-object-group","fa fa-object-ungroup","fa fa-odnoklassniki","fa fa-odnoklassniki-square","fa fa-opencart","fa fa-openid","fa fa-opera","fa fa-optin-monster","fa fa-outdent","fa fa-pagelines","fa fa-paint-brush","fa fa-paper-plane",
    1837                 "fa fa-paper-plane-o","fa fa-paperclip","fa fa-paragraph","fa fa-pause","fa fa-pause-circle","fa fa-pause-circle-o","fa fa-paw","fa fa-paypal","fa fa-pencil","fa fa-pencil-square","fa fa-pencil-square-o","fa fa-percent","fa fa-phone",
    1838                 "fa fa-phone-square","fa fa-picture-o","fa fa-pie-chart","fa fa-pied-piper","fa fa-pied-piper-alt","fa fa-pied-piper-pp","fa fa-pinterest","fa fa-pinterest-p","fa fa-pinterest-square","fa fa-plane","fa fa-play","fa fa-play-circle",
    1839                 "fa fa-play-circle-o","fa fa-plug","fa fa-plus","fa fa-plus-circle","fa fa-plus-square","fa fa-plus-square-o","fa fa-podcast","fa fa-power-off","fa fa-print","fa fa-product-hunt","fa fa-puzzle-piece","fa fa-qq","fa fa-qrcode","fa fa-question",
    1840                 "fa fa-question-circle","fa fa-question-circle-o","fa fa-quora","fa fa-quote-left","fa fa-quote-right","fa fa-random","fa fa-ravelry","fa fa-rebel","fa fa-recycle","fa fa-reddit","fa fa-reddit-alien","fa fa-reddit-square","fa fa-refresh",
    1841                 "fa fa-registered","fa fa-renren","fa fa-repeat","fa fa-reply","fa fa-reply-all","fa fa-retweet","fa fa-road","fa fa-rocket","fa fa-rss","fa fa-rss-square","fa fa-rub","fa fa-safari","fa fa-scissors","fa fa-scribd","fa fa-search","fa fa-search-minus",
    1842                 "fa fa-search-plus","fa fa-sellsy","fa fa-server","fa fa-share","fa fa-share-alt","fa fa-share-alt-square","fa fa-share-square","fa fa-share-square-o","fa fa-shield","fa fa-ship","fa fa-shirtsinbulk","fa fa-shopping-bag","fa fa-shopping-basket",
    1843                 "fa fa-shopping-cart","fa fa-shower","fa fa-sign-in","fa fa-sign-language","fa fa-sign-out","fa fa-signal","fa fa-simplybuilt","fa fa-sitemap","fa fa-skyatlas","fa fa-skype","fa fa-slack","fa fa-sliders","fa fa-slideshare","fa fa-smile-o",
    1844                 "fa fa-snapchat","fa fa-snapchat-ghost","fa fa-snapchat-square","fa fa-snowflake-o","fa fa-sort","fa fa-sort-alpha-asc","fa fa-sort-alpha-desc","fa fa-sort-amount-asc","fa fa-sort-amount-desc","fa fa-sort-asc","fa fa-sort-desc",
    1845                 "fa fa-sort-numeric-asc","fa fa-sort-numeric-desc","fa fa-soundcloud","fa fa-space-shuttle","fa fa-spinner","fa fa-spoon","fa fa-spotify","fa fa-square","fa fa-square-o","fa fa-stack-exchange","fa fa-stack-overflow","fa fa-star",
    1846                 "fa fa-star-half","fa fa-star-half-o","fa fa-star-o","fa fa-steam","fa fa-steam-square","fa fa-step-backward","fa fa-step-forward","fa fa-stethoscope","fa fa-sticky-note","fa fa-sticky-note-o","fa fa-stop","fa fa-stop-circle",
    1847                 "fa fa-stop-circle-o","fa fa-street-view","fa fa-strikethrough","fa fa-stumbleupon","fa fa-stumbleupon-circle","fa fa-subscript","fa fa-subway","fa fa-suitcase","fa fa-sun-o","fa fa-superpowers","fa fa-superscript","fa fa-table",
    1848                 "fa fa-tablet","fa fa-tachometer","fa fa-tag","fa fa-tags","fa fa-tasks","fa fa-taxi","fa fa-telegram","fa fa-television","fa fa-tencent-weibo","fa fa-terminal","fa fa-text-height","fa fa-text-width","fa fa-th","fa fa-th-large","fa fa-th-list",
    1849                 "fa fa-themeisle","fa fa-thermometer-empty","fa fa-thermometer-full","fa fa-thermometer-half","fa fa-thermometer-quarter","fa fa-thermometer-three-quarters","fa fa-thumb-tack","fa fa-thumbs-down","fa fa-thumbs-o-down",
    1850                 "fa fa-thumbs-o-up","fa fa-thumbs-up","fa fa-ticket","fa fa-times","fa fa-times-circle","fa fa-times-circle-o","fa fa-tint","fa fa-toggle-off","fa fa-toggle-on","fa fa-trademark","fa fa-train","fa fa-transgender","fa fa-transgender-alt",
    1851                 "fa fa-trash","fa fa-trash-o","fa fa-tree","fa fa-trello","fa fa-tripadvisor","fa fa-trophy","fa fa-truck","fa fa-try","fa fa-tty","fa fa-tumblr","fa fa-tumblr-square","fa fa-twitch","fab fa-x-twitter","fab fa-x-twitter-square","fa fa-umbrella",
    1852                 "fa fa-underline","fa fa-undo","fa fa-universal-access","fa fa-university","fa fa-unlock","fa fa-unlock-alt","fa fa-upload","fa fa-usb","fa fa-usd","fa fa-user","fa fa-user-circle","fa fa-user-circle-o","fa fa-user-md","fa fa-user-o",
    1853                 "fa fa-user-plus","fa fa-user-secret","fa fa-user-times","fa fa-users","fa fa-venus","fa fa-venus-double","fa fa-venus-mars","fa fa-viacoin","fa fa-viadeo","fa fa-viadeo-square","fa fa-video-camera","fa fa-vimeo","fa fa-vimeo-square","fa fa-vine",
    1854                 "fa fa-vk","fa fa-volume-control-phone","fa fa-volume-down","fa fa-volume-off","fa fa-volume-up","fa fa-weibo","fa fa-weixin","fa fa-whatsapp","fa fa-wheelchair","fa fa-wheelchair-alt","fa fa-wifi","fa fa-wikipedia-w","fa fa-window-close",
    1855                 "fa fa-window-close-o","fa fa-window-maximize","fa fa-window-minimize","fa fa-window-restore","fa fa-windows","fa fa-wordpress","fa fa-wpbeginner","fa fa-wpexplorer","fa fa-wpforms","fa fa-wrench","fa fa-xing","fa fa-xing-square",
    1856                 "fa fa-y-combinator","fa fa-yahoo","fa fa-yelp","fa fa-yoast","fa fa-youtube","fa fa-youtube-play","fa fa-youtube-square","fa-solid fa-school");
    18571806        }
    18581807   
  • wpdirectorykit/trunk/application/helpers/Basic.php

    r3738493 r3751021  
    699699                {
    700700                    $gen_q.="$value LIKE '%$smart_search%' OR ";
     701                }
     702            }
     703
     704            /* search by worlds */
     705            $words = preg_split('/\s+/u', trim($smart_search), -1, PREG_SPLIT_NO_EMPTY);
     706            if(count($words) > 1) {
     707                $gen_q = '';
     708
     709                foreach($words as $word) {
     710                    foreach($columns as $key => $value)
     711                    {
     712                        if($value == 'field_booking_date_from' || $value == 'field_booking_date_to' || $value == 'agents_ids' || $value == 'gps' || $value == 'is_featured' || $value == 'field_booking_guest') continue;
     713                        if (
     714                            strpos($value, '_CHECKBOX') !== FALSE ||
     715                            strpos($value, '_exactly') !== FALSE ||
     716                            strpos($value, '_max') !== FALSE ||
     717                            strpos($value, '_min') !== FALSE ||
     718                            strpos($value, '_NUMBER') !== FALSE ||
     719                            strpos($value, 'date') !== FALSE ||
     720                            strpos($value, 'category_id') !== FALSE ||
     721                            strpos($value, 'location_id') !== FALSE ||
     722                            strpos($value, 'post_id') !== FALSE
     723                        ) continue;
     724                   
     725
     726                        $gen_q .= "$value LIKE '%$word%' OR ";
     727
     728                        /* categoreis locations */
     729                        $gen_q.="location_title LIKE '%$$word%' OR ";
     730                        $gen_q.="category_title LIKE '%$$word%' OR ";
     731                       
     732                        $gen_q.="`category_table`.`titles_for_search` LIKE '%$$word%' OR ";
     733                        $gen_q.="`location_table`.`titles_for_search` LIKE '%$$word%' OR ";
     734                    }
    701735                }
    702736            }
    … …  
    52245258            $Winter_MVC_WDK->db->select('post_id');
    52255259            $Winter_MVC_WDK->db->where(array(
    5226                     '(post_id IN ('.esc_sql(sanitize_text_field($param)).'))' => NULL,
     5260                    'post_id IN (' . esc_sql(implode(',', array_map('intval', (array) $param))) . ')' => NULL,
    52275261                    '((`listing_related_ids` IS NOT NULL AND `listing_related_ids` !="") OR (`listing_parent_post_id` IS NOT NULL AND `listing_parent_post_id` !=0))' => NULL,
    52285262                    ));
  • wpdirectorykit/trunk/application/helpers/Listing.php

    r3405484 r3751021  
    613613                        $output = '';
    614614                        $post_data = get_post($template);
     615                       
     616                        if (
     617                                !$post_data
     618                                || !in_array($post_data->post_type, array('page', 'elementor_library'), true)
     619                                || $post_data->post_status !== 'publish'
     620                                || post_password_required($post_data)
     621                        ) {
     622                                return '';
     623                        }
    615624
    616625                        global $wdk_listing_id;
  • wpdirectorykit/trunk/application/models/Listing_m.php

    r3479534 r3751021  
    336336        $this->load->model('listingfield_m');
    337337        $this->load->model('listingusers_m');
    338         
    339         /* remove images direct */
    340         if ( get_option('wdk_remove_direct_listing_images', false)) {
     338       
     339        /* Remove only authorized attachments belonging to this listing. */
     340        if (get_option('wdk_remove_direct_listing_images', false)) {
    341341            global $Winter_MVC_WDK;
    342342            $Winter_MVC_WDK->load_helper('listing');
    343343
    344344            $listing_images = wdk_field_value('listing_images', $post_id);
    345             if(!empty($listing_images)) {
    346                 $image_ids = explode(',', $listing_images);
    347                 foreach ($image_ids as $key => $image_id) {
    348                     wp_delete_attachment($image_id, true);
    349                 }
     345           
     346           
     347            $image_ids = is_string($listing_images)
     348                ? array_unique(
     349                    array_filter(array_map('absint', explode(',', $listing_images)))
     350                )
     351                : array();
     352
     353            foreach ($image_ids as $image_id) {
     354                $attachment = get_post($image_id);
     355             
     356                if (!$attachment || $attachment->post_type !== 'attachment') {
     357                    continue;
     358                }
     359
     360                if (!current_user_can('delete_post', $image_id)) {
     361                    continue;
     362                }
     363           
     364                wp_delete_attachment($image_id, true);
    350365            }
    351366        }
    … …  
    360375
    361376        // Delete listing images if setting enabled
    362 
    363 
    364 
    365377        do_action('wpdirectorykit/model/listing/delete', $post_id);
    366378
    … …  
    400412            return false;
    401413
    402        $sql = 'UPDATE '.$this->_table_name.' SET `counter_results_views` = `counter_results_views`+'.$increment.' WHERE post_id IN ('.join(',', $listing_ids).')';
     414       global $wpdb;
     415       $safe_ids = array_map('intval', $listing_ids);
     416       $placeholders = implode(',', array_fill(0, count($safe_ids), '%d'));
     417       $sql = $wpdb->prepare(
     418           "UPDATE {$this->_table_name} SET `counter_results_views` = `counter_results_views` + %d WHERE post_id IN ($placeholders)",
     419           array_merge([intval($increment)], $safe_ids)
     420       );
    403421       $this->db->query($sql);
    404422    }
  • wpdirectorykit/trunk/application/models/Messages_m.php

    r3375282 r3751021  
    437437        global $wpdb;
    438438        if($user_id){
    439             $wpdb->query("UPDATE `{$this->_table_name}`
    440                             LEFT JOIN `{$this->db->prefix}wdk_listings` ON `{$this->db->prefix}wdk_listings`.post_id = `{$this->_table_name}`.post_id 
    441                             SET `is_notified` = 1
    442                             WHERE
    443                             (`user_id_editor` = {$user_id}
    444                             OR `user_id_sender` = {$user_id})
    445                         ");
     439            $listings_table = $this->db->prefix . 'wdk_listings';
     440            $messages_table = $this->_table_name;
     441            $wpdb->query(
     442                $wpdb->prepare(
     443                    "UPDATE `{$messages_table}`
     444                    LEFT JOIN `{$listings_table}` ON `{$listings_table}`.post_id = `{$messages_table}`.post_id
     445                    SET `is_notified` = 1
     446                    WHERE (`user_id_editor` = %d OR `user_id_sender` = %d)",
     447                    $user_id,
     448                    $user_id
     449                )
     450            );
    446451            return true;
    447452        }
  • wpdirectorykit/trunk/application/views/search_fields/SLIDER_RANGE.php

    r3689937 r3751021  
    1313
    1414<?php
    15 $field_key = 'field_'.wmvc_show_data('idfield',$field_data);
    16 $field_attr_id = 'wdk_field_'.wmvc_show_data('idfield', $field_data);
    17 $placeholder = wmvc_show_data('field_label', $field_data);
     15$field_id =(int) wmvc_show_data('idfield',$field_data, '', TRUE, TRUE);
     16$field_key = 'field_'.$field_id;
     17$field_attr_id = 'wdk_field_'.$field_id;
     18$placeholder = esc_html(wmvc_show_data('field_label', $field_data, '', TRUE, TRUE));
    1819$field_value = '';
    1920// Dynamic field values are registered in the translation catalog separately.
    2021// phpcs:ignore WordPress.WP.I18n.NonSingularStringLiteralText
    2122$placeholder = esc_html__($placeholder,'wpdirectorykit');
    22 $query_type = wmvc_show_data('query_type', $field_data, '');
     23$query_type = wmvc_show_data('query_type', $field_data, '', TRUE, TRUE);
    2324
    2425if(isset($predefinedfields_query) && !empty($predefinedfields_query[$field_key])) {
    … …  
    3233$suffix = '';
    3334$prefix = '';
    34 $prefix = apply_filters( 'wpdirectorykit/listing/field/prefix', wmvc_show_data('prefix',$field_data), wmvc_show_data('idfield', $field_data));
    35 $suffix = apply_filters( 'wpdirectorykit/listing/field/suffix',wmvc_show_data('suffix',$field_data), wmvc_show_data('idfield', $field_data));
     35$prefix = apply_filters( 'wpdirectorykit/listing/field/prefix', wmvc_show_data('prefix',$field_data, '', TRUE, TRUE), $field_id);
     36$suffix = apply_filters( 'wpdirectorykit/listing/field/suffix',wmvc_show_data('suffix',$field_data, '', TRUE, TRUE), $field_id);
    3637
    3738if(!empty($prefix)) {
    … …  
    6566    $Winter_MVC_WDK->model('listing_m');
    6667   
    67     $Winter_MVC_WDK->db->order_by('field_'.wmvc_show_data('idfield',$field_data).'_'.wdk_field_option(wmvc_show_data('idfield',$field_data), 'field_type').' DESC');
     68    $Winter_MVC_WDK->db->order_by('field_'.$field_id.'_'.esc_html(wdk_field_option($field_id, 'field_type', '')).' DESC');
    6869    $listing = $Winter_MVC_WDK->listing_m->get(NULL, TRUE);
    6970   
    7071    if($listing) {
    71         $max_value = wdk_field_value(wmvc_show_data('idfield',$field_data), $listing);
     72        $max_value = wdk_field_value($field_id, $listing);
    7273    }
    7374}
    … …  
    7677
    7778<div class="wdk-field wdk-col wdk-slider-range-col wdk_search_<?php echo esc_attr($field_key);?> <?php if($query_type == 'min_max'):?>min_max_wdk-field<?php endif;?>  <?php echo esc_attr(wmvc_show_data('field_type', $field_data)); ?> <?php echo esc_attr(wmvc_show_data('class', $field_data)); ?>
    78     wdk_field_id_<?php echo esc_attr(wmvc_show_data('idfield',$field_data));?>">
     79    wdk_field_id_<?php echo esc_attr($field_id);?>">
    7980    <label class="wdk-field-label"><?php echo esc_html(wmvc_show_data('field_label', $field_data)); ?></label>
    8081    <div class="wdk-field-group">
  • wpdirectorykit/trunk/blocks/inc/block-product-field/block-product-field.php

    r3596648 r3751021  
    171171
    172172        wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns);
    173         $data['results'] = $WMVC->listing_m->get_pagination($data['settings']['limit'], $offset, array('is_activated' => 1,'is_approved'=>1));
     173        $data['results'] = $WMVC->listing_m->get_pagination($data['settings']['limit'], $offset, array('is_activated' => 1, 'is_approved' => 1, 'post_status' => 'publish', 'post_password' => ''));
    174174
    175175    } 
  • wpdirectorykit/trunk/elementor-elements/elementor-init.php

    r3689937 r3751021  
    421421                }
    422422
    423                 $post_id  = sanitize_text_field( wp_unslash( $_POST['post_id'] ) );
     423                if (!is_scalar($_POST['post_id'])) {
     424                        wp_send_json_error(array('message' => 'Invalid post ID.'), 400);
     425                }
     426                $post_id = absint($_POST['post_id']);
    424427                $meta_input = array(
    425428                        '_elementor_edit_mode'     => 'builder',
    … …  
    434437
    435438                if ( empty( $post ) ) { // create a new one.
     439                        $post_type = get_post_type_object('elementor_library');
     440                        if (!$post_type || !current_user_can($post_type->cap->create_posts)
     441                                || !current_user_can($post_type->cap->publish_posts)) {
     442                                wp_send_json_error(array('message' => 'Access denied.'), 403);
     443                        }
    436444
    437445                        $post_title = 'WDK Template | #' . substr( md5( wp_rand(0000,9999) ), 0, 4 );
    … …  
    445453                        );
    446454
    447                         $post_id = wp_insert_post( $params );
     455                        $post_id = wp_insert_post( $params, true );
     456                        if (is_wp_error($post_id) || !$post_id) {
     457                                wp_send_json_error(array('message' => 'Unable to create template.'), 500);
     458                        }
    448459
    449460                } else {
     461                        if (!current_user_can('edit_post', $post->ID)) {
     462                                wp_send_json_error(array('message' => 'Access denied.'), 403);
     463                        }
    450464                        $post_id    = $post->ID;
    451465                        $post_title = $post->post_title;
    … …  
    475489
    476490                check_ajax_referer( 'wdk-blog-widget-nonce', 'nonce' );
     491                if (!current_user_can('edit_posts')) {
     492                        wp_send_json_error(array('message' => 'Access denied.'), 403);
     493                }
    477494
    478495                $post_type = isset( $_POST['post_type'] ) ? wp_unslash( $_POST['post_type'] ) : '';
    479496
    480                 $post_type = array_map( 'sanitize_text_field', $post_type );
     497                $post_type = array_map( 'sanitize_text_field', (array) $post_type );
    481498
    482499                if ( empty( $post_type ) ) {
  • wpdirectorykit/trunk/extensions/wdk-cached-users.php

    r3709928 r3751021  
    9999    {
    100100        if(isset($_GET['wdk_cached_users_regenerate'])) {
     101            if (!current_user_can('manage_options')) {
     102                return FALSE;
     103            }
     104            check_admin_referer('wdk-cached-users-regenerate', '_wpnonce');
    101105            $this->regenerate_cache();
    102106
  • wpdirectorykit/trunk/filters.php

    r3689937 r3751021  
    266266add_filter('document_title_parts', function ($title_parts_array) {
    267267    global $wp_query;
    268     if (isset($wp_query->post) && $wp_query->post->post_type === 'wdk-listing') {
    269         $title_parts_array['title'] = wdk_listing_seo_title();
     268    if (isset($wp_query->post) && $wp_query->post->post_type === 'wdk-listing' && $wdk_listing_title=wdk_listing_seo_title()) {
     269        $title_parts_array['title'] = $wdk_listing_title;
    270270    }
    271271    return $title_parts_array;
  • wpdirectorykit/trunk/shortcodes/shortcode-latest-listings-list.php

    r2711636 r3751021  
    5252    $columns = array('ID', 'location_id', 'category_id', 'post_title', 'post_date', 'search', 'order_by','is_featured', 'address');
    5353    $external_columns = array('location_id', 'category_id', 'post_title');
     54    $public_where = array('post_status' => 'publish', "post_password = ''" => NULL, 'is_activated' => 1, 'is_approved' => 1);
    5455   
    5556    if(!empty($data['settings']['conf_custom_results'])) {
    5657        /* where in */
     58        $listings_ids = array_filter(wp_parse_id_list($data['settings']['conf_custom_results']));
    5759        if(!empty($listings_ids)){
    58             $WMVC->db->where( $WMVC->db->prefix.'wdk_listings.post_id IN(' . $data['settings']['conf_custom_results'] . ')', null, false);
    59             $data['results'] = $WMVC->listing_m->get();
     60            $WMVC->db->where( $WMVC->db->prefix.'wdk_listings.post_id IN(' . implode(',', $listings_ids) . ')', null, false);
     61            $data['results'] = $WMVC->listing_m->get_pagination($data['settings']['limit'], 0, $public_where);
    6062        }
    6163    } else {
    … …  
    7072            $qr_string = trim($data['settings']['conf_query'],'?');
    7173            parse_str($qr_string, $_GET);
    72             $_GET = array_map('trim', $_GET);
     74            $_GET = array_map(function ($value) { return is_string($value) ? trim($value) : $value; }, $_GET);
    7375        }
    7476        if($data['settings']['only_is_featured'] == 'yes') {
    … …  
    7779
    7880        wdk_prepare_search_query_GET($columns, $controller.'_m', $external_columns);
    79         $data['results'] = $WMVC->listing_m->get_pagination($data['settings']['limit'], $offset, array('is_activated' => 1,'is_approved'=>1));
     81        $data['results'] = $WMVC->listing_m->get_pagination($data['settings']['limit'], $offset, $public_where);
    8082
    8183    } 
  • wpdirectorykit/trunk/shortcodes/views/shortcode-latest-listings-list.php

    r3689937 r3751021  
    1717                <?php foreach($results as $listing):?>
    1818                    <?php
     19                        if (wmvc_show_data('post_status', $listing) !== 'publish'
     20                            || !empty(wmvc_show_data('post_password', $listing))
     21                            || !wmvc_show_data('is_activated', $listing) || !wmvc_show_data('is_approved', $listing)) continue;
    1922                        $url = get_permalink($listing);
    2023                        $title_post =  wdk_resultitem_fields_section_value(1, 2, $listing);
Note: See TracChangeset for help on using the changeset viewer.