diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/base.php | 4 | ||||
-rw-r--r-- | lib/filecache.php | 1 | ||||
-rw-r--r-- | lib/ocsclient.php | 55 | ||||
-rw-r--r-- | lib/public/share.php | 12 | ||||
-rw-r--r-- | lib/updater.php | 11 | ||||
-rwxr-xr-x | lib/util.php | 5 |
6 files changed, 79 insertions, 9 deletions
diff --git a/lib/base.php b/lib/base.php index 41ff1870059..c898273d9e2 100644 --- a/lib/base.php +++ b/lib/base.php @@ -352,6 +352,10 @@ class OC{ OC_User::useBackend(new OC_User_Database()); OC_Group::useBackend(new OC_Group_Database()); + if(isset($_SERVER['PHP_AUTH_USER']) && isset($_SESSION['user_id']) && $_SERVER['PHP_AUTH_USER'] != $_SESSION['user_id']) { + OC_User::logout(); + } + // Load Apps // This includes plugins for users and filesystems as well global $RUNTIME_NOAPPS; diff --git a/lib/filecache.php b/lib/filecache.php index 305ba035fb5..d68525d9a54 100644 --- a/lib/filecache.php +++ b/lib/filecache.php @@ -420,6 +420,7 @@ class OC_FileCache{ $mimetype=$view->getMimeType($path); $stat=$view->stat($path); if($mimetype=='httpd/unix-directory') { + $stat['size'] = 0; $writable=$view->is_writable($path.'/'); }else{ $writable=$view->is_writable($path); diff --git a/lib/ocsclient.php b/lib/ocsclient.php index 6428a883679..fc2095f5c15 100644 --- a/lib/ocsclient.php +++ b/lib/ocsclient.php @@ -62,7 +62,15 @@ class OC_OCSClient{ } $url=OC_OCSClient::getAppStoreURL().'/content/categories'; - $xml=@file_get_contents($url); + // set a sensible timeout of 10 sec to stay responsive even if the server is down. + $ctx = stream_context_create( + array( + 'http' => array( + 'timeout' => 10 + ) + ) + ); + $xml=@file_get_contents($url, 0, $ctx); if($xml==FALSE) { return NULL; } @@ -103,7 +111,17 @@ class OC_OCSClient{ $filterurl='&filter='.urlencode($filter); $url=OC_OCSClient::getAppStoreURL().'/content/data?categories='.urlencode($categoriesstring).'&sortmode=new&page='.urlencode($page).'&pagesize=100'.$filterurl.$version; $apps=array(); - $xml=@file_get_contents($url); + + // set a sensible timeout of 10 sec to stay responsive even if the server is down. + $ctx = stream_context_create( + array( + 'http' => array( + 'timeout' => 10 + ) + ) + ); + $xml=@file_get_contents($url, 0, $ctx); + if($xml==FALSE) { return NULL; } @@ -141,7 +159,15 @@ class OC_OCSClient{ } $url=OC_OCSClient::getAppStoreURL().'/content/data/'.urlencode($id); - $xml=@file_get_contents($url); + // set a sensible timeout of 10 sec to stay responsive even if the server is down. + $ctx = stream_context_create( + array( + 'http' => array( + 'timeout' => 10 + ) + ) + ); + $xml=@file_get_contents($url, 0, $ctx); if($xml==FALSE) { OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); return NULL; @@ -178,7 +204,16 @@ class OC_OCSClient{ } $url=OC_OCSClient::getAppStoreURL().'/content/download/'.urlencode($id).'/'.urlencode($item); - $xml=@file_get_contents($url); + // set a sensible timeout of 10 sec to stay responsive even if the server is down. + $ctx = stream_context_create( + array( + 'http' => array( + 'timeout' => 10 + ) + ) + ); + $xml=@file_get_contents($url, 0, $ctx); + if($xml==FALSE) { OC_Log::write('core','Unable to parse OCS content',OC_Log::FATAL); return NULL; @@ -215,7 +250,17 @@ class OC_OCSClient{ $url=OC_OCSClient::getKBURL().'/knowledgebase/data?type=150&page='.$p.'&pagesize='.$s.$searchcmd; $kbe=array(); - $xml=@file_get_contents($url); + + // set a sensible timeout of 10 sec to stay responsive even if the server is down. + $ctx = stream_context_create( + array( + 'http' => array( + 'timeout' => 10 + ) + ) + ); + $xml=@file_get_contents($url, 0, $ctx); + if($xml==FALSE) { OC_Log::write('core','Unable to parse knowledgebase content',OC_Log::FATAL); return NULL; diff --git a/lib/public/share.php b/lib/public/share.php index e0488b8faf6..75363d081c0 100644 --- a/lib/public/share.php +++ b/lib/public/share.php @@ -645,7 +645,7 @@ class Share { } else {
if ($fileDependent) {
if (($itemType == 'file' || $itemType == 'folder') && $format == \OC_Share_Backend_File::FORMAT_FILE_APP || $format == \OC_Share_Backend_File::FORMAT_FILE_APP_ROOT) {
- $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `file_source`, `path`, `file_target`, `permissions`, `expiration`, `name`, `ctime`, `mtime`, `mimetype`, `size`, `encrypted`, `versioned`, `writable`';
+ $select = '`*PREFIX*share`.`id`, `item_type`, `*PREFIX*share`.`parent`, `uid_owner`, `share_type`, `share_with`, `file_source`, `path`, `file_target`, `permissions`, `expiration`, `name`, `ctime`, `mtime`, `mimetype`, `size`, `encrypted`, `versioned`, `writable`';
} else {
$select = '`*PREFIX*share`.`id`, `item_type`, `item_source`, `item_target`, `*PREFIX*share`.`parent`, `share_type`, `share_with`, `uid_owner`, `file_source`, `path`, `file_target`, `permissions`, `stime`, `expiration`';
}
@@ -1015,8 +1015,14 @@ class Share { continue;
}
}
- if ($item['uid_owner'] == $uidOwner && $item[$columnSource] == $itemSource) {
- return $target;
+ if ($item['uid_owner'] == $uidOwner) {
+ if ($itemType == 'file' || $itemType == 'folder') {
+ if ($item['file_source'] == \OC_FileCache::getId($itemSource)) {
+ return $target;
+ }
+ } else if ($item['item_source'] == $itemSource) {
+ return $target;
+ }
}
}
if (!isset($exclude)) {
diff --git a/lib/updater.php b/lib/updater.php index ad42f2bf605..b3b289ef276 100644 --- a/lib/updater.php +++ b/lib/updater.php @@ -42,7 +42,16 @@ class OC_Updater{ //fetch xml data from updater $url=$updaterurl.'?version='.$versionstring; - $xml=@file_get_contents($url); + + // set a sensible timeout of 10 sec to stay responsive even if the update server is down. + $ctx = stream_context_create( + array( + 'http' => array( + 'timeout' => 10 + ) + ) + ); + $xml=@file_get_contents($url, 0, $ctx); if($xml==FALSE) { return array(); } diff --git a/lib/util.php b/lib/util.php index ae77e16c8a0..6707d67638e 100755 --- a/lib/util.php +++ b/lib/util.php @@ -287,6 +287,11 @@ class OC_Util { $errors[]=array('error'=>'PHP module zlib is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.'); $web_server_restart= false; } + + if(!function_exists('simplexml_load_string')) { + $errors[]=array('error'=>'PHP module SimpleXML is not installed.<br/>','hint'=>'Please ask your server administrator to install the module.'); + $web_server_restart= false; + } if(floatval(phpversion())<5.3) { $errors[]=array('error'=>'PHP 5.3 is required.<br/>','hint'=>'Please ask your server administrator to update PHP to version 5.3 or higher. PHP 5.2 is no longer supported by ownCloud and the PHP community.'); $web_server_restart= false; |