Exemplo n.º 1
0
function get_user_file_size($gid)
{
    global $db, $tpf, $settings;
    if ($gid) {
        $group_set = $db->fetch_one_array("select * from {$tpf}groups where gid='{$gid}'");
        $upload_max = get_byte_value(ini_get('upload_max_filesize'));
        $post_max = get_byte_value(ini_get('post_max_size'));
        $settings_max = $settings['max_file_size'] ? get_byte_value($settings['max_file_size']) : 0;
        $max_php_file_size = min($upload_max, $post_max);
        $max_file_size_byte = $settings_max && $settings_max <= $max_php_file_size ? $settings_max : $max_php_file_size;
        if ($group_set['max_filesize']) {
            $group_set_max_file_size = get_byte_value($group_set['max_filesize']);
            $max_file_size_byte = $group_set_max_file_size >= $max_file_size_byte ? $max_file_size_byte : $group_set_max_file_size;
        }
        return get_size($max_file_size_byte, 'B', 0);
    } else {
        return '80 M';
    }
}
Exemplo n.º 2
0
<style type="text/css">body{font-size:12px}</style>
</head>

<body>
<div id="tips" style="padding:10px"><img src="images/ajax_load_bar.gif" align="absmiddle" border="0"><Br><?php 
echo __('sub_server_config_processing');
?>
</div>
<script type="text/javascript">
<?
$code = gpc('code','G','');
$up_size = gpc('up_size','G','');
$dir = PHPDISK_ROOT.'system/global/';
make_dir($dir);
$upload_max = get_byte_value(ini_get('upload_max_filesize'));
$post_max = get_byte_value(ini_get('post_max_size'));
$max_php_file_size = min($upload_max, $post_max);
$up_size = $max_php_file_size;
if($up_size==$max_php_file_size){
	$str = '您的网盘支持单个文件上传最大 <u style=\"font-size:14px;\">'.str_replace(' ','',get_size($max_php_file_size,'B',0)).'B</u>';
}else{
	$str = '您的网盘支持单个文件上传信息:<br>网盘主站, <u>'.str_replace(' ','',get_size($max_php_file_size,'B',0)).'B</u> ; 子服, <u>'.str_replace(' ','',get_size($up_size,'B',0)).'B</u><br><span <span style=\"color:red\">两个服务配置不一致!请重新配置,否则文件上传将可能会出现异常。</span>';
}

