XOOPS 2.5.6
Final
Main Page
Related Pages
Classes
Files
Examples
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Pages
page_dbconnection.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
*/
29
require_once
'./include/common.inc.php'
;
30
defined(
'XOOPS_INSTALL'
) or die('XOOPS Installation wizard die');
31
32
$pageHasForm
=
true
;
33
$pageHasHelp
= true;
34
35
$vars
=&
$_SESSION
['settings'];
36
37
if
(
$_SERVER
['REQUEST_METHOD'] == 'POST') {
38
$params = array(
'DB_TYPE'
,
'DB_HOST'
,
'DB_USER'
,
'DB_PASS'
);
39
foreach
($params as $name) {
40
$vars
[$name] =
$_POST
[$name];
41
}
42
$vars
[
'DB_PCONNECT'
] = @
$_POST
[
'DB_PCONNECT'
] ? 1 : 0;
43
}
44
45
$error
=
''
;
46
if
(
$_SERVER
[
'REQUEST_METHOD'
] ==
'POST'
&& !empty(
$vars
[
'DB_HOST'
] ) && !empty(
$vars
[
'DB_USER'
])) {
47
$func_connect
= empty(
$vars
[
'DB_PCONNECT'
]) ?
"mysql_connect"
:
"mysql_pconnect"
;
48
if
(!($link = @
$func_connect
(
$vars
[
'DB_HOST'
],
$vars
[
'DB_USER'
],
$vars
[
'DB_PASS'
],
true
))) {
49
$error
=
ERR_NO_DBCONNECTION
;
50
}
51
if
(empty(
$error
)) {
52
$wizard
->redirectToPage(
'+1'
);
53
exit
();
54
}
55
}
56
57
if
(@empty(
$vars
[
'DB_HOST'
])) {
58
// Fill with default values
59
$vars
= array_merge(
$vars
,
60
array(
'DB_TYPE'
=>
'mysql'
,
61
'DB_HOST'
=>
'localhost'
,
62
'DB_USER'
=>
'root'
,
63
'DB_PASS'
=>
''
,
64
'DB_PCONNECT'
=> 0,
65
)
66
);
67
}
68
ob_start();
69
?>
70
<?php
if
(!empty(
$error
)) echo
'<div class="x2-note errorMsg">'
.
$error
.
"</div>\n"
; ?>
71
<fieldset>
72
<legend><?php echo
LEGEND_CONNECTION
; ?></legend>
73
<label
class
=
"xolabel"
for
=
"DB_DATABASE_LABEL"
class
=
"center"
>
74
<?php echo
DB_DATABASE_LABEL
; ?>
75
<select size=
"1"
name=
"DB_TYPE"
>
76
<?php
77
foreach
(
$wizard
->configs[
'db_types'
] as $db_type) {
78
$selected = (
$vars
[
'DB_TYPE'
] == $db_type) ?
'selected'
:
''
;
79
echo
"<option value='$db_type' selected='$selected'>$db_type</option>"
;
80
}
81
?>
82
</select>
83
</label>
84
<?php echo
xoFormField
(
'DB_HOST'
,
$vars
[
'DB_HOST'
],
DB_HOST_LABEL
,
DB_HOST_HELP
); ?>
85
<?php echo
xoFormField
(
'DB_USER'
,
$vars
[
'DB_USER'
],
DB_USER_LABEL
,
DB_USER_HELP
); ?>
86
<?php echo
xoPassField
(
'DB_PASS'
,
$vars
[
'DB_PASS'
],
DB_PASS_LABEL
,
DB_PASS_HELP
); ?>
87
88
<label
class
=
"xolabel"
for
=
"DB_PCONNECT"
class
=
"center"
>
89
<?php echo
DB_PCONNECT_LABEL
; ?>
90
<input
class
=
"checkbox"
type=
"checkbox"
name=
"DB_PCONNECT"
value=
"1"
<?php echo
$vars
[
'DB_PCONNECT'
] ?
"'checked'"
:
""
; ?>/>
91
<div
class
=
"xoform-help"
><?php echo
DB_PCONNECT_HELP
; ?></div>
92
</label>
93
</fieldset>
94
95
<?php
96
$content
= ob_get_contents();
97
ob_end_clean();
98
include
'./include/install_tpl.php'
;
99
?>
L:
0xoops
xoops-2.5.6
htdocs
install
page_dbconnection.php
Generated on Fri May 10 2013 01:04:27 for XOOPS 2.5.6 by
1.8.3.1