+++ /dev/null
-<?php
-/* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
- license. */
-?>
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
- "http://www.w3.org/TR/html4/loose.dtd">
-<html lang="<?php echo $lang?>">
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
- <link rel="stylesheet" href="./media/common.css" type="text/css" />
- <title><?php ptrans ('SYP wizard')?></title>
- <script type="text/javascript">
- function init () {
- if (document.getElementById('password')) {
- document.getElementById('password').focus();
- document.getElementById('password').select();
- }
- }
- </script>
-</head>
-<body onload="init()">
-
-<?php
-
- if (version_compare (PHP_VERSION, '5.0.0', '<')) {
- par_error (trans ("You need at least PHP version 5"));
- }
-
- require_once ("./inc/settings.php");
- require_once ("./inc/db/mysql.php");
- require_once ("./inc/utils.php");
-
- try {
- $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
- } catch (Exception $e) {
- switch ($e->getMessage ()) {
- case anydbConnection::err_driver_unavailable:
- par_error ($connection->getdbname() . ': ' . trans ('not supported'));
- case anydbConnection::err_connection:
- par_error (trans ('Could not connect to database.'));
- case anydbConnection::err_unknown_database:
- par_error (trans ('Database does not exist.'));
- default:
- par_error (trans ('Unknown error when connecting to database.'));
- }
- }
- try {
- $users_table_exists = $connection->users_table_exists ();
- } catch(Exception $e) {
- par_error (trans ('Unknown error when checking user table.'));
- }
-
- if ($users_table_exists) {
- par_success (trans ('Found user table.'));
- } else {
- if (isset($_POST ["password"])) {
- try {
- $connection->create_users_table (true);
- } catch (Exception $e) {
- par_error (trans ('Error when creating user table.'));
- }
- par_success (trans ('User table created.'));
- try {
- $connection->setpwd ("admin", $_POST ["password"]);
- } catch (Exception $e) {
- par_error (trans ('Error when initializing password.'));
- }
- par_success (trans ('Admin password initialized.'));
-
- } else {
- print ('<form class="center" method="post" action="">
- <label for="password">' . trans ("choose admin password") . '</label>
- <input id="password" name="password" type="password">
- <input type="submit">
- </form>');
- leave ();
- }
-
- }
-
- try {
- $items_table_exists = $connection->items_table_exists ();
- } catch (Exception $e) {
- par_error (trans ('Unknown error when checking data table.'));
- }
- if ($items_table_exists) {
- par_success (trans ('Found data table.'));
- } else {
- try {
- $connection->create_items_table (true);
- } catch (Exception $e) {
- par_error (trans ('Error when creating data table.'));
- }
- par_success (trans ('Data table created.'));
- }
-
- safe_create_writable_dir (UPLOADDIR);
- safe_create_writable_dir (getthumbsdir ());
-
- if (!function_exists ("gd_info")) {
- par_warn (trans ('It looks like GD extension is not installed.'));
- }
-
- par_success (trans ('SYP is installed. You can now go to <a href="admin.en.php">admin area</a>'));
-?>
-
-</body>
-</html>