Issues (3445)

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.

_install/library/Controller.class.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
0 ignored issues
show
Coding Style Compatibility introduced by
For compatibility and reusability of your code, PSR1 recommends that a file should introduce either new symbols (like classes, functions, etc.) or have side-effects (like outputting something, or including other files), but not both at the same time. The first symbol is defined on line 18 and the first side effect is on line 14.

The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.

The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.

To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.

Loading history...
2
/**
3
 * @title            Controller Core Class
4
 *
5
 * @author           Pierre-Henry Soria <[email protected]>
6
 * @copyright        (c) 2012-2019, Pierre-Henry Soria. All Rights Reserved.
7
 * @license          GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.
8
 * @link             http://ph7cms.com
9
 * @package          PH7 / Install / Library
10
 */
11
12
namespace PH7;
13
14
defined('PH7') or die('Restricted access');
15
16
use Smarty;
17
18
abstract class Controller implements Controllable
19
{
20
    const PHP_TIMEZONE_DIRECTIVE = 'date.timezone';
21
    const VIEW_CACHE_LIFETIME = 24 * 3600; //thanks PHP5.6 for scalar expr in consts
22
23
    const SOFTWARE_NAME = 'pH7CMS';
24
    const DEFAULT_SITE_NAME = 'My Dating WebApp';
25
    const DEFAULT_ADMIN_USERNAME = 'administrator';
26
    const SOFTWARE_PREFIX_COOKIE_NAME = 'pH7';
27
    const SOFTWARE_WEBSITE = 'http://ph7cms.com';
28
    const SOFTWARE_REQUIREMENTS_URL = 'http://ph7cms.com/doc/en/requirements';
29
    const PAYPAL_DONATE_URL = 'https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=X457W3L7DAPC6';
30
    const PATREON_URL = 'https://www.patreon.com/bePatron?u=3534366';
31
    const SOFTWARE_AUTHOR = 'Pierre-Henry Soria';
32
    const AUTHOR_URL = 'https://github.com/pH-7';
33
    const SOFTWARE_GIT_REPO_URL = 'https://github.com/pH7Software/pH7-Social-Dating-CMS';
34
    const SOFTWARE_TWITTER = '@pH7Soft';
35
    const SOFTWARE_LICENSE = 'GNU General Public License; See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory.';
36
    const SOFTWARE_COPYRIGHT = '© (c) 2012-%s, Pierre-Henry Soria. All Rights Reserved.';
37
    const TOTAL_INSTALL_STEPS = 7;
38
39
    /**
40
     * VERSION NAMES:
41
     *
42
     * 1.0, 1.1 branches were "pOH", 1.2 was "pOW", 1.3, 1.4 were "p[H]", 2.* was "H2O", 3.* was "H3O", 4.* was "HCO",
43
     * 5.* was "pCO", 6.* was "WoW", 7.*, 8.* were "NaOH", 10.* was "pKa", 12.* was "PHS", 14.* was "pKb" amd 15.* is ABSOLUTEâ„¢
44
     */
45
    const SOFTWARE_VERSION_NAME = 'ABSOLUTEâ„¢';
46
    const SOFTWARE_VERSION = '15.0.0';
47
    const SOFTWARE_BUILD = '1';
48
49
    const DEFAULT_LANG = 'en';
50
    const DEFAULT_THEME = 'base';
51
52
    /** @var Smarty */
53
    protected $oView;
54
55
    /** @var string */
56
    protected $sCurrentLang;
57
58
    public function __construct()
59
    {
60
        global $LANG;
0 ignored issues
show
Compatibility Best Practice introduced by
Use of global functionality is not recommended; it makes your code harder to test, and less reusable.

Instead of relying on global state, we recommend one of these alternatives:

1. Pass all data via parameters

function myFunction($a, $b) {
    // Do something
}

2. Create a class that maintains your state

class MyClass {
    private $a;
    private $b;

    public function __construct($a, $b) {
        $this->a = $a;
        $this->b = $b;
    }

    public function myFunction() {
        // Do something
    }
}
Loading history...
61
62
        // Initialize PHP session
63
        $this->initializePHPSession();
64
65
        // Verify and correct the time zone if necessary
66
        $this->checkTimezone();
67
68
        // Language initialization
69
        $this->sCurrentLang = (new Language)->get();
70
        include_once PH7_ROOT_INSTALL . Language::LANG_FOLDER_NAME . $this->sCurrentLang . PH7_DS . Language::LANG_FILENAME;
71
72
        /* Smarty initialization */
73
        $this->oView = new Smarty;
74
        $this->oView->setUseSubDirs(true);
75
        $this->oView->setTemplateDir(PH7_ROOT_INSTALL . 'views/' . self::DEFAULT_THEME);
76
        $this->oView->setCompileDir(PH7_ROOT_INSTALL . 'data/caches/smarty_compile');
77
        $this->oView->setCacheDir(PH7_ROOT_INSTALL . 'data/caches/smarty_cache');
78
        $this->oView->setPluginsDir(PH7_ROOT_INSTALL . 'library/Smarty/plugins');
79
80
        // Smarty Cache
81
        $this->oView->setCaching(Smarty::CACHING_OFF);
82
        $this->oView->setCacheLifetime(self::VIEW_CACHE_LIFETIME);
83
84
        $this->oView->assign('LANG', $LANG);
85
        $this->oView->assign('software_name', self::SOFTWARE_NAME);
86
        $this->oView->assign('software_version', self::SOFTWARE_VERSION . ' ' . self::SOFTWARE_VERSION_NAME . ' - Build ' . self::SOFTWARE_BUILD);
87
        $this->oView->assign('software_website', self::SOFTWARE_WEBSITE);
88
        $this->oView->assign('paypal_donate_url', self::PAYPAL_DONATE_URL);
89
        $this->oView->assign('patreon_url', self::PATREON_URL);
90
        $this->oView->assign('software_author', self::SOFTWARE_AUTHOR);
91
        $this->oView->assign('software_copyright', sprintf(self::SOFTWARE_COPYRIGHT, date('Y')));
92
        $this->oView->assign('tpl_name', self::DEFAULT_THEME);
93
        $this->oView->assign('current_lang', $this->sCurrentLang);
94
        $this->oView->assign('total_install_steps', self::TOTAL_INSTALL_STEPS);
95
    }
96
97
    /**
98
     * Check if the session is already initialized (thanks "session_status()" PHP >= 5.4)
99
     * And initialize it if it isn't the case.
100
     *
101
     * @return void
102
     */
103
    protected function initializePHPSession()
104
    {
105
        if (session_status() !== PHP_SESSION_ACTIVE) {
106
            @session_start();
0 ignored issues
show
Security Best Practice introduced by
It seems like you do not handle an error condition here. This can introduce security issues, and is generally not recommended.

If you suppress an error, we recommend checking for the error condition explicitly:

// For example instead of
@mkdir($dir);

// Better use
if (@mkdir($dir) === false) {
    throw new \RuntimeException('The directory '.$dir.' could not be created.');
}
Loading history...
107
        }
108
    }
109
110
    /**
111
     * Set a default timezone if it is not already configured.
112
     *
113
     * @return void
114
     */
115
    protected function checkTimezone()
116
    {
117
        if (!ini_get(self::PHP_TIMEZONE_DIRECTIVE)) {
118
            date_default_timezone_set(PH7_DEFAULT_TIMEZONE);
119
        }
120
    }
121
}
122