Esempio n. 1
0
 if (!isset($_POST['election_id']) || !$election->electionExists($_POST['election_id'])) {
     $error = 'Unknown election';
     $elections = $election->listElections();
     require PEARWEB_TEMPLATEDIR . '/election/listforedit.tpl.php';
     exit;
 }
 $election_id = (int) $_POST['election_id'];
 if (!$election->canEdit($election_id)) {
     $error = 'Cannot edit that election';
     $elections = $election->listElections();
     require PEARWEB_TEMPLATEDIR . '/election/listforedit.tpl.php';
     exit;
 }
 switch ($_POST['step']) {
     case '2':
         $error = $election->validateStep1(false);
         $info['purpose'] = $_POST['purpose'];
         $info['detail'] = $_POST['detail'];
         $info['choices'] = (int) $_POST['choices'];
         $info['year'] = (int) $_POST['year'];
         $info['month'] = $_POST['month'];
         $info['day'] = $_POST['day'];
         $info['length'] = (int) $_POST['length'];
         $info['minimum'] = (int) $_POST['minimum'];
         $info['maximum'] = (int) $_POST['maximum'];
         $info['eligiblevoters'] = (int) $_POST['eligiblevoters'];
         if ($error) {
             require PEARWEB_TEMPLATEDIR . '/election/new-step1.tpl.php';
             exit;
         }
         $info = $election->setupChoices($election_id, $info);
Esempio n. 2
0
File: new.php Progetto: stof/pearweb
} elseif ($_POST['step'] == 4) {
    if (isset($_POST['cancel'])) {
        require 'election/pear-voter.php';
        $voter = new PEAR_Voter();
        $currentelections = $voter->listCurrentElections();
        $completedelections = $voter->listCompletedElections();
        $allelections = $voter->listAllElections();
        $error = 'Election creation cancelled';
        $retrieval = false;
        $old = false;
        require PEARWEB_TEMPLATEDIR . '/election/vote.tpl.php';
        exit;
    }
    require 'election/pear-election.php';
    $election = new PEAR_Election();
    $error = $election->validateStep1();
    $info['purpose'] = $_POST['purpose'];
    $info['detail'] = $_POST['detail'];
    $info['choices'] = (int) $_POST['choices'];
    $info['year'] = (int) $_POST['year'];
    $info['month'] = $_POST['month'];
    $info['day'] = $_POST['day'];
    $info['length'] = (int) $_POST['length'];
    $info['minimum'] = (int) $_POST['minimum'];
    $info['maximum'] = (int) $_POST['maximum'];
    $info['eligiblevoters'] = (int) $_POST['eligiblevoters'];
    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';