Exemplo n.º 1
0
$author = new nlb_user($db, $blog_data['author_id']);
if (!empty($_POST)) {
    /**
     *		Check submited data
     */
    $text->validate();
    $text->makeClean('trim', 'slash_if_needed');
    $c = $text->clean;
    if ($text->is_missing_required) {
        $baddata = true;
    } else {
        // delete the blog?
        if ($c['delete'] == 'x') {
            $db->query('DELETE FROM ' . db_blogs . ' WHERE blog_id=' . $blog_id . ' LIMIT 1;');
            $author->recountBlogs();
            $author->updatedb();
            $ets->page_body = $l['item-deleted'];
        } else {
            // deal with options.
            $c['bb'] = empty($c['bb']) ? 1 : 0;
            $c['html'] = empty($c['html']) ? 1 : 0;
            $c['smiles'] = empty($c['smiles']) ? 1 : 0;
            // anti bad html
            badHtmlSecond($c['body']);
            // make the updates
            $update = new nlb_blog($db);
            $update->fetchFromDB($blog_id);
            foreach (array('subject', 'custom', 'body', 'mood', 'bb', 'html', 'smiles') as $item) {
                $update->setItem($item, $c[$item]);
            }
            // deal with comments.