summaryrefslogtreecommitdiffstats
path: root/lib/helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/helper.php')
-rw-r--r--lib/helper.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/helper.php b/lib/helper.php
index 41985ca57a7..2ba70294f4b 100644
--- a/lib/helper.php
+++ b/lib/helper.php
@@ -159,7 +159,7 @@ class OC_Helper {
*/
public static function imagePath( $app, $image ) {
// Read the selected theme from the config file
- $theme=OC_Config::getValue( "theme" );
+ $theme = OC_Util::getTheme();
// Check if the app is in the app folder
if( file_exists( OC::$SERVERROOT."/themes/$theme/apps/$app/img/$image" )) {
@@ -764,9 +764,15 @@ class OC_Helper {
public static function maxUploadFilesize($dir) {
$upload_max_filesize = OCP\Util::computerFileSize(ini_get('upload_max_filesize'));
$post_max_size = OCP\Util::computerFileSize(ini_get('post_max_size'));
- $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
-
$freeSpace = \OC\Files\Filesystem::free_space($dir);
+ if ($upload_max_filesize == 0 and $post_max_size == 0) {
+ $maxUploadFilesize = \OC\Files\FREE_SPACE_UNLIMITED;
+ } elseif ($upload_max_filesize === 0 or $post_max_size === 0) {
+ $maxUploadFilesize = max($upload_max_filesize, $post_max_size); //only the non 0 value counts
+ } else {
+ $maxUploadFilesize = min($upload_max_filesize, $post_max_size);
+ }
+
if($freeSpace !== \OC\Files\FREE_SPACE_UNKNOWN){
$freeSpace = max($freeSpace, 0);
@@ -806,11 +812,19 @@ class OC_Helper {
$used = 0;
}
$free = \OC\Files\Filesystem::free_space();
- $total = $free + $used;
+ if ($free >= 0){
+ $total = $free + $used;
+ } else {
+ $total = $free; //either unknown or unlimited
+ }
if ($total == 0) {
$total = 1; // prevent division by zero
}
- $relative = round(($used / $total) * 10000) / 100;
+ if ($total >= 0){
+ $relative = round(($used / $total) * 10000) / 100;
+ } else {
+ $relative = 0;
+ }
return array('free' => $free, 'used' => $used, 'total' => $total, 'relative' => $relative);
}