summary refs log tree commit diff stats
path: root/xmlrpc.php
diff options
context:
space:
mode:
Diffstat (limited to 'xmlrpc.php')
-rwxr-xr-xxmlrpc.php32
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
104function 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?>