summaryrefslogtreecommitdiffstats
path: root/lib/util.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/util.php')
-rwxr-xr-xlib/util.php64
1 files changed, 37 insertions, 27 deletions
diff --git a/lib/util.php b/lib/util.php
index b2a4fce65a2..2e32ee2e3c2 100755
--- a/lib/util.php
+++ b/lib/util.php
@@ -73,9 +73,9 @@ class OC_Util {
* @return array
*/
public static function getVersion() {
- // hint: We only can count up. So the internal version number
- // of ownCloud 4.5 will be 4.90.0. This is not visible to the user
- return array(4, 92, 10);
+ // hint: We only can count up. Reset minor/patchlevel when
+ // updating major/minor version number.
+ return array(4, 94, 10);
}
/**
@@ -83,7 +83,7 @@ class OC_Util {
* @return string
*/
public static function getVersionString() {
- return '5.0 alpha 1';
+ return '5.0 beta 2';
}
/**
@@ -178,14 +178,14 @@ class OC_Util {
}
//common hint for all file permissons error messages
- $permissionsHint="Permissions can usually be fixed by giving the webserver write access'
- .' to the ownCloud directory";
+ $permissionsHint='Permissions can usually be fixed by giving the webserver write access'
+ .' to the ownCloud directory';
// Check if config folder is writable.
if(!is_writable(OC::$SERVERROOT."/config/") or !is_readable(OC::$SERVERROOT."/config/")) {
$errors[]=array('error'=>"Can't write into config directory 'config'",
- 'hint'=>"You can usually fix this by giving the webserver user write access'
- .' to the config directory in owncloud");
+ 'hint'=>'You can usually fix this by giving the webserver user write access'
+ .' to the config directory in owncloud');
}
// Check if there is a writable install folder.
@@ -194,8 +194,8 @@ class OC_Util {
|| !is_writable(OC_App::getInstallPath())
|| !is_readable(OC_App::getInstallPath()) ) {
$errors[]=array('error'=>"Can't write into apps directory",
- 'hint'=>"You can usually fix this by giving the webserver user write access'
- .' to the apps directory in owncloud or disabling the appstore in the config file.");
+ 'hint'=>'You can usually fix this by giving the webserver user write access'
+ .' to the apps directory in owncloud or disabling the appstore in the config file.');
}
}
$CONFIG_DATADIRECTORY = OC_Config::getValue( "datadirectory", OC::$SERVERROOT."/data" );
@@ -222,7 +222,16 @@ class OC_Util {
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
-
+ if(!class_exists('DOMDocument')) {
+ $errors[] = array('error' => 'PHP module dom not installed.<br/>',
+ 'hint' => 'Please ask your server administrator to install the module.');
+ $web_server_restart = false;
+ }
+ if(!function_exists('xml_parser_create')) {
+ $errors[] = array('error' => 'PHP module libxml not installed.<br/>',
+ 'hint' => 'Please ask your server administrator to install the module.');
+ $web_server_restart = false;
+ }
if(!function_exists('mb_detect_encoding')) {
$errors[]=array('error'=>'PHP module mb multibyte not installed.<br/>',
'hint'=>'Please ask your server administrator to install the module.');
@@ -269,18 +278,10 @@ class OC_Util {
'hint'=>'Please ask your server administrator to install the module.');
$web_server_restart= false;
}
-
- $handler = ini_get("session.save_handler");
- if($handler == "files") {
- $tmpDir = session_save_path();
- if($tmpDir != "") {
- if(!@is_writable($tmpDir)) {
- $errors[]=array('error' => 'The temporary folder used by PHP to save the session data'
- .' is either incorrect or not writable! Please check : '.session_save_path().'<br/>',
- 'hint'=>'Please ask your server administrator to grant write access'
- .' or define another temporary folder.');
- }
- }
+ if(ini_get('safe_mode')) {
+ $errors[]=array('error'=>'PHP Safe Mode is enabled. ownCloud requires that it is disabled to work properly.<br/>',
+ 'hint'=>'PHP Safe Mode is a deprecated and mostly useless setting that should be disabled. Please ask your server administrator to disable it in php.ini or in your webserver config.');
+ $web_server_restart= false;
}
if($web_server_restart) {
@@ -504,10 +505,10 @@ class OC_Util {
* @return array with sanitized strings or a single sanitized string, depends on the input parameter.
*/
public static function sanitizeHTML( &$value ) {
- if (is_array($value) || is_object($value)) {
+ if (is_array($value)) {
array_walk_recursive($value, 'OC_Util::sanitizeHTML');
} else {
- $value = htmlentities($value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4
+ $value = htmlentities((string)$value, ENT_QUOTES, 'UTF-8'); //Specify encoding for PHP<5.4
}
return $value;
}
@@ -562,13 +563,18 @@ class OC_Util {
*/
public static function isWebDAVWorking() {
if (!function_exists('curl_init')) {
- return;
+ return true;
}
-
$settings = array(
'baseUri' => OC_Helper::linkToRemote('webdav'),
);
+ // save the old timeout so that we can restore it later
+ $old_timeout=ini_get("default_socket_timeout");
+
+ // use a 5 sec timeout for the check. Should be enough for local requests.
+ ini_set("default_socket_timeout", 5);
+
$client = new \Sabre_DAV_Client($settings);
$return = true;
@@ -578,9 +584,13 @@ class OC_Util {
} catch(\Sabre_DAV_Exception_NotAuthenticated $e) {
$return = true;
} catch(\Exception $e) {
+ OC_Log::write('core', 'isWebDAVWorking: NO - Reason: '.$e, OC_Log::WARN);
$return = false;
}
+ // restore the original timeout
+ ini_set("default_socket_timeout", $old_timeout);
+
return $return;
}