Permalink
Browse files

Detect safe_mode and abort the install. Fixes #1534.

  • Loading branch information...
1 parent 8a5bbc8 commit 6ac82bc6b72e94466787e291e15968f15f33089d @bharat bharat committed Dec 16, 2010
Showing with 23 additions and 0 deletions.
  1. +23 −0 installer/installer.php
View
@@ -233,7 +233,30 @@ static function check_environment() {
$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;
+ }
+
}

0 comments on commit 6ac82bc

Please sign in to comment.