format('Y-m-d H:i:s')], TEMPLATE_SETTINGS ); require 'backend/classes/core/Autoloader.php'; if (!is_dir(Autoloader::PATH_CACHE)) { mkdir(Autoloader::PATH_CACHE); } $file = fopen(getcwd() . '/backend/classes/Setting.php', 'w'); fwrite($file, $settings); fclose($file); Autoloader::BuildCache(); $autoloader = new Autoloader(); $file = fopen('backend/scripts/setup.sql', 'r'); $setupSql = fread($file, filesize('backend/scripts/setup.sql')); fclose($file); $db = new MySqlDatabase($hostname, $username, $password, $database); $db->startTransaction(); $db->Query(str_replace('$DB_NAME', $database, $setupSql)); echo 'Let\'s create an admin account...' . PHP_EOL; $user = new User(null, $db); $user->setUsername(getUserInput('Username: ')); $user->setPassword(Password::GetHash(getUserInput('Password: '))); $user->setEmail(getUserInput('Email: ')); $user->setJabberAddress(getUserInput('Jabber address: ')); $user->setAdmin(true); $user->Save(); $db->commit(); echo 'Ringfinger setup has successfully finished.' . PHP_EOL;