XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
index.php
1<?php
12
13
14/* The error_reporting() function specifies which errors are reported.
15* PHP has many levels of errors, and using this function sets that level for the current script.
16* https://www.php.net/manual/en/errorfunc.constants.php
17* PHP 7 makes E_STRICT irrelevant, reclassifying most of the errors as proper warnings, notices or E_DEPRECATED
18 * The ^ is the xor (bit flipping) operator, so its "off" : ^ E_ALL
19*/
20
21if ( PHP_VERSION_ID >= 70000 ) {
22 //error_reporting( error_reporting() ^ E_ALL & ~E_NOTICE );E_ERROR
23 ini_set('error_reporting', E_ALL);
24 ini_set('display_errors', '0');
25}
26
27/* ALERT PHP VERSION REQUIRED BY XCL V2.5.0 */
28if (version_compare(PHP_VERSION, '7.4.0', '<')) {
29 echo '<style>body{background:#222730;color:#bfcbd9;font-family:sans-serif;}
30 .phpalert{background:#9a0a0a;color:white;font-size:16px;font-weight:600;line-height:2;width:50%;margin:3em auto;padding:1em;border:1 px solid orange;border-radius:6px;}
31 .phpversion{background:#222730;color:#bfcbd9;border-radius:6px;padding:4px 6px}</style>
32 <div class="phpalert">Your PHP version <i class="phpversion">' . PHP_VERSION . '</i>
33 does not satisfy XOOPSCube requirements.<br>
34 PHP version <i class="phpversion">PHP 7.4</i> is required !</div>';
35}
36
37/*
38 * To trigger an E_USER_NOTICE error, you may use the trigger_error function:
39 * trigger_error("You probably should not be using the feature this way, but I will allow you to continue if you know what you are doing.", E_USER_NOTICE);
40 */
41
42/* if ( PHP_VERSION_ID >= 70000 ) {
43
44 $exceptions = [
45 E_ERROR => "E_ERROR",
46 E_WARNING => "E_WARNING",
47 E_PARSE => "E_PARSE",
48 E_NOTICE => "E_NOTICE",
49 E_CORE_ERROR => "E_CORE_ERROR",
50 E_CORE_WARNING => "E_CORE_WARNING",
51 E_COMPILE_ERROR => "E_COMPILE_ERROR",
52 E_COMPILE_WARNING => "E_COMPILE_WARNING",
53 E_USER_ERROR => "E_USER_ERROR",
54 E_USER_WARNING => "E_USER_WARNING",
55 E_USER_NOTICE => "E_USER_NOTICE",
56 E_STRICT => "E_STRICT",
57 E_RECOVERABLE_ERROR => "E_RECOVERABLE_ERROR",
58 E_DEPRECATED => "E_DEPRECATED",
59 E_USER_DEPRECATED => "E_USER_DEPRECATED",
60 E_ALL => "E_ALL"
61];
62
63 echo $exceptions["1"];
64 $code = 256; // error constant
65 echo $exceptions[$code];
66} */
67
68/*
69 * error_reporting(E_ERROR | E_WARNING | E_PARSE | E_NOTICE);
70*/
71
72include_once './passwd.php';
73
74if ( INSTALL_USER !== '' || INSTALL_PASSWD !== '' ) {
75 if ( ! isset( $_SERVER['PHP_AUTH_USER'] ) ) {
76 header( 'WWW-Authenticate: Basic realm="XOOPSCube Installer"' );
77 header( 'HTTP/1.0 401 Unauthorized' );
78 echo 'You can not access this XOOPSCube installer.';
79 exit;
80 } else {
81 if ( INSTALL_USER !== '' && INSTALL_USER != $_SERVER['PHP_AUTH_USER'] ) {
82 header( 'HTTP/1.0 401 Unauthorized' );
83 echo 'You can not access this XOOPSCube installer.';
84 exit;
85 }
86 if ( INSTALL_PASSWD !== $_SERVER['PHP_AUTH_PW'] ) {
87 header( 'HTTP/1.0 401 Unauthorized' );
88 echo 'You can not access this XOOPSCube installer.';
89 exit;
90 }
91 }
92}
93
94
95include_once './class/textsanitizer.php';
96
97$myts = TextSanitizer::getInstance();
98
99if ( isset( $_POST ) ) {
100 foreach ( $_POST as $k => $v ) {
101 ${$k} = $myts->stripSlashesGPC( $v );
102 }
103}
104
105
106include_once './include/functions.php';
107
108$language = getLanguage();
109
110include_once './language/' . $language . '/install.php';
111include_once '../language/' . $language . '/timezone.php';
112
113const _OKIMG = '<img src="img/yes.svg" alt="OK">';
114const _NGIMG = '<img src="img/no.svg" alt="NG">';
115
116
117include_once './class/simplewizard.php';
118
119$wizard = new SimpleWizard();
120$wizard->setBaseTemplate( './install_tpl.php' );
121$wizard->setTemplatePath( './templates' );
122
123$wizardSeq = new SimpleWizardSequence();
124
125$wizardSeq->add( 'langselect', _INSTALL_L0, 'start', _INSTALL_L80 );
126$wizardSeq->add( 'start', _INSTALL_L0, 'modcheck', _INSTALL_L81 );
127$wizardSeq->add( 'modcheck', _INSTALL_L82, 'dbform', _INSTALL_L89);
128$wizardSeq->add( 'dbform', _INSTALL_L90, 'dbconfirm', _INSTALL_L91 );
129$wizardSeq->add( 'dbconfirm', _INSTALL_L53, 'dbsave', _INSTALL_L92, '', _INSTALL_L93 );
130$wizardSeq->add( 'dbsave', _INSTALL_L92, 'modcheck_trust', _INSTALL_L166 );
131$wizardSeq->add( 'modcheck_trust', _INSTALL_L167, 'mainfile', _INSTALL_L94 );
132$wizardSeq->add( 'mainfile', _INSTALL_L94, 'initial', _INSTALL_L102, 'start', _INSTALL_L103 );
133$wizardSeq->add( 'initial', _INSTALL_L102, 'checkDB', _INSTALL_L104, 'start', _INSTALL_L103 );
134$wizardSeq->add( 'checkDB', _INSTALL_L104, 'createDB', _INSTALL_L105, 'start', _INSTALL_L103, true );
135$wizardSeq->add( 'createDB', _INSTALL_L105, 'checkDB', _INSTALL_L104 );
136$wizardSeq->add( 'createTables', _INSTALL_L40, 'siteInit', _INSTALL_L112 );
137$wizardSeq->add( 'siteInit', _INSTALL_L112, 'insertData', _INSTALL_L116 );
138$wizardSeq->add( 'insertData', _INSTALL_L116, 'finish', _INSTALL_L117 );
139$wizardSeq->add( 'finish', _INSTALL_L32, 'nextStep', _INSTALL_L210 );
140
141if ( file_exists( './custom/custom.inc.php' ) ) {
142 include './custom/custom.inc.php';
143}
144
145// options for mainfile.php
146$xoopsOption['nocommon'] = true;
147const XOOPS_INSTALL = 1;
148
149if ( ! empty( $_POST['op'] ) ) {
150 $op = $_POST['op'];
151} elseif ( ! empty( $_GET['op'] ) ) {
152 $op = $_GET['op'];
153} else {
154 $op = 'langselect';
155}
156$wizard->setOp( $op );
157
158$op = basename( $op );
159$fname = './wizards/install_' . $op . '.inc.php';
160$custom_fname = './custom/install_' . $op . '.inc.php';
161
162if ( file_exists( $fname ) ) {
163 include $fname;
164} elseif ( file_exists( $custom_fname ) ) {
165 include $custom_fname;
166} else {
167 $wizard->render();
168}