$ets_outter->page_title = $l['title-editblog']; 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 { // deal with options. $c['bb'] = empty($c['bb']) ? 1 : 0; $c['html'] = empty($c['html']) ? 1 : 0; $c['smiles'] = empty($c['smiles']) ? 1 : 0; badHtmlSecond($c['body']); // make the updates $update = new nlb_blog($db); $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
$text = new text($_POST, array('subject', 'body')); $text->validate(); $text->makeClean('slash_if_needed', 'trim'); $baddata = false; $problems = array(); $ets->page_body = ''; $ets_outter->main_title = $config->get('site_name') . ": " . $l['title-art-edit']; $ets_outter->page_title = $l['title-art-edit']; if (!empty($_POST)) { // check data if ($text->is_missing_required) { $baddata = true; } else { $subject = $text->clean['subject']; $body = $text->clean['body']; badHtmlSecond($body); $db->query('UPDATE ' . db_articles . ' SET subject="' . $subject . '", body="' . $body . '" where article_id="' . $_GET['id'] . '" LIMIT 1;'); $ets->page_body .= $l['goodedit']; } } if (empty($_POST) || $baddata) { if ($baddata) { // the only thing that can go wrong is missing fields. $ets->page_body .= '<div class="error">'; foreach ($text->missing_fields as $f) { $ets->page_body .= '<li>' . $l['missing-field'] . $f . '</li>'; } $ets->page_body .= '</div>';
* Check submited data */ $text->validate(); $text->makeClean('trim', 'slash_if_needed'); $c = $text->clean; if ($text->is_missing_required) { $baddata = true; } else { /** * U P D A T E I T E M */ // deal with options. $bb = empty($c['bb']) ? 1 : 0; $html = empty($c['html']) ? 1 : 0; $smiles = empty($c['smiles']) ? 1 : 0; badHtmlSecond($c['subject']); $update = new nlb_blog($db); $update->fetchFromDB($_GET['id']); $update->setItem("subject", $c['subject']); $update->setItem("body", $c['body']); $update->setItem("bb", $bb); $update->setItem("html", $html); $update->setItem("smiles", $smiles); if (empty($c['comments'])) { $update->recountComments(); } else { $update->setItem("comments", -1); } $update->updateToDB(); $ets->page_body = $l['goodedit']; }
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? if ($comment['author_id'] != -1) { $get = $db->getArray('SELECT username FROM ' . db_users . ' WHERE user_id=' . $comment['author_id'] . ' LIMIT 1;'); $username = $get['username']; // anti html pass 1