Exemple #1
0
 // 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.
     if (empty($c['comments'])) {
         // comments are allowed
         $update->recountComments();
     } else {
         // no comments
         $update->setItem('comments', -1);
     }
     // deal with blog count
     $author->recountBlogs();
     // set it in stone
     $update->updateToDB();
Exemple #2
0
  *		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
     $user->recountBlogs();
     // set it in stone
     $update->updateToDB();
$ets_outter->main_title = $config->get('site_name') . ": " . $l['title-editcomment'];
$ets_outter->page_title = $l['title-editcomment'];
$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>';