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 https://www.gnu.org/licenses/gpl-2.0.html
16: *
17: * @copyright (c) 2000-2021 XOOPS Project (www.xoops.org)
18: * @license GNU GPL 2.0 or later (https://www.gnu.org/licenses/gpl-2.0.html)
19: * @package installer
20: * @since 2.3.0
21: * @author Haruki Setoyama <haruki@planewave.org>
22: * @author Kazumi Ono <webmaster@myweb.ne.jp>
23: * @author Skalpa Keo <skalpa@xoops.org>
24: * @author Taiwen Jiang <phppp@users.sourceforge.net>
25: * @author DuGris (aka L. JEN) <dugris@frxoops.org>
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: 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 !== null && $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 \Exception $e */
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 = array(
55: 'lifetime' => 0,
56: 'path' => '/',
57: 'domain' => null,
58: 'secure' => false,
59: 'httponly' => true,
60: 'samesite' => 'strict',
61: );
62: // options for mainfile.php
63: if (empty($xoopsOption['hascommon'])) {
64: $xoopsOption['nocommon'] = true;
65: if (PHP_VERSION_ID >= 70300) {
66: session_set_cookie_params($options);
67: }
68:
69: session_start();
70:
71: if (PHP_VERSION_ID < 70300) {
72: require_once __DIR__ . '/../../include/xoopssetcookie.php';
73: xoops_setcookie(session_name(), session_id(), $options);
74: }
75:
76: }
77:
78: @include __DIR__ . '/../../mainfile.php';
79: if (!defined('XOOPS_ROOT_PATH')) {
80: define('XOOPS_ROOT_PATH', str_replace("\\", '/', realpath('../')));
81: }
82:
83: date_default_timezone_set(@date_default_timezone_get());
84: include __DIR__ . '/../class/installwizard.php';
85: include_once __DIR__ . '/../../include/version.php';
86: require_once __DIR__ . '/../../include/xoopssetcookie.php';
87: include_once __DIR__ . '/../include/functions.php';
88: include_once __DIR__ . '/../../class/module.textsanitizer.php';
89: include_once __DIR__ . '/../../class/libraries/vendor/autoload.php';
90:
91: $pageHasHelp = false;
92: $pageHasForm = false;
93:
94: $wizard = new XoopsInstallWizard();
95: if (!$wizard->xoInit()) {
96: exit();
97: }
98:
99: if (!isset($_SESSION['settings']) || !is_array($_SESSION['settings'])) {
100: $_SESSION['settings'] = array();
101: }
102: