?>
:</td>
					<td width="*" class="box-sel" align="center">
						<?php 
if (!isset($config_ext['quota']['select_quota']) || $config_ext['quota']['select_quota'] == 0) {
    echo '<input type="text" size="35" name="frm_quota_trans_mb" value="' . @$config_ext['quota']['trans_mb'] . '" align="right" style="width: 190px;">';
} else {
    echo '<select name="frm_quota_trans_mb" style="width: 192px;">';
    if (@$config_ext['quota']['trans_mb'] == 0) {
        echo '<option value="0" selected>' . $language['configure']['quota_no_limit'] . '</option>';
    } else {
        echo '<option value="0">' . $language['configure']['quota_no_limit'] . '</option>';
    }
    foreach ($config_quota_select_datasize as $count) {
        echo '<option value="' . $count['v'] . '"';
        if (float2int(mb2byte(@$config_ext['quota']['trans_mb'])) == $count['v']) {
            echo ' selected';
        }
        echo '>' . $count['d'] . '</option>';
    }
    echo '</select>';
}
?>
					</td>
					<td width="*" class="box-sel-head"><?php 
echo $GLOBALS['language']['configure']['quota_trans_files'];
?>
:</td>
					<td width="*" class="box-sel" align="right">
						<?php 
if (!isset($config_ext['quota']['select_quota']) || $config_ext['quota']['select_quota'] == 0) {
 function do_add_default_quota($username)
 {
     $this->log_add_debug('do_add_default_quota', 'Adding default quota for user with username"' . $username . '"');
     if ($GLOBALS['config_ext']['quota']['per_session'] == 1) {
         $GLOBALS['config_ext']['quota']['per_session'] = 'true';
     } else {
         $GLOBALS['config_ext']['quota']['per_session'] = 'false';
     }
     $this->__do_basic_query('INSERT INTO ftpquotalimits SET name="' . $username . '", quota_type="user", per_session="' . $GLOBALS['config_ext']['quota']['per_session'] . '", limit_type="' . $GLOBALS['config_ext']['quota']['limittype'] . '", bytes_in_avail="' . mb2byte($GLOBALS['config_ext']['quota']['up_mb']) . '", bytes_out_avail="' . mb2byte($GLOBALS['config_ext']['quota']['down_mb']) . '", bytes_xfer_avail="' . mb2byte($GLOBALS['config_ext']['quota']['trans_mb']) . '", files_in_avail="' . $GLOBALS['config_ext']['quota']['up_files'] . '", files_out_avail="' . $GLOBALS['config_ext']['quota']['down_files'] . '", files_xfer_avail="' . $GLOBALS['config_ext']['quota']['trans_files'] . '"');
 }
$out .= "\t\t\t\t<proftpd>" . @$configuration['file_paths']['os_specific']['linux']['proftpd'] . "</proftpd>\n";
$out .= "\t\t\t</linux>\n";
$out .= "\t\t\t<bsd>\n";
$out .= "\t\t\t\t<kernel_configuration>" . $configuration['file_paths']['os_specific']['bsd']['kernel_configuration'] . "</kernel_configuration>\n";
$out .= "\t\t\t\t<proftpd>" . @$configuration['file_paths']['os_specific']['bsd']['proftpd'] . "</proftpd>\n";
$out .= "\t\t\t</bsd>\n";
$out .= "\t\t</os_specific>\n";
$out .= "\t</file_paths>\n";
$out .= "\t<extensions>\n";
$out .= "\t\t<vhosts>\n";
$out .= "\t\t\t<enabled>" . $config_ext['vhosts']['enabled'] . "</enabled>\n";
$out .= "\t\t</vhosts>\n";
$out .= "\t\t<quota>\n";
$out .= "\t\t\t<enabled>" . @$config_ext['quota']['enabled'] . "</enabled>\n";
$out .= "\t\t\t<select_quota>" . @$config_ext['quota']['select_quota'] . "</select_quota>\n";
$out .= "\t\t\t<type>" . @$config_ext['quota']['type'] . "</type>\n";
$out .= "\t\t\t<limit_type>" . @$config_ext['quota']['limittype'] . "</limit_type>\n";
$out .= "\t\t\t<per_session>" . @$config_ext['quota']['per_session'] . "</per_session>\n";
$out .= "\t\t\t<download_byte_limit>" . mb2byte(@$config_ext['quota']['down_mb']) . "</download_byte_limit>\n";
$out .= "\t\t\t<upload_byte_limit>" . mb2byte(@$config_ext['quota']['up_mb']) . "</upload_byte_limit>\n";
$out .= "\t\t\t<transferred_byte_limit>" . mb2byte(@$config_ext['quota']['trans_mb']) . "</transferred_byte_limit>\n";
$out .= "\t\t\t<download_file_limit>" . @$config_ext['quota']['down_files'] . "</download_file_limit>\n";
$out .= "\t\t\t<upload_file_limit>" . @$config_ext['quota']['up_files'] . "</upload_file_limit>\n";
$out .= "\t\t\t<transferred_file_limit>" . @$config_ext['quota']['trans_files'] . "</transferred_file_limit>\n";
$out .= "\t\t</quota>\n";
$out .= "\t\t<pdns>\n";
$out .= "\t\t\t<enabled>" . @$config_ext['pdns']['enabled'] . "</enabled>\n";
$out .= "\t\t</pdns>\n";
$out .= "\t</extensions>\n";
$out .= "</configuration>";
@file_put_contents('configuration.xml', $out);
Esempio n. 4
0
if ($config_ext['quota']['enabled'] == 1) {
    if (isset($_GET['section']) && $_GET['section'] == 'delete_quota') {
        $db->do_delete_quota($res_data['userid']);
        $_GET['section'] = 'quota';
    }
    $quota_data = $db->get_userquota_by_id($res_data['userid']);
    if ($quota_data['have_quota'] == false) {
        if (isset($_GET['section']) && $_GET['section'] == 'add_quota') {
            $db->do_add_default_quota($res_data['userid']);
            $_GET['section'] = 'quota';
            $quota_data = $db->get_userquota_by_id($res_data['userid']);
        }
    } else {
        /* Check if we got an update for the users quota limits */
        if (isset($_POST['frm_quota_turndefaultlimit']) || isset($_POST['frm_quota_up_mb'])) {
            $db->do_set_quota($res_data['userid'], $_POST['frm_quota_turndefaultpersession'], $_POST['frm_quota_turndefaultlimit'], mb2byte($_POST['frm_quota_up_mb']), mb2byte($_POST['frm_quota_down_mb']), mb2byte($_POST['frm_quota_trans_mb']), $_POST['frm_quota_up_files'], $_POST['frm_quota_down_files'], $_POST['frm_quota_trans_files']);
            $quota_data = $db->get_userquota_by_id($res_data['userid']);
        }
    }
}
?>
	<table class="box">
		<tr>
			<td class="box-headline">&gt;&gt; <?php 
echo strtoupper($res_data['userid'][0]) . substr($res_data['userid'], 1);
?>
</td>
		</tr>
		<tr>
			<td>
			<table class="box" style="border-style: none;">