You are here

protected function elFinderVolumeDrupal::CalculateUserAllowedSpace in elFinder file manager 6.2

Same name and namespace in other branches
  1. 8.2 src/Controller/elFinderVolumeDrupal.php \elFinderVolumeDrupal::CalculateUserAllowedSpace()
  2. 7.3 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::CalculateUserAllowedSpace()
  3. 7.2 inc/elfinder.drupalfs.driver.inc \elFinderVolumeDrupal::CalculateUserAllowedSpace()
1 call to elFinderVolumeDrupal::CalculateUserAllowedSpace()
elFinderVolumeDrupal::CheckUserQuota in inc/elfinder.drupalfs.driver.inc

File

inc/elfinder.drupalfs.driver.inc, line 475

Class

elFinderVolumeDrupal
elFinder driver for Drupal 6 filesystem.

Code

protected function CalculateUserAllowedSpace($checkuser = NULL) {
  global $user;
  $realUser = isset($checkuser) ? $checkuser : $user;
  $currentSpace = $this
    ->CalculateUserUsedSpace($realUser);
  $maxSpace = isset($this->options['userProfile']->settings['user_quota']) ? parse_size($this->options['userProfile']->settings['user_quota']) : NULL;
  $diff = $maxSpace - $currentSpace;

  //drupal_set_message('current space = '.$currentSpace.' max = ' . $maxSpace . ' diff = ' . $diff,'warning');
  if (isset($maxSpace) && $maxSpace > 0) {
    if ($diff > 0) {
      return $diff;
    }
    else {
      return 0;
    }
  }
  return -1;
}