mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 18:48:41 +00:00
feat(web/image_hosting): show usage statistics
This commit is contained in:
parent
0a7a6cbe9e
commit
cafa5b61f2
@ -14,7 +14,9 @@
|
||||
}
|
||||
|
||||
$limit = $myUser['images_size_limit'];
|
||||
$used = DB::select("SELECT SUM(size) FROM `users_images` WHERE uploader = {$myUser['username']}")["SUM(size)"];
|
||||
$_result = DB::selectFirst("SELECT SUM(size), count(*) FROM `users_images` WHERE uploader = '{$myUser['username']}'");
|
||||
$used = $_result["SUM(size)"];
|
||||
$count = $_result["count(*)"];
|
||||
|
||||
function throwError($msg) {
|
||||
die(json_encode(['status' => 'error', 'message' => $msg]));
|
||||
@ -121,7 +123,7 @@
|
||||
<div class="card card-default">
|
||||
<div class="card-body">
|
||||
<form class="row m-0" id="image-upload-form" method="post" enctype="multipart/form-data">
|
||||
<div class="col-12 col-md-3 drop mx-auto" id="image-upload-form-drop">
|
||||
<div class="col-12 col-md-3 col-lg-3 order-1 drop mx-auto" id="image-upload-form-drop">
|
||||
<svg aria-hidden="true" focusable="false" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 576 512" width="56" class="mb-2">
|
||||
<g>
|
||||
<path fill="#3498db" d="M424.49 120.48a12 12 0 0 0-17 0L272 256l-39.51-39.52a12 12 0 0 0-17 0L160 272v48h352V208zM64 336V128H48a48 48 0 0 0-48 48v256a48 48 0 0 0 48 48h384a48 48 0 0 0 48-48v-16H144a80.09 80.09 0 0 1-80-80z"></path>
|
||||
@ -158,7 +160,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-12 col-md-3 mt-3 mt-md-0 ms-md-2">
|
||||
<div class="col-12 col-md-4 col-lg-2 order-2 mt-3 mt-md-0 ms-md-2">
|
||||
<h2 class="h4">水印</h2>
|
||||
<?php if (isSuperUser($myUser)): ?>
|
||||
<div class="form-check d-inline-block d-md-block me-2">
|
||||
@ -181,14 +183,25 @@
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col mt-3 mt-md-0 ms-md-2">
|
||||
<div class="col-12 col-lg-4 order-3 order-md-4 order-lg-3 mt-3 mt-lg-0 ms-lg-2">
|
||||
<h2 class="h4">上传须知</h2>
|
||||
<ul>
|
||||
<li>上传的图片必须符合法律与社会道德;</li>
|
||||
<li>图床仅供 S2OJ 站内使用;</li>
|
||||
<li>图床仅供 S2OJ 站内使用,校外用户无法查看;</li>
|
||||
<li>在合适的地方插入图片即可引用。</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="col-12 col-md-5 col-lg-3 order-4 order-md-3 order-lg-4 mt-3 mt-md-0 ms-md-2">
|
||||
<h2 class="h4">使用统计</h2>
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="small">已用空间</span>
|
||||
<span><?= round($used * 1.0 / 1024 / 1024, 2) ?> MB / <?= round($limit * 1.0 / 1024 / 1024, 2) ?> MB</span>
|
||||
</div>
|
||||
<div class="d-flex justify-content-between">
|
||||
<span class="small">上传总数</span>
|
||||
<span><?= $count ?> 张</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user