$documentationlink = "please read the <A HREF=\"../doc/?frame=install.html&sub=webserver\">install documentation</A>";
- if (!(bool)ini_get('short_open_tag')) {
- error("The PHP server variable 'short_open_tag' is not turned on - $documentationlink");
- }
- if (!(bool)ini_get('magic_quotes_gpc')) {
- error("The PHP server variable 'magic_quotes_gpc' is not turned on - $documentationlink");
+ if (ini_get_bool('session.auto_start')) {
+ error("The PHP server variable 'session.auto_start' should be Off - $documentationlink");
}
- if ((bool)ini_get('magic_quotes_runtime')) {
+
+ if (ini_get_bool('magic_quotes_runtime')) {
error("The PHP server variable 'magic_quotes_runtime' should be Off - $documentationlink");
}
- if (!(bool)ini_get('file_uploads')) {
- error("The PHP server variable 'file_uploads' is not turned on - $documentationlink");
+ if (!ini_get_bool('magic_quotes_gpc')) {
+ error("The PHP server variable 'magic_quotes_gpc' is not turned On - $documentationlink");
}
- if ((bool)ini_get('session.auto_start')) {
- error("The PHP server variable 'session.auto_start' should be Off - $documentationlink");
+ if (!ini_get_bool('file_uploads')) {
+ error("The PHP server variable 'file_uploads' is not turned On - $documentationlink");
}
+ if (!ini_get_bool('short_open_tag')) {
+ error("The PHP server variable 'short_open_tag' is not turned On - $documentationlink");
+ }
+
+
/// Check that sessions are supported
- if (!is_readable(ini_get('session.save_path')) and !(bool)ini_get('safe_mode')) {
+ if (!is_readable(ini_get('session.save_path')) and !ini_get_bool('safe_mode')) {
$sessionpath = ini_get('session.save_path');
notify("Warning: It appears your server does not support sessions (session.save_path = '$sessionpath')");
}
return false;
}
+function ini_get_bool($ini_get_arg) {
+/// This function makes the return value of ini_get consistent if you are
+/// setting server directives through the .htaccess file in apache.
+/// Current behavior for value set from php.ini On = 1, Off = [blank]
+/// Current behavior for value set from .htaccess On = On, Off = Off
+/// Contributed by jdell@unr.edu
+
+ $temp = ini_get($ini_get_arg);
+
+ if ($temp == "1" or strtolower($temp) == "on") {
+ return true;
+ }
+ return false;
+}
+
function can_use_richtext_editor() {
/// Is the richedit editor enabled?
global $USER, $CFG;
/// If you have problems with slashes everywhere then you might want to
/// uncomment this code. It will not be necessary on 99.9% of PHP servers.
/// Got this from http://www.php.net/manual/en/configuration.php
-// if (ini_get("magic_quotes_gpc") ) {
+// if (ini_get_bool("magic_quotes_gpc") ) {
// foreach ($GLOBALS["HTTP_".$GLOBALS["REQUEST_METHOD"]."_VARS"] as $key => $value) {
// if (!is_array($value)) { // Simple value
// $newval = stripslashes($value);
// $GLOBALS["HTTP_".$GLOBALS["REQUEST_METHOD"]."_VARS"][$key] = $newval;
-// if (ini_get("register_globals")) {
+// if (ini_get_bool("register_globals")) {
// $GLOBALS[$key] = $newval;
// }
// } else { // Array
// foreach ($value as $k => $v) {
// $newval = stripslashes($v);
// $GLOBALS["HTTP_".$GLOBALS["REQUEST_METHOD"]."_VARS"][$key][$k] = $newval;
-// if (ini_get("register_globals")) {
+// if (ini_get_bool("register_globals")) {
// $GLOBALS[$key][$k] = $newval;
// }
// }