Skip to content

Commit

Permalink
Merge pull request #33 from belivipro9x99/indev
Browse files Browse the repository at this point in the history
merge branch indev into master
  • Loading branch information
Belikhun authored Nov 10, 2019
2 parents 1eae968 + e3769af commit 9d84aef
Show file tree
Hide file tree
Showing 21 changed files with 178 additions and 80 deletions.
16 changes: 14 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Change Logs

- [Thay đổi trong v0.5.2](#thay-đổi-trong-v051)
- [Thay đổi trong v0.5.3](#thay-đổi-trong-v053)
- [Thay đổi trong v0.5.2](#thay-đổi-trong-v052)
- [Thay đổi trong v0.5.1](#thay-đổi-trong-v051)
- [Thay đổi trong v0.5.0](#thay-đổi-trong-v050)
- [Thay đổi trong v0.4.6](#thay-đổi-trong-v046)
Expand All @@ -26,7 +27,18 @@

---

## Thay đổi trong v0.5.2
## Thay đổi trong v0.5.3

* **Bug:** Sửa lỗi font **Exo** không được tải (#31)
* **Thêm:** Thêm cài đặt: **Tự động cập nhật Xếp Hạng và Nhật Ký** (#32)
* **Thay đổi:** Hiển thị tên đề bài thay vì mã đề bài nếu có thể (2806eb0993d3a1c6c98db86da3af629607e3c430)
* **Thay đổi:** Lọc mã đề bài: Chỉ cho phép các kí tự (a-z A-Z) và số (0-9) (8e72ce23229d63696358ccc18b5e0a3e196a4cac)
* **Thay đổi:** Tăng giới hạn của cài đặt **Thời gian làm mới** (#32)
* **Thay đổi:** Cache các tài nguyên tĩnh (`sounds`, `fonts``img`) với thời hạn *1 tuần* (#32)
* **Thay đổi:** Loại bỏ *chuyển thành chữ thường* tại một số api (4458efc20fdbda895a3c70ec38631527c0437dd3, eb94135e3b452c23d6c30873f37dd6ea0636d23c, 1b80b01feb5eb050904d94888e828ce17238da1f)
* Sửa một số lỗi khác và thêm một số chức năng nhỏ

### Thay đổi trong v0.5.2

* **Chỉnh sửa:** Đính dòng đầu tiên của bảng xếp hạng ở phía trên để dễ dàng đọc hơn
* **Chỉnh sửa:** Thêm ratelimit cho trang `public`
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ An **beautiful** and **easy-to-use** Web Interface for **[Themis](https://dsapbl

<img src="https://lh3.googleusercontent.com/SYT2hlU7_rxmCgHz0kt6089Md1V-j-ePWUUQBFtUVF5DTlcSjmGhr14J7Qsgx262KBZuhGKZ4eZD3ChYzdBaFMytEw0aBD3dRLi0bZskyK3-6MQ7rMkDMfcED18JgPyfeZEee50h8g=w2400" width="500px">

[![version](https://img.shields.io/badge/release-v0.5.2-brightgreen.svg?longCache=true&style=for-the-badge)](https://github.com/belivipro9x99/themis-webinterface/releases/)
[![version](https://img.shields.io/badge/release-v0.5.3-brightgreen.svg?longCache=true&style=for-the-badge)](https://github.com/belivipro9x99/themis-webinterface/releases/)
[![license](https://img.shields.io/badge/license-MIT-orange.svg?longCache=true&style=for-the-badge)](https://github.com/belivipro9x99/themis-web-interface/blob/master/LICENSE)
[![status](https://img.shields.io/badge/status-May_contain_bugs-blue.svg?longCache=true&style=for-the-badge)]()
[![Travis CI Build Status](https://img.shields.io/travis/belivipro9x99/themis-web-interface.svg?style=for-the-badge)](https://travis-ci.org/belivipro9x99/themis-web-interface)
Expand Down
9 changes: 6 additions & 3 deletions account.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,18 @@
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/default.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/statusBar.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/scrollBar.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/fonts/material-font.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/fonts/fontawesome.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/fonts/calibri.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/input.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/switch.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/button.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/spinner.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/menu.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/css/accountPage.css?v=<?php print VERSION; ?>" />
<!-- Fonts -->
<link rel="stylesheet" type="text/css" media="screen" href="/assets/fonts/calibri.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/fonts/exo.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/fonts/material-font.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/fonts/consolas.css?v=<?php print VERSION; ?>" />
<link rel="stylesheet" type="text/css" media="screen" href="/assets/fonts/fontawesome.css?v=<?php print VERSION; ?>" />
</head>

<body id="container">
Expand Down
17 changes: 12 additions & 5 deletions api/contest/logs.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
stop(11, "Bạn chưa đăng nhập.", 403);

require_once $_SERVER["DOCUMENT_ROOT"] ."/lib/logParser.php";
require_once $_SERVER["DOCUMENT_ROOT"] ."/data/problems/problem.php";
$username = $_SESSION["username"];
$updir = glob($config["uploadDir"] ."/*.*");
$queues = Array();
Expand All @@ -31,6 +32,8 @@

array_push($queues, Array(
"problem" => $data["problem"],
"problemName" => $data["problemName"],
"problemPoint" => $data["problemPoint"],
"extension" => $data["extension"],
"lastmodify" => $lastm
));
Expand All @@ -50,18 +53,20 @@

foreach($lqfs as $i => $item)
if (!in_array($item, $queueFiles)) {
$p = parseLogName($item);
$data = parseLogName($item);

// find and remove old log file
$loglist = glob($config["logDir"] ."/*.*");
foreach ($loglist as $log)
if (strpos($log, $p["problem"]) > 0 && (strpos($log, $username) > 0))
if (strpos($log, $data["problem"]) > 0 && (strpos($log, $username) > 0))
unlink($log);

array_push($judging, Array(
"problem" => $p["problem"],
"name" => $p["name"],
"extension" => $p["extension"],
"problem" => $data["problem"],
"problemName" => $data["problemName"],
"problemPoint" => $data["problemPoint"],
"name" => $data["name"],
"extension" => $data["extension"],
"lastmodify" => date("d/m/Y H:i:s"),
"lastmtime" => time(),
));
Expand Down Expand Up @@ -99,6 +104,8 @@
array_push($logres, Array(
"status" => $data["status"],
"problem" => $data["problem"],
"problemName" => $data["problemName"],
"problemPoint" => $data["problemPoint"],
"extension" => $data["file"]["extension"],
"point" => $data["point"],
"lastmodify" => $lastm,
Expand Down
2 changes: 1 addition & 1 deletion api/contest/problems/add.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

require_once $_SERVER["DOCUMENT_ROOT"] ."/data/problems/problem.php";

$id = preg_replace("/[.\/\\\\]/m", "", reqForm("id"));
$id = preg_replace("/[^a-zA-Z0-9]/m", "", reqForm("id"));

$name = reqForm("name");
$point = reqForm("point");
Expand Down
5 changes: 5 additions & 0 deletions api/contest/rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
$logDir = glob($config["logDir"] ."/*.log");
$res = Array();
$list = Array();
$nameList = Array();

foreach ($logDir as $i => $log) {
$data = ((new logParser($log, LOGPARSER_MODE_MINIMAL)) -> parse())["header"];
Expand All @@ -48,6 +49,9 @@
$res[$user]["status"][$data["problem"]] = $data["status"];
$res[$user]["point"][$data["problem"]] = $data["point"];
$res[$user]["logFile"][$data["problem"]] = ($config["viewLog"] === true || $_SESSION["id"] === "admin") ? $filename : null;

if ($data["problemName"])
$nameList[$data["problem"]] = $data["problemName"];
}

$res[$user]["username"] = $user;
Expand Down Expand Up @@ -75,5 +79,6 @@

stop(0, "Thành công!", 200, $returnData = Array (
"list" => $list,
"nameList" => $nameList,
"rank" => $res
), true);
2 changes: 1 addition & 1 deletion api/contest/upload.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
$userid = $_SESSION["id"];
apache_setenv("no-gzip", "1");

$file = utf8_encode(strtolower($_FILES["file"]["name"]));
$file = utf8_encode($_FILES["file"]["name"]);
$filename = pathinfo($file, PATHINFO_FILENAME);
$extension = pathinfo($file, PATHINFO_EXTENSION);

Expand Down
12 changes: 8 additions & 4 deletions assets/css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -649,10 +649,9 @@ body.guest #timep:not(.show) ~ #problemp.hide ~ #rankp {
position: relative;
display: block;
width: 100%;
font-size: 12px;
font-size: 13px;
font-weight: 500;
text-align: center;
text-transform: uppercase;
color: rgb(93, 93, 93);
}

Expand Down Expand Up @@ -1282,7 +1281,7 @@ body.guest #timep:not(.show) ~ #problemp.hide ~ #rankp {
}

#problemp .problem-container .problem-list li.item:hover {
background-color: rgba(202, 202, 202, 0.1);
background-color: rgba(124, 124, 124, 0.1);
}

#problemp .problem-container .problem-list li.item:after {
Expand Down Expand Up @@ -1534,7 +1533,7 @@ body.guest #timep:not(.show) ~ #problemp.hide ~ #rankp {
#rankp div.ranking-container table tbody tr[data-rank="3"] td:nth-child(3) .name {
font-weight: bolder;
font-family: Exo;
font-size: 13px;
font-size: 14px;
letter-spacing: .2px;
color: rgb(65, 65, 65);
}
Expand All @@ -1545,12 +1544,17 @@ body.guest #timep:not(.show) ~ #problemp.hide ~ #rankp {
background-color: #fafafa;
border-bottom: 1px solid #9b9b9b;
color: rgb(82, 82, 82);
font-family: Segoe UI;
font-size: 13px;
z-index: 1;
}

#rankp div.ranking-container table tr th,
#rankp div.ranking-container table tr td {
padding: 10px 12px;
}

#rankp div.ranking-container table tr td {
font-size: 13px;
}

Expand Down
14 changes: 7 additions & 7 deletions assets/css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ body.dark #logp .logItemContainer .logItem .d:hover {
}

body.dark #logp .logItemContainer .logItem.queue .h .l .n {
color: #ca92ff;
color: #bc75fd;
}

body.dark #logp .logItemContainer .logItem.judging .h .l .n {
Expand All @@ -296,19 +296,19 @@ body.dark #logp .logItemContainer .logItem.scored .h .l .n {
}

body.dark #logp .logItemContainer .logItem.correct .h .l .n {
color: #1edf4e;
color: #36f666;
}

body.dark #logp .logItemContainer .logItem.passed .h .l .n {
color: #1fc5e2;
color: #2bd1ee;
}

body.dark #logp .logItemContainer .logItem.accepted .h .l .n {
color: #dfd029;
color: #eedf3c;
}

body.dark #logp .logItemContainer .logItem.failed .h .l .n {
color: #f66f6f;
color: #fe8f8f;
}

/* userSettings */
Expand Down Expand Up @@ -519,11 +519,11 @@ body.dark .viewLog-container .testList {
}

body.dark .viewLog-container .testList .item {
background-color: rgb(60, 60, 60);
background-color: rgb(48, 48, 48);
}

body.dark .viewLog-container .testList .item:hover {
background-color: rgb(68, 68, 68);
background-color: rgb(60, 60, 60);
}

body.dark .viewLog-container .testList .item .line.detail > t {
Expand Down
33 changes: 21 additions & 12 deletions assets/css/slider.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
? |-----------------------------------------------------------------------------------------------|
*/

input[type=range].sq-slider {
input.sq-slider[type=range] {
position: relative;
width: 40px;
height: 2px;
Expand All @@ -19,7 +19,7 @@ input[type=range].sq-slider {
-moz-appearance: none;
}

input[type=range].sq-slider::-webkit-slider-thumb {
input.sq-slider[type=range]::-webkit-slider-thumb {
width: 14px;
height: 14px;
border-radius: 50%;
Expand All @@ -30,44 +30,53 @@ input[type=range].sq-slider::-webkit-slider-thumb {
-moz-appearance: none;
}

input[type=range].sq-slider:hover {
input.sq-slider[type=range]:hover {
background-color: rgba(255, 102, 171, 0.8);
}

input[type=range].sq-slider:hover::-webkit-slider-thumb {
input.sq-slider[type=range]:hover::-webkit-slider-thumb {
background-color: rgb(255, 194, 214);
}

input[type=range].sq-slider:active {
input.sq-slider[type=range]:active {
background-color: rgba(235, 91, 156, 0.8);
}

input[type=range].sq-slider:active::-webkit-slider-thumb {
input.sq-slider[type=range]:active::-webkit-slider-thumb {
background-color: rgb(233, 139, 170);
}

input.sq-slider[type=range]:disabled {
filter: brightness(0.6);
cursor: not-allowed;
}

input.sq-slider[type=range]:disabled::-webkit-slider-thumb {
cursor: not-allowed;
}

/* Blue */

input[type=range].sq-slider.blue {
input.sq-slider[type=range].blue {
background-color: rgba(68, 170, 221, 0.6);
}

input[type=range].sq-slider.blue::-webkit-slider-thumb {
input.sq-slider[type=range].blue::-webkit-slider-thumb {
background-color: rgb(68, 170, 221);
}

input[type=range].sq-slider.blue:hover {
input.sq-slider[type=range].blue:hover {
background-color: rgba(68, 170, 221, 0.8);
}

input[type=range].sq-slider.blue:hover::-webkit-slider-thumb {
input.sq-slider[type=range].blue:hover::-webkit-slider-thumb {
background-color: rgb(160, 220, 250);
}

input[type=range].sq-slider.blue:active {
input.sq-slider[type=range].blue:active {
background-color: rgba(50, 145, 192, 0.8);
}

input[type=range].sq-slider.blue:active::-webkit-slider-thumb {
input.sq-slider[type=range].blue:active::-webkit-slider-thumb {
background-color: rgb(65, 167, 218);
}
22 changes: 4 additions & 18 deletions assets/fonts/.htaccess
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
# Below is custom site speed items
# We need to set correct content-type for fonts
AddType application/vnd.ms-fontobject .eot
AddType application/x-font-ttf .ttf
AddType application/x-font-opentype .otf
AddType application/x-font-woff .woff
AddType image/svg+xml .svg

# This sets up expire times
# BEGIN Expire headers
<ifModule mod_expires.c>
ExpiresActive On
ExpiresDefault "access plus 5 seconds"
# This part sets the expires for the fonts
ExpiresByType application/vnd.ms-fontobject "access plus 1 year"
ExpiresByType application/x-font-ttf "access plus 1 year"
ExpiresByType application/x-font-opentype "access plus 1 year"
ExpiresByType application/x-font-woff "access plus 1 year"
ExpiresByType image/svg+xml "access plus 1 year"
</ifModule>
<IfModule mod_headers.c>
# Expire after 1 WEEK
Header set Cache-Control "public, max-age=604800"
</IfModule>
# END Expire headers
7 changes: 7 additions & 0 deletions assets/img/.htaccess
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# This sets up expire times
# BEGIN Expire headers
<IfModule mod_headers.c>
# Expire after 1 WEEK
Header set Cache-Control "public, max-age=604800"
</IfModule>
# END Expire headers
Loading

0 comments on commit 9d84aef

Please sign in to comment.