Shimmie needs to be run via a web server with PHP support -- you appear to be either opening the file from your hard disk, or your web server is mis-configured.
If you've installed a web server on your desktop PC, you probably want to visit the local web server.
Once you have created these folders, hit 'refresh' to continue.";
		exit;
	}
} // }}}
function write_config() { // {{{
	global $database_dsn;
	$file_content = '<' . '?php' . "\n" .
			"define('DATABASE_DSN', '$database_dsn');\n" .
			'?' . '>';
	
	if(is_writable("./") && file_put_contents("config.php", $file_content)) {
		assert(file_exists("config.php"));
	}
	else {
		$h_file_content = htmlentities($file_content);
		print << One done, Continue
EOD;
		exit;
	}
} // }}}
function Database_user_deletion_fix() {
	try {
		require_once "core/database.class.php";
		$db = new Database();
		
		echo "Fixing user_favorites table....";
		
		($db->Execute("ALTER TABLE user_favorites ENGINE=InnoDB;")) ? print_r("ok
") : print_r("failed
");
		echo "adding Foreign key to user ids...";
		
		($db->Execute("ALTER TABLE user_favorites ADD CONSTRAINT foreign_user_favorites_user_id FOREIGN KEY (user_id) REFERENCES users(id) ON DELETE CASCADE;"))? print_r("ok
"):print_r("failed
");
		echo "cleaning, the table from deleted image favorites...
";
		
		$rows = $db->get_all("SELECT * FROM user_favorites WHERE image_id NOT IN ( SELECT id FROM images );");
		
		foreach( $rows as $key => $value)
			$db->Execute("DELETE FROM user_favorites WHERE image_id = :image_id;", array("image_id" => $value["image_id"]));
		
		echo "adding forign key to image ids...";
		
		($db->Execute("ALTER TABLE user_favorites ADD CONSTRAINT user_favorites_image_id FOREIGN KEY (image_id) REFERENCES images(id) ON DELETE CASCADE;"))? print_r("ok
"):print_r("failed
");
		
		echo "adding foreign keys to private messages...";
		
		($db->Execute("ALTER TABLE private_message 
		ADD CONSTRAINT foreign_private_message_from_id FOREIGN KEY (from_id) REFERENCES users(id) ON DELETE CASCADE,
		ADD CONSTRAINT foreign_private_message_to_id FOREIGN KEY (to_id) REFERENCES users(id) ON DELETE CASCADE;")) ? print_r("ok
"):print_r("failed
");
		
		echo "Just one more step...which you need to do manually:
";
		echo "You need to go to your database and Delete the foreign key on the owner_id in the images table.
";
		echo "How to remove foreign keys
";
		echo "and finally execute this querry:
";
		echo "ALTER TABLE images ADD CONSTRAINT foreign_images_owner_id FOREIGN KEY (owner_id) REFERENCES users(id) ON DELETE RESTRICT;
";
		echo "if this is all sucesfull you are done!";
	}
	catch (PDOException $e)
	{
		// FIXME: Make the error message user friendly
		exit($e->getMessage());
	}
}
?>