Issues (4714)

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.

src/Intraface/Factory.php (14 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
class Intraface_Factory
3
{
4
    protected $config;
5
6
    function __construct($config = null)
7
    {
8
        $this->config = $config;
9
    }
10
11
    function new_k_TemplateFactory($c)
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
12
    {
13
        return new Intraface_TemplateFactory(null);
14
    }
15
16
    function new_MDB2($c)
17
    {
18
        return $this->new_MDB2_Driver_Common($c);
19
    }
20
21
    function new_MDB2_Driver_Common($container)
0 ignored issues
show
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
22
    {
23
        $db = MDB2::singleton(DB_DSN, array('persistent' => true));
24
        if (PEAR::isError($db)) {
25
            throw new Exception($db->getMessage() . $db->getUserInfo());
26
        }
27
28
        $db->setFetchMode(MDB2_FETCHMODE_ASSOC);
29
        $db->query('SET NAMES utf8');
30
        $res = $db->setCharset('utf8');
31
32
        $db->setOption('debug', MDB2_DEBUG);
33
        $db->setOption('portability', MDB2_PORTABILITY_NONE);
34
35
        if (PEAR::isError($res)) {
36
            throw new Exception($res->getUserInfo());
37
        }
38
39 View Code Duplication
        if ($db->getOption('debug')) {
40
            $db->setOption('log_line_break', "\n\n\n\n\t");
41
42
            $my_debug_handler = new MDB2_Debug_ExplainQueries($db);
43
            $db->setOption('debug_handler', array($my_debug_handler, 'collectInfo'));
44
45
            register_shutdown_function(array($my_debug_handler, 'executeAndExplain'));
46
            register_shutdown_function(array($my_debug_handler, 'dumpInfo'));
47
        }
48
49
        return $db;
50
    }
51
52
    function new_DB_Sql($container)
0 ignored issues
show
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
53
    {
54
        $db = new DB_Sql(DB_HOST, DB_USER, DB_PASS, DB_NAME);
55
        $db->query('SET NAMES utf8');
56
        return $db;
57
    }
58
59
    function new_Translation2()
60
    {
61
        // set the parameters to connect to your db
62
        $dbinfo = array(
63
            'hostspec' => DB_HOST,
64
            'database' => DB_NAME,
65
            'phptype'  => 'mysql',
66
            'username' => DB_USER,
67
            'password' => DB_PASS
68
        );
69
70
        if (!defined('LANGUAGE_TABLE_PREFIX')) {
71
            define('LANGUAGE_TABLE_PREFIX', 'core_translation_');
72
        }
73
74
        $params = array(
75
            'langs_avail_table' => LANGUAGE_TABLE_PREFIX.'langs',
76
            'strings_default_table' => LANGUAGE_TABLE_PREFIX.'i18n'
77
        );
78
79
        $translation = Translation2::factory('MDB2', $dbinfo, $params);
80
        //always check for errors. In this examples, error checking is omitted
81
        //to make the example concise.
82
        if (PEAR::isError($translation)) {
83
            throw new Exception('Could not start Translation ' . $translation->getMessage());
84
        }
85
86
        // set the group of strings you want to fetch from
87
        // $translation->setPageID($page_id);
0 ignored issues
show
Unused Code Comprehensibility introduced by
75% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
88
89
        // add a Lang decorator to provide a fallback language
90
        // $translation = $translation->getDecorator('Lang');
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
91
        // $translation->setOption('fallbackLang', 'uk');
0 ignored issues
show
Unused Code Comprehensibility introduced by
73% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
92
        // $translation = $translation->getDecorator('LogMissingTranslation');
0 ignored issues
show
Unused Code Comprehensibility introduced by
59% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
93
        // $translation->setOption('logger', array(new ErrorHandler_Observer_File(ERROR_LOG), 'update'));
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
94
        $translation = $translation->getDecorator('DefaultText');
95
96
        // %stringID% will be replaced with the stringID
97
        // %pageID_url% will be replaced with the pageID
98
        // %stringID_url% will replaced with a urlencoded stringID
99
        // %url% will be replaced with the targeted url
100
        //$this->translation->outputString = '%stringID% (%pageID_url%)'; //default: '%stringID%'
0 ignored issues
show
Unused Code Comprehensibility introduced by
46% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
101
        $translation->outputString = '%stringID%';
102
        $translation->url = '';           //same as default
103
        $translation->emptyPrefix  = '';  //default: empty string
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
104
        $translation->emptyPostfix = '';  //default: empty string
0 ignored issues
show
Unused Code Comprehensibility introduced by
50% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
105
        return $translation;
106
    }
107
108
    function new_Translation2_Cache()
109
    {
110
        $options = array(
111
            "cacheDir" => PATH_CACHE.'translation/',
112
            "lifeTime" => 3600
113
        );
114
        return new Cache_Lite($options);
115
    }
116
117
    function new_Intraface_Auth($container)
0 ignored issues
show
The parameter $container is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
118
    {
119
        return new Intraface_Auth(session_id());
120
    }
121
122
    function new_Doctrine_Connection_Common()
123
    {
124
        $connection = Doctrine_Manager::connection(DB_DSN);
125
        $connection->setCharset('utf8');
126
        return $connection;
127
    }
128
129
    function new_Swift_Message($c)
0 ignored issues
show
The parameter $c is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
130
    {
131
        return Swift_Message::newInstance();
132
    }
133
134
    function new_Swift_Mailer($c)
135
    {
136
        return Swift_Mailer::newInstance($this->new_Swift_Transport($c));
0 ignored issues
show
The call to Intraface_Factory::new_Swift_Transport() has too many arguments starting with $c.

This check compares calls to functions or methods with their respective definitions. If the call has more arguments than are defined, it raises an issue.

If a function is defined several times with a different number of parameters, the check may pick up the wrong definition and report false positives. One codebase where this has been known to happen is Wordpress.

In this case you can add the @ignore PhpDoc annotation to the duplicate definition and it will be ignored.

Loading history...
137
    }
138
139
    function new_Swift_Transport()
140
    {
141
        return Swift_MailTransport::newInstance();
142
    }
143
144
    function new_Cache_Lite()
145
    {
146
        $options = array(
147
            'cacheDir' => PATH_CACHE,
148
            'lifeTime' => 3600
149
        );
150
151
        return new Cache_Lite($options);
152
    }
153
}
154