Skip to content

Commit

Permalink
🚙 files restructure and library update
Browse files Browse the repository at this point in the history
  • Loading branch information
Belikhun committed Mar 18, 2020
1 parent ed14629 commit 6537b25
Show file tree
Hide file tree
Showing 39 changed files with 4,051 additions and 3,663 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
data/logs.json
data/avatar/*
!data/avatar/avt.default
!data/avatar/*.php
.cache

# Byte-compiled / optimized / DLL files
Expand Down
29 changes: 0 additions & 29 deletions api/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,49 +84,20 @@ function setting(String $key, &$target, $type) {
setting("app_description" , $rawConfig["app"]["description"] , $TYPE_STRING);
setting("uploadDir" , $rawConfig["uploadDir"] , $TYPE_STRING);
setting("time_zone" , $rawConfig["time"]["zone"] , $TYPE_STRING);
setting("time_begin_seconds" , $rawConfig["time"]["begin"]["seconds"] , $TYPE_NUMBER);
setting("time_begin_minutes" , $rawConfig["time"]["begin"]["minutes"] , $TYPE_NUMBER);
setting("time_begin_hours" , $rawConfig["time"]["begin"]["hours"] , $TYPE_NUMBER);
setting("time_begin_days" , $rawConfig["time"]["begin"]["days"] , $TYPE_NUMBER);
setting("time_begin_months" , $rawConfig["time"]["begin"]["months"] , $TYPE_NUMBER);
setting("time_begin_years" , $rawConfig["time"]["begin"]["years"] , $TYPE_NUMBER);
setting("time_during" , $rawConfig["time"]["during"] , $TYPE_NUMBER);
setting("time_offset" , $rawConfig["time"]["offset"] , $TYPE_NUMBER);
setting("pageTitle" , $rawConfig["pageTitle"] , $TYPE_STRING);
setting("publish" , $rawConfig["publish"] , $TYPE_BOOL );
setting("submit" , $rawConfig["submit"] , $TYPE_BOOL );
setting("submitInProblems" , $rawConfig["submitInProblems"] , $TYPE_BOOL );
setting("allowRegister" , $rawConfig["allowRegister"] , $TYPE_BOOL );
setting("edit_name" , $rawConfig["edit"]["name"] , $TYPE_BOOL );
setting("edit_password" , $rawConfig["edit"]["password"] , $TYPE_BOOL );
setting("edit_avatar" , $rawConfig["edit"]["avatar"] , $TYPE_BOOL );
setting("viewRank" , $rawConfig["viewRank"] , $TYPE_BOOL );
setting("viewRankTask" , $rawConfig["viewRankTask"] , $TYPE_BOOL );
setting("viewRankHideDisabled" , $rawConfig["viewRankHideDisabled"] , $TYPE_BOOL );
setting("viewLog" , $rawConfig["viewLog"] , $TYPE_BOOL );
setting("viewLogOther" , $rawConfig["viewLogOther"] , $TYPE_BOOL );
setting("publicProblems" , $rawConfig["publicProblems"] , $TYPE_BOOL );
setting("clientConfig_sounds" , $rawConfig["clientConfig"]["sounds"] , $TYPE_BOOL );
setting("clientConfig_nightmode" , $rawConfig["clientConfig"]["nightmode"] , $TYPE_BOOL );
setting("clientConfig_showMs" , $rawConfig["clientConfig"]["showMs"] , $TYPE_BOOL );
setting("clientConfig_transition" , $rawConfig["clientConfig"]["transition"] , $TYPE_BOOL );
setting("clientConfig_dialogProblem", $rawConfig["clientConfig"]["dialogProblem"] , $TYPE_BOOL );
setting("clientConfig_rankUpdate" , $rawConfig["clientConfig"]["rankUpdate"] , $TYPE_BOOL );
setting("clientConfig_logsUpdate" , $rawConfig["clientConfig"]["logsUpdate"] , $TYPE_BOOL );
setting("clientConfig_updateDelay" , $rawConfig["clientConfig"]["updateDelay"] , $TYPE_NUMBER);
setting("ratelimit_maxRequest" , $rawConfig["ratelimit"]["maxRequest"] , $TYPE_NUMBER);
setting("ratelimit_time" , $rawConfig["ratelimit"]["time"] , $TYPE_NUMBER);
setting("ratelimit_banTime" , $rawConfig["ratelimit"]["banTime"] , $TYPE_NUMBER);
setting("cache_contestRank" , $rawConfig["cache"]["contestRank"] , $TYPE_NUMBER);

if ($rawConfig["publish"] !== true) {
$rawConfig["viewRank"] = false;
$rawConfig["viewLog"] = false;
}

if ($rawConfig["viewRankTask"] !== true)
$rawConfig["viewLogOther"] = false;

if ($changed === false)
stop(102, "Woah nothing happened.", 200);

Expand Down
4 changes: 2 additions & 2 deletions api/contest/rank.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@
});

foreach ($res as $value) {
$total[$user] = $value["total"];
$overall += $total[$user];
$total[$value["username"]] = $value["total"];
$overall += $total[$value["username"]];
}

if ($export) {
Expand Down
3 changes: 3 additions & 0 deletions api/info.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
$username = reqQuery("u");
require_once $_SERVER["DOCUMENT_ROOT"] ."/data/xmldb/account.php";

if ($username !== preg_replace("/[^a-zA-Z0-9]+/", "", $username))
stop(-1, "Tên người dùng chỉ được phép dùng các kí tự trong khoảng a-zA-Z0-9", 400);

if (!$data = getUserData($username))
stop(13, "Không tìm thấy tên người dùng \"$username\"!", 404, Array( "username" => $username ));

Expand Down
275 changes: 228 additions & 47 deletions api/login.php

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion api/register.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
if ($config["allowRegister"] !== true)
stop(21, "Đăng kí tài khoản đã bị tắt!", 403);

$username = reqForm("username");
$username = preg_replace("/[^a-zA-Z0-9]+/", "", reqForm("username"));
$password = reqForm("password");
$captcha = reqForm("captcha");

Expand Down
10 changes: 9 additions & 1 deletion assets/css/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ body.dark pre {
timer {
position: relative;
display: inline-block;
font-family: Segoe UI;
font-family: "Segoe UI", "Calibri";
font-weight: bold;
font-size: 21px;
letter-spacing: .5px;
Expand All @@ -105,6 +105,14 @@ body.dark timer[data-color = "red"] {
color: rgb(255, 169, 169);
}

timer[data-color = "yellow"] {
color: rgb(190, 166, 29);
}

body.dark timer[data-color = "yellow"] {
color: rgb(239, 241, 80);
}

timer[data-color = "green"] {
color: rgb(12, 184, 41);
}
Expand Down
3 changes: 1 addition & 2 deletions assets/css/loginPage.css
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ body.dark {

width: 100%;
box-sizing: border-box;
padding: 0 20px;
overflow-x: hidden;
overflow-y: auto;
}
Expand Down Expand Up @@ -228,7 +227,7 @@ body.dark {
.rightPanel .center .formBox .inputForm .progress .indicator > .item {
position: relative;
display: inline-block;
width: 100px;
width: 120px;
padding-top: 24px;
font-family: Nunito;
font-size: 12px;
Expand Down
2 changes: 1 addition & 1 deletion assets/css/progressBar.css
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@
}

.progressBar > .bar[data-color="yellow"] {
background-color: #d4d23f;
background-color: #c7c545;
}

.progressBar > .bar[data-color="pink"] {
Expand Down
94 changes: 86 additions & 8 deletions assets/css/switch.css
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,6 @@
.sq-checkbox input {
position: absolute;
display: none;
cursor: pointer;
height: 0;
width: 0;
}
Expand All @@ -197,20 +196,20 @@
width: 42px;
}

.sq-checkbox:hover input ~ .checkmark {
.sq-checkbox:hover > input ~ .checkmark {
background-color: rgba(68, 170, 221, 0.4);
border-color: rgb(160, 220, 250);
}

.sq-checkbox input:checked ~ .checkmark {
.sq-checkbox > input:checked ~ .checkmark {
background-color: rgb(68, 170, 221);
}

.sq-checkbox:hover input:checked ~ .checkmark {
.sq-checkbox:hover > input:checked ~ .checkmark {
background-color: rgb(160, 220, 250);
}

.sq-checkbox input:disabled ~ .checkmark {
.sq-checkbox > input:disabled ~ .checkmark {
filter: brightness(0.8);
cursor: not-allowed;
}
Expand All @@ -219,15 +218,94 @@
border-color: rgb(255, 102, 170);
}

.sq-checkbox.pink:hover input ~ .checkmark {
.sq-checkbox.pink:hover > input ~ .checkmark {
background-color: rgba(255, 102, 171, 0.4);
border-color: rgb(255, 194, 214);
}

.sq-checkbox.pink input:checked ~ .checkmark {
.sq-checkbox.pink > input:checked ~ .checkmark {
background-color: rgb(255, 102, 170);
}

.sq-checkbox.pink:hover input:checked ~ .checkmark {
.sq-checkbox.pink:hover > input:checked ~ .checkmark {
background-color: rgb(255, 194, 214);
}

.circleCheckbox {
position: relative;
display: inline-block;
width: 28px;
height: 28px;
user-select: none;
}

.circleCheckbox > input {
position: absolute;
display: none;
height: 0;
width: 0;
}

.circleCheckbox > .checkmark {
position: absolute;
display: flex;
align-items: center;
justify-content: center;
top: 0;
left: 0;
width: 100%;
height: 100%;
border: 2px solid rgb(34, 34, 34);
border-radius: 50%;
box-sizing: border-box;
font-size: 15px;
font-weight: bold;
cursor: pointer;

transition: all 0.3s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.circleCheckbox > input:disabled + .checkmark {
cursor: not-allowed;
}

.circleCheckbox > input:checked + .checkmark,
.circleCheckbox[data-force="true"] > input + .checkmark {
background-color: rgb(34, 34, 34);
border-width: 0;
color: rgb(228, 228, 228);
}

.circleCheckbox[data-color="green"] > input:checked + .checkmark,
.circleCheckbox[data-color="green"][data-force="true"] > input + .checkmark {
background-color: rgb(55, 228, 55);
color: rgb(44, 44, 44);
}

.circleCheckbox[data-color="red"] > input:checked + .checkmark,
.circleCheckbox[data-color="red"][data-force="true"] > input + .checkmark {
background-color: rgb(255, 125, 125);
color: rgb(44, 44, 44);
}

.circleCheckbox[data-color="blue"] > input:checked + .checkmark,
.circleCheckbox[data-color="blue"][data-force="true"] > input + .checkmark {
background-color: rgb(44, 224, 248);
color: rgb(44, 44, 44);
}

.circleCheckbox[data-color="yellow"] > input:checked + .checkmark,
.circleCheckbox[data-color="yellow"][data-force="true"] > input + .checkmark {
background-color: rgb(217, 230, 47);
color: rgb(44, 44, 44);
}

body.dark .circleCheckbox > .checkmark {
border-color: rgb(65, 65, 65);
}

body.dark .circleCheckbox > input:checked + .checkmark,
body.dark .circleCheckbox[data-force="true"] > input + .checkmark {
background-color: rgb(168, 168, 168);
color: rgb(46, 46, 46);
}
Binary file added assets/fonts/segoeui/SegoeUI-Bold.woff2
Binary file not shown.
Binary file added assets/fonts/segoeui/SegoeUI-BoldItalic.woff2
Binary file not shown.
Binary file added assets/fonts/segoeui/SegoeUI-Italic.woff2
Binary file not shown.
Binary file added assets/fonts/segoeui/SegoeUI-Light.woff2
Binary file not shown.
Binary file added assets/fonts/segoeui/SegoeUI-LightItalic.woff2
Binary file not shown.
Binary file added assets/fonts/segoeui/SegoeUI-Semibold.woff2
Binary file not shown.
Binary file not shown.
Binary file added assets/fonts/segoeui/SegoeUI-Semilight.woff2
Binary file not shown.
Binary file not shown.
Binary file added assets/fonts/segoeui/SegoeUI.woff2
Binary file not shown.
Binary file added assets/fonts/segoeui/SegoeUIBlack-Italic.woff2
Binary file not shown.
Binary file added assets/fonts/segoeui/SegoeUIBlack.woff2
Binary file not shown.
105 changes: 105 additions & 0 deletions assets/fonts/segoeui/segoeui.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
/*
? |-----------------------------------------------------------------------------------------------|
? | /assets/fonts/segoeui/segoeui.css |
? | |
? | Copyright (c) 2018-2020 Belikhun. All right reserved |
? | Licensed under the MIT License. See LICENSE in the project root for license information. |
? |-----------------------------------------------------------------------------------------------|
*/

