public static function getUserQuota($user) { $userQuota = OC_Preferences::getValue($user, 'files', 'quota', 'default'); if ($userQuota === 'default') { $userQuota = OC_AppConfig::getValue('files', 'default_quota', 'none'); } if ($userQuota === 'none') { return \OC\Files\SPACE_UNLIMITED; } else { return OC_Helper::computerFileSize($userQuota); } }
/** * get the quota for the current user * @return int */ private function getQuota() { if ($this->userQuota != -1) { return $this->userQuota; } $userQuota = OC_Preferences::getValue(OC_User::getUser(), 'files', 'quota', 'default'); if ($userQuota == 'default') { $userQuota = OC_AppConfig::getValue('files', 'default_quota', 'none'); } if ($userQuota == 'none') { $this->userQuota = 0; } else { $this->userQuota = OC_Helper::computerFileSize($userQuota); } return $this->userQuota; }
/** * get the quota for the user * @param user * @return int */ private function getQuota($user) { if (in_array($user, $this->userQuota)) { return $this->userQuota[$user]; } $userQuota = OC_Preferences::getValue($user, 'files', 'quota', 'default'); if ($userQuota == 'default') { $userQuota = OC_AppConfig::getValue('files', 'default_quota', 'none'); } if ($userQuota == 'none') { $this->userQuota[$user] = -1; } else { $this->userQuota[$user] = OC_Helper::computerFileSize($userQuota); } return $this->userQuota[$user]; }
public static function gc() { $last_run = OC_AppConfig::getValue('core', 'global_cache_gc_lastrun', 0); $now = time(); if ($now - $last_run < 300) { // only do cleanup every 5 minutes return; } OC_AppConfig::setValue('core', 'global_cache_gc_lastrun', $now); $cache_dir = self::getCacheDir(); if ($cache_dir and is_dir($cache_dir)) { $dh = opendir($cache_dir); while ($file = readdir($dh)) { if ($file != '.' and $file != '..') { $mtime = filemtime($cache_dir . $file); if ($mtime < $now) { unlink($cache_dir . $file); } } } } }
public function __construct($renderas) { // Decide which page we show if ($renderas == 'user') { parent::__construct('core', 'layout.user'); if (in_array(OC_APP::getCurrentApp(), array('settings', 'admin', 'help')) !== false) { $this->assign('bodyid', 'body-settings', false); } else { $this->assign('bodyid', 'body-user', false); } // Add navigation entry $navigation = OC_App::getNavigation(); $this->assign('navigation', $navigation, false); $this->assign('settingsnavigation', OC_App::getSettingsNavigation(), false); foreach ($navigation as $entry) { if ($entry['active']) { $this->assign('application', $entry['name'], false); break; } } } else { if ($renderas == 'guest') { parent::__construct('core', 'layout.guest'); } else { parent::__construct('core', 'layout.base'); } } $apps_paths = array(); foreach (OC_App::getEnabledApps() as $app) { $apps_paths[$app] = OC_App::getAppWebPath($app); } $this->assign('apps_paths', str_replace('\\/', '/', json_encode($apps_paths)), false); // Ugly unescape slashes waiting for better solution if (OC_Config::getValue('installed', false) && !OC_AppConfig::getValue('core', 'remote_core.css', false)) { OC_AppConfig::setValue('core', 'remote_core.css', '/core/minimizer.php'); OC_AppConfig::setValue('core', 'remote_core.js', '/core/minimizer.php'); } // Add the js files $jsfiles = self::findJavascriptFiles(OC_Util::$scripts); $this->assign('jsfiles', array(), false); if (!empty(OC_Util::$core_scripts)) { $this->append('jsfiles', OC_Helper::linkToRemoteBase('core.js', false)); } foreach ($jsfiles as $info) { $root = $info[0]; $web = $info[1]; $file = $info[2]; $this->append('jsfiles', $web . '/' . $file); } // Add the css files $cssfiles = self::findStylesheetFiles(OC_Util::$styles); $this->assign('cssfiles', array()); if (!empty(OC_Util::$core_styles)) { $this->append('cssfiles', OC_Helper::linkToRemoteBase('core.css', false)); } foreach ($cssfiles as $info) { $root = $info[0]; $web = $info[1]; $file = $info[2]; $paths = explode('/', $file); $in_root = false; foreach (OC::$APPSROOTS as $app_root) { if ($root == $app_root['path']) { $in_root = true; break; } } if ($in_root) { $app = $paths[0]; unset($paths[0]); $path = implode('/', $paths); $this->append('cssfiles', OC_Helper::linkTo($app, $path)); } else { $this->append('cssfiles', $web . '/' . $file); } } }
<?php $RUNTIME_NOAPPS = TRUE; require_once 'lib/base.php'; $path_info = OC_Request::getPathInfo(); if ($path_info === false || $path_info === '') { OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND); exit; } if (!($pos = strpos($path_info, '/', 1))) { $pos = strlen($path_info); } $service = substr($path_info, 1, $pos - 1); $file = OC_AppConfig::getValue('core', 'remote_' . $service); if (is_null($file)) { OC_Response::setStatus(OC_Response::STATUS_NOT_FOUND); exit; } $file = ltrim($file, '/'); $parts = explode('/', $file, 2); $app = $parts[0]; switch ($app) { case 'core': $file = OC::$SERVERROOT . '/' . $file; break; default: OC_Util::checkAppEnabled($app); OC_App::loadApp($app); if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') { $file = OC_App::getAppPath($app) . '/' . $parts[1]; } else {