|
1
|
|
|
<?php |
|
|
|
|
|
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
/** |
|
12
|
|
|
* Installer common include file |
|
13
|
|
|
* |
|
14
|
|
|
* See the enclosed file license.txt for licensing information. |
|
15
|
|
|
* If you did not receive this file, get it at http://www.gnu.org/licenses/gpl-2.0.html |
|
16
|
|
|
* |
|
17
|
|
|
* @copyright (c) 2000-2016 XOOPS Project (www.xoops.org) |
|
18
|
|
|
* @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) |
|
19
|
|
|
* @package installer |
|
20
|
|
|
* @since 2.3.0 |
|
21
|
|
|
* @author Haruki Setoyama <[email protected]> |
|
22
|
|
|
* @author Kazumi Ono <[email protected]> |
|
23
|
|
|
* @author Skalpa Keo <[email protected]> |
|
24
|
|
|
* @author Taiwen Jiang <[email protected]> |
|
25
|
|
|
* @author DuGris (aka L. JEN) <[email protected]> |
|
26
|
|
|
**/ |
|
27
|
|
|
|
|
28
|
|
|
/** |
|
29
|
|
|
* If non-empty, only this user can access this installer |
|
30
|
|
|
*/ |
|
31
|
|
|
define('INSTALL_USER', ''); |
|
32
|
|
|
define('INSTALL_PASSWORD', ''); |
|
33
|
|
|
|
|
34
|
|
|
define('XOOPS_INSTALL', 1); |
|
35
|
|
|
|
|
36
|
|
View Code Duplication |
function fatalPhpErrorHandler($e = null) { |
|
|
|
|
|
|
37
|
|
|
$messageFormat = '<br><div>Fatal %s %s file: %s : %d </div>'; |
|
38
|
|
|
$exceptionClass = '\Exception'; |
|
39
|
|
|
$throwableClass = '\Throwable'; |
|
40
|
|
|
if ($e === null) { |
|
41
|
|
|
$lastError = error_get_last(); |
|
42
|
|
|
if ($lastError['type'] === E_ERROR) { |
|
43
|
|
|
// fatal error |
|
44
|
|
|
printf($messageFormat, 'Error', $lastError['message'], $lastError['file'], $lastError['line']); |
|
45
|
|
|
} |
|
46
|
|
|
} elseif ($e instanceof $exceptionClass || $e instanceof $throwableClass) { |
|
47
|
|
|
/** @var $e \Exception */ |
|
48
|
|
|
printf($messageFormat, get_class($e), $e->getMessage(), $e->getFile(), $e->getLine()); |
|
49
|
|
|
} |
|
50
|
|
|
} |
|
51
|
|
|
register_shutdown_function('fatalPhpErrorHandler'); |
|
52
|
|
|
set_exception_handler('fatalPhpErrorHandler'); |
|
53
|
|
|
|
|
54
|
|
|
// options for mainfile.php |
|
55
|
|
|
if (empty($xoopsOption['hascommon'])) { |
|
56
|
|
|
$xoopsOption['nocommon'] = true; |
|
57
|
|
|
session_start(); |
|
58
|
|
|
} |
|
59
|
|
|
@include '../mainfile.php'; |
|
|
|
|
|
|
60
|
|
|
if (!defined('XOOPS_ROOT_PATH')) { |
|
61
|
|
|
define('XOOPS_ROOT_PATH', str_replace("\\", '/', realpath('../'))); |
|
62
|
|
|
} |
|
63
|
|
|
|
|
64
|
|
|
/* |
|
65
|
|
|
error_reporting( 0 ); |
|
66
|
|
|
if (isset($xoopsLogger)) { |
|
67
|
|
|
$xoopsLogger->activated = false; |
|
68
|
|
|
} |
|
69
|
|
|
error_reporting(E_ALL); |
|
70
|
|
|
$xoopsLogger->activated = true; |
|
71
|
|
|
*/ |
|
72
|
|
|
|
|
73
|
|
|
date_default_timezone_set(@date_default_timezone_get()); |
|
74
|
|
|
include './class/installwizard.php'; |
|
75
|
|
|
include_once '../include/version.php'; |
|
76
|
|
|
include_once './include/functions.php'; |
|
77
|
|
|
include_once '../class/module.textsanitizer.php'; |
|
78
|
|
|
include_once '../class/libraries/vendor/autoload.php'; |
|
79
|
|
|
|
|
80
|
|
|
$pageHasHelp = false; |
|
81
|
|
|
$pageHasForm = false; |
|
82
|
|
|
|
|
83
|
|
|
$wizard = new XoopsInstallWizard(); |
|
84
|
|
|
if (!$wizard->xoInit()) { |
|
85
|
|
|
exit(); |
|
86
|
|
|
} |
|
87
|
|
|
|
|
88
|
|
|
if (!@is_array($_SESSION['settings'])) { |
|
89
|
|
|
$_SESSION['settings'] = array(); |
|
90
|
|
|
} |
|
91
|
|
|
|
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.