if ($error) { // this should never happen. It will only occur // if the user manually fills POST data without going // through the official form, and makes a mistake. require PEARWEB_TEMPLATEDIR . '/election/new-step1.tpl.php'; exit; } for ($i = 1; $i <= $info['choices']; $i++) { $info['summary' . $i] = empty($_POST['summary' . $i]) ? '' : $_POST['summary' . $i]; $info['summary_link' . $i] = empty($_POST['summary_link' . $i]) ? '' : $_POST['summary_link' . $i]; } $error = $election->validateStep2(); if ($error) { // this should never happen. It will only occur // if the user manually fills POST data without going // through the official form, and makes a mistake. require PEARWEB_TEMPLATEDIR . '/election/new-step2.tpl.php'; exit; } $election->saveNewElection(); $error = ''; require 'election/pear-voter.php'; $voter = new PEAR_Voter(); $currentelections = $voter->listCurrentElections(); $completedelections = $voter->listCompletedElections(); $allelections = $voter->listAllElections(); $info = 'Election saved'; $retrieval = false; $old = false; require PEARWEB_TEMPLATEDIR . '/election/vote.tpl.php'; }