XOOPS
2.6.0
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
page_siteinit.php
Go to the documentation of this file.
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
27
require_once __DIR__ .
'/include/common.inc.php'
;
28
29
set_time_limit(0);
// don't want this to timeout
30
31
function
exception_handler
($exception)
32
{
33
echo
"Uncaught exception: "
, $exception->getMessage(),
"\n"
;
34
var_dump($exception->getTrace());
35
}
36
37
set_exception_handler(
'exception_handler'
);
38
39
\Xoops\Core\Cache\CacheManager::createDefaultConfig();
40
41
$xoops
=
Xoops::getInstance
();
42
43
// setup legacy db support
44
$GLOBALS
[
'xoopsDB'
] =
\XoopsDatabaseFactory::getDatabaseConnection
(
true
);
45
46
//Set active modules in cache folder, delete caches if existing
47
//$xoops->setActiveModules();
48
$modules_active
= array();
49
$xoops
->cache()->write(
'system/modules/active'
,
$modules_active
);
50
51
$root
= dirname(__DIR__);
52
$language
=
$wizard
->language;
53
$xoops
->setConfig(
'locale'
,
$language
);
54
$xoops
->loadLocale();
55
$xoops
->loadLocale(
'system'
);
56
57
// Install system module
58
include_once
$root
.
"/modules/system/class/module.php"
;
59
include_once
$root
.
"/modules/system/class/system.php"
;
60
61
$system_module
=
new
SystemModule
();
62
$system
=
System::getInstance
();
63
$status
=
$system_module
->install(
'system'
,
true
);
64
if
(!
$status
) {
65
$_SESSION
[
'error'
] =
$system_module
->error;
66
//$sql = $xoops->db()->getConfiguration()->getSQLLogger()->queries;
67
}
68
69
$pageHasForm
=
true
;
70
$pageHasHelp
=
false
;
71
72
$siteconfig
=
$_SESSION
[
'siteconfig'
];
73
74
$error
=
$_SESSION
[
'error'
];
75
76
if
(
$_SERVER
[
'REQUEST_METHOD'
] ==
'POST'
) {
77
$siteconfig
[
'adminname'
] = $_POST[
'adminname'
];
78
$siteconfig
[
'adminmail'
] = $_POST[
'adminmail'
];
79
$siteconfig
[
'adminpass'
] = $_POST[
'adminpass'
];
80
$siteconfig
[
'adminpass2'
] = $_POST[
'adminpass2'
];
81
$error
= array();
82
83
if
(empty(
$siteconfig
[
'adminname'
])) {
84
$error
[
'name'
][] =
ERR_REQUIRED
;
85
}
86
if
(empty(
$siteconfig
[
'adminmail'
])) {
87
$error
[
'email'
][] =
ERR_REQUIRED
;
88
}
89
if
(empty(
$siteconfig
[
'adminpass'
])) {
90
$error
[
'pass'
][] =
ERR_REQUIRED
;
91
}
92
if
(!preg_match(
"/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+([\.][a-z0-9-]+)+$/i"
,
$siteconfig
[
'adminmail'
])) {
93
$error
[
'email'
][] =
ERR_INVALID_EMAIL
;
94
}
95
if
(
$siteconfig
[
'adminpass'
] !=
$siteconfig
[
'adminpass2'
]) {
96
$error
[
'pass'
][] =
ERR_PASSWORD_MATCH
;
97
}
98
if
(
$error
) {
99
$_SESSION
[
'error'
] =
$error
;
100
$_SESSION
[
'siteconfig'
] =
$siteconfig
;
101
$wizard
->redirectToPage(
'+0'
);
102
return
200;
103
}
else
{
104
$_SESSION
[
'error'
] =
$error
;
105
$_SESSION
[
'siteconfig'
] =
$siteconfig
;
106
$wizard
->redirectToPage(
'+1'
);
107
return
302;
108
}
109
}
else
{
110
$dbm
=
new
XoopsDatabaseManager
();
111
112
if
(!
$dbm
->isConnectable()) {
113
$_SESSION
[
'error'
] =
$error
;
114
$_SESSION
[
'siteconfig'
] =
$siteconfig
;
115
$wizard
->redirectToPage(
'dbsettings'
);
116
exit
();
117
}
118
119
$res
=
$dbm
->query(
"SELECT COUNT(*) FROM "
.
$dbm
->db->prefix(
"users"
));
120
list ($isadmin) =
$dbm
->db->fetchRow(
$res
);
121
}
122
123
ob_start();
124
125
if
($isadmin) {
126
$pageHasForm
=
false
;
127
$pageHasHelp
=
false
;
128
echo
"<div class='x2-note errorMsg'>"
.
ADMIN_EXIST
.
"</div>\n"
;
129
}
else
{
130
?>
131
<fieldset>
132
<legend><?php echo
LEGEND_ADMIN_ACCOUNT
; ?></legend>
133
134
<?php
135
echo
'<script type="text/javascript">
136
var desc = new Array();
137
desc[0] = "'
.
PASSWORD_DESC
.
'";
138
desc[1] = "'
.
PASSWORD_VERY_WEAK
.
'";
139
desc[2] = "'
.
PASSWORD_WEAK
.
'";
140
desc[3] = "'
.
PASSWORD_BETTER
.
'";
141
desc[4] = "'
.
PASSWORD_MEDIUM
.
'";
142
desc[5] = "'
.
PASSWORD_STRONG
.
'";
143
desc[6] = "'
.
PASSWORD_STRONGEST
.
'";
144
</script>'
;
145
146
echo
xoFormField
(
'adminname'
,
$siteconfig
[
'adminname'
],
ADMIN_LOGIN_LABEL
);
147
if
(!empty(
$error
[
"name"
])) {
148
echo
'<ul class="diags1">'
;
149
foreach
(
$error
[
"name"
] as $errmsg) {
150
echo
'<li class="failure">'
. $errmsg .
'</li>'
;
151
}
152
echo
'</ul>'
;
153
}
154
155
echo
xoFormField
(
'adminmail'
,
$siteconfig
[
'adminmail'
],
ADMIN_EMAIL_LABEL
);
156
if
(!empty(
$error
[
"email"
])) {
157
echo
'<ul class="diags1">'
;
158
foreach
(
$error
[
"email"
] as $errmsg) {
159
echo
'<li class="failure">'
. $errmsg .
'</li>'
;
160
}
161
echo
'</ul>'
;
162
}
163
?>
164
165
<div
id
=
"password"
>
166
<div
id
=
"passwordinput"
>
167
<?php
168
echo
xoPassField
(
'adminpass'
,
''
,
ADMIN_PASS_LABEL
);
169
echo
xoPassField
(
'adminpass2'
,
''
,
ADMIN_CONFIRMPASS_LABEL
);
170
if
(!empty(
$error
[
"pass"
])) {
171
echo
'<ul class="diags1">'
;
172
foreach
(
$error
[
"pass"
] as $errmsg) {
173
echo
'<li class="failure">'
. $errmsg .
'</li>'
;
174
}
175
echo
'</ul>'
;
176
}
177
?>
178
</div>
179
180
<div
id
=
"passwordmetter"
class
=
"xoform-help"
>
181
<label
class
=
"xolabel"
for
=
'passwordStrength'
><strong><?php echo
PASSWORD_LABEL
; ?></strong></label>
182
183
<div
id
=
'passwordStrength'
class
=
'strength0'
>
184
<span
id
=
'passwordDescription'
><?php echo
PASSWORD_DESC
; ?></span>
185
</div>
186
187
<label
class
=
"xolabel"
for
=
'password_generator'
><strong><?php echo
PASSWORD_GENERATOR
; ?></strong></label>
188
189
<div
id
=
"passwordgenerator"
>
190
<input type=
'text'
name=
'generated_pw'
id
=
'generated_pw'
value=
''
/><br/>
191
<button type=
'button'
class
=
"gradient_bar button"
onclick=
'javascript:suggestPassword(14);'
/>
192
<?php echo
PASSWORD_GENERATE
; ?></button>
193
<button type=
'button'
class
=
"gradient_bar button"
194
onclick=
'javascript:suggestPasswordCopy("adminpass");'
/>
195
<?php echo
PASSWORD_COPY
; ?></button>
196
</div>
197
</div>
198
</div>
199
<br style=
"clear: both;"
/>
200
</fieldset>
201
<script type=
"text/javascript"
>
202
showHideHelp(
this
);
203
</script>
204
<?php
205
206
}
207
$content
= ob_get_contents();
208
ob_end_clean();
209
$error
=
''
;
210
211
$_SESSION
[
'error'
] =
$error
;
212
$_SESSION
[
'siteconfig'
] =
$siteconfig
;
213
$_SESSION
[
'pageHasHelp'
] =
$pageHasHelp
;
214
$_SESSION
[
'pageHasForm'
] =
$pageHasForm
;
215
$_SESSION
[
'content'
] =
$content
;
216
include
XOOPS_INSTALL_PATH
.
'/include/install_tpl.php'
;
ERR_PASSWORD_MATCH
const ERR_PASSWORD_MATCH
Definition:
install.php:150
$_SESSION
$_SESSION['error']
Definition:
page_siteinit.php:211
PASSWORD_STRONG
const PASSWORD_STRONG
Definition:
install.php:222
$error
$error
Definition:
page_siteinit.php:74
$res
if(!$dbm->isConnectable()) $res
Definition:
page_siteinit.php:119
System\getInstance
static getInstance()
Definition:
system.php:46
Xoops\getInstance
static getInstance()
Definition:
Xoops.php:160
PASSWORD_VERY_WEAK
const PASSWORD_VERY_WEAK
Definition:
install.php:218
PASSWORD_STRONGEST
const PASSWORD_STRONGEST
Definition:
install.php:223
$_SERVER
$_SERVER['REQUEST_URI']
Definition:
comment_delete.php:23
ADMIN_LOGIN_LABEL
const ADMIN_LOGIN_LABEL
Definition:
install.php:122
$siteconfig
$siteconfig
Definition:
page_siteinit.php:72
XoopsDatabaseManager
Definition:
manager.php:27
xoPassField
xoPassField($name, $value, $label, $help= '')
Definition:
functions.php:103
PASSWORD_COPY
const PASSWORD_COPY
Definition:
install.php:216
ADMIN_EMAIL_LABEL
const ADMIN_EMAIL_LABEL
Definition:
install.php:123
$dbm
$dbm
Definition:
page_tablesfill.php:44
PASSWORD_MEDIUM
const PASSWORD_MEDIUM
Definition:
install.php:221
PASSWORD_GENERATOR
const PASSWORD_GENERATOR
Definition:
install.php:214
PASSWORD_LABEL
const PASSWORD_LABEL
Definition:
install.php:212
ADMIN_CONFIRMPASS_LABEL
const ADMIN_CONFIRMPASS_LABEL
Definition:
install.php:125
$system_module
$system_module
Definition:
page_siteinit.php:61
exit
exit
Definition:
browse.php:104
SystemModule
$pageHasForm
if(!$status) $pageHasForm
Definition:
page_siteinit.php:69
$wizard
$wizard
Definition:
common.inc.php:66
$root
$root
Definition:
page_siteinit.php:51
$status
$status
Definition:
page_siteinit.php:63
PASSWORD_WEAK
const PASSWORD_WEAK
Definition:
install.php:219
XOOPS_INSTALL_PATH
const XOOPS_INSTALL_PATH
Definition:
common.inc.php:33
xoFormField
xoFormField($name, $value, $label, $help= '')
Definition:
functions.php:76
include
ADMIN_EXIST
const ADMIN_EXIST
Definition:
install.php:187
PASSWORD_BETTER
const PASSWORD_BETTER
Definition:
install.php:220
LEGEND_ADMIN_ACCOUNT
const LEGEND_ADMIN_ACCOUNT
Definition:
install.php:121
ERR_INVALID_EMAIL
const ERR_INVALID_EMAIL
Definition:
install.php:148
XoopsDatabaseFactory\getDatabaseConnection
static getDatabaseConnection()
Definition:
databasefactory.php:45
$system
$system
Definition:
page_siteinit.php:62
$xoops
$xoops
Definition:
page_siteinit.php:41
$GLOBALS
$GLOBALS['xoopsDB']
Definition:
page_siteinit.php:44
$language
$language
Definition:
page_siteinit.php:52
$modules_active
$modules_active
Definition:
page_siteinit.php:48
ERR_REQUIRED
const ERR_REQUIRED
Definition:
install.php:149
PASSWORD_DESC
const PASSWORD_DESC
Definition:
install.php:213
ADMIN_PASS_LABEL
const ADMIN_PASS_LABEL
Definition:
install.php:124
exception_handler
exception_handler($exception)
Definition:
page_siteinit.php:31
$pageHasHelp
$pageHasHelp
Definition:
page_siteinit.php:70
PASSWORD_GENERATE
const PASSWORD_GENERATE
Definition:
install.php:215
$content
$content
Definition:
page_siteinit.php:207
usr64
htdocs
install
page_siteinit.php
Generated on Fri May 22 2015 03:07:02 for XOOPS by
1.8.9.1