Completed
Branch master (09e186)
by Pierre-Henry
51:26 queued 16:32
created

InstallController::removeCookies()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 4
nc 1
nop 0
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
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 13.

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            InstallController Class
4
 *
5
 * @author           Pierre-Henry Soria <[email protected]>
6
 * @copyright        (c) 2012-2017, 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
 * @package          PH7 / Install / Controller
9
 */
10
11
namespace PH7;
12
13
defined('PH7') or exit('Restricted access');
14
15
// Reset the time limit
16
@set_time_limit(0);
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...
17
18
class InstallController extends Controller
19
{
20
    /**
21
     * Enable/Disable Modules according to the chosen niche
22
     */
23
    const SOCIAL_MODS = [
24
        'connect' => '0',
25
        'affiliate' => '0',
26
        'game' => '1',
27
        'chat' => '0',
28
        'chatroulette' => '0',
29
        'picture' => '1',
30
        'video' => '1',
31
        'hotornot' => '0',
32
        'forum' => '1',
33
        'note' => '1',
34
        'blog' => '1',
35
        'newsletter' => '0',
36
        'invite' => '1',
37
        'webcam' => '1',
38
        'love-calculator' => '0',
39
        'mail' => '1',
40
        'im' => '0',
41
        'user-dashboard' => '0',
42
        'related-profile' => '1',
43
        'friend' => '1'
44
    ];
45
46
    const DATING_MODS = [
47
        'connect' => '0',
48
        'affiliate' => '1',
49
        'game' => '0',
50
        'chat' => '1',
51
        'chatroulette' => '1',
52
        'picture' => '1',
53
        'video' => '0',
54
        'hotornot' => '1',
55
        'forum' => '0',
56
        'note' => '0',
57
        'blog' => '1',
58
        'newsletter' => '1',
59
        'invite' => '0',
60
        'webcam' => '0',
61
        'love-calculator' => '1',
62
        'mail' => '1',
63
        'im' => '1',
64
        'user-dashboard' => '1',
65
        'related-profile' => '1',
66
        'friend' => '0'
67
    ];
68
69
    /**
70
     * Enable/Disable Site Settings according to the chosen niche
71
     */
72
    const SOCIAL_SETTINGS = [
73
        'social_media_widgets' => '1'
74
    ];
75
76
    const DATING_SETTINGS = [
77
        'social_media_widgets' => '0'
78
    ];
79
80
81
    /********************* STEP 1 *********************/
82
    public function index()
83
    {
84
        $aLangs = get_dir_list(PH7_ROOT_INSTALL . 'langs/');
85
        $aLangsList = include PH7_ROOT_INSTALL . 'inc/lang_list.inc.php';
86
        $sLangSelect = '';
87
88
        foreach ($aLangs as $sLang) {
89
            $sSel = (empty($_REQUEST['l']) ? $sLang == $this->sCurrentLang ? '" selected="selected' : '' : ($sLang == $_REQUEST['l']) ? '" selected="selected' : '');
90
            $sLangSelect .= '<option value="?l=' . $sLang . $sSel . '">' . $aLangsList[$sLang] . '</option>';
91
        }
92
93
        $this->oView->assign('lang_select', $sLangSelect);
94
        $this->oView->assign('sept_number', 1);
95
        $this->oView->display('index.tpl');
96
    }
97
98
    /********************* STEP 2 *********************/
99
    public function config_path()
100
    {
101
        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...
102
103
        if (empty($_SESSION['val']['path_protected']))
104
            $_SESSION['val']['path_protected'] = PH7_ROOT_PUBLIC . '_protected' . PH7_DS;
105
106
        if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['path_protected'])) {
107
            $_SESSION['val']['path_protected'] = check_ext_start(check_ext_end(trim($_POST['path_protected'])));
108
109
            if (is_dir($_SESSION['val']['path_protected'])) {
110
                if (is_readable($_SESSION['val']['path_protected'])) {
111
                    $sConstantContent = file_get_contents(PH7_ROOT_INSTALL . 'data/configs/constants.php');
112
113
                    $sConstantContent = str_replace('%path_protected%', addslashes($_SESSION['val']['path_protected']), $sConstantContent);
114
115
                    if (!@file_put_contents(PH7_ROOT_PUBLIC . '_constants.php', $sConstantContent)) {
116
                        $aErrors[] = $LANG['no_public_writable'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
117
                    } else {
118
                        $_SESSION['step2'] = 1;
119
                        unset($_SESSION['val']);
120
121
                        redirect(PH7_URL_SLUG_INSTALL . 'config_system');
122
                    }
123
                } else {
124
                    $aErrors[] = $LANG['no_protected_readable'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
125
                }
126
            } else {
127
                $aErrors[] = $LANG['no_protected_exist'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
128
            }
129
        }
130
131
        $this->oView->assign('sept_number', 2);
132
        $this->oView->assign('errors', @$aErrors);
0 ignored issues
show
Bug introduced by
The variable $aErrors does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
133
        unset($aErrors);
134
        $this->oView->display('config_path.tpl');
135
    }
136
137
    /********************* STEP 3 *********************/
138
    public function config_system()
139
    {
140
        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...
141
142
        if (!empty($_SESSION['step2']) && is_file(PH7_ROOT_PUBLIC . '_constants.php')) {
143
            session_regenerate_id(true);
144
145
            if (empty($_SESSION['val'])) {
146
                $_SESSION['db']['type_name'] = 'MySQL';
147
                $_SESSION['db']['type'] = 'mysql';
148
                $_SESSION['db']['hostname'] = 'localhost';
149
                $_SESSION['db']['username'] = 'root';
150
                $_SESSION['db']['name'] = 'ph7cms';
151
                $_SESSION['db']['prefix'] = 'PH7_';
152
                $_SESSION['db']['port'] = '3306';
153
                $_SESSION['db']['charset'] = 'UTF8';
154
155
                $_SESSION['val']['bug_report_email'] = '';
156
                $_SESSION['val']['ffmpeg_path'] = ffmpeg_path();
157
            }
158
159
            if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['config_system_submit'])) {
160
                if (filled_out($_POST)) {
161
                    foreach ($_POST as $sKey => $sVal) {
162
                        $_SESSION['db'][str_replace('db_', '', $sKey)] = trim($sVal);
163
                    }
164
165
                    $_SESSION['val']['bug_report_email'] = trim($_POST['bug_report_email']);
166
                    $_SESSION['val']['ffmpeg_path'] = trim($_POST['ffmpeg_path']);
167
168
                    if (validate_email($_SESSION['val']['bug_report_email'])) {
169
                        try {
170
                            require_once PH7_ROOT_INSTALL . 'inc/_db_connect.inc.php';
171
                            @require_once PH7_ROOT_PUBLIC . '_constants.php';
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...
172
                            @require_once PH7_PATH_APP . 'configs/constants.php';
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...
173
174
                            // Config File
175
                            @chmod(PH7_PATH_APP_CONFIG, 0777);
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...
176
                            $sConfigContent = file_get_contents(PH7_ROOT_INSTALL . 'data/configs/config.ini');
177
178
                            $sConfigContent = str_replace('%bug_report_email%', $_SESSION['val']['bug_report_email'], $sConfigContent);
179
                            $sConfigContent = str_replace('%ffmpeg_path%', clean_string($_SESSION['val']['ffmpeg_path']), $sConfigContent);
180
181
                            $sConfigContent = str_replace('%db_type_name%', $_SESSION['db']['type_name'], $sConfigContent);
182
                            $sConfigContent = str_replace('%db_type%', $_SESSION['db']['type'], $sConfigContent);
183
                            $sConfigContent = str_replace('%db_hostname%', $_SESSION['db']['hostname'], $sConfigContent);
184
                            $sConfigContent = str_replace('%db_username%', clean_string($_SESSION['db']['username']), $sConfigContent);
185
                            $sConfigContent = str_replace('%db_password%', clean_string($_SESSION['db']['password']), $sConfigContent);
186
                            $sConfigContent = str_replace('%db_name%', clean_string($_SESSION['db']['name']), $sConfigContent);
187
                            $sConfigContent = str_replace('%db_prefix%', clean_string($_SESSION['db']['prefix']), $sConfigContent);
188
                            $sConfigContent = str_replace('%db_charset%', $_SESSION['db']['charset'], $sConfigContent);
189
                            $sConfigContent = str_replace('%db_port%', $_SESSION['db']['port'], $sConfigContent);
190
191
                            $sConfigContent = str_replace('%private_key%', generate_hash(40), $sConfigContent);
192
                            $sConfigContent = str_replace('%rand_id%', generate_hash(5), $sConfigContent);
193
194
                            if (!@file_put_contents(PH7_PATH_APP_CONFIG . 'config.ini', $sConfigContent)) {
195
                                $aErrors[] = $LANG['no_app_config_writable'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
196
                            } else {
197
                                if (
198
                                    !($DB->getAttribute(\PDO::ATTR_DRIVER_NAME) == 'mysql' &&
199
                                    version_compare($DB->getAttribute(\PDO::ATTR_SERVER_VERSION), PH7_REQUIRE_SQL_VERSION, '>='))
200
                                ) {
201
                                    $aErrors[] = $LANG['require_mysql_version'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
202
                                } else {
203
                                    $aDumps = [
204
                                        /*** Game ***/
205
                                        // We need to install the Game before the Core SQL for "foreign keys" that work are correct.
206
                                        'pH7_SchemaGame',
207
                                        'pH7_DataGame',
208
                                        /*** Core ***/
209
                                        'pH7_Core',
210
                                        // --- GeoIp (exec_query_file() function executes these files only if they existens otherwise it does nothing) --- //
211
                                        'pH7_GeoCountry',
212
                                        'pH7_GeoCity',
213
                                        'pH7_GeoCity2',
214
                                        'pH7_GeoCity3',
215
                                        'pH7_GeoCity4',
216
                                        'pH7_GeoCity5',
217
                                        'pH7_GeoCity6',
218
                                        'pH7_GeoCity7',
219
                                        'pH7_GeoCity8',
220
                                        'pH7_GeoState',
221
                                        // --- Execute this file if there is something --- //
222
                                        'pH7_SampleData'
223
                                    ];
224
225
                                    for ($i = 0, $iCount = count($aDumps); $i < $iCount; $i++)
226
                                        exec_query_file($DB, PH7_ROOT_INSTALL . 'data/sql/' . $_SESSION['db']['type_name'] . '/' . $aDumps[$i] . '.sql');
0 ignored issues
show
Bug introduced by
The variable $DB does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
227
228
                                    unset($DB);
229
230
                                    $_SESSION['step3'] = 1;
231
                                    unset($_SESSION['val']);
232
233
                                    redirect(PH7_URL_SLUG_INSTALL . 'config_site');
234
                                }
235
                            }
236
                        } catch (\PDOException $oE) {
237
                            $aErrors[] = $LANG['database_error'] . escape($oE->getMessage());
0 ignored issues
show
Bug introduced by
The variable $aErrors does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
238
                        }
239
                    } else {
240
                        $aErrors[] = $LANG['bad_email'];
241
                    }
242
                } else {
243
                    $aErrors[] = $LANG['all_fields_mandatory'];
244
                }
245
            }
246
        } else {
247
            redirect(PH7_URL_SLUG_INSTALL . 'config_path');
248
        }
249
250
        $this->oView->assign('sept_number', 3);
251
        $this->oView->assign('errors', @$aErrors);
252
        unset($aErrors);
253
        $this->oView->display('config_system.tpl');
254
    }
255
256
    /********************* STEP 4 *********************/
257
    public function config_site()
258
    {
259
        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...
260
261
        if (empty($_SESSION['step4'])) {
262
            if (!empty($_SESSION['step3']) && is_file(PH7_ROOT_PUBLIC . '_constants.php')) {
263
                session_regenerate_id(true);
264
265
                if (empty($_SESSION['val'])) {
266
                    $_SESSION['val']['site_name'] = Controller::DEFAULT_SITE_NAME;
267
                    $_SESSION['val']['admin_login_email'] = '';
268
                    $_SESSION['val']['admin_email'] = '';
269
                    $_SESSION['val']['admin_feedback_email'] = '';
270
                    $_SESSION['val']['admin_return_email'] = '';
271
                    $_SESSION['val']['admin_username'] = 'administrator';
272
                    $_SESSION['val']['admin_first_name'] = '';
273
                    $_SESSION['val']['admin_last_name'] = '';
274
                }
275
276
                if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['config_site_submit'])) {
277
                    if (filled_out($_POST)) {
278
                        foreach ($_POST as $sKey => $sVal) {
279
                            $_SESSION['val'][$sKey] = trim($sVal);
280
                        }
281
282
                        if (validate_email($_SESSION['val']['admin_login_email']) && validate_email($_SESSION['val']['admin_email']) && validate_email($_SESSION['val']['admin_feedback_email']) && validate_email($_SESSION['val']['admin_return_email'])) {
283
                            if (validate_username($_SESSION['val']['admin_username']) == 0) {
284
                                if (validate_password($_SESSION['val']['admin_password']) == 0) {
285
                                    if (validate_identical($_SESSION['val']['admin_password'], $_SESSION['val']['admin_passwords'])) {
286
                                        if (!find($_SESSION['val']['admin_password'], $_SESSION['val']['admin_username']) && !find($_SESSION['val']['admin_password'], $_SESSION['val']['admin_first_name']) && !find($_SESSION['val']['admin_password'], $_SESSION['val']['admin_last_name'])) {
287
                                            if (validate_name($_SESSION['val']['admin_first_name'])) {
288
                                                if (validate_name($_SESSION['val']['admin_last_name'])) {
289
                                                    @require_once PH7_ROOT_PUBLIC . '_constants.php';
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...
290
                                                    @require_once PH7_PATH_APP . 'configs/constants.php';
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...
291
292
                                                    require PH7_PATH_APP . 'includes/helpers/misc.php';
293
                                                    require PH7_PATH_FRAMEWORK . 'Loader/Autoloader.php';
294
                                                    // To load "\PH7\Framework\Security\Security" class
295
                                                    Framework\Loader\Autoloader::getInstance()->init();
296
297
                                                    try {
298
                                                        require_once PH7_ROOT_INSTALL . 'inc/_db_connect.inc.php';
299
300
                                                        // SQL EXECUTE
301
                                                        $rStmt = $DB->prepare('INSERT INTO ' . $_SESSION['db']['prefix'] . 'Admins
0 ignored issues
show
Bug introduced by
The variable $DB does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
302
                                                        (profileId , username, password, email, firstName, lastName, joinDate, lastActivity, ip)
303
                                                        VALUES (1, :username, :password, :email, :firstName, :lastName, :joinDate, :lastActivity, :ip)');
304
305
                                                        $sCurrentDate = date('Y-m-d H:i:s');
306
                                                        $rStmt->execute([
307
                                                            'username' => $_SESSION['val']['admin_username'],
308
                                                            'password' => Framework\Security\Security::hashPwd($_SESSION['val']['admin_password']),
309
                                                            'email' => $_SESSION['val']['admin_login_email'],
310
                                                            'firstName' => $_SESSION['val']['admin_first_name'],
311
                                                            'lastName' => $_SESSION['val']['admin_last_name'],
312
                                                            'joinDate' => $sCurrentDate,
313
                                                            'lastActivity' => $sCurrentDate,
314
                                                            'ip' => client_ip()
315
                                                        ]);
316
317
                                                        $rStmt = $DB->prepare('UPDATE ' . $_SESSION['db']['prefix'] . 'Settings SET value = :siteName WHERE name = \'siteName\' LIMIT 1');
318
                                                        $rStmt->execute(['siteName' => $_SESSION['val']['site_name']]);
319
320
                                                        $rStmt = $DB->prepare('UPDATE ' . $_SESSION['db']['prefix'] . 'Settings SET value = :adminEmail WHERE name = \'adminEmail\'  LIMIT 1');
321
                                                        $rStmt->execute(['adminEmail' => $_SESSION['val']['admin_email']]);
322
323
                                                        $rStmt = $DB->prepare('UPDATE ' . $_SESSION['db']['prefix'] . 'Settings SET value = :feedbackEmail WHERE name = \'feedbackEmail\'  LIMIT 1');
324
                                                        $rStmt->execute(['feedbackEmail' => $_SESSION['val']['admin_feedback_email']]);
325
326
                                                        $rStmt = $DB->prepare('UPDATE ' . $_SESSION['db']['prefix'] . 'Settings SET value = :returnEmail WHERE name = \'returnEmail\'  LIMIT 1');
327
                                                        $rStmt->execute(['returnEmail' => $_SESSION['val']['admin_return_email']]);
328
329
                                                        // We finalise by putting the correct permission to the config files
330
                                                        $this->chmodConfigFiles();
331
332
                                                        $_SESSION['step4'] = 1;
333
334
                                                        redirect(PH7_URL_SLUG_INSTALL . 'niche');
335
                                                    } catch (\PDOException $oE) {
336
                                                        $aErrors[] = $LANG['database_error'] . escape($oE->getMessage());
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
337
                                                    }
338
                                                } else {
339
                                                    $aErrors[] = $LANG['bad_last_name'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
340
                                                }
341
                                            } else {
342
                                                $aErrors[] = $LANG['bad_first_name'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
343
                                            }
344
                                        } else {
345
                                            $aErrors[] = $LANG['insecure_password'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
346
                                        }
347
                                    } else {
348
                                        $aErrors[] = $LANG['passwords_different'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
349
                                    }
350
                                } elseif (validate_password($_SESSION['val']['admin_password']) == 1) {
351
                                    $aErrors[] = $LANG['password_too_short'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
352
                                } elseif (validate_password($_SESSION['val']['admin_password']) == 2) {
353
                                    $aErrors[] = $LANG['password_too_long'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
354
                                } elseif (validate_password($_SESSION['val']['admin_password']) == 3) {
355
                                    $aErrors[] = $LANG['password_no_number'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
356
                                } elseif (validate_password($_SESSION['val']['admin_password']) == 4) {
357
                                    $aErrors[] = $LANG['password_no_upper'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
358
                                }
359
                            } elseif (validate_username($_SESSION['val']['admin_username']) == 1) {
360
                                $aErrors[] = $LANG['username_too_short'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
361
                            } elseif (validate_username($_SESSION['val']['admin_username']) == 2) {
362
                                $aErrors[] = $LANG['username_too_long'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
363
                            } elseif (validate_username($_SESSION['val']['admin_username']) == 3) {
364
                                $aErrors[] = $LANG['bad_username'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
365
                            }
366
                        } else {
367
                            $aErrors[] = $LANG['bad_email'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
368
                        }
369
                    } else {
370
                        $aErrors[] = $LANG['all_fields_mandatory'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
371
                    }
372
                }
373
            } else {
374
                redirect(PH7_URL_SLUG_INSTALL . 'config_system');
375
            }
376
        } else {
377
            redirect(PH7_URL_SLUG_INSTALL . 'niche');
378
        }
379
380
        $this->oView->assign('def_site_name', Controller::DEFAULT_SITE_NAME);
381
        $this->oView->assign('sept_number', 4);
382
        $this->oView->assign('errors', @$aErrors);
0 ignored issues
show
Bug introduced by
The variable $aErrors does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
383
        unset($aErrors);
384
        $this->oView->display('config_site.tpl');
385
    }
386
387
    /********************* STEP 5 *********************/
388
    public function niche()
389
    {
390
        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...
391
392
        if (empty($_SESSION['step5'])) {
393
            if (!empty($_SESSION['step4']) && is_file(PH7_ROOT_PUBLIC . '_constants.php')) {
394
                session_regenerate_id(true);
395
396
                if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['niche_submit'])) {
397
                    $bUpdateNeeded = false; // Value by default. Don't need to update the DB for the Social-Dating Niche
398
399
                    switch ($_POST['niche_submit']) {
400
                        case 'zendate':
401
                            $bUpdateNeeded = true;
402
                            $sTheme = 'zendate';
403
                            $aModUpdate = self::SOCIAL_MODS;
404
                            $aSettingUpdate = self::SOCIAL_SETTINGS;
405
                            break;
406
407
                        case 'datelove':
408
                            $bUpdateNeeded = true;
409
                            $sTheme = 'datelove';
410
                            $aModUpdate = self::DATING_MODS;
411
                            $aSettingUpdate = self::DATING_SETTINGS;
412
                            break;
413
414
                        // Or for 'base', don't do anything. Just use the default settings already setup in the database
415
                    }
416
417
                    if ($bUpdateNeeded) {
418
                        @require_once PH7_ROOT_PUBLIC . '_constants.php';
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...
419
                        @require_once PH7_PATH_APP . 'configs/constants.php';
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...
420
421
                        require PH7_PATH_APP . 'includes/helpers/misc.php';
422
                        require PH7_PATH_FRAMEWORK . 'Loader/Autoloader.php';
423
                        // To load "PH7\Framework\Mvc\Model\DbConfig" class
424
                        Framework\Loader\Autoloader::getInstance()->init();
425
426
                        try {
427
                            require_once PH7_ROOT_INSTALL . 'inc/_db_connect.inc.php';
428
429
                            // Enable/Disable the modules according to the chosen niche
430
                            foreach ($aModUpdate as $sModName => $sStatus)
0 ignored issues
show
Bug introduced by
The variable $aModUpdate does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
431
                                $this->updateMods($DB, $sModName, $sStatus);
0 ignored issues
show
Bug introduced by
The variable $DB does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
432
433
                            $this->updateSettings($aSettingUpdate);
0 ignored issues
show
Bug introduced by
The variable $aSettingUpdate does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
434
435
                            // Set the theme for the chosen niche
436
                            $sSql = 'UPDATE ' . $_SESSION['db']['prefix'] . 'Settings SET value = :theme WHERE name = \'defaultTemplate\' LIMIT 1';
437
                            $rStmt = $DB->prepare($sSql);
438
                            $rStmt->execute(['theme' => $sTheme]);
0 ignored issues
show
Bug introduced by
The variable $sTheme does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
439
                        } catch (\PDOException $oE) {
440
                            $aErrors[] = $LANG['database_error'] . escape($oE->getMessage());
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
441
                        }
442
                    }
443
                    $_SESSION['step5'] = 1;
444
445
                    redirect(PH7_URL_SLUG_INSTALL . 'service');
446
                }
447
            } else {
448
                redirect(PH7_URL_SLUG_INSTALL . 'config_site');
449
            }
450
        } else {
451
            redirect(PH7_URL_SLUG_INSTALL . 'service');
452
        }
453
454
        $this->oView->assign('sept_number', 5);
455
        $this->oView->assign('errors', @$aErrors);
0 ignored issues
show
Bug introduced by
The variable $aErrors does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
456
        unset($aErrors);
457
        $this->oView->display('niche.tpl');
458
    }
459
460
    /********************* STEP 6 *********************/
461
    public function service()
462
    {
463
        $this->oView->assign('sept_number', 6);
464
        $this->oView->display('service.tpl');
465
    }
466
467
    /********************* STEP 7 *********************/
468
    public function license()
469
    {
470
        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...
471
472
        if (!empty($_SESSION['step5']) && is_file(PH7_ROOT_PUBLIC . '_constants.php')) {
473
            if (empty($_SESSION['val']['license']))
474
                $_SESSION['val']['license'] = '';
475
476
            if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($_POST['license'])) {
477
                $sKey = trim($_POST['license']);
478
                if (check_license($sKey)) {
479
                    @require_once PH7_ROOT_PUBLIC . '_constants.php';
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...
480
                    @require_once PH7_PATH_APP . 'configs/constants.php';
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...
481
482
                    try {
483
                        require_once PH7_ROOT_INSTALL . 'inc/_db_connect.inc.php';
484
485
                        $rStmt = $DB->prepare('UPDATE ' . $_SESSION['db']['prefix'] . 'License SET licenseKey = :key WHERE licenseId = 1');
0 ignored issues
show
Bug introduced by
The variable $DB does not exist. Did you forget to declare it?

This check marks access to variables or properties that have not been declared yet. While PHP has no explicit notion of declaring a variable, accessing it before a value is assigned to it is most likely a bug.

Loading history...
486
                        $rStmt->execute(['key' => $sKey]);
487
488
                        redirect(PH7_URL_SLUG_INSTALL . 'finish');
489
                    } catch (\PDOException $oE) {
490
                        $aErrors[] = $LANG['database_error'] . escape($oE->getMessage());
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
491
                    }
492
                } else {
493
                    $aErrors[] = $LANG['failure_license'];
0 ignored issues
show
Coding Style Comprehensibility introduced by
$aErrors was never initialized. Although not strictly required by PHP, it is generally a good practice to add $aErrors = array(); before regardless.

Adding an explicit array definition is generally preferable to implicit array definition as it guarantees a stable state of the code.

Let’s take a look at an example:

foreach ($collection as $item) {
    $myArray['foo'] = $item->getFoo();

    if ($item->hasBar()) {
        $myArray['bar'] = $item->getBar();
    }

    // do something with $myArray
}

As you can see in this example, the array $myArray is initialized the first time when the foreach loop is entered. You can also see that the value of the bar key is only written conditionally; thus, its value might result from a previous iteration.

This might or might not be intended. To make your intention clear, your code more readible and to avoid accidental bugs, we recommend to add an explicit initialization $myArray = array() either outside or inside the foreach loop.

Loading history...
494
                }
495
            }
496
        } else {
497
            redirect(PH7_URL_SLUG_INSTALL . 'niche');
498
        }
499
500
        $this->oView->assign('sept_number', 7);
501
        $this->oView->assign('errors', @$aErrors);
0 ignored issues
show
Bug introduced by
The variable $aErrors does not seem to be defined for all execution paths leading up to this point.

If you define a variable conditionally, it can happen that it is not defined for all execution paths.

Let’s take a look at an example:

function myFunction($a) {
    switch ($a) {
        case 'foo':
            $x = 1;
            break;

        case 'bar':
            $x = 2;
            break;
    }

    // $x is potentially undefined here.
    echo $x;
}

In the above example, the variable $x is defined if you pass “foo” or “bar” as argument for $a. However, since the switch statement has no default case statement, if you pass any other value, the variable $x would be undefined.

Available Fixes

  1. Check for existence of the variable explicitly:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        if (isset($x)) { // Make sure it's always set.
            echo $x;
        }
    }
    
  2. Define a default value for the variable:

    function myFunction($a) {
        $x = ''; // Set a default which gets overridden for certain paths.
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
        }
    
        echo $x;
    }
    
  3. Add a value for the missing path:

    function myFunction($a) {
        switch ($a) {
            case 'foo':
                $x = 1;
                break;
    
            case 'bar':
                $x = 2;
                break;
    
            // We add support for the missing case.
            default:
                $x = '';
                break;
        }
    
        echo $x;
    }
    
Loading history...
502
        unset($aErrors);
503
        $this->oView->display('license.tpl');
504
    }
505
506
    /********************* STEP 8 *********************/
507
    public function finish()
508
    {
509
        @require_once PH7_ROOT_PUBLIC . '_constants.php';
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...
510
511
        if (
512
            !empty($_SESSION['val']['admin_login_email'])
513
            && !empty($_SESSION['val']['admin_username'])
514
        ) {
515
            $this->sendWelcomeEmail();
516
517
            $this->oView->assign('admin_login_email', $_SESSION['val']['admin_login_email']);
518
            $this->oView->assign('admin_username', $_SESSION['val']['admin_username']);
519
        }
520
521
        $this->removeSessions();
522
        $this->removeCookies();
523
524
        if (
525
            $_SERVER['REQUEST_METHOD'] == 'POST'
526
            && !empty($_POST['confirm_remove_install'])
527
        ) {
528
            remove_install_dir();
529
            clearstatcache(); // We remove the files status cache as the "_install" folder doesn't exist anymore by now.
530
            exit(header('Location: ' . PH7_URL_ROOT));
531
        }
532
533
        $this->oView->assign('sept_number', 8);
534
        $this->oView->display('finish.tpl');
535
    }
536
537
    /**
538
     * Send an email to say the installation is now done, and give some information...
539
     */
540
    private function sendWelcomeEmail()
541
    {
542
        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...
543
544
        $aParams = [
545
            'to' => $_SESSION['val']['admin_login_email'],
546
            'subject' => $LANG['title_email_finish_install'],
547
            'body' => $LANG['content_email_finish_install']
548
        ];
549
550
        send_mail($aParams);
551
    }
552
553
    private function removeSessions()
554
    {
555
        $_SESSION = [];
556
        session_unset();
557
        session_destroy();
558
    }
559
560
    private function removeCookies()
561
    {
562
        $sCookieName = Controller::SOFTWARE_PREFIX_COOKIE_NAME . '_install_lang';
563
        // We are asking the browser to delete the cookie.
564
        setcookie($sCookieName, 0, 0);
565
        // and then, we delete the cookie value locally to avoid using it by mistake in following our script.
566
        unset($_COOKIE[$sCookieName]);
567
    }
568
569
    /**
570
     * Update module status (enabled/disabled).
571
     *
572
     * @param Db $oDb
573
     * @param string $sModName Module Name.
574
     * @param string $sStatus '1' = Enabled | '0' = Disabled (need to be string because in DB it is an "enum").
575
     *
576
     * @return integer|boolean Returns the number of rows on success or FALSE on failure.
577
     */
578
    private function updateMods(Db $oDb, $sModName, $sStatus)
579
    {
580
        $sSql = 'UPDATE ' . $_SESSION['db']['prefix'] . 'SysModsEnabled SET enabled = :status WHERE folderName = :modName LIMIT 1';
581
        $rStmt = $oDb->prepare($sSql);
582
        return $rStmt->execute(['modName' => $sModName, 'status' => $sStatus]);
583
    }
584
585
    /**
586
     * @param array $aParams
587
     *
588
     * @return void
589
     */
590
    private function updateSettings(array $aParams)
591
    {
592
        // Initialize the site's database to get "\PH7\Framework\Mvc\Model\Engine\Db" class working (as it uses that DB and not the installer one)
593
        Framework\Mvc\Router\FrontController::getInstance()->_databaseInitialize();
594
595
        // Enable/Disable Social Media Widgets according to the chosen niche
596
        Framework\Mvc\Model\DbConfig::setSocialWidgets($aParams['social_media_widgets']);
597
    }
598
599
    /***** Set the correct permission to the config files *****/
600
    private function chmodConfigFiles()
601
    {
602
        @chmod(PH7_PATH_APP_CONFIG . 'config.ini', 0644);
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...
603
        @chmod(PH7_ROOT_PUBLIC . '_constants.php', 0644);
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...
604
    }
605
606
    /***** Get the loading image *****/
607
    private function loadImg()
0 ignored issues
show
Unused Code introduced by
This method is not used, and could be removed.
Loading history...
608
    {
609
        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...
610
611
        return '<div style="text-align:center"><p>' . $LANG['wait_importing_database'] . '</p>
612
        <p><img src="data:image/gif;base64,R0lGODlhHwAfAPUAAP///wAAAOjo6NLS0ry8vK6urqKiotzc3Li4uJqamuTk5NjY2KqqqqCgoLCwsMzMzPb29qioqNTU1Obm5jY2NiYmJlBQUMTExH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