diff options
| author | Nathan Kinkade <nkinkade@nkinka.de> | 2010-12-23 02:12:38 +0000 |
|---|---|---|
| committer | Nathan Kinkade <nkinkade@nkinka.de> | 2010-12-23 02:12:38 +0000 |
| commit | 5e17a5e7fcb678bd7081bdf8089afec5b25f3aff (patch) | |
| tree | 9590eae390af1f72b72ddc6500a2566e3558e3bb /installer/installer.php | |
| parent | cf1965957c48b1c88a3913f8167688d03d191cec (diff) | |
| parent | 032e6fde5f99c3150a4ae70e410ce314d8c3877a (diff) | |
Merge branch 'master' of git://github.com/gallery/gallery3
Diffstat (limited to 'installer/installer.php')
| -rw-r--r-- | installer/installer.php | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/installer/installer.php b/installer/installer.php index 9a957b43..1771e3aa 100644 --- a/installer/installer.php +++ b/installer/installer.php @@ -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; + } + } |
