if (!empty($config['_mandatory'])) {
    if (ereg(',', $config['_mandatory'])) {
        $amkeys = split(',', $config['_mandatory']);
        foreach ($amkeys as $mkey) {
            if (!isset($store[$mkey])) {
                $store[$mkey] = "__ERROR__ ";
                ++$missing;
            }
        }
    } elseif (!isset($store[$config['_mandatory']])) {
        $store[$config['_mandatory']] = "__ERROR__ ";
        ++$missing;
    }
}
if ($missing || isset($_cancel)) {
    write_errors($config['_html_return'], $store);
    // show confirm page
} elseif (!empty($config['_html_confirm'])) {
    parse_html($config['_html_confirm'], $store);
    // perform all actions
} else {
    if ($config['_mail_to']) {
        write_mail();
    }
    if ($config['_save_csv']) {
        write_csv($config['_csv_directory'] . '/' . $config['_save_csv'] . '.csv');
    }
    if ($config['_save_database']) {
        write_database($config['_save_database']);
    }
    if ($config['_mail_confirm']) {
Пример #2
0
}
if (!isset($_POST['content']) || strlen($_POST['content']) <= 0) {
    $errors[] = "You did not enter any content for your post.";
}
if (strlen($_POST['content']) > 3000) {
    $errors[] = "The content of your post must be less than 3,000 characters.";
}
$postContent = $_POST['content'];
$postID = $_POST['postID'];
$post = get_post($postID);
// Make sure the user has sufficient permissions to post
if (!$user_canpost or $post['user'] != $_SESSION['user']['id']) {
    $errors[] = "You do not have sufficient permissions to edit this posts.";
}
if (!inError()) {
    if (update_post_content($postID, $postContent)) {
        echo "Your post was edited successfully! \n";
        echo "<a href=\"viewpost.php?postid={$postID}\">Go back to post.</a>\n";
    } else {
        $errors[] = "There was an unknown error adding your post";
        echo "ERROR: add_post(" . $user_id . ", " . $_POST['title'] . ", " . $_POST['content'] . ", " . $_POST['tags'] . ")";
    }
}
if (inError()) {
    echo "<p>There were some problems with your form. Please go back and try again.</p><br /><br />";
    // Display error messages
    // TODO: change to error handler function
    write_errors($errors);
    // lives in lib/errormanagement.php
}
require_once "footer.php";