diff options
Diffstat (limited to 'installer')
-rw-r--r-- | installer/cli.php | 2 | ||||
-rw-r--r-- | installer/index.php | 7 | ||||
-rw-r--r-- | installer/install.sql | 50 | ||||
-rw-r--r-- | installer/installer.php | 29 | ||||
-rw-r--r-- | installer/web.php | 2 |
5 files changed, 55 insertions, 35 deletions
diff --git a/installer/cli.php b/installer/cli.php index fe82395a..e02c8658 100644 --- a/installer/cli.php +++ b/installer/cli.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2010 Bharat Mediratta + * Copyright (C) 2000-2011 Bharat Mediratta * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by diff --git a/installer/index.php b/installer/index.php index 75d6fe5b..5ac23cfb 100644 --- a/installer/index.php +++ b/installer/index.php @@ -1,7 +1,7 @@ <?php /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2010 Bharat Mediratta + * Copyright (C) 2000-2011 Bharat Mediratta * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -26,6 +26,11 @@ if (version_compare(PHP_VERSION, "5.2.3", "<")) { exit; } +// Turn off session.use_trans_sid -- that feature attempts to inject session ids +// into generated URLs and forms, but it doesn't interoperate will with Gallery's +// Ajax code. +ini_set("session.use_trans_sid", false); + require(DOCROOT . "installer/installer.php"); if (PHP_SAPI == "cli") { include("cli.php"); diff --git a/installer/install.sql b/installer/install.sql index 427a3283..865cb2a4 100644 --- a/installer/install.sql +++ b/installer/install.sql @@ -43,7 +43,7 @@ CREATE TABLE {caches} ( `expiration` int(9) NOT NULL, `cache` longblob, PRIMARY KEY (`id`), - KEY `key` (`key`), + UNIQUE KEY `key` (`key`), KEY `tags` (`tags`) ) DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; @@ -152,7 +152,7 @@ CREATE TABLE {items} ( `album_cover_item_id` int(9) DEFAULT NULL, `captured` int(9) DEFAULT NULL, `created` int(9) DEFAULT NULL, - `description` varchar(2048) DEFAULT NULL, + `description` text, `height` int(9) DEFAULT NULL, `left_ptr` int(9) NOT NULL, `level` int(9) NOT NULL, @@ -160,7 +160,7 @@ CREATE TABLE {items} ( `name` varchar(255) DEFAULT NULL, `owner_id` int(9) DEFAULT NULL, `parent_id` int(9) NOT NULL, - `rand_key` float DEFAULT NULL, + `rand_key` decimal(11,10) DEFAULT NULL, `relative_path_cache` varchar(255) DEFAULT NULL, `relative_url_cache` varchar(255) DEFAULT NULL, `resize_dirty` tinyint(1) DEFAULT '1', @@ -225,7 +225,7 @@ CREATE TABLE {messages} ( `id` int(9) NOT NULL AUTO_INCREMENT, `key` varchar(255) DEFAULT NULL, `severity` varchar(32) DEFAULT NULL, - `value` varchar(255) DEFAULT NULL, + `value` text, PRIMARY KEY (`id`), UNIQUE KEY `key` (`key`) ) DEFAULT CHARSET=utf8; @@ -242,18 +242,17 @@ CREATE TABLE {modules} ( PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`), KEY `weight` (`weight`) -) AUTO_INCREMENT=11 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=10 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; -INSERT INTO {modules} VALUES (1,1,'gallery',41,1); +INSERT INTO {modules} VALUES (1,1,'gallery',46,1); INSERT INTO {modules} VALUES (2,1,'user',3,2); INSERT INTO {modules} VALUES (3,1,'comment',3,3); -INSERT INTO {modules} VALUES (4,1,'organize',2,4); -INSERT INTO {modules} VALUES (5,1,'info',1,5); -INSERT INTO {modules} VALUES (6,1,'rest',3,6); -INSERT INTO {modules} VALUES (7,1,'rss',1,7); -INSERT INTO {modules} VALUES (8,1,'search',1,8); -INSERT INTO {modules} VALUES (9,1,'slideshow',2,9); -INSERT INTO {modules} VALUES (10,1,'tag',2,10); +INSERT INTO {modules} VALUES (4,1,'organize',4,4); +INSERT INTO {modules} VALUES (5,1,'info',2,5); +INSERT INTO {modules} VALUES (6,1,'rss',1,6); +INSERT INTO {modules} VALUES (7,1,'search',1,7); +INSERT INTO {modules} VALUES (8,1,'slideshow',2,8); +INSERT INTO {modules} VALUES (9,1,'tag',2,9); DROP TABLE IF EXISTS {outgoing_translations}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -350,18 +349,6 @@ CREATE TABLE {themes} ( /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {themes} VALUES (1,'wind',1); INSERT INTO {themes} VALUES (2,'admin_wind',1); -DROP TABLE IF EXISTS {user_access_keys}; -/*!40101 SET @saved_cs_client = @@character_set_client */; -/*!40101 SET character_set_client = utf8 */; -CREATE TABLE {user_access_keys} ( - `id` int(9) NOT NULL AUTO_INCREMENT, - `user_id` int(9) NOT NULL, - `access_key` char(32) NOT NULL, - PRIMARY KEY (`id`), - UNIQUE KEY `access_key` (`access_key`), - UNIQUE KEY `user_id` (`user_id`) -) DEFAULT CHARSET=utf8; -/*!40101 SET character_set_client = @saved_cs_client */; DROP TABLE IF EXISTS {users}; /*!40101 SET @saved_cs_client = @@character_set_client */; /*!40101 SET character_set_client = utf8 */; @@ -395,7 +382,7 @@ CREATE TABLE {vars} ( `value` text, PRIMARY KEY (`id`), UNIQUE KEY `module_name` (`module_name`,`name`) -) AUTO_INCREMENT=35 DEFAULT CHARSET=utf8; +) AUTO_INCREMENT=40 DEFAULT CHARSET=utf8; /*!40101 SET character_set_client = @saved_cs_client */; INSERT INTO {vars} VALUES (NULL,'gallery','active_site_theme','wind'); INSERT INTO {vars} VALUES (NULL,'gallery','active_admin_theme','admin_wind'); @@ -405,8 +392,9 @@ INSERT INTO {vars} VALUES (NULL,'gallery','resize_size','640'); INSERT INTO {vars} VALUES (NULL,'gallery','default_locale','en_US'); INSERT INTO {vars} VALUES (NULL,'gallery','image_quality','75'); INSERT INTO {vars} VALUES (NULL,'gallery','image_sharpen','15'); +INSERT INTO {vars} VALUES (NULL,'gallery','upgrade_checker_auto_enabled','1'); INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_sidebar','a:4:{i:2;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"block_adder\";}i:3;a:2:{i:0;s:7:\"gallery\";i:1;s:5:\"stats\";}i:4;a:2:{i:0;s:7:\"gallery\";i:1;s:13:\"platform_info\";}i:5;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"project_news\";}}'); -INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_center','a:3:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}'); +INSERT INTO {vars} VALUES (NULL,'gallery','blocks_dashboard_center','a:4:{i:6;a:2:{i:0;s:7:\"gallery\";i:1;s:7:\"welcome\";}i:7;a:2:{i:0;s:7:\"gallery\";i:1;s:15:\"upgrade_checker\";}i:8;a:2:{i:0;s:7:\"gallery\";i:1;s:12:\"photo_stream\";}i:9;a:2:{i:0;s:7:\"gallery\";i:1;s:11:\"log_entries\";}}'); INSERT INTO {vars} VALUES (NULL,'gallery','choose_default_tookit','1'); INSERT INTO {vars} VALUES (NULL,'gallery','date_format','Y-M-d'); INSERT INTO {vars} VALUES (NULL,'gallery','date_time_format','Y-M-d H:i:s'); @@ -424,10 +412,14 @@ INSERT INTO {vars} VALUES (NULL,'gallery','email_line_length','70'); INSERT INTO {vars} VALUES (NULL,'gallery','email_header_separator','s:1:\"\n\";'); INSERT INTO {vars} VALUES (NULL,'gallery','show_user_profiles_to','registered_users'); INSERT INTO {vars} VALUES (NULL,'gallery','extra_binary_paths','/usr/local/bin:/opt/local/bin:/opt/bin'); -INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:4:{i:9;a:2:{i:0;s:7:\"gallery\";i:1;s:8:\"language\";}i:10;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:11;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:12;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}'); +INSERT INTO {vars} VALUES (NULL,'gallery','blocks_site_sidebar','a:4:{i:10;a:2:{i:0;s:7:\"gallery\";i:1;s:8:\"language\";}i:11;a:2:{i:0;s:4:\"info\";i:1;s:8:\"metadata\";}i:12;a:2:{i:0;s:3:\"rss\";i:1;s:9:\"rss_feeds\";}i:13;a:2:{i:0;s:3:\"tag\";i:1;s:3:\"tag\";}}'); INSERT INTO {vars} VALUES (NULL,'gallery','identity_provider','user'); INSERT INTO {vars} VALUES (NULL,'user','mininum_password_length','5'); INSERT INTO {vars} VALUES (NULL,'comment','spam_caught','0'); INSERT INTO {vars} VALUES (NULL,'comment','access_permissions','everybody'); -INSERT INTO {vars} VALUES (NULL,'rest','allow_guest_access','0'); +INSERT INTO {vars} VALUES (NULL,'info','show_title','1'); +INSERT INTO {vars} VALUES (NULL,'info','show_description','1'); +INSERT INTO {vars} VALUES (NULL,'info','show_owner','1'); +INSERT INTO {vars} VALUES (NULL,'info','show_name','1'); +INSERT INTO {vars} VALUES (NULL,'info','show_captured','1'); INSERT INTO {vars} VALUES (NULL,'slideshow','max_scale','0'); diff --git a/installer/installer.php b/installer/installer.php index 9a957b43..c23d918f 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2010 Bharat Mediratta + * Copyright (C) 2000-2011 Bharat Mediratta * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -138,7 +138,7 @@ class installer { $char += ($char > 90) ? 13 : ($char > 57) ? 7 : 0; $salt .= chr($char); } - $password = substr(md5(time() * rand()), 0, 6); + $password = substr(md5(time() . mt_rand()), 0, 6); // Escape backslash in preparation for our UPDATE statement. $hashed_password = str_replace("\\", "\\\\", $salt . md5($salt . $password)); $sql = self::prepend_prefix($config["prefix"], @@ -152,7 +152,7 @@ class installer { } static function create_admin_session($config) { - $session_id = md5(time() * rand()); + $session_id = md5(time() . mt_rand()); $user_agent = $_SERVER["HTTP_USER_AGENT"]; $user_agent_len = strlen($user_agent); $now = time(); @@ -233,7 +233,30 @@ class installer { $errors[] = "Gallery requires the <a href=\"http://php.net/manual/en/book.ctype.php\">PHP Ctype</a> extension. Please install it."; } + if (self::ini_get_bool("safe_mode")) { + $errors[] = "Gallery cannot function when PHP is in <a href=\"http://php.net/manual/en/features.safe-mode.php\">Safe Mode</a>. Please disable safe mode."; + } + return @$errors; } + /** + * Convert any possible boolean ini value to true/false. + * On = on = 1 = true + * Off = off = 0 = false + */ + static function ini_get_bool($varname) { + $value = ini_get($varname); + + if (!strcasecmp("on", $value) || $value == 1 || $value === true) { + return true; + } + + if (!strcasecmp("off", $value) || $value == 0 || $value === false) { + return false; + } + + return false; + } + } diff --git a/installer/web.php b/installer/web.php index 51f0f8aa..0df9b69c 100644 --- a/installer/web.php +++ b/installer/web.php @@ -1,7 +1,7 @@ <?php defined("SYSPATH") or die("No direct script access."); /** * Gallery - a web based photo album viewer and editor - * Copyright (C) 2000-2010 Bharat Mediratta + * Copyright (C) 2000-2011 Bharat Mediratta * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by |