Ejemplo n.º 1
0
    $edate = mktime($_POST['endstunde'], $_POST['endmin'], 0, $_POST['endmonat'], $_POST['endtag'], $_POST['endjahr']);
    $_POST['type'] = $_POST['type'] == 1 ? 1 : 0;
    // Insert poll into DB
    $stmt = $FD->db()->conn()->prepare('INSERT INTO ' . $FD->db()->getPrefix() . "poll (poll_quest, poll_start, poll_end, poll_type)\n                 VALUES (?,\n                         '{$adate}',\n                         '{$edate}',\n                         '" . $_POST['type'] . "')");
    $stmt->execute(array($_POST['frage']));
    // Insert answers into DB
    $stmt = $FD->db()->conn()->prepare('SELECT poll_id FROM ' . $FD->db()->getPrefix() . 'poll WHERE poll_quest = ?');
    $stmt->execute(array($_POST['frage']));
    $id = $stmt->fetchColumn();
    $stmt = $FD->db()->conn()->prepare('INSERT INTO ' . $FD->db()->getPrefix() . "poll_answers (poll_id, answer)\n                   VALUES ('{$id}', ?)");
    for ($i = 0; $i < count($_POST['ant']); $i++) {
        if (!emptystr($_POST['ant'][$i])) {
            $stmt->execute(array($_POST['ant'][$i]));
        }
    }
    systext('Umfrage wurde hinzugef&uuml;gt');
    unset($_POST);
}
/////////////////////
///// Poll Form /////
/////////////////////
if (true) {
    if (isset($_POST['sended']) && !isset($_POST['add_answers'])) {
        echo get_systext($FD->text("admin", "changes_not_saved") . '<br>' . $FD->text("admin", "form_not_filled"), $FD->text("admin", "error"), 'red', $FD->text("admin", "icon_save_error"));
    }
    //time array for "Now" Button
    $jetzt['tag'] = date('d');
    $jetzt['monat'] = date('m');
    $jetzt['jahr'] = date('Y');
    $jetzt['stunde'] = date('H');
    $jetzt['minute'] = date('i');
Ejemplo n.º 2
0
    try {
        $FD->saveConfig('polls', $data);
        systext($FD->text('admin', 'config_saved'), $FD->text('admin', 'info'), 'green', $FD->text('admin', 'icon_save_ok'));
    } catch (Exception $e) {
        systext($FD->text('admin', 'config_not_saved') . '<br>' . (DEBUG ? $e->getMessage() : $FD->text('admin', 'unknown_error')), $FD->text('admin', 'error'), 'red', $FD->text('admin', 'icon_save_error'));
    }
    // Unset Vars
    unset($_POST);
}
/////////////////////////////////
////// Konfiguration Form ///////
/////////////////////////////////
if (true) {
    // Display Error Messages
    if (isset($_POST['sended'])) {
        systext($FD->text('admin', 'changes_not_saved') . '<br>' . $FD->text('admin', 'form_not_filled'), $FD->text('admin', 'error'), 'red', $FD->text('admin', 'icon_save_error'));
        // Load Data from DB into Post
    } else {
        $FD->loadConfig('polls');
        $data = $FD->configObject('polls')->getConfigArray();
        putintopost($data);
    }
    // security functions
    $_POST = array_map('killhtml', $_POST);
    echo '
                    <form action="" method="post">
                        <input type="hidden" value="poll_config" name="go">
                        <input type="hidden" value="1" name="sended">
                        <table class="content" cellpadding="3" cellspacing="0">
                            <tr><td colspan="2"><h3>Einstellungen</h3><hr></td></tr>
                            <tr>
Ejemplo n.º 3
0
            }
            if (!emptystr($_POST['ant'][$i])) {
                if (!$_POST['id'][$i] && $_POST['ant'][$i]) {
                    $stmt = $FD->db()->conn()->prepare('INSERT INTO ' . $FD->db()->getPrefix() . "poll_answers (poll_id, answer, answer_count)\n                                 VALUES (?,\n                                         ?,\n                                         ?)");
                    $stmt->execute(array($_POST['editpollid'], $_POST['ant'][$i], $_POST['count'][$i]));
                } else {
                    $stmt = $FD->db()->conn()->prepare('UPDATE ' . $FD->db()->getPrefix() . 'poll_answers
                               SET answer       = ?,
                                   answer_count = ?
                               WHERE answer_id = ?');
                    $stmt->execute(array($_POST['ant'][$i], $_POST['count'][$i], $_POST['id'][$i]));
                }
            }
        }
    }
    systext('Umfrage wurde aktualisiert');
    unset($_POST);
}
///////////////////////
////// Edit Poll //////
///////////////////////
if (isset($_POST['pollid'])) {
    $_POST['pollid'] = $_POST['pollid'][0];
    if (isset($_POST['sended']) && !isset($_POST['add_answers'])) {
        echo get_systext($FD->text('admin', 'changes_not_saved') . '<br>' . $FD->text('admin', 'form_not_filled'), $FD->text('admin', 'error'), 'red', $FD->text('admin', 'icon_save_error'));
    }
    //Time Array for "Now" Button
    $jetzt['tag'] = date('d');
    $jetzt['monat'] = date('m');
    $jetzt['jahr'] = date('Y');
    $jetzt['stunde'] = date('H');