Issues (1131)

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.

etc/phing/OlsonCompileTask.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
3
// +---------------------------------------------------------------------------+
4
// | This file is part of the Agavi package.                                   |
5
// | Copyright (c) 2005-2011 the Agavi Project.                                |
6
// |                                                                           |
7
// | For the full copyright and license information, please view the LICENSE   |
8
// | file that was distributed with this source code. You can also view the    |
9
// | LICENSE file online at http://www.agavi.org/LICENSE.txt                   |
10
// |   vi: set noexpandtab:                                                    |
11
// |   Local Variables:                                                        |
12
// |   indent-tabs-mode: t                                                     |
13
// |   End:                                                                    |
14
// +---------------------------------------------------------------------------+
15
16
class OlsonCompileTask extends Task
0 ignored issues
show
Coding Style Compatibility introduced by
PSR1 recommends that each class must be in a namespace of at least one level to avoid collisions.

You can fix this by adding a namespace to your class:

namespace YourVendor;

class YourClass { }

When choosing a vendor namespace, try to pick something that is not too generic to avoid conflicts with other libraries.

Loading history...
17
{
18
    private $olsonDir = '';
19
    private $outputDir = '';
20
21
    public function setOlsonDir($olsonDir)
22
    {
23
        $this->olsonDir = (string) $olsonDir;
24
    }
25
26
    public function setOutputDir($outputDir)
27
    {
28
        $this->outputDir = (string) $outputDir;
29
    }
30
31
    public function main()
32
    {
33
        set_time_limit(0);
34
35
        require_once('src/agavi.php');
36
37
        $this->olsonDir = realpath($this->olsonDir);
38
        $this->outputDir = realpath($this->outputDir);
39
40
        Config::set('olson.dir', $this->olsonDir);
41
42
        Config::set('core.app_dir', getcwd() . '/etc/olson/agavi/app');
43
        Agavi::bootstrap('');
44
45
        $context = AgaviContext::getInstance('');
46
47
        if (!$this->olsonDir || !file_exists($this->olsonDir)) {
48
            throw new BuildException('Olson data directory is not defined or does not exist.');
49
        }
50
51
        if (!$this->outputDir || !file_exists($this->outputDir)) {
52
            throw new BuildException('Timezone data output directory is not defined or does not exist.');
53
        }
54
55
        $this->log("Building compiling olson files in {$this->olsonDir} to {$this->outputDir}", PROJECT_MSG_INFO);
56
57
        $links = array();
58
        $zones = array();
59
60
        $di = new DirectoryIterator($this->olsonDir);
61
        foreach ($di as $file) {
62
            if ($file->isFile()) {
63
                // the file doesn't contain an extension so we parse it
64
                // and we don't want the factory time zone
65
                if (strpos($file->getFilename(), '.') === false && $file->getFilename() != 'factory') {
66
                    $this->log(sprintf('compiling %s', $file->getPathname()), PROJECT_MSG_INFO);
67
                    $parser = new TimeZoneDataParser();
68
                    $parser->initialize(AgaviContext::getInstance($context));
69
                    $rules = $parser->parse($file->getPathname());
70
                    $zones = $rules['zones'] + $zones;
71
                    $links = $rules['links'] + $links;
72
                }
73
            }
74
        }
75
76
        $baseCode = '<?php
77
78
/**
79
 * %s
80
 * %s
81
 *
82
 * @package    agavi
83
 * @subpackage translation
84
 *
85
 * @copyright  Authors
86
 * @copyright  The Agavi Project
87
 *
88
 * @since      0.11.0
89
 *
90
 * @version    $Id' . '$
91
 */
92
93
return %s;
94
95
?>';
96
97
        $zoneList = array();
98
99
        foreach ($zones as $name => $zone) {
100
            $fname = preg_replace('#([^a-z0-9_])#ie', "'_'.ord('\\1').'_'", $name) . '.php';
101
            $pathname = $this->outputDir . '/' . $fname;
102
            $zone['name'] = $name;
103
104
            $zoneList[$name] = array('type' => 'zone', 'filename' => $fname);
105
            $this->log('Writing zone ' . $name . ' to: ' . $pathname);
106
            file_put_contents(
107
                $pathname,
108
                sprintf(
109
                    $baseCode,
110
                    sprintf(
111
                        'Data file for timezone "%s".',
112
                        $name
113
                    ),
114
                    sprintf(
115
                        'Compiled from olson file "%s", version %s.',
116
                        $zone['source'],
117
                        $zone['version']
118
                    ),
119
                    var_export($zone, true)
120
                )
121
            );
122
        }
123
124
        foreach ($links as $from => $to) {
125
            $zoneList[$from] = array('type' => 'link', 'to' => $to);
126
        }
127
128
        $this->log('Writing zone listing to: ' . $this->outputDir . '/zonelist.php');
129
        file_put_contents(
130
            $this->outputDir . '/zonelist.php',
131
            sprintf(
132
                $baseCode,
133
                'Zone list file.',
134
                sprintf('Generated on %s.', gmdate('c')),
135
                var_export($zoneList, true)
136
            )
137
        );
138
    }
139
}
140