X-Git-Url: https://dev.renevier.net/gitweb.cgi?p=syp.git;a=blobdiff_plain;f=inc%2Ftemplates_wizard.php;h=b6780258d5b7976c34e50eb1f0bdf19c270ccf4e;hp=f556991a67eccf75a927e010bbb1d2dc585c5d19;hb=3c9d0dbaecbd62e5933096270da3e970371d67ec;hpb=a95b8e8626615eb84bd4760a0640d13dc1e67bab diff --git a/inc/templates_wizard.php b/inc/templates_wizard.php index f556991..b678025 100644 --- a/inc/templates_wizard.php +++ b/inc/templates_wizard.php @@ -4,7 +4,7 @@ ?> - + @@ -15,68 +15,57 @@ document.getElementById('password').focus(); document.getElementById('password').select(); } + } "); - } - function wiz_success ($message) { - printf ("

%s

", $message); - } - function wiz_error ($message) { - printf ("

%s

", $message); - leave (); - } - function wiz_warn ($message) { - printf ("

%s

", $message); - } if (version_compare (PHP_VERSION, '5.0.0', '<')) { - wiz_error (trans ("You need at least PHP version 5")); + 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: - wiz_error ($connection->getdbname() . ': ' . trans ('not supported')); + par_error ($connection->getdbname() . ': ' . trans ('not supported')); case anydbConnection::err_connection: - wiz_error (trans ('Could not connect to database.')); + par_error (trans ('Could not connect to database.')); case anydbConnection::err_unknown_database: - wiz_error (trans ('Database does not exist.')); + par_error (trans ('Database does not exist.')); default: - wiz_error (trans ('Unknown error when connecting to database.')); + par_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.')); + par_error (trans ('Unknown error when checking user table.')); } if ($users_table_exists) { - wiz_success (trans ('Found user table.')); + par_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.')); + par_error (trans ('Error when creating user table.')); } - wiz_success (trans ('User table created.')); + par_success (trans ('User table created.')); try { $connection->setpwd ("admin", $_POST ["password"]); } catch (Exception $e) { - wiz_error (trans ('Error when initializing password.')); + par_error (trans ('Error when initializing password.')); } - wiz_success (trans ('Admin password initialized.')); + par_success (trans ('Admin password initialized.')); } else { print ('
@@ -92,32 +81,27 @@ try { $items_table_exists = $connection->items_table_exists (); } catch (Exception $e) { - wiz_error (trans ('Unknown error when checking data table.')); + par_error (trans ('Unknown error when checking data table.')); } if ($items_table_exists) { - wiz_success (trans ('Found data table.')); + par_success (trans ('Found data table.')); } else { try { $connection->create_items_table (true); } catch (Exception $e) { - wiz_error (trans ('Error when creating data table.')); + par_error (trans ('Error when creating data table.')); } - wiz_success (trans ('Data table created.')); + par_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')); + + 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.')); } - wiz_success (trans ('SYP is installed. You can now go to admin area')); + + par_success (trans ('SYP is installed. You can now go to admin area')); ?>