3) {
$init_modules[] = 'auth';
}
require realpath(__DIR__ . '/..') . '/includes/init.php';
// List of php modules we expect to see
$modules = array('gd','mysqli','snmp','mcrypt');
$dbhost = @$_POST['dbhost'] ?: 'localhost';
$dbuser = @$_POST['dbuser'] ?: 'librenms';
$dbpass = @$_POST['dbpass'] ?: '';
$dbname = @$_POST['dbname'] ?: 'librenms';
$dbport = @$_POST['dbport'] ?: 3306;
$config['db_host']=$dbhost;
$config['db_user']=$dbuser;
$config['db_pass']=$dbpass;
$config['db_name']=$dbname;
$config['db_port']=$dbport;
$add_user = @$_POST['add_user'] ?: '';
$add_pass = @$_POST['add_pass'] ?: '';
$add_email = @$_POST['add_email'] ?: '';
// Check we can connect to MySQL DB, if not, back to stage 1 :)
if ($stage > 1) {
$database_link = mysqli_connect('p:'.$dbhost, $dbuser, $dbpass, $dbname, $dbport);
dbQuery("SET NAMES 'utf8'");
dbQuery("SET CHARACTER SET 'utf8'");
dbQuery("SET COLLATION_CONNECTION = 'utf8_unicode_ci'");
if (mysqli_connect_error()) {
$stage = 1;
$msg = "Couldn't connect to the database, please check your details
" . mysqli_connect_error();
} elseif ($stage == 2) {
if ($_SESSION['build-ok'] == true) {
$stage = 3;
$msg = "It appears that the database is already setup so have moved onto stage $stage";
}
}
$_SESSION['stage'] = $stage;
}
if ($stage == 4) {
// Now check we have a username, password and email before adding new user
if (empty($add_user) || empty($add_pass) || empty($add_email)) {
$stage = 3;
$msg = "You haven't entered enough information to add the user account, please check below and re-try";
}
} elseif ($stage == 6) {
session_destroy();
// If we get here then let's do some final checks.
if (!file_exists("../config.php")) {
// config.php file doesn't exist. go back to that stage
$msg = "config.php still doesn't exist";
$stage = 5;
}
}
if (empty($stage)) {
$stage = 0;
}
$total_stages = 6;
$stage_perc = $stage / $total_stages * 100;
$complete = 1;
?>
Module | Installed | Comments | $extension | $ext_loaded | "); if ($ext_loaded == 'no') { echo(""); } else { echo(" | "); } echo(""); } // Check for pear install @include_once 'System.php'; if (class_exists('System') === true) { $ext_loaded = 'yes'; $row_class = 'success'; } else { $ext_loaded = 'no'; $row_class = 'danger'; } echo(" |
---|---|---|---|
pear | $ext_loaded | "); if ($ext_loaded == 'no') { echo("apt-get install php-pear / yum install php-pear | "); } else { echo(""); } echo(" |
<?php\n".stripslashes($config_file).""); } else { $config_file = stripslashes($config_file); fwrite($conf, $config_file); echo("
<?php\n".stripslashes($config_file).""); } } ?>