From 98018de54167f9da55badabb577eb0f339209996 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ Date: Sun, 4 Jan 2015 18:49:57 +0100 Subject: [PATCH] Fix some things after cherry-picking --- app/classes/Framadate/FramaDB.php | 2 +- choix_autre.php | 4 +++- choix_date.php | 7 ++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/app/classes/Framadate/FramaDB.php b/app/classes/Framadate/FramaDB.php index 8c15772..35797d1 100644 --- a/app/classes/Framadate/FramaDB.php +++ b/app/classes/Framadate/FramaDB.php @@ -268,7 +268,7 @@ class FramaDB { * @return array Array of old polls */ public function findOldPolls() { - $prepared = $this->prepare('SELECT * FROM ' . Utils::table('poll') . ' WHERE end_date < NOW() AND date_fin != 0 LIMIT 20'); + $prepared = $this->prepare('SELECT * FROM ' . Utils::table('poll') . ' WHERE end_date < NOW() AND end_date != 0 LIMIT 20'); $prepared->execute([]); return $prepared->fetchAll(); diff --git a/choix_autre.php b/choix_autre.php index 11e693f..586bc52 100644 --- a/choix_autre.php +++ b/choix_autre.php @@ -53,6 +53,8 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( bandeau_pied(); } else { + $min_time = time() + 86400; + $max_time = time() + (86400 * $config['default_poll_duration']); // Step 4 : Data prepare before insert in DB if (isset($_POST['confirmecreation'])) { @@ -174,7 +176,7 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( } $summary .= ''; - $end_date_str = utf8_encode(strftime('%d/%m/%Y', $_SESSION['form']->end_date)); //textual date + $end_date_str = utf8_encode(strftime('%d/%m/%Y', $max_time)); //textual date echo '
diff --git a/choix_date.php b/choix_date.php index aa9d7ca..9c0ae49 100644 --- a/choix_date.php +++ b/choix_date.php @@ -54,13 +54,14 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || bandeau_pied(); } else { + $min_time = time() + 86400; + $max_time = time() + (86400 * $config['default_poll_duration']); + // Step 4 : Data prepare before insert in DB if (!empty($_POST['confirmation'])) { // Define expiration date $enddate = filter_input(INPUT_POST, 'enddate', FILTER_VALIDATE_REGEXP, ['options' => ['regexp' => '#^[0-9]{2}/[0-9]{2}/[0-9]{4}$#']]); - $min_time = time() + (24 * 60 * 60); - $max_time = time() + (86400 * $config['default_poll_duration']); if (!empty($enddate)) { $registredate = explode('/', $enddate); @@ -172,7 +173,7 @@ if (!isset($_SESSION['form']->title) || !isset($_SESSION['form']->admin_name) || } $summary .= ''; - $end_date_str = utf8_encode(strftime('%d/%m/%Y', $_SESSION['form']->end_date)); //textual date + $end_date_str = utf8_encode(strftime('%d/%m/%Y', $max_time)); //textual date echo '