本文整理汇总了PHP中FileHandler::returnbytes方法的典型用法代码示例。如果您正苦于以下问题:PHP FileHandler::returnbytes方法的具体用法?PHP FileHandler::returnbytes怎么用?PHP FileHandler::returnbytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileHandler
的用法示例。
在下文中一共展示了FileHandler::returnbytes方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: dispFileAdminConfig
/**
* Set attachment information (for administrator)
*
* @return Object
*/
function dispFileAdminConfig()
{
$oFileModel = getModel('file');
$config = $oFileModel->getFileConfig();
Context::set('config', $config);
$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', FileHandler::filesize($iniMinSize));
// Set a template file
$this->setTemplatePath($this->module_path . 'tpl');
$this->setTemplateFile('adminConfig');
}
示例2: getUploadConfig
/**
* Return configurations of the attachement (it automatically checks if an administrator is)
*
* @return object Returns a file configuration of current module. If user is admin, returns PHP's max file size and allow all file types.
*/
function getUploadConfig()
{
$logged_info = Context::get('logged_info');
$module_srl = Context::get('module_srl');
// Get the current module if module_srl doesn't exist
if (!$module_srl) {
$current_module_info = Context::get('current_module_info');
$module_srl = $current_module_info->module_srl;
}
$file_config = $this->getFileConfig($module_srl);
if ($logged_info->is_admin == 'Y') {
$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;
$file_config->allowed_filetypes = '*.*';
}
return $file_config;
}
示例3: procFileAdminInsertModuleConfig
/**
* Add file information for each module
*
* @return void
*/
function procFileAdminInsertModuleConfig()
{
// Get variables
$module_srl = Context::get('target_module_srl');
// In order to configure multiple modules at once
if (preg_match('/^([0-9,]+)$/', $module_srl)) {
$module_srl = explode(',', $module_srl);
} else {
$module_srl = array($module_srl);
}
$download_grant = Context::get('download_grant');
$file_config = new stdClass();
$file_config->allow_outlink = Context::get('allow_outlink');
$file_config->allow_outlink_format = Context::get('allow_outlink_format');
$file_config->allow_outlink_site = Context::get('allow_outlink_site');
$file_config->allowed_filesize = Context::get('allowed_filesize');
$file_config->allowed_attach_size = Context::get('allowed_attach_size');
$file_config->allowed_filetypes = str_replace(' ', '', Context::get('allowed_filetypes'));
if (!is_array($download_grant)) {
$file_config->download_grant = explode('|@|', $download_grant);
} else {
$file_config->download_grant = $download_grant;
}
//관리자가 허용한 첨부파일의 사이즈가 php.ini의 값보다 큰지 확인하기 - by ovclas
$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) {
return new Object(-1, 'input size over than config in php.ini');
}
$oModuleController = getController('module');
for ($i = 0; $i < count($module_srl); $i++) {
$srl = trim($module_srl[$i]);
if (!$srl) {
continue;
}
$oModuleController->insertModulePartConfig('file', $srl, $file_config);
}
$this->setError(-1);
$this->setMessage('success_updated', 'info');
$returnUrl = Context::get('success_return_url') ? Context::get('success_return_url') : getNotEncodedUrl('', 'module', 'admin', 'act', 'dispBoardAdminContent');
$this->setRedirectUrl($returnUrl);
}