XOOPS  2.6.0
page_dbdriver.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 /* @var $wizard XoopsInstallWizard */
30 $wizard = $_SESSION['wizard'];
31 
32 $settings = $_SESSION['settings'];
33 
34 // clear any old list
35 if (array_key_exists('DB_PARAMETERS', $settings)) {
36  unset($settings['DB_PARAMETERS']);
37 }
38 
39 if ($_SERVER['REQUEST_METHOD'] == 'POST') {
40  $params = array('DB_DRIVER', 'DB_PREFIX');
41  foreach ($params as $name) {
42  $settings[$name] = $_POST[$name];
43  }
44  //$settings['DB_PCONNECT'] = @$_POST['DB_PCONNECT'] ? 1 : 0;
45 }
46 
47 $error = '';
48 if ($_SERVER['REQUEST_METHOD'] == 'POST' && !empty($settings['DB_DRIVER'])) {
49  $_SESSION['settings'] = $settings;
50  $wizard->redirectToPage('+1');
51  exit();
52 }
53 
54 if (@empty($settings['DB_DRIVER'])) {
55  // Fill with default values
56  $settings = array_merge(
57  $settings,
58  array(
59  'DB_DRIVER' => 'pdo_mysql',
60  'DB_PREFIX' => 'x' . substr(md5(time()), 0, 3),
61  )
62  );
63 }
64 ob_start();
65 ?>
66 <?php
67 if (!empty($error)) {
68  echo '<div class="x2-note errorMsg">' . $error . "</div>\n";
69 }
70 ?>
71 <fieldset>
72  <div class="xoform-help"><?php echo DB_DRIVER_HELP; ?></div>
73  <legend><?php echo LEGEND_DRIVER; ?></legend>
74  <label class="xolabel" for="DB_DATABASE_LABEL" class="center">
75  <?php echo DB_DRIVER_LABEL; ?>
76  <select size="1" name="DB_DRIVER">
77  <?php
78  foreach ($wizard->configs['db_types'] as $db_driver => $db_info) {
79  $selected = ($settings['DB_DRIVER'] == $db_driver) ? 'selected' : '';
80  echo "<option value=\"{$db_driver}\" {$selected}>{$db_info['desc']}</option>";
81  }
82  ?>
83  </select>
84  </label>
85  <?php echo xoFormField('DB_PREFIX', $settings['DB_PREFIX'], DB_PREFIX_LABEL, DB_PREFIX_HELP); ?>
86 </fieldset>
87 
88 <?php
89 $content = ob_get_contents();
90 ob_end_clean();
91 
92 $_SESSION['pageHasHelp'] = true;
93 $_SESSION['pageHasForm'] = true;
94 $_SESSION['content'] = $content;
95 $_SESSION['settings'] = $settings;
96 include XOOPS_INSTALL_PATH . '/include/install_tpl.php';
$_SESSION['pageHasHelp']
const DB_PREFIX_HELP
Definition: install.php:100
if(array_key_exists('DB_PARAMETERS', $settings)) if($_SERVER['REQUEST_METHOD']== 'POST') $error
$_SERVER['REQUEST_URI']
$content
exit
Definition: browse.php:104
const XOOPS_INSTALL_PATH
Definition: common.inc.php:33
xoFormField($name, $value, $label, $help= '')
Definition: functions.php:76
const LEGEND_DRIVER
Definition: install.php:83
const DB_PREFIX_LABEL
Definition: install.php:99
const DB_DRIVER_LABEL
Definition: install.php:104
$wizard
const DB_DRIVER_HELP
Definition: install.php:105
$settings