@font-face {
font-family: "Segoe UI Semilight";
src: local("Segoe UI Semilight Italic"), local("SegoeUI-SemilightItalic"),
url("SegoeUI-SemilightItalic.woff2") format("woff2");
font-weight: 300;
font-style: italic;
}

@font-face {
font-family: "Segoe UI Semilight";
src: local("Segoe UI Semilight"), local("SegoeUI-Semilight"),
url("SegoeUI-Semilight.woff2") format("woff2");
font-weight: 300;
font-style: normal;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI Black"), local("SegoeUIBlack"),
url("SegoeUIBlack.woff2") format("woff2");
font-weight: 900;
font-style: normal;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI Light Italic"), local("SegoeUI-LightItalic"),
url("SegoeUI-LightItalic.woff2") format("woff2");
font-weight: 300;
font-style: italic;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI Bold Italic"), local("SegoeUI-BoldItalic"),
url("SegoeUI-BoldItalic.woff2") format("woff2");
font-weight: bold;
font-style: italic;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI Light"), local("SegoeUI-Light"),
url("SegoeUI-Light.woff2") format("woff2");
font-weight: 300;
font-style: normal;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI"), local("SegoeUI"),
url("SegoeUI.woff2") format("woff2");
font-weight: normal;
font-style: normal;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI Bold"), local("SegoeUI-Bold"),
url("SegoeUI-Bold.woff2") format("woff2");
font-weight: bold;
font-style: normal;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI Semibold Italic"), local("SegoeUI-SemiboldItalic"),
url("SegoeUI-SemiboldItalic.woff2") format("woff2");
font-weight: 600;
font-style: italic;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI Italic"), local("SegoeUI-Italic"),
url("SegoeUI-Italic.woff2") format("woff2");
font-weight: normal;
font-style: italic;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI Semibold"), local("SegoeUI-Semibold"),
url("SegoeUI-Semibold.woff2") format("woff2");
font-weight: 600;
font-style: normal;
}

@font-face {
font-family: "Segoe UI";
src: local("Segoe UI Black Italic"), local("SegoeUIBlack-Italic"),
url("SegoeUIBlack-Italic.woff2") format("woff2");
font-weight: 900;
font-style: italic;
}

Binary file added assets/img/chrome-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets/img/coccoc-icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 6537b25

Please sign in to comment.