From 22f60e20861b38e64e3a5e0a69144ebd35412775 Mon Sep 17 00:00:00 2001 From: Belikhun Date: Sat, 29 Feb 2020 22:34:35 +0700 Subject: [PATCH 1/9] fix "undefined index" while exporting csv only php 7.4 user got this bug --- api/contest/rank.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/contest/rank.php b/api/contest/rank.php index b145e946..c8294bc4 100644 --- a/api/contest/rank.php +++ b/api/contest/rank.php @@ -119,7 +119,7 @@ $header = Array("#", "username", "name", "total"); foreach ($list as $id) - array_push($header, $nameList[$id] || $id); + array_push($header, isset($nameList[$id]) ? $nameList[$id] : $id); array_push($data, $header); @@ -127,7 +127,7 @@ $line = Array($i + 1, $item["username"], $item["name"], $item["total"]); foreach ($list as $id) - array_push($line, $item["point"][$id] || null); + array_push($line, isset($item["point"][$id]) ? $item["point"][$id] : null); array_push($data, $line); } From 819c67242e36f9a7ca0ec78bea3fe5d2733064bf Mon Sep 17 00:00:00 2001 From: Belikhun Date: Sat, 29 Feb 2020 22:39:20 +0700 Subject: [PATCH 2/9] =?UTF-8?q?=E2=9C=8F=20edit=20version=20string?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- data/info.php | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d909f6af..f3f1a801 100644 --- a/README.md +++ b/README.md @@ -6,11 +6,11 @@ An **beautiful** and **easy-to-use** Web Interface for **[Themis](https://dsapbl -[![version](https://img.shields.io/badge/release-v0.6.0-brightgreen.svg?longCache=true&style=for-the-badge)](https://github.com/belivipro9x99/themis-webinterface/releases/) +[![version](https://img.shields.io/badge/indev-v0.6.1-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-near_stable-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) -[![codefactor](https://www.codefactor.io/repository/github/belivipro9x99/themis-web-interface/badge/master?style=for-the-badge)](https://www.codefactor.io/repository/github/belivipro9x99/themis-web-interface) +[![codefactor](https://www.codefactor.io/repository/github/belivipro9x99/themis-web-interface/badge/indev?style=for-the-badge)](https://www.codefactor.io/repository/github/belivipro9x99/themis-web-interface) [![Travis CI Build Status](https://img.shields.io/travis/belivipro9x99/themis-web-interface/master.svg?label=master&style=for-the-badge)](https://travis-ci.org/belivipro9x99/themis-web-interface) [![Travis CI Build Status](https://img.shields.io/travis/belivipro9x99/themis-web-interface/indev.svg?label=indev&style=for-the-badge)](https://travis-ci.org/belivipro9x99/themis-web-interface) diff --git a/data/info.php b/data/info.php index 8b1ecee2..63c4bc0a 100644 --- a/data/info.php +++ b/data/info.php @@ -9,8 +9,8 @@ // dont claim it for your own. its not nice define("APPNAME", "Themis Web Interface"); define("AUTHOR", "Belikhun"); - define("VERSION", "0.6.0"); - define("VERSION_TAG", "release"); + define("VERSION", "0.6.1"); + define("VERSION_TAG", "indev"); define("REPO_ADDRESS", "https://github.com/belivipro9x99/themis-web-interface"); define("REPORT_ERROR", REPO_ADDRESS . "/issues"); define("TRACK_ID", "UA-124598427-1"); From d961a4cb9b249a6579a48f297ff9a2560a6b0c94 Mon Sep 17 00:00:00 2001 From: Belikhun Date: Sun, 1 Mar 2020 21:06:59 +0700 Subject: [PATCH 3/9] rename contest config --- api/config.php | 4 ++-- api/server.php | 4 ++-- assets/js/config.js | 14 +++++++------- assets/js/core.js | 4 ++-- config.php | 2 +- data/config.json | 6 +++--- data/config.php | 6 +++--- index.php | 14 +++++++------- login.php | 4 ++-- tests/.config/config.json | 2 +- 10 files changed, 30 insertions(+), 30 deletions(-) diff --git a/api/config.php b/api/config.php index 2cc1bc54..8eba7272 100644 --- a/api/config.php +++ b/api/config.php @@ -80,8 +80,8 @@ function setting(String $key, &$target, $type) { stop(3, "Loại biến không khớp! Yêu cầu form ". $key ." là ". $type["string"], 400); } - setting("contest_name" , $rawConfig["contest"]["name"] , $TYPE_STRING); - setting("contest_description" , $rawConfig["contest"]["description"] , $TYPE_STRING); + setting("app_title" , $rawConfig["app"]["title"] , $TYPE_STRING); + 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); diff --git a/api/server.php b/api/server.php index 4486aa69..4bfe7864 100644 --- a/api/server.php +++ b/api/server.php @@ -17,8 +17,8 @@ "version" => VERSION, "versionTag" => VERSION_TAG, "author" => AUTHOR, - "contestName" => $config["contest"]["name"], - "contestDescription" => $config["contest"]["description"], + "contestName" => $config["app"]["title"], + "contestDescription" => $config["app"]["description"], "username" => $_SESSION["username"] ?: null, "API_TOKEN" => isset($_SESSION["apiToken"]) ? $_SESSION["apiToken"] : null, "REPO_ADDRESS" => REPO_ADDRESS, diff --git a/assets/js/config.js b/assets/js/config.js index c86c1c40..277f8598 100644 --- a/assets/js/config.js +++ b/assets/js/config.js @@ -13,9 +13,9 @@ var landingImage = $("#landingImage"); var landingImageInput = $("#landingImageInput"); var landingImageReset = $("#landingImageReset"); -var contest = { - name: $("#contest_name"), - desc: $("#contest_description") +var app = { + title: $("#contest_name"), + description: $("#contest_description") } var uploadDir = $("#uploadDir"); var time = { @@ -102,8 +102,8 @@ function update() { }, response => { let data = response.data; - contest.name.value = data.contest.name; - contest.desc.value = data.contest.description; + app.title.value = data.app.title; + app.description.value = data.app.description; uploadDir.value = data.uploadDir; time.zone.value = data.time.zone; time.beginDate.value = cvdate( @@ -291,8 +291,8 @@ $("#formContainer").addEventListener("submit", e => { url: "/api/config", method: "POST", form: { - "contest.name": contest.name.value, - "contest.description": contest.desc.value, + "app.title": app.title.value, + "app.description": app.description.value, "uploadDir": uploadDir.value, "time.zone": time.zone.value, "time.begin.seconds": bt.s, diff --git a/assets/js/core.js b/assets/js/core.js index aed8d256..7c97e9af 100644 --- a/assets/js/core.js +++ b/assets/js/core.js @@ -1431,7 +1431,7 @@ const core = { else r = await this.onUnCheckHandler(); - if (r !== false) + if (r !== "cancel") cookie.set(cookieKey, e.target.checked); else e.target.checked = !e.target.checked; @@ -1731,7 +1731,7 @@ const core = { }) if (response !== "turnOff") - return false; + return "cancel"; } if (!this.rankingUpdateToggler.checked) diff --git a/config.php b/config.php index 19194de7..760cec76 100644 --- a/config.php +++ b/config.php @@ -55,7 +55,7 @@
  • %name%: Tên dự án
  • %version%: Phiên bản
  • %author%: Tên tác giả
  • -
  • %contestName%: Tên kì thi
  • +
  • %appTitle%: Tên kì thi
  • %root%: Thư mục gốc của hệ thống
  • %currentDate%: Ngày hiện tại
  • %currentTime%: Thời gian hiện tại
  • diff --git a/data/config.json b/data/config.json index 3b0f5c59..35bfa511 100644 --- a/data/config.json +++ b/data/config.json @@ -1,6 +1,6 @@ { - "contest": { - "name": "\u00d4n T\u1eadp", + "app": { + "title": "\u00d4n T\u1eadp", "description": "B\u00e0i l\u00e0m n\u1ed9p l\u00ean \u0111\u01b0\u1ee3c ch\u1ea5m b\u1eb1ng ph\u1ea7n m\u1ec1m Themis (L\u00ea Minh Ho\u00e0ng & \u0110\u1ed7 \u0110\u1ee9c \u0110\u00f4ng)<\/a>" }, "uploadDir": "D:\\Themis\\data\\uploadDir", @@ -35,7 +35,7 @@ "time": 10, "banTime": 30 }, - "pageTitle": "%contestName%", + "pageTitle": "%appTitle%", "allowRegister": true, "clientConfig": { "sounds": false, diff --git a/data/config.php b/data/config.php index b92c13be..d02efa0d 100644 --- a/data/config.php +++ b/data/config.php @@ -30,7 +30,7 @@ "name" => APPNAME, "version" => VERSION, "author" => AUTHOR, - "contestName" => $config["contest"]["name"], + "appTitle" => $config["app"]["title"], "root" => $_SERVER["DOCUMENT_ROOT"], "currentDate" => date("d/m/Y"), "currentTime" => date("H:i:s") @@ -48,8 +48,8 @@ function applyCustomVar(&$string) { $string = $s; } - applyCustomVar($config["contest"]["name"]); - applyCustomVar($config["contest"]["description"]); + applyCustomVar($config["app"]["title"]); + applyCustomVar($config["app"]["description"]); applyCustomVar($config["uploadDir"]); applyCustomVar($config["pageTitle"]); diff --git a/index.php b/index.php index d4248397..c19e37de 100644 --- a/index.php +++ b/index.php @@ -30,7 +30,7 @@ $id = $userdata["id"]; } - $stripedContestDescription = strip_tags($config["contest"]["description"]); + $stripedContestDescription = strip_tags($config["app"]["description"]); ?> @@ -45,17 +45,17 @@ <?php print $config["pageTitle"]; ?> | <?php print APPNAME ." v". VERSION; ?> - "> + "> - "> + "> - "> + "> @@ -93,7 +93,7 @@