From bb736bb631788574137742f60dfaa2a808573af8 Mon Sep 17 00:00:00 2001 From: Starla Insigna Date: Sun, 7 Dec 2008 17:11:22 -0500 Subject: Moved pingbacks to a seperate table Because pingbacks just aren't comments, they shouldn't be stored in the comments table. So, a new table has been created for them and the blog post view pages have been accomodated to show them at the bottom just like the related posts are shown. --- xmlrpc.php | 32 ++++---------------------------- 1 file changed, 4 insertions(+), 28 deletions(-) (limited to 'xmlrpc.php') diff --git a/xmlrpc.php b/xmlrpc.php index 69990da..9ca47c4 100755 --- a/xmlrpc.php +++ b/xmlrpc.php @@ -58,33 +58,15 @@ function ping($xmlrpcmsg) $title = $from; } - preg_match_all('/HREF="([^"]+)">([^>]+)<\/A>/i',$page_data,$matches); - for ($i=0;$i',"\n",$text); - $text = str_ireplace('
',"\n",$text); - $text = str_replace("\t", ' ', $text); - $text = preg_replace('/' . "\n" . '([ ]*)' . "\n" . '/i', '', $text); - - $commentText = "[url=" . $from . "]" . $title . "[/url]\n\n[....] " . $text . " [....]"; - - $getping = "SELECT * FROM comments WHERE page_id = \"updates-" . $getpost3['id'] . "\" AND comment = \"" . addslashes($commentText) . "\""; + $getping = "SELECT * FROM pingbacks WHERE post_id = " . $getpost3['id'] . " AND url = \"" . mysql_real_escape_string($from) . "\""; $getping2 = mysql_query($getping); $getping3 = mysql_fetch_array($getping2); - if ($getping3['comment'] == $commentText) + if ($getping3['url'] == $from) { return new xmlrpcresp(0, 48, "Target uri cannot be used as target"); } else { - $insping = "INSERT INTO comments (page_id,username,comment) VALUES (\"updates-" . $getpost3['id'] . "\",\"Pingback\",\"" . $commentText . "\")"; + $insping = "INSERT INTO pingbacks (post_id,title,url) VALUES (" . $getpost3['id'] . ",\"" . mysql_real_escape_string($title) . "\",\"" . mysql_real_escape_string($from) . "\")"; $insping2 = mysql_query($insping); recalcPop($getpost3['id']); @@ -101,13 +83,7 @@ function ping($xmlrpcmsg) } } -function rr($xmlrpcmsg) -{ - return new xmlrpcresp(new xmlrpcval(0, "int")); -} - $s = new xmlrpc_server(array( - "pingback.ping" => array("function" => "ping"), - "InstaDisc.checkRegistration" => array("function" => "rr"))); + "pingback.ping" => array("function" => "ping"))); ?> -- cgit 1.4.1