if($code && ($code==$configs['server_key'])){
	settings_cache();
	lang_cache();
	tpl_cache();
	group_settings_cache();
	echo 'var callback="[PHPDisk Tips] <span style=\"color:blue;\">'.__('sub_server_config_update_success').'</span><br><br>'.$str.'";';
}else{
Exemplo n.º 3
0
     }
     if (checklength($settings['file_path'], 2, 20)) {
         $error = true;
         $sysmsg[] = __('file_path_error');
     }
     if (!$error) {
         settings_cache($settings);
         $sysmsg[] = __('advanced_settings_update_success');
         redirect(urr(ADMINCP, "item=settings&menu=base&action={$action}"), $sysmsg);
     } else {
         redirect('back', $sysmsg);
     }
 } else {
     $upload_max = get_byte_value(ini_get('upload_max_filesize'));
     $post_max = get_byte_value(ini_get('post_max_size'));
     $settings_max = $settings['max_file_size'] ? get_byte_value($settings['max_file_size']) : 0;
     $max_php_file_size = min($upload_max, $post_max);
     $max_file_size_byte = $settings_max && $settings_max <= $max_php_file_size ? $settings_max : $max_php_file_size;
     $max_user_file_size = get_size($max_file_size_byte, 'B', 0);
     $file_real_path = PHPDISK_ROOT . $settings['file_path'] . '/';
     if (!is_dir($file_real_path)) {
         $file_path_tips = __('file_path_not_exists');
     }
     $settings['site_notify'] = base64_decode($settings['site_notify']);
     $settings['meta_ext'] = base64_decode($settings['meta_ext']);
     $settings['convert_rate'] = $settings['convert_rate'] ? (int) $settings['convert_rate'] : 100;
     $settings[close_guest_upload] = $settings['close_guest_upload'] ? (int) $settings['close_guest_upload'] : 0;
     if ($settings[promo_time] != '') {
         $arr = explode(',', $settings[promo_time]);
         $run_script = '';
         for ($i = 0; $i < count($arr); $i++) {
Exemplo n.º 4
0
    exit('[PHPDisk] Access Denied');
}
$is_locked = @$db->result_first("select is_locked from {$tpf}users where userid='{$pd_uid}' limit 1");
if ($is_locked) {
    exit("[PHPDISK] User locked");
}
$server_oid = get_server_oid();
@set_time_limit(0);
$group_set = $db->fetch_one_array("select * from {$tpf}groups where gid='{$pd_gid}'");
$upload_max = get_byte_value(ini_get('upload_max_filesize'));
$post_max = get_byte_value(ini_get('post_max_size'));
$settings_max = $settings['max_file_size'] ? get_byte_value($settings['max_file_size']) : 0;
$max_php_file_size = min($upload_max, $post_max);
$max_file_size_byte = $settings_max && $settings_max <= $max_php_file_size ? $settings_max : $max_php_file_size;
if ($group_set['max_filesize']) {
    $group_set_max_file_size = get_byte_value($group_set['max_filesize']);
    $max_file_size_byte = $group_set_max_file_size >= $max_file_size_byte ? $max_file_size_byte : $group_set_max_file_size;
}
$max_user_file_size = get_size($max_file_size_byte, 'B', 0);
$uid = (int) gpc('uid', 'G', 0);
$folder_id = (int) gpc('folder_id', 'G', 0);
$plugin_type = trim(gpc('plugin_type', 'G', ''));
$hash = trim(gpc('hash', 'G', ''));
$md5_sign = md5($uid . $folder_id . $plugin_type . $settings[phpdisk_url]);
if ($md5_sign != $hash) {
    exit('[PHPDisk] Error Params!');
}
$action = $action ? $action : 'doupload';
switch ($action) {
    default:
        $upload_url = urr("plugin_upload", "uid={$uid}&folder_id={$folder_id}&plugin_type={$plugin_type}&hash={$hash}");
Exemplo n.º 5
0
function get_my_nav($nav_arr = array())
{
    global $db, $tpf, $pd_uid, $pd_gid, $group_settings;
    $rs = $db->fetch_one_array("select user_store_space from {$tpf}users where userid='{$pd_uid}'");
    if ($rs['user_store_space'] == 0) {
        $arr['max_storage'] = $group_settings[$pd_gid]['max_storage'] == 0 ? __('no_limit') : $group_settings[$pd_gid]['max_storage'];
    } else {
        $arr['max_storage'] = $rs['user_store_space'];
    }
    unset($rs);
    $file_size_total = $db->result_first("select sum(file_size) from {$tpf}files where userid='{$pd_uid}'");
    $arr['now_space'] = get_size($file_size_total);
    $file_size_total = $file_size_total > get_byte_value($arr['max_storage']) ? get_byte_value($arr['max_storage']) : $file_size_total;
    $arr['disk_fill'] = $arr['max_storage'] ? @round($file_size_total / get_byte_value($arr['max_storage']), 1) * 120 : 0;
    $arr['disk_percent'] = $arr['max_storage'] ? @round($file_size_total / get_byte_value($arr['max_storage']), 3) * 100 : 0;
    $arr['disk_remain'] = 100 - $arr['disk_percent'];
    $arr['disk_space'] = $arr['max_storage'] ? get_size(get_byte_value($arr['max_storage']) - $file_size_total) : __('no_limit');
    if (is_array($nav_arr)) {
        $arr = array_merge($arr, $nav_arr);
    }
    return $arr;
}