require_once('include/init.php');
function bytesToSize($bytes, $precision = 2) {
$kilobyte = 1024;
$megabyte = $kilobyte * 1024;
$gigabyte = $megabyte * 1024;
$terabyte = $gigabyte * 1024;
if (($bytes >= 0) && ($bytes < $kilobyte)) {
return $bytes . ' B';
} elseif (($bytes >= $kilobyte) && ($bytes < $megabyte)) {
return round($bytes / $kilobyte, $precision) . ' KB';
} elseif (($bytes >= $megabyte) && ($bytes < $gigabyte)) {
return round($bytes / $megabyte, $precision) . ' MB';
} elseif (($bytes >= $gigabyte) && ($bytes < $terabyte)) {
return round($bytes / $gigabyte, $precision) . ' GB';
} elseif ($bytes >= $terabyte) {
return round($bytes / $gigabyte, $precision) . ' TB';
} else {
return $bytes . ' B';
}
}
check_login();
if ($_SESSION['type'] != 'personeel') throw new Exception('Alleen personeel mag files uploaden', 2);
$quotum = sprint_singular("SELECT quotum FROM ppl WHERE ppl_id = {$_SESSION['ppl_id']}");
$usage = sprint_singular("SELECT SUM(file_size) FROM files WHERE ppl_id = {$_SESSION['ppl_id']}");
if (!isset($usage)) $usage = 0;
$maxupload = sprint_singular("SELECT maxupload FROM ppl WHERE ppl_id = {$_SESSION['ppl_id']}");
if ($quotum - $usage < $maxupload)
$maxupload = $quotum - $usage;
$result = mysql_query_safe("SELECT file_naam, file_size, CONCAT('[url=store/{$_SESSION['ppl_id']}/', file_naam, ']link[/url]
') `bbcode link (voor in notities)`, date datum, CONCAT('delete') verwijderen, CONCAT('download') download, downloaded hits FROM files WHERE ppl_id = {$_SESSION['ppl_id']} ORDER BY file_id");
$table = sprint_table($result);
if (mysql_num_rows($result) == 0) $table .= 'er zijn geen files aanwezig';
mysql_free_result($result);
gen_html_header("Upload");
status() ?>
Hier kun je een file uploaden naar het klassenboek. Je mag
maximaal echo(bytesToSize($quotum)) ?> gebruiken, waarvan je
momenteel echo(bytesToSize($usage)) ?> ( $perc = $usage/$quotum*100; echo round($perc, 1).'%' ?>) hebt gebruikt.
echo($table) ?>
Als je een nieuwe groepsnotitie maakt, komt er automatisch een lijst met je meest recente files onder te staan. Je kunt de bbcode link knippen en plakken naar je notitie.
Je hebt alle ruimte gebruikt. Je moet files gaan verwijderen of aan de beheerder vragen om meer ruimte. } else { ?>
Je mag een file uploaden van maximaal echo(bytesToSize($maxupload)) ?>.
} ?> gen_html_footer(); ?>