2 /* Copyright (c) 2009 Arnaud Renevier, Inc, published under the modified BSD
5 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
6 "http://www.w3.org/TR/html4/loose.dtd">
7 <html lang="<?php echo $lang?>">
9 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
10 <link rel="stylesheet" href="./media/common.css" type="text/css" />
11 <title><?php ptrans ('SYP wizard')?></title>
12 <script type="text/javascript">
14 if (document.getElementById('password')) {
15 document.getElementById('password').focus();
16 document.getElementById('password').select();
21 <body onload="init()">
25 if (version_compare (PHP_VERSION, '5.0.0', '<')) {
26 par_error (trans ("You need at least PHP version 5"));
29 require_once ("./inc/settings.php");
30 require_once ("./inc/db/mysql.php");
31 require_once ("./inc/utils.php");
34 $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
35 } catch (Exception $e) {
36 switch ($e->getMessage ()) {
37 case anydbConnection::err_driver_unavailable:
38 par_error ($connection->getdbname() . ': ' . trans ('not supported'));
39 case anydbConnection::err_connection:
40 par_error (trans ('Could not connect to database.'));
41 case anydbConnection::err_unknown_database:
42 par_error (trans ('Database does not exist.'));
44 par_error (trans ('Unknown error when connecting to database.'));
48 $users_table_exists = $connection->users_table_exists ();
49 } catch(Exception $e) {
50 par_error (trans ('Unknown error when checking user table.'));
53 if ($users_table_exists) {
54 par_success (trans ('Found user table.'));
56 if (isset($_POST ["password"])) {
58 $connection->create_users_table (true);
59 } catch (Exception $e) {
60 par_error (trans ('Error when creating user table.'));
62 par_success (trans ('User table created.'));
64 $connection->setpwd ("admin", $_POST ["password"]);
65 } catch (Exception $e) {
66 par_error (trans ('Error when initializing password.'));
68 par_success (trans ('Admin password initialized.'));
71 print ('<form class="center" method="post" action="">
72 <label for="password">' . trans ("choose admin password") . '</label>
73 <input id="password" name="password" type="password">
82 $items_table_exists = $connection->items_table_exists ();
83 } catch (Exception $e) {
84 par_error (trans ('Unknown error when checking data table.'));
86 if ($items_table_exists) {
87 par_success (trans ('Found data table.'));
90 $connection->create_items_table (true);
91 } catch (Exception $e) {
92 par_error (trans ('Error when creating data table.'));
94 par_success (trans ('Data table created.'));
97 safe_create_writable_dir (UPLOADDIR);
98 safe_create_writable_dir (getthumbsdir ());
100 if (!function_exists ("gd_info")) {
101 par_warn (trans ('It looks like GD extension is not installed.'));
104 par_success (trans ('SYP is installed. You can now go to <a href="admin.en.php">admin area</a>'));