'; - - global $connect; - $tables = $connect->allTables(); - $diff = array_diff([Utils::table('comment'), Utils::table('poll'), Utils::table('slot'), Utils::table('vote')], $tables); - if (0 !== count($diff)) { - echo '
' . __('Error', 'Framadate is not properly installed, please check the "INSTALL" to setup the database before continuing.') . '
'; - bandeau_pied(); - die(); - } } function liste_lang() diff --git a/create_classic_poll.php b/create_classic_poll.php index 8318894..93eac08 100644 --- a/create_classic_poll.php +++ b/create_classic_poll.php @@ -51,8 +51,12 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( $min_expiry_time = $pollService->minExpiryDate(); $max_expiry_time = $pollService->maxExpiryDate(); - // The poll format is AUTRE (other) - if ($_SESSION['form']->format !== 'A') { + // The poll format is other (A) if we are in this file + if (!isset($_SESSION['form'])) { + $_SESSION['form']->format = 'A'; + } + // If we come from another format, we need to clear choices + if (isset($_SESSION['form']->format) && $_SESSION['form']->format !== 'A') { $_SESSION['form']->format = 'A'; $_SESSION['form']->clearChoices(); } @@ -111,7 +115,7 @@ if (empty($_SESSION['form']->title) || empty($_SESSION['form']->admin_name) || ( // creation message $sessionService->set("Framadate", "messagePollCreated", TRUE); - + // Redirect to poll administration header('Location:' . Utils::getUrlSondage($admin_poll_id, true)); exit; diff --git a/create_date_poll.php b/create_date_poll.php index 8d9eb91..7cc3aec 100644 --- a/create_date_poll.php +++ b/create_date_poll.php @@ -44,8 +44,12 @@ if (is_readable('bandeaux_local.php')) { $min_expiry_time = $pollService->minExpiryDate(); $max_expiry_time = $pollService->maxExpiryDate(); -// The poll format is DATE -if (isset($_SESSION['form']->format) && ($_SESSION['form']->format !== 'D')) { +// The poll format is DATE if we are in this file +if (!isset($_SESSION['form'])) { + $_SESSION['form']->format = 'D'; +} +// If we come from another format, we need to clear choices +if (isset($_SESSION['form']->format) && $_SESSION['form']->format !== 'D') { $_SESSION['form']->format = 'D'; $_SESSION['form']->clearChoices(); } @@ -73,6 +77,7 @@ switch ($step) { // Prefill form->choices foreach ($_SESSION['form']->getChoices() as $c) { + /** @var Choice $c */ $count = 3 - count($c->getSlots()); for ($i = 0; $i < $count; $i++) { $c->addSlot(''); @@ -136,7 +141,7 @@ switch ($step) { if (!empty($day)) { // Add choice to Form data $date = DateTime::createFromFormat(__('Date', 'datetime_parseformat'), $_POST['days'][$i])->setTime(0, 0, 0); - $time = $date->getTimestamp(); + $time = (string) $date->getTimestamp(); $choice = new Choice($time); $_SESSION['form']->addChoice($choice); @@ -155,6 +160,7 @@ switch ($step) { $summary = '