Fix some things after cherry-picking

This commit is contained in:
Olivier PEREZ 2015-01-04 18:49:57 +01:00
parent f71326f496
commit 98018de541
3 changed files with 8 additions and 5 deletions

View File

@ -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();

View File

@ -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 .= '</ol>';
$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 '
<form name="formulaire" action="' . Utils::get_server_name() . 'choix_autre.php" method="POST" class="form-horizontal" role="form">

View File

@ -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 .= '</ul>';
$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 '
<form name="formulaire" action="' . Utils::get_server_name() . 'choix_date.php" method="POST" class="form-horizontal" role="form">