コード例 #1
0
ファイル: index.php プロジェクト: Alm001/form
    return;
}
$f = new form\Form((int) $id);
if ($f->error) {
    // form not found
    @error_log('form not found');
    return;
}
if ($f->submit()) {
    // handle form submission
    // unset csrf prevention token
    unset($_POST['_token_']);
    // save the results
    $r = new form\Results(array('form_id' => $id, 'ts' => gmdate('Y-m-d H:i:s'), 'ip' => $_SERVER['REMOTE_ADDR']));
    $r->results = $_POST;
    $r->put();
    // call any custom hooks
    $this->hook('form/submitted', array('form' => $id, 'values' => $_POST));
    foreach ($_POST as $k => $v) {
        if (is_array($v)) {
            $_POST[$k] = join(', ', $v);
        }
    }
    // if there's a redirect, we wait to exit after
    // all actions have been performed.
    $has_redirect = false;
    foreach ($f->actions as $action) {
        // handle action
        switch ($action->type) {
            case 'email':
                $reply_to = false;