mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-20 19:02:14 +09:00
Merge pull request #1182 from YJSoft/develop
php.ini의 파일 업로드 용량을 잘못 불러오는 문제 수정
This commit is contained in:
commit
3cf0f0466f
5 changed files with 27 additions and 19 deletions
|
|
@ -178,23 +178,6 @@ class fileAdminController extends file
|
|||
else $_SESSION['file_management'][$output->file_srl] = true;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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)
|
||||
{
|
||||
switch (substr ($size_str, -1))
|
||||
{
|
||||
case 'M': case 'm': return (int)$size_str * 1048576;
|
||||
case 'K': case 'k': return (int)$size_str * 1024;
|
||||
case 'G': case 'g': return (int)$size_str * 1073741824;
|
||||
default: return $size_str;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* End of file file.admin.controller.php */
|
||||
/* Location: ./modules/file/file.admin.controller.php */
|
||||
|
|
|
|||
|
|
@ -217,6 +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'));
|
||||
$iniMinSize = min($iniPostMaxSize, $iniUploadMaxSize);
|
||||
Context::set('upload_max_filesize',$this->_changeBytes($iniMinSize / 1048576));
|
||||
// Set a template file
|
||||
$this->setTemplatePath($this->module_path.'tpl');
|
||||
$this->setTemplateFile('adminConfig');
|
||||
|
|
|
|||
|
|
@ -150,6 +150,25 @@ 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,7 +238,9 @@ class fileModel extends file
|
|||
|
||||
if($logged_info->is_admin == 'Y')
|
||||
{
|
||||
$size = preg_replace('/[a-z]/is', '', ini_get('upload_max_filesize'));
|
||||
$iniPostMaxSize = $this->_changeBytes(ini_get('post_max_size'));
|
||||
$iniUploadMaxSize = $this->_changeBytes(ini_get('upload_max_filesize'));
|
||||
$size = min($iniPostMaxSize, $iniUploadMaxSize) / 1048576;
|
||||
$file_config->allowed_attach_size = $size;
|
||||
$file_config->allowed_filesize = $size;
|
||||
$file_config->allowed_filetypes = '*.*';
|
||||
|
|
|
|||
|
|
@ -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/{ini_get('upload_max_filesize')}
|
||||
<input type="number" id="filesize" name="allowed_filesize" value="{$config->allowed_filesize}" /> MB/{$upload_max_filesize}MB
|
||||
</div>
|
||||
</div>
|
||||
<div class="x_control-group">
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue