cp -RLp inc/ $DESTDIR/
# other php files
-cp -p admin.*php index.*php api.php items.php logout.php wizard.php $DESTDIR/
+cp -p admin.*php index.*php wizard.*php api.php items.php logout.php $DESTDIR/
# media
cp -RLp media/ $DESTDIR/
public function users_table_exists();
/*
- * create users table; if $error_if_exists is true; throws an err_query
- * error in case users table already exists.
+ * create users table;
+ * throws an err_query error in case users table already exists.
*/
- public function create_users_table($error_if_exists);
+ public function create_users_table();
/*
* return true if items table already exists
public function items_table_exists();
/*
- * create items table; if $error_if_exists is true; throws an err_query
- * error in case items table already exists.
+ * create items table;
+ * throws an err_query error in case items table already exists.
*/
- public function create_items_table($error_if_exists);
+ public function create_items_table();
/*
* set password $pwd for user $usrname. If $usrname does not exist, create
public function users_table_exists () {
return $this->_tblexists ("users");
}
- public function create_users_table ($error_if_exists) {
+ public function create_users_table () {
$query = sprintf ("CREATE TABLE " .
- ($error_if_exists ? " " : "IF NOT EXISTS ") .
"%susers (
name VARCHAR(255) NOT NULL, pwd CHAR(32),
PRIMARY KEY (name));", $this->dbprefix);
public function items_table_exists () {
return $this->_tblexists ("items");
}
- public function create_items_table ($error_if_exists) {
+ public function create_items_table () {
$query = sprintf ("CREATE TABLE " .
- ($error_if_exists ? " " : "IF NOT EXISTS ") .
"%sitems (
id MEDIUMINT NOT NULL AUTO_INCREMENT,
location POINT,
"_language_name" => "english",
/* starts translation */
+ "SYP wizard"
+ => "",
+
+ "You need at least PHP version 5"
+ => "",
+
+ "not supported"
+ => "",
+
+ "Could not connect to database."
+ => "",
+
+ "Database does not exist."
+ => "",
+
+ "Unknown error when connecting to database."
+ => "",
+
+ "Unknown error when checking user table."
+ => "",
+
+ "Found user table."
+ => "",
+
+ "Error when creating user table."
+ => "",
+
+ "User table created."
+ => "",
+
+ "Error when initializing password."
+ => "",
+
+ "Admin password initialized."
+ => "",
+
+ "choose admin password"
+ => "",
+
+ "Unknown error when checking data table."
+ => "",
+
+ "Found data table."
+ => "",
+
+ "Error when creating data table."
+ => "",
+
+ "Data table created."
+ => "",
+
+ "exist but is not a directory"
+ => "",
+
+ "could not create directory"
+ => "",
+
+ "directory created"
+ => "",
+
+ "could not write in directory"
+ => "",
+
+ "SYP is installed. You can now go to <a href=\"admin.en.php\">admin area</a>"
+ => "",
"SYP needs javascript. Please activate scripts in your browser."
=> "",
"SYP admin"
=> "",
- "SYP is not correctly installed. Please read README.txt file and follow\n" .
- " installation instructions."
+ "SYP is not correctly installed. Please follow README.txt instructions\n" .
+ " and go to <a href=\"wizard.en.php\">wizard</a>."
=> "",
"add a place"
/* starts translation */
+ "SYP wizard"
+ =>
+ "Assistant d'installation de SYP"
+ ,
+
+ "You need at least PHP version 5"
+ =>
+ "Vous devez utiliser une version de PHP au moins égale à la version 5"
+ ,
+
+ "not supported"
+ =>
+ "support non détecté"
+ ,
+
+ "Could not connect to database."
+ =>
+ "Impossible de se connecter à la base de donnée."
+ ,
+
+ "Database does not exist."
+ =>
+ "La base de donnée n'existe pas."
+ ,
+
+ "Unknown error when connecting to database."
+ =>
+ "Erreur inconnue lors de la connexion à la base."
+ ,
+
+ "Unknown error when checking user table."
+ =>
+ "Erreur inconnue lors de la vérification de la table utilisateur."
+ ,
+
+ "Found user table."
+ =>
+ "Table utilisateur trouvée."
+ ,
+
+ "Error when creating user table."
+ =>
+ "Erreur lors de la création de la table utilisateur."
+ ,
+
+ "User table created."
+ =>
+ "Table utilisateur créée."
+ ,
+
+ "Error when initializing password."
+ =>
+ "Erreur lors de l'initialisation du mot de passe."
+ ,
+
+ "Admin password initialized."
+ =>
+ "Mot de passe administrateur initialisé."
+ ,
+
+ "choose admin password"
+ =>
+ "choisir un mot de passe administrateur"
+ ,
+
+ "Unknown error when checking data table."
+ =>
+ "Erreur inconnue lors de la vérification de la table des données."
+ ,
+
+ "Found data table."
+ =>
+ "Table des données trouvée."
+ ,
+
+ "Error when creating data table."
+ =>
+ "Erreur lors de la création de la table des données."
+ ,
+
+ "Data table created."
+ =>
+ "Table des données créée."
+ ,
+
+ "exist but is not a directory"
+ =>
+ "existe mais n'est pas un répertoire"
+ ,
+
+ "could not create directory"
+ =>
+ "Impossible de créer le répertoire"
+ ,
+
+ "directory created"
+ =>
+ "Répertoire créé"
+ ,
+
+ "could not write in directory"
+ =>
+ "Impossible d'écrire dans le répertoire"
+ ,
+
+ "SYP is installed. You can now go to <a href=\"admin.en.php\">admin area</a>"
+ =>
+ "SYP est installé. Vous pouvez maintenant vous rendre dans <a href=\"admin.fr.php\">la partie administration.</a>"
+ ,
+
"SYP needs javascript. Please activate scripts in your browser."
=>
"SYP a besoin de javascript pour fonctionner. Veuillez activer les scripts dans votre navigateur."
"administration de SYP"
,
- "SYP is not correctly installed. Please read README.txt file and follow\n" .
- " installation instructions."
+ "SYP is not correctly installed. Please follow README.txt instructions\n" .
+ " and go to <a href=\"wizard.en.php\">wizard</a>."
=>
"SYP n'est pas correctement installé. Veuillez\n" .
- " consulter le fichier README.txt et suivez les instructions\n" .
- " d'installation."
+ " suivre les instructions du fichier README.txt et vous rendre\n" .
+ " sur la page du <a href=\"wizard.fr.php\">wizard</a>."
,
"add a place"
}
$ROOTDIR="../../";
-$SCRIPTS=array("admin"); // scripts in rootdir we need to link to
+$SCRIPTS=array("admin", "index", "wizard"); // scripts in rootdir we need to link to
function usage() {
global $argv;
// tables prefix. This prefix will also be used as a prefix for cookie names.
define ("DBPREFIX", "syp_");
-// admin password. It will be read from here during site installation.
-// Then, it will be stored in database. So, if you need to change password
-// once it's set, changing it here will not work; you'll need to change it
-// in the database.
-define ("ADMINPWD", "");
-
// directory where images will be uploaded and stored. That directory needs
// to be writeable by SYP.
define ("UPLOADDIR", "upload");
<link rel="stylesheet" href="./media/admin.css" type="text/css">
</head>
<body>
- <p class="error center"><?php ptrans('SYP is not correctly installed. Please read README.txt file and follow
- installation instructions.')?></p>
+ <p class="error center"><?php ptrans('SYP is not correctly installed. Please follow README.txt instructions
+ and go to <a href="wizard.en.php">wizard</a>.')?></p>
</body>
</html>
<?php
--- /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>
+<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
+ function leave () {
+ exit ("\n</body></html>");
+ }
+ function wiz_success ($message) {
+ printf ("<p class=\"success center\">%s</p>", $message);
+ }
+ function wiz_error ($message) {
+ printf ("<p class=\"error center\">%s</p>", $message);
+ leave ();
+ }
+ function wiz_warn ($message) {
+ printf ("<p class=\"warn center\">%s</p>", $message);
+ }
+
+ if (version_compare (PHP_VERSION, '5.0.0', '<')) {
+ wiz_error (trans ("You need at least PHP version 5"));
+ }
+
+ require_once ("./inc/settings.php");
+ require_once ("./inc/db/mysql.php");
+
+ try {
+ $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
+ } catch (Exception $e) {
+ switch ($e->getMessage ()) {
+ case anydbConnection::err_driver_unavailable:
+ wiz_error ($connection->getdbname() . ': ' . trans ('not supported'));
+ case anydbConnection::err_connection:
+ wiz_error (trans ('Could not connect to database.'));
+ case anydbConnection::err_unknown_database:
+ wiz_error (trans ('Database does not exist.'));
+ default:
+ wiz_error (trans ('Unknown error when connecting to database.'));
+ }
+ }
+ try {
+ $users_table_exists = $connection->users_table_exists ();
+ } catch(Exception $e) {
+ wiz_error (trans ('Unknown error when checking user table.'));
+ }
+
+ if ($users_table_exists) {
+ wiz_success (trans ('Found user table.'));
+ } else {
+ if (isset($_POST ["password"])) {
+ try {
+ $connection->create_users_table (true);
+ } catch (Exception $e) {
+ wiz_error (trans ('Error when creating user table.'));
+ }
+ wiz_success (trans ('User table created.'));
+ try {
+ $connection->setpwd ("admin", $_POST ["password"]);
+ } catch (Exception $e) {
+ wiz_error (trans ('Error when initializing password.'));
+ }
+ wiz_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) {
+ wiz_error (trans ('Unknown error when checking data table.'));
+ }
+ if ($items_table_exists) {
+ wiz_success (trans ('Found data table.'));
+ } else {
+ try {
+ $connection->create_items_table (true);
+ } catch (Exception $e) {
+ wiz_error (trans ('Error when creating data table.'));
+ }
+ wiz_success (trans ('Data table created.'));
+ }
+ if (!is_dir (UPLOADDIR)) {
+ if (file_exists (UPLOADDIR)) {
+ wiz_error (UPLOADDIR . ": " . trans ('exist but is not a directory'));
+ }
+ if (!mkdir (UPLOADDIR)) {
+ wiz_error (UPLOADDIR . ": " . trans ('could not create directory'));
+ } else {
+ wiz_success (UPLOADDIR . ": " . trans ('directory created'));
+ }
+ }
+ if (!is_writeable (UPLOADDIR) || !is_executable (UPLOADDIR)) {
+ wiz_error (UPLOADDIR . ": " . trans ('could not write in directory'));
+ }
+ wiz_success (trans ('SYP is installed. You can now go to <a href="admin.en.php">admin area</a>'));
+?>
+
+</body>
+</html>
--- /dev/null
+wizard.php
\ No newline at end of file
--- /dev/null
+wizard.php
\ No newline at end of file
<?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>
-<head>
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" >
- <link rel="stylesheet" href="./media/common.css" type="text/css" />
- <title>SYP wizard</title>
-</head>
-<body>
-
-<?php
- function wiz_success ($message) {
- printf ("<p class=\"success center\">%s</p>", $message);
- }
- function wiz_error ($message) {
- exit (sprintf ("<p class=\"error center\">%s</p>", $message));
- }
- function wiz_warn ($message) {
- printf ("<p class=\"warn center\">%s</p>", $message);
- }
-
- if (version_compare (PHP_VERSION, '5.0.0', '<')) {
- wiz_error ("Vous devez utiliser une version de PHP au moins égale à la version 5");
- }
-
- if (!function_exists ("exif_read_data")) {
- wiz_warn ("Cette version de php ne supporte pas la lecture des données exif");
- }
- require_once ("./inc/settings.php");
- require_once ("./inc/db/mysql.php");
-
- try {
- $connection->connect (DBHOST, DBUSER, DBPWD, DBNAME, DBPREFIX);
- } catch (Exception $e) {
- switch ($e->getMessage ()) {
- case anydbConnection::err_driver_unavailable:
- wiz_error ('Support de ' . $connection->getdbname () . ' non détecté.');
- case anydbConnection::err_connection:
- wiz_error ('Impossible de se connecter à la base de donnée.');
- case anydbConnection::err_unknown_database:
- wiz_error ('La base de donnée n\'existe pas.');
- default:
- wiz_error ('Erreur inconnue lors de la connexion à la base.');
- }
- }
- try {
- $users_table_exists = $connection->users_table_exists ();
- } catch(Exception $e) {
- wiz_error ('Erreur inconnue lors de la vérification de la table utilisateur.');
- }
-
- if ($users_table_exists) {
- wiz_success ('Table utilisateur trouvée.');
- } else {
- try {
- $connection->create_users_table (true);
- } catch (Exception $e) {
- wiz_error ('Erreur lors de la création de la table utilisateur.');
- }
- wiz_success ('Table utilisateur crée.');
- try {
- $connection->setpwd ("admin", ADMINPWD);
- } catch (Exception $e) {
- wiz_error ('Erreur lors de l\'initialisation du mot de passe.');
- }
- wiz_success ('Mot de passe administrateur initialisé.');
- }
-
- try {
- $items_table_exists = $connection->items_table_exists ();
- } catch (Exception $e) {
- wiz_error ('Erreur inconnue lors de la vérification de la table des données.');
- }
- if ($items_table_exists) {
- wiz_success ('Table utilisateur trouvée.');
- } else {
- try {
- $connection->create_items_table (true);
- } catch (Exception $e) {
- wiz_error ('Erreur lors de la création de la table des données.');
- }
- wiz_success ('Table des données crée.');
- }
- if (!is_dir (UPLOADDIR)) {
- if (file_exists (UPLOADDIR)) {
- wiz_error (sprintf ("%s existe et n'est pas un répertoire.",
- UPLOADDIR));
- }
- if (!mkdir (UPLOADDIR)) {
- wiz_error (sprintf ("Impossible de créer le répertoire %s.",
- UPLOADDIR));
- } else {
- wiz_success (sprintf ('Répertoire %s crée.', UPLOADDIR));
- }
- }
- if (!is_writeable (UPLOADDIR) || !is_executable (UPLOADDIR)) {
- wiz_error (sprintf ("Impossible d'écrire dans %s.", UPLOADDIR));
- }
- wiz_success ('SYP est installé. Vous pouvez maintenant vous rendre dans <a href="admin.php">la partie administration.');
+ require ('inc/langutils.php');
+ require ('inc/templates_wizard.php');
?>
-
-</body>
-</html>