From 9a78f15ac3e65e7437220537487abeae8906d7b4 Mon Sep 17 00:00:00 2001 From: albertoleoncio Date: Wed, 27 Mar 2024 12:52:31 -0300 Subject: [PATCH] Merge branch 'bugfix/iframe-title' --- badge.php | 4 +--- bin/connect.php | 2 +- bin/edits.php | 6 +++--- bin/evaluators.php | 4 ++-- bin/graph.php | 6 +++--- bin/languages.php | 4 ++-- bin/load_edits.php | 12 ++++++------ bin/login.php | 8 ++++---- bin/manage_contests.php | 42 ++++++++++++++++++++--------------------- bin/modify.php | 2 +- bin/sidebar.php | 20 ++++++++++---------- bin/triage.php | 10 +++++----- index.php | 4 ++-- update.php | 16 ++++++++-------- 14 files changed, 69 insertions(+), 71 deletions(-) diff --git a/badge.php b/badge.php index 5c0d4a7..04e55ff 100644 --- a/badge.php +++ b/badge.php @@ -40,7 +40,7 @@ case $percentage > 75: $color = 'orange'; break; - + default: $color = 'red'; break; @@ -55,5 +55,3 @@ // Convert result to JSON and output echo json_encode($result, JSON_PRETTY_PRINT); - -?> diff --git a/bin/connect.php b/bin/connect.php index 5d4d63b..ea812ba 100644 --- a/bin/connect.php +++ b/bin/connect.php @@ -25,7 +25,7 @@ echo "Error creating database."; die(); } -} +} //Cria tabelas caso não existam mysqli_query($con, " diff --git a/bin/edits.php b/bin/edits.php index 25dd923..79db1ee 100644 --- a/bin/edits.php +++ b/bin/edits.php @@ -32,7 +32,7 @@ `{$contest['name_id']}__users` ON `{$contest['name_id']}__edits`.`user_id` = `{$contest['name_id']}__users`.`local_id` - LEFT JOIN + LEFT JOIN `{$contest['name_id']}__articles` ON `{$contest['name_id']}__edits`.`article` = `{$contest['name_id']}__articles`.`articleID`; @@ -191,8 +191,8 @@ } ?> - diff --git a/bin/evaluators.php b/bin/evaluators.php index 22c2cef..a119e2f 100644 --- a/bin/evaluators.php +++ b/bin/evaluators.php @@ -177,10 +177,10 @@
  • - - - + - $contest['start_time']) { require_once "stats.php"; - } ?> + } ?>
    diff --git a/bin/manage_contests.php b/bin/manage_contests.php index 24b9706..6de038c 100644 --- a/bin/manage_contests.php +++ b/bin/manage_contests.php @@ -232,12 +232,12 @@ function processFormData() //Valida se usuário pertence ao grupo relacionado ao concurso if (!isset($contests_array[$name_id])) die(§('manage-notfound')); if ( - $_SESSION['user']["user_group"] !== "ALL" && + $_SESSION['user']["user_group"] !== "ALL" && $_SESSION['user']["user_group"] !== $contests_array[$name_id]['group'] ) die(§('manage-unauthorized')); - $deactive_statement = - "UPDATE + $deactive_statement = + "UPDATE `{$name_id}__credentials` SET `user_status` = 'P' @@ -246,8 +246,8 @@ function processFormData() $deactive_query = mysqli_prepare($con, $deactive_statement); mysqli_stmt_execute($deactive_query); - $manager_statement = - "INSERT IGNORE INTO + $manager_statement = + "INSERT IGNORE INTO `{$name_id}__credentials` (`user_name`, `user_email`, `user_password`, `user_status`) VALUES (?,?,?,?) @@ -311,14 +311,14 @@ function processFormData() //Valida se usuário pertence ao grupo relacionado ao concurso if (!isset($contests_array[$name_id])) die(§('manage-notfound')); if ( - $_SESSION['user']["user_group"] !== "ALL" && + $_SESSION['user']["user_group"] !== "ALL" && $_SESSION['user']["user_group"] !== $contests_array[$name_id]['group'] ) die(§('manage-unauthorized')); //Reinicia concurso if (isset($_POST['do_restart'])) { - //Reinicia tabelas do concurso, mas mantem a tabela de credenciais + //Reinicia tabelas do concurso, mas mantem a tabela de credenciais mysqli_query($con, "TRUNCATE TABLE `{$name_id}__edits`;"); mysqli_query($con, "TRUNCATE TABLE `{$name_id}__users`;"); mysqli_query($con, "TRUNCATE TABLE `{$name_id}__articles`;"); @@ -358,9 +358,9 @@ function processFormData() //Prepara e executa query $update_statement = - "UPDATE + "UPDATE `manage__contests` - SET + SET `start_time` = ?, `end_time` = ?, `name` = ?, @@ -380,7 +380,7 @@ function processFormData() `max_pic_per_article` = ?, `theme` = ?, `color` = ? - WHERE + WHERE `name_id` = ?"; $update_query = mysqli_prepare($con, $update_statement); mysqli_stmt_bind_param( @@ -524,7 +524,7 @@ function managerChange(id, doChange) { $contest_info): ?>
    @@ -553,7 +553,7 @@ class="w3-input w3-border w3-margin-bottom"
    - + @@ -679,7 +679,7 @@ class="w3-select w3-border w3-margin-bottom"
    -
    diff --git a/bin/modify.php b/bin/modify.php index 4e0e1bd..7336587 100644 --- a/bin/modify.php +++ b/bin/modify.php @@ -35,7 +35,7 @@ } if (isset($_POST['overwrite'])) { $post['overwrite'] = addslashes($_POST['overwrite']); - } + } //Busca número de bytes e nome do avaliador no banco de dados $evaluated_query = mysqli_prepare( diff --git a/bin/sidebar.php b/bin/sidebar.php index fcc768f..a1806de 100644 --- a/bin/sidebar.php +++ b/bin/sidebar.php @@ -53,19 +53,19 @@ function w3_close() {
    -   -   -   -   @@ -73,11 +73,11 @@ function w3_close() { rel="noopener" class="w3-bar-item w3-button w3-padding ">   -   -   @@ -90,22 +90,22 @@ function w3_close() { ? "https://petscan.wmflabs.org/?psid={$contest['category_petscan']}" : "{$contest['endpoint']}?curid={$contest['category_pageid']}" ?>" target="_blank" rel="noopener" class="w3-bar-item w3-button w3-padding"> -   +   -   +   -   -   diff --git a/bin/triage.php b/bin/triage.php index df78e3a..eba93c7 100644 --- a/bin/triage.php +++ b/bin/triage.php @@ -440,7 +440,7 @@ function movePosition(){ var first = document.getElementById("first_column"); var third = document.getElementById("third_column"); var edits = document.getElementById("edits"); - + var windowWidth = document.documentElement.clientWidth; if(windowWidth < 601){ third.insertBefore(edits, third.firstChild); @@ -482,7 +482,7 @@ function updateTooltip() { var domReady = function(callback) { document.readyState === "interactive" || document.readyState === "complete" ? callback() : document.addEventListener("DOMContentLoaded", callback); }; - domReady(function() { + domReady(function() { movePosition(); document.getElementById("text-container").addEventListener("mouseup", updateTooltip); }); @@ -540,7 +540,7 @@ class="w3-button w3-border-purple w3-purple w3-border w3-block w3-small"

    -

    @@ -772,7 +772,7 @@ class="diff diff-mobile diff-contentalign-left diff-editfont-monospace w3-hide-l
    -

    @@ -833,7 +833,7 @@ class="diff diff-mobile diff-contentalign-left diff-editfont-monospace w3-hide-l


    - ×

    -
    diff --git a/update.php b/update.php index 16dc6ce..8bddf3d 100644 --- a/update.php +++ b/update.php @@ -2,8 +2,8 @@ set_time_limit(1790); //Atualiza traduções -if (isset($_SERVER['HTTP_X_GITHUB_EVENT'])) { - $output = `bash git.sh`; +if (isset($_SERVER['HTTP_X_GITHUB_EVENT'])) { + $output = `bash git.sh`; echo $output; exit(); } @@ -18,20 +18,20 @@ FROM `manage__contests` WHERE - + -- Concurso já começou `start_time` < NOW() -- Não há registro de atualização iniciada (nunca houve ou foi apagado) ou -- A última atualização foi há mais de 10 minutos - AND ( + AND ( `started_update` IS NULL OR `started_update` + INTERVAL 10 MINUTE < NOW() - ) - + ) + -- Não há agendamento de próxima atualização (nunca houve ou foi apagado) ou - AND ( - `next_update` IS NULL + AND ( + `next_update` IS NULL -- Concurso ainda não terminou, não está em atualização e o prazo de atualização foi atingido OR (