Plugin Directory

Changeset 3812534


Ignore:
Timestamp:
11/19/2026 09:34:35 PM (37 hours ago)
Author:
codepeople
Message:

New version 1.3.1
Modifications in the changelogs.

Location:
codepeople-post-map
Files:
79 added
4 edited

Legend:

Unmodified
Added
Removed
  • codepeople-post-map/trunk/codepeople-post-map.php

    r3649081 r3812534  
    33Plugin Name: CodePeople Post Map for Google Maps
    44Text Domain: codepeople-post-map
    5 Version: 1.3.0
     5Version: 1.3.1
    66Author: CodePeople
    77Author URI: http://wordpress.dwbooster.com/content-tools/codepeople-post-map
    … …  
    153153                                add_menu_page( 'CodePeople Post Map for Google Maps', 'CodePeople Post Map for Google Maps', 'manage_options', $slug, array(&$cpm_master_obj, 'settings_page'), 'data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAyNCAyNCIgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiBmaWxsPSJjdXJyZW50Q29sb3IiPg0KICA8cGF0aCBkPSJNMTIgMmMzLjE5NiAwIDYgMi42MTggNiA1LjYwMiAwIDMuMDkzLTIuNDkzIDcuMTMyLTYgMTIuNTkxLTMuNTA3LTUuNDU5LTYtOS40OTgtNi0xMi41OTFDNiA0LjYxOCA4LjgwNCAyIDEyIDJ6bTAgNGEyIDIgMCAxIDAgMCA0IDIgMiAwIDAgMCAwLTR6Ii8+DQo8L3N2Zz4=' );
    154154
    155                                 add_submenu_page( $slug, 'Online Help', 'Online Help', 'read', 'google_maps_cp_help', array(&$cpm_master_obj, 'settings_page') );
     155                                add_submenu_page( $slug, 'Online Help', 'Online Help', 'read', 'google_maps_cp_help', array(&$cpm_master_obj, 'help_page') );
    156156
    157                                 add_submenu_page( $slug, 'I\'ve a Question', 'I\'ve a Question', 'read', 'google_maps_cp_question', array(&$cpm_master_obj, 'settings_page') );
     157                                add_submenu_page( $slug, 'I\'ve a Question', 'I\'ve a Question', 'read', 'google_maps_cp_question', array(&$cpm_master_obj, 'question_page') );
    158158
    159                                 add_submenu_page( $slug, 'Upgrade', 'Upgrade', 'read', 'google_maps_cp_upgrade', array(&$cpm_master_obj, 'settings_page') );
     159                                add_submenu_page( $slug, 'Upgrade', 'Upgrade', 'read', 'google_maps_cp_upgrade', array(&$cpm_master_obj, 'upgrade_page') );
    160160                        }
    161161                }
  • codepeople-post-map/trunk/include/functions.php

    r3588032 r3812534  
    109109                return wp_kses_post( $v );
    110110        } // End sanitize_description
     111
     112        function sanitize_api_key( $v )
     113        {
     114                if ( ! is_string( $v ) ) return '';
     115                $v = trim( $v );
     116                if ( '' === $v ) return '';
     117                // Google Maps API keys contain only letters, digits, dashes and underscores.
     118                // Removing every other character guarantees the value can never carry
     119                // markup into the admin JavaScript.
     120                return preg_replace( '/[^A-Za-z0-9_\-]/', '', $v );
     121    } // End sanitize_api_key
    111122
    112123        //---------- CREATE MAP ----------
    … …  
    938949                if( !empty( $api_key ) )
    939950                {
    940                         $cpm_global[ 'api_key' ] = trim($api_key);
     951                        $cpm_global[ 'api_key' ] = $this->sanitize_api_key( $api_key );
    941952                }
    942953                wp_localize_script('admin_cpm_script', 'cpm_global', $cpm_global);
    … …  
    9931004        } // End load_header_resources
    9941005
     1006        function help_page(){
     1007                echo("Redirecting to documentation...<script type='text/javascript'>document.location='http://wordpress.dwbooster.com/content-tools/codepeople-post-map?acode=18517';</script>");
     1008                exit;
     1009        }
     1010
     1011        function question_page(){
     1012                echo("Redirecting to documentation...<script type='text/javascript'>document.location='https://wordpress.org/support/plugin/codepeople-post-map/#new-post';</script>");
     1013                exit;
     1014        }
     1015
     1016        function upgrade_page(){
     1017                echo("Redirecting to upgrade page...<script type='text/javascript'>document.location='http://wordpress.dwbooster.com/content-tools/codepeople-post-map?acode=18517#download';</script>");
     1018                exit;
     1019        }
     1020
    9951021        /**
    9961022         * Print the settings page for entering the general setting's data of maps
    9971023         */
    9981024        function settings_page(){
    999                 if (isset($_GET["page"]))
    1000         {
    1001                         if( $_GET["page"] == 'google_maps_cp_upgrade' )
    1002                         {
    1003                                 echo("Redirecting to upgrade page...<script type='text/javascript'>document.location='http://wordpress.dwbooster.com/content-tools/codepeople-post-map?acode=18517#download';</script>");
    1004                                 exit;
    1005                         }
    1006                         elseif( $_GET["page"] == 'google_maps_cp_help')
    1007                         {
    1008                                 echo("Redirecting to documentation...<script type='text/javascript'>document.location='http://wordpress.dwbooster.com/content-tools/codepeople-post-map?acode=18517';</script>");
    1009                                 exit;
    1010                         }
    1011                         elseif( $_GET["page"] == 'google_maps_cp_question')
    1012                         {
    1013                                 echo("Redirecting to documentation...<script type='text/javascript'>document.location='https://wordpress.org/support/plugin/codepeople-post-map/#new-post';</script>");
    1014                                 exit;
    1015                         }
    1016 
    1017         }
     1025                if ( ! current_user_can( 'manage_options' ) ){
     1026                        wp_die( esc_html__( 'You do not have sufficient permissions to access this page.', 'codepeople-post-map'), 403 );
     1027                }
    10181028
    10191029                // Check if post exists and save the configuraton options
    1020                 if (isset($_POST['cpm_map_noncename']) && wp_verify_nonce($_POST['cpm_map_noncename'],__FILE__)){
     1030                if (
     1031                        isset( $_POST['cpm_map_noncename'] ) &&
     1032                        wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST['cpm_map_noncename'] ) ), __FILE__ )
     1033                ){
    10211034                        $options = $_POST['cpm_map'];
    10221035                        $options = $this->array_map_recursive('sanitize_text_field', $options);
     1036                        $options['api_key'] = $this->sanitize_api_key( isset($options['api_key']) ? $options['api_key'] : '' );
    10231037                        $options['drag_map'] = ( isset( $options[ 'drag_map' ] ) ) ? true : false;
    10241038            $options['windowhtml'] = $this->get_configuration_option('windowhtml');
    … …  
    15261540
    15271541                $api_key = $this->get_configuration_option( 'api_key' );
    1528                 $output .= 'var cpm_api_key = ' . wp_json_encode( (!empty( $api_key )) ? trim($api_key) : '' ) . ";\n";
     1542                $output .= 'var cpm_api_key = ' . wp_json_encode( (!empty( $api_key )) ? $this->sanitize_api_key( $api_key ) : '' ) . ";\n";
    15291543
    15301544                $output .= "var cpm_global = cpm_global || {};\n";
  • codepeople-post-map/trunk/js/cpm.admin.js

    r3259483 r3812534  
    1313                typeof cpm_global['api_key'] != 'undefined' &&
    1414                cpm_global['api_key'] != ''
    15         ) _api_key = 'key='+cpm_global['api_key']+'&';
     15        ) _api_key = 'key='+encodeURIComponent(cpm_global['api_key'])+'&';
     16
     17        function cpm_load_maps_api( callback, language ){
     18                var script = document.createElement('script');
     19                var url = (( typeof window.location.protocol != 'undefined' ) ? window.location.protocol : 'http:')+
     20                                '//maps.google.com/maps/api/js?loading=async&'+_api_key+'callback='+encodeURIComponent(callback)+
     21                                ((language) ? '&language='+encodeURIComponent(language) : '')+'&libraries=marker';
     22                script.type = 'text/javascript';
     23                script.src = url;
     24                document.body.appendChild(script);
     25    }
    1626
    1727        if(!('gm_authFailure' in window))
    … …  
    122132                        cpm_get_latlng();
    123133                }else{
    124                         $('<script type="text/javascript" src="'+(( typeof window.location.protocol != 'undefined' ) ? window.location.protocol : 'http:' )+'//maps.google.com/maps/api/js?loading=async&'+_api_key+'callback=cpm_get_latlng'+((language) ? '&language='+language: '')+'&libraries=marker"></script>').appendTo('body');
     134                        cpm_load_maps_api('cpm_get_latlng', language);
    125135                }
    126136        };
    … …  
    246256            else
    247257            {
    248                 $('<script type="text/javascript" src="'+(( typeof window.location.protocol != 'undefined' ) ? window.location.protocol : 'http:' )+'//maps.google.com/maps/api/js?loading=async&'+_api_key+'callback=cpm_set_map_flag&libraries=marker"></script>').appendTo('body');
     258                                cpm_load_maps_api('cpm_set_map_flag', '');
    249259            }
    250260                }
  • codepeople-post-map/trunk/readme.txt

    r3649081 r3812534  
    55Requires at least: 3.0.5
    66Tested up to: 7.1
    7 Stable tag: 1.3.0
     7Stable tag: 1.3.1
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    … …  
    587587== Changelog ==
    588588
     589= 1.3.1 =
     590
     591* Enhanced security in the plugin settings screens with additional authorization checks. Special thanks to AndrewN and the Wordfence team.
     592
    589593= 1.3.0 =
    590594
Note: See TracChangeset for help on using the changeset viewer.