mirror of
https://gitlab.com/animath/si/plateforme-corres2math.git
synced 2025-06-24 18:20:30 +02:00
Nombreuses petites corrections, ajout de texte.
Les Correspondances peuvent démarrer :)
This commit is contained in:
@ -43,27 +43,32 @@ class Config
|
||||
|
||||
public function initDB()
|
||||
{
|
||||
global $DB, $LOCAL_PATH;
|
||||
global $DB, $LOCAL_PATH, $YEAR;
|
||||
|
||||
$index_template_page = htmlspecialchars(file_get_contents($LOCAL_PATH . "/server_files/views/index.html"));
|
||||
|
||||
$DB->exec("SET GLOBAL time_zone = 'Europe/Paris';");
|
||||
$DB->prepare("INSERT IGNORE INTO `config` VALUES ('inscription_date', CURRENT_TIMESTAMP + INTERVAL 2 DAY),
|
||||
('start_phase1_date', CURRENT_TIMESTAMP + INTERVAL 1 DAY), ('end_phase1_date', CURRENT_TIMESTAMP + INTERVAL 3 DAY),
|
||||
('start_phase2_date', CURRENT_TIMESTAMP + INTERVAL 4 DAY), ('end_phase2_date', CURRENT_TIMESTAMP + INTERVAL 5 DAY),
|
||||
('start_phase3_date', CURRENT_TIMESTAMP + INTERVAL 6 DAY), ('end_phase3_date', CURRENT_TIMESTAMP + INTERVAL 7 DAY),
|
||||
('start_phase4_date', CURRENT_TIMESTAMP + INTERVAL 8 DAY), ('end_phase4_date', CURRENT_TIMESTAMP + INTERVAL 9 DAY),
|
||||
('index_page', ?);")->execute([$index_template_page]);
|
||||
$DB->prepare("INSERT IGNORE INTO `config`(`key`, `value`)
|
||||
VALUES ('inscription_date_$YEAR', CURRENT_TIMESTAMP + INTERVAL 2 DAY),
|
||||
('start_phase1_date_$YEAR', CURRENT_TIMESTAMP + INTERVAL 1 DAY),
|
||||
('end_phase1_date_$YEAR', CURRENT_TIMESTAMP + INTERVAL 3 DAY),
|
||||
('start_phase2_date_$YEAR', CURRENT_TIMESTAMP + INTERVAL 4 DAY),
|
||||
('end_phase2_date_$YEAR', CURRENT_TIMESTAMP + INTERVAL 5 DAY),
|
||||
('start_phase3_date_$YEAR', CURRENT_TIMESTAMP + INTERVAL 6 DAY),
|
||||
('end_phase3_date_$YEAR', CURRENT_TIMESTAMP + INTERVAL 7 DAY),
|
||||
('start_phase4_date_$YEAR', CURRENT_TIMESTAMP + INTERVAL 8 DAY),
|
||||
('end_phase4_date_$YEAR', CURRENT_TIMESTAMP + INTERVAL 9 DAY),
|
||||
('index_page_$YEAR', ?);")->execute([$index_template_page]);
|
||||
}
|
||||
|
||||
public function loadConfigValues()
|
||||
{
|
||||
global $DB;
|
||||
global $DB, $YEAR;
|
||||
|
||||
$req = $DB->query("SELECT * FROM `config`;");
|
||||
$req = $DB->query("SELECT * FROM `config` WHERE `key` REGEXP '$YEAR';");
|
||||
|
||||
while (($data = $req->fetch()) !== false) {
|
||||
$key = $data["key"];
|
||||
$key = substr($data["key"], 0, -5);
|
||||
$this->$key = $data["value"];
|
||||
}
|
||||
}
|
||||
@ -75,8 +80,8 @@ class Config
|
||||
|
||||
public function setInscriptionDate($inscription_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$inscription_date' WHERE `key` = 'inscription_date';");
|
||||
global $DB, $YEAR;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$inscription_date' WHERE `key` = 'inscription_date_$YEAR'");
|
||||
|
||||
$this->inscription_date = $inscription_date;
|
||||
}
|
||||
@ -88,8 +93,8 @@ class Config
|
||||
|
||||
public function setStartPhase1Date($start_phase1_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase1_date' WHERE `key` = 'start_phase1_date';");
|
||||
global $DB, $YEAR;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase1_date' WHERE `key` = 'start_phase1_date_$YEAR'");
|
||||
|
||||
$this->start_phase1_date = $start_phase1_date;
|
||||
}
|
||||
@ -101,8 +106,8 @@ class Config
|
||||
|
||||
public function setEndPhase1Date($end_phase1_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase1_date' WHERE `key` = 'end_phase1_date';");
|
||||
global $DB, $YEAR;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase1_date' WHERE `key` = 'end_phase1_date_$YEAR'");
|
||||
|
||||
$this->end_phase1_date = $end_phase1_date;
|
||||
}
|
||||
@ -114,8 +119,8 @@ class Config
|
||||
|
||||
public function setStartPhase2Date($start_phase2_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase2_date' WHERE `key` = 'start_phase2_date';");
|
||||
global $DB, $YEAR;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase2_date' WHERE `key` = 'start_phase2_date_$YEAR'");
|
||||
|
||||
$this->start_phase2_date = $start_phase2_date;
|
||||
}
|
||||
@ -127,8 +132,8 @@ class Config
|
||||
|
||||
public function setEndPhase2Date($end_phase2_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase2_date' WHERE `key` = 'end_phase2_date';");
|
||||
global $DB, $YEAR;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase2_date' WHERE `key` = 'end_phase2_date_$YEAR'");
|
||||
|
||||
$this->end_phase2_date = $end_phase2_date;
|
||||
}
|
||||
@ -140,8 +145,8 @@ class Config
|
||||
|
||||
public function setStartPhase3Date($start_phase3_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase3_date' WHERE `key` = 'start_phase3_date';");
|
||||
global $DB, $YEAR;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase3_date' WHERE `key` = 'start_phase3_date_$YEAR'");
|
||||
|
||||
$this->start_phase3_date = $start_phase3_date;
|
||||
}
|
||||
@ -153,8 +158,8 @@ class Config
|
||||
|
||||
public function setEndPhase3Date($end_phase3_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase3_date' WHERE `key` = 'end_phase3_date';");
|
||||
global $DB, $YEAR;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase3_date' WHERE `key` = 'end_phase3_date_$YEAR'");
|
||||
|
||||
$this->end_phase3_date = $end_phase3_date;
|
||||
}
|
||||
@ -166,8 +171,8 @@ class Config
|
||||
|
||||
public function setStartPhase4Date($start_phase4_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase4_date' WHERE `key` = 'start_phase4_date';");
|
||||
global $DB, $YEAR;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$start_phase4_date' WHERE `key` = 'start_phase4_date_$YEAR'");
|
||||
|
||||
$this->start_phase4_date = $start_phase4_date;
|
||||
}
|
||||
@ -179,8 +184,8 @@ class Config
|
||||
|
||||
public function setEndPhase4Date($end_phase4_date)
|
||||
{
|
||||
global $DB;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase4_date' WHERE `key` = 'end_phase4_date';");
|
||||
global $DB, $YEAR;
|
||||
$DB->exec("UPDATE `config` SET `value` = '$end_phase4_date' WHERE `key` = 'end_phase4_date_$YEAR'");
|
||||
|
||||
$this->end_phase4_date = $end_phase4_date;
|
||||
}
|
||||
@ -192,8 +197,8 @@ class Config
|
||||
|
||||
public function setIndexPage($index_page)
|
||||
{
|
||||
global $DB;
|
||||
$DB->prepare("UPDATE `config` SET `value` = ? WHERE `key` = 'index_page';")->execute([$index_page]);
|
||||
global $DB, $YEAR;
|
||||
$DB->prepare("UPDATE `config` SET `value` = ? WHERE `key` = 'index_page_$YEAR'")->execute([$index_page]);
|
||||
|
||||
$this->index_page = $index_page;
|
||||
}
|
||||
|
Reference in New Issue
Block a user