' . $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 SMALLINT(6) NOT NULL DEFAULT '0' 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')) { $convert_favicons = "true"; print_msg ("ImageMagick convert found: $convert", "success"); } else { $convert = ""; $convert_favicons = "false"; print_msg ("ImageMagick convert not found. Make sure ImageMagick is installed and specify location of convert manually or set \$convert_favicons to false.", "error"); } if ($identify = @exec ('which identify')) { $convert_favicons = "true"; print_msg ("ImageMagick identify found: $identify", "success"); } else { $identify = ""; $convert_favicons = "false"; print_msg ("ImageMagick identify not found. Make sure ImageMagick is installed and specify location of identify manually or set \$convert_favicons to false.", "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_favicons = ' . $convert_favicons . '; $convert = \'' . $convert . '\'; $identify = \'' . $identify . '\'; $timeout = 5; $folder_closed = \'<img src="./images/folder.gif" alt="">\'; $folder_opened = \'<img src="./images/folder_open.gif" alt="">\'; $folder_closed_public = \'<img src="./images/folder_red.gif" alt="">\'; $folder_opened_public = \'<img src="./images/folder_open_red.gif" alt="">\'; $bookmark_image = \'<img src="./images/bookmark_image.gif" alt="">\'; $plus = \'<img src="./images/plus.gif" alt=""> \'; $minus = \'<img src="./images/minus.gif" alt=""> \'; $neutral = \'<img src="./images/spacer.gif" width="13" height="1" alt=""> \'; $edit_image = \'<img src="./images/edit.gif" title="%s" alt="">\'; $move_image = \'<img src="./images/move.gif" title="%s" alt="">\'; $delete_image = \'<img src="./images/delete.gif" title="%s" alt="">\'; $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"); ?>