Skip to content
Snippets Groups Projects
Commit 9dcd3ee3 authored by Graham Cole's avatar Graham Cole
Browse files

make ajax blog commenting work again

parent c7ca2348
No related branches found
No related tags found
No related merge requests found
<?php
/*
* Comment posting AJAX service
*/
// don't output the site template
$no_template = TRUE;
// don't output anything before we've returned status
ob_start();
require_once("../lib/blog/blog.lib.php");
$blogid = $_POST['blog'];
$postid = $_POST['post'];
$blog = new blogs($blogid);
$ret = $blog->newComment($postid, FALSE);
if($ret[0]) {
echo "<split>OK";
} else {
echo "<split>ERROR<split>".$ret[1];
}
ob_end_flush();
?>
......@@ -28,7 +28,7 @@ array_shift($request);
ob_start();
$smarty->assign("title", $blog->title);
$smarty->assign("extra_scripts", array("<script type=\"text/javascript\" src=\"/js/xmlhttp.js\"></script>"));
$smarty->assign("extra_scripts", array("<script type=\"text/javascript\" src=\"$baseurl/js/xmlhttp.js\"></script>"));
//check we have a valid username before offering a RSS feed
if($blog->userName) {
$smarty->assign("rss_url", "http://{$_SERVER['HTTP_HOST']}{$blog->httpPath}feed/rss/{$blog->userName}".(($request[0]=="category") ? "/category/".(int)$request[1]:""));
......
......@@ -15,7 +15,7 @@ function postcomment(strBaseUrl, strBlog, strPost) {
frm = document.forms['commentform'];
url = "blog=" + strBlog + "&post=" + strPost + "&author=" + escape(frm.elements['author'].value) + "&email=" + escape(frm.elements['email'].value) + "&comment=" + escape(frm.elements['comment'].value);
xmlhttp.open("POST", strBaseUrl+"postcomment.php", true);
xmlhttp.open("POST", strBaseUrl+"comment", true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.onreadystatechange = function() {
if (xmlhttp.readyState == 4) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment