add method getMaximumUploadSize(), make various methods protected

This commit is contained in:
Uwe Steinmann 2022-04-29 18:27:49 +02:00
parent 1aa52e3164
commit 8d4492164d

View File

@ -376,7 +376,7 @@ class Settings { /* {{{ */
* @param string $var value
* @return true/false
*/
function boolVal($var) { /* {{{ */
protected static function boolVal($var) { /* {{{ */
$var = strtolower(strval($var));
switch ($var) {
case 'true':
@ -417,7 +417,7 @@ class Settings { /* {{{ */
* @param string $stringValue string value
*
*/
function setViewOnlineFileTypesFromString($stringValue) { /* {{{ */
protected function setViewOnlineFileTypesFromString($stringValue) { /* {{{ */
$this->_viewOnlineFileTypes = explode(";", $stringValue);
} /* }}} */
@ -427,7 +427,7 @@ class Settings { /* {{{ */
* @return string value
*
*/
function getViewOnlineFileTypesToString() { /* {{{ */
protected function getViewOnlineFileTypesToString() { /* {{{ */
return implode(";", $this->_viewOnlineFileTypes);
} /* }}} */
@ -437,7 +437,7 @@ class Settings { /* {{{ */
* @param string $stringValue string value
*
*/
function setEditOnlineFileTypesFromString($stringValue) { /* {{{ */
protected function setEditOnlineFileTypesFromString($stringValue) { /* {{{ */
$this->_editOnlineFileTypes = explode(";", $stringValue);
} /* }}} */
@ -447,7 +447,7 @@ class Settings { /* {{{ */
* @return string value
*
*/
function getEditOnlineFileTypesToString() { /* {{{ */
protected function getEditOnlineFileTypesToString() { /* {{{ */
return implode(";", $this->_editOnlineFileTypes);
} /* }}} */
@ -1196,7 +1196,7 @@ class Settings { /* {{{ */
* If none was found a final try will be made checking /etc/seeddms
* @return NULL|string config directory
*/
static function getConfigDir() { /* {{{ */
protected static function getConfigDir() { /* {{{ */
if(defined("SEEDDMS_CONFIG_FILE"))
return dirname(SEEDDMS_CONFIG_FILE);
elseif(getenv("SEEDDMS_CONFIG_FILE"))
@ -1698,5 +1698,22 @@ class Settings { /* {{{ */
$this->_extensions[$extname]['__disable__'] = true;
} /* }}} */
/**
* Get maximum upload size
*
* Determine the maximum upload size by checking the php config
* variables upload_max_filesize, post_max_size and the seeddms
* setting maxUploadSize
* @return int
*/
public function getMaximumUploadSize() { /* {{{ */
$mus = [];
$mus[] = SeedDMS_Core_File::parse_filesize(ini_get("upload_max_filesize"));
$mus[] = SeedDMS_Core_File::parse_filesize(ini_get("post_max_size"));
if(is_numeric($this->_maxUploadSize) && $this->_maxUploadSize > 0)
$mus[] = SeedDMS_Core_File::parse_filesize($this->_maxUploadSize);
return min($mus);
} /* }}} */
} /* }}} */