Issues (11)

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.

Classes/Controller/PopupController.php (1 issue)

Labels
Severity

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
namespace FRUIT\Popup\Controller;
4
5
use FRUIT\Popup\Popup;
6
use TYPO3\CMS\Core\Utility\GeneralUtility;
7
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
8
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
9
10
/**
11
 * Class PopupController
12
 *
13
 * @package FRUIT\Popup\Controller
14
 */
15
class PopupController extends ActionController
16
{
17
18
    /**
19
     * Same as class name
20
     */
21
    public $prefixId = 'tx_popup_pi1';
22
23
    /**
24
     * The extension key.
25
     */
26
    public $extKey = 'popup';
27
28
    /**
29
     * @var Popup
30
     */
31
    protected $popup;
32
33
    /**
34
     * @var array
35
     */
36
    protected $customParams = [];
37
38
    /**
39
     * Init the popup frontend plugin
40
     *
41
     * @return void
42
     */
43
    protected function init()
44
    {
45
        $this->popup = GeneralUtility::makeInstance('FRUIT\\Popup\\Popup');
46
        $this->allowedParams = $this->popup->allowedParams;
0 ignored issues
show
The property allowedParams does not exist. Did you maybe forget to declare it?

In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:

class MyClass { }

$x = new MyClass();
$x->foo = true;

Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion:

class MyClass {
    public $foo;
}

$x = new MyClass();
$x->foo = true;
Loading history...
47
        $this->customParams = $this->popup->advancedParams;
48
    } # function - init
49
50
    /**
51
     * Generate JS code for opening pop-up
52
     * Main Plugin function for T3
53
     *
54
     * @return string
55
     */
56
    public function indexAction()
57
    {
58
        // Init
59
        $this->init();
60
61
        $link = $this->configurationManager->getContentObject()->data['tx_popup_auto'];
62
        if (!$link) {
63
            return '';
64
        }
65
        // create the url
66
        $url = $this->configurationManager->getContentObject()
67
            ->getTypoLink_URL($link);
68
        if (!$url) {
69
            return '';
70
        }
71
72
        $ts = $this->configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
73
        $conf = $ts['plugin.']['tx_popup_pi1.'];
74
75
        // get session data
76
        if ($conf['advancedParams.']['once_per_session']) {
77
            $popups = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->prefixId);
78
            if ($conf['advancedParams.']['once_per_link']) {
79
                if ($popups['links'][$link]) {
80
                    return '';
81
                } else {
82
                    $popups['links'][$link] = 1;
83
                }
84
            } else {
85
                if ($popups['pages'][$GLOBALS['TSFE']->id]) { // we have been on the current page
86
                    return '';
87
                } else {
88
                    $popups['pages'][$GLOBALS['TSFE']->id] = 1;
89
                }
90
            }
91
            $GLOBALS['TSFE']->fe_user->setKey('ses', $this->prefixId, $popups);
92
        }
93
94
        $cParams = [];
95
        foreach ($this->customParams as $name => $type) {
96
            $v = $conf['advancedParams.'][$name];
97
            $cParams[$name] = ($v === '1' || $v == 'yes' || $v == 'on') ? true : false;
98
        }
99
100
        $params = (array)$conf['allowedParams.'];
101
        if ($cParams['maximize']) {
102
            $params['left'] = 0;
103
            $params['top'] = 0;
104
            $params['width'] = '\' + screen.width + \'';
105
            $params['height'] = '\' + screen.height + \'';
106
        } elseif ($cParams['center'] && $params['width'] > 0 && $params['height'] > 0) {
107
            $params['left'] = '\' + ((screen.width - ' . $params['width'] . ') / 2) + \'';
108
            $params['top'] = '\' + ((screen.height - ' . $params['height'] . ') / 2) + \'';
109
            $params['screenX'] = '\' + ((screen.width - ' . $params['width'] . ') / 2) + \'';
110
            $params['screenY'] = '\' + ((screen.height - ' . $params['height'] . ') / 2) + \'';
111
        }
112
113
        $params = $this->convertArrayToJsParams($params);
114
        return $this->getHtml($url, $params, $cParams);
115
    }
116
117
    /**
118
     * @param array $array
119
     * @return string
120
     */
121
    protected function convertArrayToJsParams(array $array)
122
    {
123
        $tmp_params = [];
124
        while (list($key, $val) = each($array)) {
125
            if (isset($val) && $val != '') {
126
                $tmp_params[] = $key . '=' . $val;
127
            }
128
        }
129
        return implode(",", $tmp_params);
130
    }
131
132
    /**
133
     * @param $url
134
     * @param $params
135
     * @param $cParams
136
     * @return string
137
     */
138
    protected function getHtml($url, $params, $cParams)
139
    {
140
        $window = uniqid('_popup_');
141
142
        $content = '<script type="text/javascript">';
143
        $content .= "var $window = window.open('$url', 'Window', '$params');\n";
144
        // thanks to Tom Binder for the timeout
145
        if ($cParams['popunder']) {
146
            $content .= "if ($window) { window.setTimeout('$window.blur()',500); window.focus(); }";
147
        } else {
148
            $content .= "if ($window) { window.setTimeout('$window.focus()',500); }";
149
        }
150
151
        return $content . "\n</script>\n";
152
    }
153
}
154