$update->fetchFromDB($_GET['id']); foreach (array('subject', 'custom', 'body', 'bb', 'html', 'smiles', 'access') as $item) { $update->setItem($item, $c[$item]); } // deal with comments. if (empty($c['comments'])) { // comments are allowed $update->recountComments(); } else { // no comments $update->setItem('comments', -1); } // deal with blog count $user->recountBlogs(); // set it in stone $update->updateToDB(); $user->updateDB(); $ets->page_body = $l['goodedit']; } } if (empty($_POST) || $baddata) { /** * Build input */ // check for problems. if (!empty($_POST) && $text->is_missing_required) { $baddata = true; foreach ($text->missing_fields as $miss) { $problems[] = $l['missing-field'] . $miss; } }
$text = new text($_POST, array('body'), array('delete')); $missing = false; if (!empty($_POST)) { $text->validate(); if ($text->is_missing_required) { $missing = true; } else { $text->makeClean('trim', 'slash_if_needed'); $clean = $text->clean; if ($clean['delete'] == 'x') { // remove comment $db->query('DELETE FROM ' . db_comments . ' WHERE comment_id="' . $comment_id . '" LIMIT 1;'); $updatecount = new nlb_blog($db); $updatecount->fetchFromDB($comment['parent_id']); $updatecount->recountComments(); $updatecount->updateToDB(); $ets->page_body .= $l['acp-com-deleted']; } else { // just update the comment badHtmlSecond($clean['body']); $db->query('UPDATE ' . db_comments . ' SET body="' . $clean['body'] . '" WHERE comment_id="' . $comment_id . '" LIMIT 1;'); $ets->page_body .= $l['goodedit']; } } } if (empty($_POST) || $missing) { if ($missing) { $ets->page_body = '<div class="error">' . $l['data-problems'] . "\n"; $ets->page_body .= '<li>' . $l['all-fields-required'] . '</li></div>'; } // get username?