From 1a36b5e190962a066b63480091fe13bfe50fadf1 Mon Sep 17 00:00:00 2001 From: Stefan Frech Date: Sun, 20 Apr 2008 13:02:58 +0000 Subject: [PATCH] removing install.php --- install.php | 520 ---------------------------------------------------- 1 file changed, 520 deletions(-) delete mode 100644 install.php diff --git a/install.php b/install.php deleted file mode 100644 index ead9d36..0000000 --- a/install.php +++ /dev/null @@ -1,520 +0,0 @@ - - - - - - Online-Bookmarks - - - - -' . $message . '' . "\n"; -} - -function check_table_version ($table, $field) { - $query = "DESC $table"; - $return = false; - if ($result = mysql_query ($query)) { - while ($row = mysql_fetch_row ($result)) { - if ($row[0] == $field) { - $return = true; - break; - } - } - } - return $return; -} - -function upgrade_table ($table, $field, $query) { - if (check_table_version ($table, $field)) { - print_msg ("Table $table contains '$field' field, good.", "success"); - } - else { - print_msg ("Table $table does not contain $field field, attempting to upgrade", "notice"); - if (mysql_query ($query)) { - print_msg ("Table $table altered, $field added.", "success"); - } - else { - print_msg ("Failure! Table $table not changed.", "error"); - } - } -} - - -############## html stuff ############## - -function html_db () { - global $mysql_hostname, - $mysql_db_name, - $mysql_db_username, - $mysql_db_su_username, - $cookie_name, - $cookie_domain, - $cookie_path, - $cookie_seed, - $cookie_expire; - ?> - -

Database connection:

- -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Database hostname:
Database name:
Database username:
Database password:
Create new database:
using Superuser account:
Superuser password:

Cookie settings:

