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
|
|||
2 | /** |
||
3 | * @title Index |
||
4 | * @desc Index file for public root. |
||
5 | * |
||
6 | * @author Pierre-Henry Soria <[email protected]> |
||
7 | * @copyright (c) 2011-2017, Pierre-Henry Soria. All Rights Reserved. |
||
8 | * @license See PH7.LICENSE.txt and PH7.COPYRIGHT.txt in the root directory. |
||
9 | * @link http://ph7cms.com |
||
10 | * @package PH7 / ROOT / Core |
||
11 | */ |
||
12 | |||
13 | namespace PH7; |
||
14 | |||
15 | define('PH7', 1); |
||
16 | |||
17 | define('PH7_REQUIRE_SERVER_VERSION', '5.6.0'); |
||
18 | define('PH7_REQUIRE_SQL_VERSION', '5.0'); |
||
19 | |||
20 | if (version_compare(PHP_VERSION, PH7_REQUIRE_SERVER_VERSION, '<')) { |
||
21 | exit('ERROR: Your current PHP version is ' . PHP_VERSION . '. pH7CMS requires PHP ' . PH7_REQUIRE_SERVER_VERSION . ' or newer.<br /> Please ask your Web host to upgrade PHP to ' . PH7_REQUIRE_SERVER_VERSION . ' or newer.'); |
||
22 | } |
||
23 | |||
24 | // If no settings found, go to the installer |
||
25 | if (!is_file(__DIR__ . '/_constants.php')) { |
||
26 | if (is_dir(__DIR__ . '/_install/')) { |
||
27 | // Clear redirection cache since some folks get it cached |
||
28 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
||
29 | header('Expires: Thu, 01 Jan 1970 00:00:00 GMT'); |
||
30 | header('Location: _install/'); |
||
31 | } else { |
||
32 | echo 'CONFIG FILE NOT FOUND! If you want to make a new installation, please re-upload _install/ folder and clear your database.'; |
||
33 | } |
||
34 | exit; |
||
35 | } |
||
36 | |||
37 | require __DIR__ . '/_constants.php'; |
||
38 | require PH7_PATH_APP . 'Bootstrap.php'; |
||
39 | |||
40 | $oApp = Bootstrap::getInstance(); |
||
41 | $oApp->setTimezoneIfNotSet(); |
||
42 | |||
43 | ob_start(); |
||
44 | $oApp->run(); |
||
45 | ob_end_flush(); |
||
46 |
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.