Your Bouffe@Ulm instance is already configured. You should either delete data/config.php to access this page or delete the install.php for security reasons if you are ok with the configuration. Go to your instance.
');
if(!function_exists("file_get_contents") && !function_exists("file_put_contents")) {
$error = "Functions file_get_contents and file_put_contents seems to not be available on your PHP installation. You should enable them first.";
$block_form = true;
}
if(!is_writable('data/')) {
$error = "The script seems to be unable to write to data/ folder (to write the data/config.php configuration file). You should give write access during install and disable them after (chmod 777 -R data/ to install and chmod 755 -R data/ after installation for example). You'll need right access on this folder each time you will want to edit settings.";
$block_form = true;
}
if(!is_writable('tmp/')) {
$error = "The script seems to be unable to write to tmp/ folder (to store the cached files for templates). You should give write access to this folder.";
$block_form = true;
}
if(!is_writable('db_backups/')) {
$error = "The script seems to be unable to write to db_backups/ folder (to write the database backups). You should give write access to this folder.";
$block_form = true;
}
if(!empty($_POST['mysql_host']) && !empty($_POST['mysql_login']) && !empty($_POST['mysql_password']) && !empty($_POST['mysql_db']) && !empty($_POST['instance_title']) && !empty($_POST['base_url']) && !empty($_POST['currency']) && !empty($_POST['timezone']) && !empty($_POST['lang']) && !empty($_POST['template']) && !empty($_POST['admin_login']) && !empty($_POST['admin_password']) && check_token(600, 'install')) {
$mysql_prefix = (!empty($_POST['mysql_prefix'])) ? $_POST['mysql_prefix'] : '';
$current_template = $_POST['template'];
$current_lang = $_POST['lang'];
try {
$db = new PDO('mysql:host='.$_POST['mysql_host'].';dbname='.$_POST['mysql_db'], $_POST['mysql_login'], $_POST['mysql_password']);
//Create table "Users"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Users (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
login VARCHAR(255),
email VARCHAR(255),
display_name VARCHAR(255),
password VARCHAR(130),
admin TINYINT(1),
json_token VARCHAR(32),
notifications TINYINT(1),
stay_signed_in_token VARCHAR(32),
UNIQUE (login),
UNIQUE (display_name),
UNIQUE (json_token),
UNIQUE (stay_signed_in_token)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
//Create table "Invoices"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Invoices (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
date DATETIME,
buyer INT(11),
FOREIGN KEY (buyer) REFERENCES '.$mysql_prefix.'Users(id) ON DELETE CASCADE,
amount INT(11),
what TEXT
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
//Create table "Users_in_invoices"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Users_in_invoices (
invoice_id INT(11) NOT NULL,
FOREIGN KEY (invoice_id) REFERENCES '.$mysql_prefix.'Invoices(id) ON DELETE CASCADE,
user_id INT(11),
FOREIGN KEY (user_id) REFERENCES '.$mysql_prefix.'Users(id) ON DELETE CASCADE,
guests INT(11)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
//Create table "Paybacks"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Paybacks (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
date DATETIME,
invoice_id INT(11),
FOREIGN KEY (invoice_id) REFERENCES '.$mysql_prefix.'Invoices(id) ON DELETE CASCADE,
amount INT(11),
from_user INT(11),
FOREIGN KEY (from_user) REFERENCES '.$mysql_prefix.'Users(id) ON DELETE CASCADE,
to_user INT(11)
FOREIGN KEY (to_user) REFERENCES '.$mysql_prefix.'Users(id) ON DELETE CASCADE,
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
// Create table "GlobalPaybacks"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'GlobalPaybacks (
id INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
date DATETIME,
closed TINYINT(1)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
// Create table "Users_in_GlobalPaybacks"
$db->query('CREATE TABLE IF NOT EXISTS '.$mysql_prefix.'Users_in_GlobalPaybacks (
global_payback_id INT(11) NOT NULL,
FOREIGN KEY (global_payback_id) REFERENCES '.$mysql_prefix.'GlobalPaybacks(id) ON DELETE CASCADE,
user1_id INT(11),
FOREIGN KEY (user1_id) REFERENCES '.$mysql_prefix.'Users(id) ON DELETE CASCADE,
user2_id INT(11),
FOREIGN KEY (user2_id) REFERENCES '.$mysql_prefix.'Users(id) ON DELETE CASCADE,
amount INT(11)
) DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci');
} catch (PDOException $e) {
$error = 'Unable to connect to database and create database, check your credentials and config. Error message: '.$e->getMessage().'.';
}
if(!empty($_POST['email_webmaster']) && !filter_var($_POST['email_webmaster'], FILTER_VALIDATE_EMAIL)) {
$error = "Webmaster's email address is invalid.";
}
if(empty($error)) {
if(function_exists('mcrypt_create_iv')) {
$salt = strtr(base64_encode(mcrypt_create_iv(16, MCRYPT_DEV_URANDOM)), '+', '.');
}
else {
mt_srand(microtime(true)*100000 + memory_get_usage(true));
$salt = md5(uniqid(mt_rand(), true));
}
$salt = sprintf("$2a$%02d$", 10) . $salt; //prefix for blowfish
$config = "setLogin($_POST['admin_login']);
$admin->setDisplayName(!empty($_POST['admin_display_name']) ? $_POST['admin_display_name'] : '');
$admin->setPassword($admin->encrypt($_POST['admin_password']));
$admin->setAdmin(true);
$admin->setEmail($email_webmaster);
$admin->setStaySignedInToken("");
$admin->setNotifications(3);
$admin->newJsonToken();
$admin->save();
header('location: index.php');
exit();
} catch (Exception $e) {
$error = 'An error occurred when inserting user in the database. Error message: '.$e->getMessage().'.';
}
}
else {
$error = 'Unable to write configuration to config file data/config.php.';
}
}
}
else {
$current_template = 'default';
$current_lang = 'en.php';
}
$token = generate_token('install');
?>
Bouffe@Ulm - Installation
Bouffe@Ulm - Installation
'.$error.'';
}
?>
This small form will guide you through the installation of Bouffe@Ulm. You must fill in all the fields.