Update of /cvsroot/php-blog/jBlog
In directory sc8-pr-cvs1:/tmp/cvs-serv20472
Modified Files:
jBlog_functions.inc.php
Log Message:
trackback auto-discovery fixes
Index: jBlog_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/jBlog/jBlog_functions.inc.php,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- jBlog_functions.inc.php 7 Mar 2003 04:44:29 -0000 1.30
+++ jBlog_functions.inc.php 7 Mar 2003 05:11:21 -0000 1.31
@@ -561,7 +561,7 @@
* validate trackback response
*/
function
-jBlog_trackback_is_success($resp, $final=0)
+jBlog_trackback_is_success($resp, $data, $final=0)
{
if (preg_match('@<error>(\d)+</error>@', $resp, $matches)) {
if ((int) $matches[1]) {
@@ -575,7 +575,7 @@
}
}
}
- else if($final) {
+ else if($final == 0) {
if(preg_match('@trackback:ping(\s*rdf:resource)?\s*=\s*"(http:[^"]+)"@', $resp, $matches)) {
return jBlog_trackback_is_success(_jBlog_send($matches[2], $data), 1);
}
@@ -591,8 +591,10 @@
$pingback = $matches[1];
}
else {
+ return;
+ }
// xml-rpc hack
- $query = "
+ $query = "
<?xml version=\"1.0\"?>
<methodCall>
<methodName>pingback.ping</methodName>
@@ -608,8 +610,6 @@
</methodCall>";
_jBlog_send($pingback, $query);
return;
- }
-
}
/**
@@ -648,7 +648,6 @@
{
$data = "url=".rawurlencode($url)."&title=".rawurlencode($title).
"&blog_name=".rawurlencode($author)."&excerpt=".rawurlencode($text);
-
$res = _jBlog_send($loc, $data);
$response = jBlog_trackback_is_success($res, $data);
jBlog_pingback_autodiscover($loc, $res);
@@ -711,7 +710,6 @@
jBlog_handle_references($id, $author, $title, $text)
{
global $jBlog;
-
if (!preg_match_all('@<a[^>]+?href\s*=\s*["\']?([^\'" >]+?)[ \'"]?>([^<]*)</a>@i', $text, $matches)) {
return;
}
@@ -752,7 +750,7 @@
preg_match_all('@<cite[^>]*>([^<]+)</cite>@i', $text, $matches);
foreach ($matches[1] as $citation) {
- $query = "INSERT INTO {$jBlog['dbPrefix']}references (entry_id, name) VALUES(";
+ $query = "INSERT INTO {$jBlog['dbPrefix']}references (en)try_id, name) VALUES(";
$query .= "'$tmpid', '" . mysql_escape_string($citation) . "')";
mysql_db_query($jBlog['dbName'], $query);
@@ -789,8 +787,12 @@
$newEntry = 1;
$entry['id'] = mysql_insert_id();
}
-
- jBlog_handle_references($entry['id'], $jBlog['blogTitle'], $entry['title'], $entry['extended'], $newEntry);
+ if($exflag) {
+ jBlog_handle_references($entry['id'], $jBlog['blogTitle'], $entry['title'], $entry['extended'], $newEntry);
+ }
+ else {
+ jBlog_handle_references($entry['id'], $jBlog['blogTitle'], $entry['title'], $entry['body'], $newEntry);
+ }
jBlog_purgeEntry($entry['id'], $entry['timestamp']);
|