function articlecommentsdelete($article) { $commentsclass = new CommentStorage('comments'); if (!is_array($article)) { $commentsclass->deleteall($article); return true; } else { foreach ($article as $null => $thisid) { $commentsclass->deleteall($thisid); } return true; } }
$commentline = explode("|>|", $commentline); $articleid = $commentline[0]; if (array_key_exists($articleid, $allarticles)) { $comments = explode("||", $commentline[1]); foreach ($comments as $null => $comment) { unset($email); unset($url); $comment = explode("|", $comment); if ($comment[0] != "") { if ($comment[2] != "none") { if ($comment[2] != "" and preg_match("/^[\\.A-z0-9_\\-]+[@][A-z0-9_\\-]+([.][A-z0-9_\\-]+)+[A-z]{1,4}\$/", $comment[2])) { $email = $comment[2]; } else { $url = $comment[2]; } } $knifedb[$articleid][$comment[0]] = array("parentcid" => "", "name" => $comment[1], "email" => $email, "url" => $url, "ip" => $comment[3], "browser" => "", "content" => $comment[4]); } } } } echo "<pre>"; print_r($knifedb); echo "</pre>"; $dataclass = new CommentStorage('comments'); # load a knife article class $dataclass->settings = $knifedb; # overwrite the knife db with our db $dataclass->save(); # save it all # FINISHED
$null = $Userclass->verify(); if ($Userclass->username) { $_POST[comment][name] = $match[name]; # No error, we're good to go } else { $errors .= $userverifymessage; } } else { $errors .= $userverifymessage; } } } if (!$errors) { $newcommentid = time(); $savecomment = array('parentcid' => stripslashes($_GET[replyto]), 'name' => stripslashes($_POST[comment][name]), 'email' => stripslashes($_POST[comment][email]), 'url' => stripslashes($_POST[comment][url]), 'ip' => '127.0.0.1', 'browser' => $_SERVER["HTTP_USER_AGENT"], 'content' => stripslashes($_POST[comment][content])); $commentsclass = new CommentStorage('comments'); $commentsclass->settings[$date][$newcommentid] = $savecomment; $commentsclass->save(); #FIXME: Redirect javascript doesn't work on all servers echo "<script type=\"text/javascript\">self.location.href='http://{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}';</script>"; } else { echo "<div id=\"Commentposterrors\"><h1>" . i18n("generic_error") . "</h1><p>" . i18n("visible_comment_error_info") . "</p><ol>{$errors}</ol></div>"; } } # # Show the comment form # $output = '<form method="post" action="">'; $output .= $template[commentform]; $output = str_replace("{allowedtags}", kses_filter("gettags"), $output); $output .= '</form>';