Issues (125)

Security Analysis    not enabled

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

code/MappableData.php (3 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/*
4
 * Provides a GoogleMap() function to ViewableData objects.
5
 *
6
 * @author Uncle Cheese
7
 * @package mappable
8
 */
9
class MappableData extends Extension
10
{
11
    /**
12
     * Optional template values for the map info windows.
13
     */
14
    private $MarkerTemplateValues = null;
15
16
    /**
17
     * URL of static maps api.
18
     *
19
     * @var string
20
     */
21
    private static $staticmap_api_url = '//maps.googleapis.com/maps/api/staticmap';
22
23
    /**
24
     * Default zoom for static map.
25
     *
26
     * @var int
27
     */
28
    private static $staticmap_default_zoom = 13;
29
30
    /**
31
     * Pass through values to the markers so that when rendering the map info windows, these
32
     * parameters are available to the template.  This is of course optional.
33
     *
34
     * @param array $values hash array of template key to template value
35
     */
36 1
    public function setMarkerTemplateValues($values)
37
    {
38 1
        $this->MarkerTemplateValues = $values;
39 1
    }
40
41 32
    public function getRenderableMap($width = null, $height = null, $zoom = 9)
42
    {
43 32
        $gmap = MapUtil::get_map(new ArrayList(array($this->owner)), $this->MarkerTemplateValues);
44 32
        $w = $width ? $width : MapUtil::$map_width;
45 32
        $h = $height ? $height : MapUtil::$map_height;
46 32
        $gmap->setSize($w, $h);
47 32
        $gmap->setZoom($zoom);
48 32
        $gmap->setEnableAutomaticCenterZoom(false);
49 32
        if ($this->owner->MapPinEdited) {
0 ignored issues
show
The property MapPinEdited does not seem to exist in SS_Object.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
50 4
            $gmap->setLatLongCenter(array(
51 4
                'lat' => $this->owner->getMappableLatitude(),
52 4
                'lng' => $this->owner->getMappableLongitude(),
53 4
            ));
54 4
        }
55
56 32
        return $gmap;
57
    }
58
59
    /**
60
     * returns an <img> with a src set to a static map picture.
61
     *
62
     * You can use MappableData.staticmap_api_url config var to set the domain of the static map.
63
     * You can use MappableData.staticmap_default_zoom config var to set the default zoom for the static map.
64
     *
65
     * @uses Mappable::getMappableMapPin() to draw a special marker, be sure this image is publicly available
66
     *
67
     * @param int $width
68
     * @param int $height
69
     *
70
     * @return string
71
     */
72 5
    public function StaticMap($width, $height, $zoom = null, $mapType = 'roadmap')
0 ignored issues
show
Method name "MappableData::StaticMap" is not in camel caps format
Loading history...
73
    {
74 5
        $lat = $this->owner->getMappableLatitude();
75 5
        $lng = $this->owner->getMappableLongitude();
76 5
        $pin = $this->owner->getMappableMapPin();
77
78
        // use provided zoom or set a default
79 5
        if ($zoom == null) {
80 3
            $zoom = Config::inst()->get('MappableData', 'staticmap_default_zoom');
81 3
        }
82
83
        //https://maps.googleapis.com/maps/api/staticmap?center=Berkeley,CA&zoom=14&size=400x400&key=YOUR_API_KEY
84
        //maps.googleapis.com/maps/api/staticmap';
85
86 5
        $apiurl = Config::inst()->get('MappableData', 'staticmap_api_url');
87
88
        $urlparts = array(
89 5
            'center' => "$lat,$lng",
90 5
            'markers' => "$lat,$lng",
91 5
            'zoom' => $zoom,
92 5
            'size' => "{$width}x{$height}",
93 5
            'sensor' => 'false', //@todo: make sensor param configurable
94 5
            'maptype' => $mapType,
95 5
        );
96 5
        if ($pin) {
97 1
            $urlparts['markers'] = "icon:$pin|$lat,$lng";
98 1
        }
99
100 5
        $src = htmlentities($apiurl.'?'.http_build_query($urlparts));
101
102 5
        return '<img src="'.$src.'" width="'.$width.'" height="'.$height.'" alt="'.$this->owner->Title.'" />';
0 ignored issues
show
The property Title does not seem to exist in SS_Object.

An attempt at access to an undefined property has been detected. This may either be a typographical error or the property has been renamed but there are still references to its old name.

If you really want to allow access to undefined properties, you can define magic methods to allow access. See the php core documentation on Overloading.

Loading history...
103
    }
104
}
105