diff options
author | Starla Insigna <hatkirby@fourisland.com> | 2008-12-07 17:11:22 -0500 |
---|---|---|
committer | Starla Insigna <hatkirby@fourisland.com> | 2008-12-07 17:11:22 -0500 |
commit | bb736bb631788574137742f60dfaa2a808573af8 (patch) | |
tree | e840a6a4c24866c33e8a0bf51ff6044d4fb2adbf /xmlrpc.php | |
parent | a930e827048acf17d04a6af06c1616a72dee714a (diff) | |
download | fourisland-bb736bb631788574137742f60dfaa2a808573af8.tar.gz fourisland-bb736bb631788574137742f60dfaa2a808573af8.tar.bz2 fourisland-bb736bb631788574137742f60dfaa2a808573af8.zip |
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.
Diffstat (limited to 'xmlrpc.php')
-rwxr-xr-x | xmlrpc.php | 32 |
1 files changed, 4 insertions, 28 deletions
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) | |||
58 | $title = $from; | 58 | $title = $from; |
59 | } | 59 | } |
60 | 60 | ||
61 | preg_match_all('/HREF="([^"]+)">([^>]+)<\/A>/i',$page_data,$matches); | 61 | $getping = "SELECT * FROM pingbacks WHERE post_id = " . $getpost3['id'] . " AND url = \"" . mysql_real_escape_string($from) . "\""; |
62 | for ($i=0;$i<count($matches[1]);$i++) | ||
63 | { | ||
64 | if ($matches[1][$i] == $to) | ||
65 | { | ||
66 | $find = $matches[2][$i]; | ||
67 | } | ||
68 | } | ||
69 | |||
70 | $text = strip_tags($page_data); | ||
71 | $text = substr($text,(stripos($text,$find)-300),700); | ||
72 | $text = str_ireplace('<BR>',"\n",$text); | ||
73 | $text = str_ireplace('<BR />',"\n",$text); | ||
74 | $text = str_replace("\t", ' ', $text); | ||
75 | $text = preg_replace('/' . "\n" . '([ ]*)' . "\n" . '/i', '', $text); | ||
76 | |||
77 | $commentText = "[url=" . $from . "]" . $title . "[/url]\n\n[....] " . $text . " [....]"; | ||
78 | |||
79 | $getping = "SELECT * FROM comments WHERE page_id = \"updates-" . $getpost3['id'] . "\" AND comment = \"" . addslashes($commentText) . "\""; | ||
80 | $getping2 = mysql_query($getping); | 62 | $getping2 = mysql_query($getping); |
81 | $getping3 = mysql_fetch_array($getping2); | 63 | $getping3 = mysql_fetch_array($getping2); |
82 | 64 | ||
83 | if ($getping3['comment'] == $commentText) | 65 | if ($getping3['url'] == $from) |
84 | { | 66 | { |
85 | return new xmlrpcresp(0, 48, "Target uri cannot be used as target"); | 67 | return new xmlrpcresp(0, 48, "Target uri cannot be used as target"); |
86 | } else { | 68 | } else { |
87 | $insping = "INSERT INTO comments (page_id,username,comment) VALUES (\"updates-" . $getpost3['id'] . "\",\"Pingback\",\"" . $commentText . "\")"; | 69 | $insping = "INSERT INTO pingbacks (post_id,title,url) VALUES (" . $getpost3['id'] . ",\"" . mysql_real_escape_string($title) . "\",\"" . mysql_real_escape_string($from) . "\")"; |
88 | $insping2 = mysql_query($insping); | 70 | $insping2 = mysql_query($insping); |
89 | recalcPop($getpost3['id']); | 71 | recalcPop($getpost3['id']); |
90 | 72 | ||
@@ -101,13 +83,7 @@ function ping($xmlrpcmsg) | |||
101 | } | 83 | } |
102 | } | 84 | } |
103 | 85 | ||
104 | function rr($xmlrpcmsg) | ||
105 | { | ||
106 | return new xmlrpcresp(new xmlrpcval(0, "int")); | ||
107 | } | ||
108 | |||
109 | $s = new xmlrpc_server(array( | 86 | $s = new xmlrpc_server(array( |
110 | "pingback.ping" => array("function" => "ping"), | 87 | "pingback.ping" => array("function" => "ping"))); |
111 | "InstaDisc.checkRegistration" => array("function" => "rr"))); | ||
112 | 88 | ||
113 | ?> | 89 | ?> |