diff options
| author | mamouneyya <mamoun.diraneyya@gmail.com> | 2011-02-16 18:25:18 +0300 | 
|---|---|---|
| committer | mamouneyya <mamoun.diraneyya@gmail.com> | 2011-02-16 18:25:18 +0300 | 
| commit | 00772aaa62e6bce14e58e163ea72f386136c731d (patch) | |
| tree | ed658d454d8bea79d551969fffa0bc18faee5d52 /installer/installer.php | |
| parent | 3e2610ea83c60805d5e727df6509da6c49fd6c7b (diff) | |
| parent | d2c77fd0590501f7b6b51d9f4cc033ed9485b082 (diff) | |
Merge remote-tracking branch 'gallery3/master'
Diffstat (limited to 'installer/installer.php')
| -rw-r--r-- | installer/installer.php | 29 | 
1 files changed, 26 insertions, 3 deletions
| 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; +  } +  } | 
