titre) || empty($_SESSION['form']->nom) || (($config['use_smtp']) ? empty($_SESSION['form']->adresse) : false)) { Utils::print_header ( _("Error!") ); bandeau_titre(_("Error!")); echo '

' . _('You haven\'t filled the first section of the poll creation.') . ' !

' . _('Back to the homepage of') . ' ' . NOMAPPLICATION . '

'."\n"; bandeau_pied(); } else { // Step 4 : Data prepare before insert in DB if (isset($_POST['confirmecreation'])) { $registredate = explode('/', $_POST['champdatefin']); if (is_array($registredate) == true && count($registredate) == 3) { $time = mktime(0,0,0,$registredate[1],$registredate[0],$registredate[2]); if ($time > time() + (24*60*60)) { $_SESSION['form']->champdatefin = $time; } } // format du sondage AUTRE $_SESSION['form']->formatsondage = 'A'; // Insert poll in database $admin_poll_id = ajouter_sondage( $_SESSION['form']->titre, $_SESSION['form']->commentaires, $_SESSION['form']->nom, $_SESSION['form']->adresse, $_SESSION['form']->formatsondage, $_SESSION['form']->editable, $_SESSION['form']->champdatefin, $_SESSION['form']->receiveNewVotes, $_SESSION['form']->getChoices() ); // Clean Form data in $_SESSION unset($_SESSION['form']); // Delete old polls Utils::cleaningOldPolls($connect, 'admin/logs_studs.txt'); // Redirect to poll administration header('Location:' . Utils::getUrlSondage($admin_poll_id, true)); exit; } // Step 3/4 : Confirm poll creation and choose a removal date else if (isset($_POST['fin_sondage_autre'])) { Utils::print_header ( _('Removal date and confirmation (3 on 3)') ); bandeau_titre(_('Removal date and confirmation (3 on 3)')); // Store choices in $_SESSION if (isset($_POST['choices'])) { $_SESSION['form']->clearChoices(); foreach ($_POST['choices'] as $c) { if (!empty($c)) { $choice = new Choice(htmlentities(html_entity_decode($c, ENT_QUOTES, 'UTF-8'), ENT_QUOTES, 'UTF-8')); $_SESSION['form']->addChoice($choice); } } } // Expiration date is initialised with config parameter. Value will be modified in step 4 if user has defined an other date $_SESSION['form']->champdatefin = time() + (86400 * $config['default_poll_duration']); //60 sec * 60 min * 24 hours * config // Summary $summary = '
    '; foreach ($_SESSION['form']->getChoices() as $choice) { preg_match_all('/\[!\[(.*?)\]\((.*?)\)\]\((.*?)\)/', $choice->getName(), $md_a_img); // Markdown [![alt](src)](href) preg_match_all('/!\[(.*?)\]\((.*?)\)/', $choice->getName(), $md_img); // Markdown ![alt](src) preg_match_all('/\[(.*?)\]\((.*?)\)/', $choice->getName(), $md_a); // Markdown [text](href) if (isset($md_a_img[2][0]) && $md_a_img[2][0]!='' && isset($md_a_img[3][0]) && $md_a_img[3][0]!='') { // [![alt](src)](href) $li_subject_text = (isset($md_a_img[1][0]) && $md_a_img[1][0]!='') ? stripslashes($md_a_img[1][0]) : _("Choice") .' '.($i+1); $li_subject_html = ''.$li_subject_text.''; } elseif (isset($md_img[2][0]) && $md_img[2][0]!='') { // ![alt](src) $li_subject_text = (isset($md_img[1][0]) && $md_img[1][0]!='') ? stripslashes($md_img[1][0]) : _("Choice") .' '.($i+1); $li_subject_html = ''.$li_subject_text.''; } elseif (isset($md_a[2][0]) && $md_a[2][0]!='') { // [text](href) $li_subject_text = (isset($md_a[1][0]) && $md_a[1][0]!='') ? stripslashes($md_a[1][0]) : _("Choice") .' '.($i+1); $li_subject_html = ''.$li_subject_text.''; } else { // text only $li_subject_text = stripslashes($choice->getName()); $li_subject_html = $li_subject_text; } $summary .= '
  1. '.$li_subject_html.'
  2. '."\n"; } $summary .= '
'; $end_date_str = utf8_encode(strftime('%d/%M/%Y', $_SESSION['form']->champdatefin));//textual date echo '

'. _("List of your choices").'

'. $summary .'

' . _('Your poll will be automatically removed after'). ' ' . $config['default_poll_duration'] . ' ' . _('days') . '.
' . _("You can fix another removal date for it.") .'

'. _("(dd/mm/yyyy)") .'

'. _("Once you have confirmed the creation of your poll, you will be automatically redirected on the administration page of your poll."). '

'; if($config['use_smtp']==true){ echo '

' . _("Then, you will receive quickly two emails: one contening the link of your poll for sending it to the voters, the other contening the link to the administration page of your poll.") .'

'; } echo '

'."\n"; bandeau_pied(); // Step 2/4 : Select choices of the poll } else { Utils::print_header( _('Poll subjects (2 on 3)')); bandeau_titre(_('Poll subjects (2 on 3)')); echo '
'; echo '

'. _("To make a generic poll you need to propose at least two choices between differents subjects.") .'

'. _("You can add or remove additional choices with the buttons") .' '. _("Remove") .' '. _("Add") .'

'; if($config['user_can_add_img_or_link']){ echo '

'. _("It's possible to propose links or images by using "). ''. _("the Markdown syntax") .'.

'; } echo '
'."\n"; // Fields choices : 5 by default $choices = $_SESSION['form']->getChoices(); $nb_choices = max(count($choices), 5); for ($i = 0; $i < $nb_choices; $i++) { $choice = isset($choices[$i]) ? $choices[$i] : new Choice(); echo '
'; if($config['user_can_add_img_or_link']){ echo ' '; } echo '
'."\n"; } echo '
'. _('Back') . '
'."\n"; bandeau_pied(); } }