Cookie name:
Cookie domain:
Cookie path:
Cookie seed:Just some random junk.
Cookie expire:Set an amount of seconds when the cookie will expire.
-
- - $mysql_db_username, - 'db_password' => $mysql_db_password, - 'db_hostname' => $mysql_hostname, - 'db_name' => $mysql_db_name, - ); - - if (! @mysql_connect ($dsn['db_hostname'], $dsn['db_username'], $dsn['db_password'])) { - html_db (); - print_msg (mysql_error (), "error"); - } - else { - if (! @mysql_select_db ($dsn['db_name'])) { - html_db (); - print_msg (mysql_error (), "error"); - } - else { - ############## DB support ############## - print_msg ("DB connection succeeded", "success"); - - $query = "SHOW TABLES"; - $tables = array (); - $result = mysql_query ($query); - - while ($row = mysql_fetch_row ($result)) { - array_push ($tables, $row[0]); - } - - # the bookmark table - if (!in_array ("bookmark", $tables)) { - if (create_table_bookmark ()) { - print_msg ("Table bookmark created", "success"); - } - else { - print_msg (mysql_error (), "error"); - } - } - else { - print_msg ("Table bookmark exists, checking for version:", "notice"); - - # check for favicon support - upgrade_table ("bookmark", "favicon", "ALTER TABLE bookmark ADD COLUMN favicon varchar(200)"); - - # check for public field in table - upgrade_table ("bookmark", "public", "ALTER TABLE bookmark ADD COLUMN public ENUM('0','1') DEFAULT 0 NOT NULL"); - } - - # the folder table - if (!in_array ("folder", $tables)) { - if (create_table_folder ()) { - print_msg ("Table folder created", "success"); - } - else { - print_msg (mysql_error (), "error"); - } - } - else { - print_msg ("Table folder exists, checking for version:", "notice"); - - # check for public field in table - upgrade_table ("folder", "public", "ALTER TABLE folder ADD COLUMN public ENUM('0','1') DEFAULT 0 NOT NULL"); - } - - - - # the user table - if (!in_array ("user", $tables)) { - if (create_table_user ()) { - print_msg ("Table user created", "success"); - if (create_admin_user ()) { - print_msg ("Admin user created (see below)", "success"); - $admin_message = 'Initial user created. Login with username "admin" and password "admin"'; - } - } - else { - print_msg (mysql_error (), "error"); - } - } - else { - print_msg ("Table user exists, checking for version:", "notice"); - - # check for date_format field in table - upgrade_table ("user", "date_format", "ALTER TABLE user ADD COLUMN date_format CHAR(10) NOT NULL DEFAULT 'd.m.Y' AFTER show_column_date"); - - # check for show_public field in table - upgrade_table ("user", "show_public", "ALTER TABLE user ADD COLUMN show_public ENUM('0','1') DEFAULT 1 NOT NULL"); - - # check for admin field in table - upgrade_table ("user", "admin", "ALTER TABLE user ADD COLUMN admin ENUM('0','1') DEFAULT 0 NOT NULL AFTER password"); - } - - ############## favicon support ############## - - if ($convert = @exec ('which convert')) { - print_msg ("ImageMagick convert found: $convert", "success"); - } - else { - $convert = ""; - print_msg ("ImageMagick convert not found. Make sure ImageMagick is installed and specify location of convert manually in ./config/config.php", "error"); - } - - if ($identify = @exec ('which identify')) { - print_msg ("ImageMagick identify found: $identify", "success"); - } - else { - $identify = ""; - print_msg ("ImageMagick identify not found. Make sure ImageMagick is installed and specify location of identify manually in ./config/config.php", "error"); - } - - if (is_writable ("./favicons/")) { - print_msg ("./favicons directory is writable by the webserver, good.", "success"); - } - else { - print_msg ("./favicons directory is not writable by the webserver. Adjust permissions manually.", "error"); - } - - - $config = ' -<?php -if (basename ($_SERVER[\'SCRIPT_NAME\']) == basename (__FILE__)) { - die ("no direct access allowed"); -} - -$dsn = array( - \'username\' => \'' . $mysql_db_username . '\', - \'password\' => \'' . $mysql_db_password . '\', - \'hostspec\' => \'' . $mysql_hostname . '\', - \'database\' => \'' . $mysql_db_name . '\', -); - -$cookie = array ( - \'name\' => \'' . $cookie_name . '\', - \'domain\' => \'' . $cookie_domain . '\', - \'path\' => \'' . $cookie_path . '\', - \'seed\' => \'' . $cookie_seed . '\', - \'expire\' => time() + ' . $cookie_expire . ', -); - -# Feel free to add values to this list as you like -# according to the PHP documentation -# http://www.php.net/manual/en/function.date.php -$date_formats = array ( - \'d/m/Y\', - \'Y-m-d\', - \'m/d/Y\', - \'d.m.Y\', - \'F j, Y\', - \'dS \o\f F Y\', - \'dS F Y\', - \'d F Y\', - \'d. M Y\', - \'Y F d\', - \'F d, Y\', - \'M. d, Y\', - \'m/d/Y\', - \'m-d-Y\', - \'m.d.Y\', - \'m.d.y\', -); - -$convert = \'' . $convert . '\'; -$identify = \'' . $identify . '\'; -$timeout = 5; -$folder_closed = \'<img src="./images/folder.gif">\'; -$folder_opened = \'<img src="./images/folder_open.gif">\'; -$folder_closed_public = \'<img src="./images/folder_red.gif">\'; -$folder_opened_public = \'<img src="./images/folder_open_red.gif">\'; -$bookmark_image = \'<img src="./images/bookmark_image.gif">\'; -$plus = \'<img src="./images/plus.gif"> \'; -$minus = \'<img src="./images/minus.gif"> \'; -$neutral = \'<img src="./images/spacer.gif" width="13" height="1"> \'; -$edit_image = \'<img src="./images/edit.gif" title="%s">\'; -$move_image = \'<img src="./images/move.gif" title="%s">\'; -$delete_image = \'<img src="./images/delete.gif" title="%s">\'; -$delimiter = "/"; -?>'; - - echo '

Paste the configuration shown below in the configuration file ./config/config.php

' . "\n"; - if ($admin_message != '') { - echo $admin_message; - } - print_msg ("

IMPORTANT! Do not forget to remove this install.php script.

"); - echo '
';
-			echo $config;
-			echo "
\n"; - echo 'Now go Bookmark...'; - } - } -} -else { - html_db (); -} - -require_once (ABSOLUTE_PATH . "footer.php"); - -?>