Issues (6)

Security Analysis    no request data  

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.

sfWidgetFormI18nSelect2ChoiceCountry.class.php (1 issue)

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
require_once(dirname(__FILE__) . '/../select2/Select2.class.php');
3
4
/**
5
 * This widget is designed to generate more user friendly autocomplete widgets.
6
 *
7
 * @package     symfony
8
 * @subpackage  widget
9
 * @link        https://github.com/19Gerhard85/sfSelect2WidgetsPlugin
10
 * @author      Ing. Gerhard Schranz <[email protected]>
11
 * @version     0.1 2013-03-11
12
 */
13 View Code Duplication
class sfWidgetFormI18nSelect2ChoiceCountry extends sfWidgetFormI18nChoiceCountry
0 ignored issues
show
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
14
{
15
    /**
16
     * Configures the current widget.
17
     *
18
     * Available options:
19
     *
20
     *  * url:            The URL to call to get the choices to use (required)
21
     *  * config:         A JavaScript array that configures the JQuery autocompleter widget
22
     *  * value_callback: A callback that converts the value before it is displayed
23
     *
24
     * @param array $options     An array of options
25
     * @param array $attributes  An array of default HTML attributes
26
     *
27
     * @see sfWidgetForm
28
     */
29
    protected function configure($options = array(), $attributes = array())
30
    {
31
        $this->addOption('width', sfConfig::get('sf_sfSelect2Widgets_width'));
32
33
        parent::configure($options, $attributes);
34
35
        if (!$this->getOption('culture')) {
36
            $this->setOption('culture', sfContext::getInstance()->getUser()->getCulture());
37
        }
38
    }
39
40
    public function getChoices()
41
    {
42
        $choices = parent::getChoices();
43
44
        if (count($choices) > 0 && isset($choices['']) && $choices[''] == '') {
45
            $choices[''] = '&nbsp;';
46
        }
47
48
        return $choices;
49
    }
50
51
    /**
52
     * @param  string $name        The element name
53
     * @param  string $value       The date displayed in this widget
54
     * @param  array  $attributes  An array of HTML attributes to be merged with the default HTML attributes
55
     * @param  array  $errors      An array of errors for the field
56
     *
57
     * @return string An HTML tag string
58
     *
59
     * @see sfWidgetForm
60
     */
61
    public function render($name, $value = null, $attributes = array(), $errors = array())
62
    {
63
        $id = $this->generateId($name);
64
65
        $return = parent::render($name, $value, $attributes, $errors);
66
67
        $return .= sprintf(<<<EOF
68
<script type="text/javascript">
69
function formatResult(item)
70
{
71
    return item.text;
72
}
73
74
jQuery("#%s").select2(
75
{
76
    width:              '%s',
77
    allowClear:         %s,
78
});
79
</script>
80
EOF
81
            ,
82
            $id,
83
            $this->getOption('width'),
84
            $this->getOption('add_empty') == true ? 'true' : 'false'
85
        );
86
87
        return $return;
88
    }
89
90
    /**
91
     * Gets the stylesheet paths associated with the widget.
92
     *
93
     * @return array An array of stylesheet paths
94
     */
95
    public function getStylesheets()
96
    {
97
        return Select2::addStylesheets();
98
    }
99
100
    /**
101
     * Gets the JavaScript paths associated with the widget.
102
     *
103
     * @return array An array of JavaScript paths
104
     */
105
    public function getJavascripts()
106
    {
107
        return Select2::addJavascripts($this->getOption('culture'));
108
    }
109
}
110