mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-02 01:52:10 +09:00
parent
ae55711dc4
commit
14ffdbe5f0
6 changed files with 17 additions and 41 deletions
|
|
@ -635,18 +635,13 @@ class FileHandler
|
|||
*/
|
||||
function returnBytes($val)
|
||||
{
|
||||
$last = strtolower(substr(trim($val), -1));
|
||||
switch ($last)
|
||||
$unit = strtoupper(substr($val, -1));
|
||||
$val = (int)$val;
|
||||
switch ($unit)
|
||||
{
|
||||
case 'g':
|
||||
$val *= 1024 * 1024 * 1024;
|
||||
break;
|
||||
case 'm':
|
||||
$val *= 1024 * 1024;
|
||||
break;
|
||||
case 'k':
|
||||
$val *= 1024;
|
||||
break;
|
||||
case 'G': $val *= 1024;
|
||||
case 'M': $val *= 1024;
|
||||
case 'K': $val *= 1024;
|
||||
}
|
||||
|
||||
return $val;
|
||||
|
|
|
|||
|
|
@ -134,10 +134,10 @@ class fileAdminController extends file
|
|||
else $file_config->download_grant = $download_grant;
|
||||
|
||||
//관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas
|
||||
$userFileAllowSize = $this->_changeBytes($file_config->allowed_filesize.'M');
|
||||
$userAttachAllowSize = $this->_changeBytes($file_config->allowed_attach_size.'M');
|
||||
$iniPostMaxSize = $this->_changeBytes(ini_get('post_max_size'));
|
||||
$iniUploadMaxSize = $this->_changeBytes(ini_get('upload_max_filesize'));
|
||||
$userFileAllowSize = FileHandler::returnbytes($file_config->allowed_filesize.'M');
|
||||
$userAttachAllowSize = FileHandler::returnbytes($file_config->allowed_attach_size.'M');
|
||||
$iniPostMaxSize = FileHandler::returnbytes(ini_get('post_max_size'));
|
||||
$iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize'));
|
||||
$iniMinSzie = min($iniPostMaxSize, $iniUploadMaxSize);
|
||||
|
||||
if($userFileAllowSize > $iniMinSzie || $userAttachAllowSize > $iniMinSzie)
|
||||
|
|
|
|||
|
|
@ -201,7 +201,7 @@ class fileAdminView extends file
|
|||
// Set a template
|
||||
$security = new Security();
|
||||
$security->encodeHTML('file_list..');
|
||||
$security->encodeHTML('module_list..');
|
||||
$security->encodeHTML('module_list..');
|
||||
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('file_list');
|
||||
|
|
@ -217,10 +217,10 @@ class fileAdminView extends file
|
|||
$oFileModel = getModel('file');
|
||||
$config = $oFileModel->getFileConfig();
|
||||
Context::set('config',$config);
|
||||
$iniPostMaxSize = $this->_changeBytes(ini_get('post_max_size'));
|
||||
$iniUploadMaxSize = $this->_changeBytes(ini_get('upload_max_filesize'));
|
||||
$iniPostMaxSize = FileHandler::returnbytes(ini_get('post_max_size'));
|
||||
$iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize'));
|
||||
$iniMinSize = min($iniPostMaxSize, $iniUploadMaxSize);
|
||||
Context::set('upload_max_filesize',$this->_changeBytes($iniMinSize / 1048576));
|
||||
Context::set('upload_max_filesize', FileHandler::filesize($iniMinSize));
|
||||
// Set a template file
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('adminConfig');
|
||||
|
|
|
|||
|
|
@ -150,25 +150,6 @@ class file extends ModuleObject
|
|||
function recompileCache()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Change value from human readable to byte unit
|
||||
*
|
||||
* @param string $size_str Size string
|
||||
* @return int The byte value for input
|
||||
*/
|
||||
function _changeBytes($size_str)
|
||||
{
|
||||
$unit = strtoupper(substr($size_str, -1));
|
||||
$size_str = (int)$size_str;
|
||||
switch ($unit)
|
||||
{
|
||||
case 'G': $size_str *= 1024;
|
||||
case 'M': $size_str *= 1024;
|
||||
case 'K': $size_str *= 1024;
|
||||
}
|
||||
return $size_str;
|
||||
}
|
||||
}
|
||||
/* End of file file.class.php */
|
||||
/* Location: ./modules/file/file.class.php */
|
||||
|
|
|
|||
|
|
@ -238,8 +238,8 @@ class fileModel extends file
|
|||
|
||||
if($logged_info->is_admin == 'Y')
|
||||
{
|
||||
$iniPostMaxSize = $this->_changeBytes(ini_get('post_max_size'));
|
||||
$iniUploadMaxSize = $this->_changeBytes(ini_get('upload_max_filesize'));
|
||||
$iniPostMaxSize = FileHandler::returnbytes(ini_get('post_max_size'));
|
||||
$iniUploadMaxSize = FileHandler::returnbytes(ini_get('upload_max_filesize'));
|
||||
$size = min($iniPostMaxSize, $iniUploadMaxSize) / 1048576;
|
||||
$file_config->allowed_attach_size = $size;
|
||||
$file_config->allowed_filesize = $size;
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@
|
|||
<div class="x_control-group">
|
||||
<label for="filesize" class="x_control-label">{$lang->allowed_filesize} <a class="x_icon-question-sign" href="./admin/help/index.html#UMAN_config_file_size" target="_blank">{$lang->help}</a></label>
|
||||
<div class="x_controls">
|
||||
<input type="number" id="filesize" name="allowed_filesize" value="{$config->allowed_filesize}" /> MB/{$upload_max_filesize}MB
|
||||
<input type="number" id="filesize" name="allowed_filesize" value="{$config->allowed_filesize}" /> MB/{$upload_max_filesize}
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue