Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20812
Modified Files:
serendipity_functions.inc.php NEWS
Added Files:
wfwcomment.php
Log Message:
Support CommentAPI: In the rss/atom feed a new element indicated a URL where
an aggregator/feedread can immediately POST a comment to an entry.
RSS Bandit (www.rssbandit.org) for Windows already supports that, however
kind of buggy right now.
--- NEW FILE: wfwcomment.php ---
<?php # $Id: wfwcomment.php,v 1.1 2004/02/06 21:56:21 garvinhicking Exp $
# Copyright (c) 2003-2004, Jannis Hermanns
# All rights reserved. See LICENSE file for licensing details
session_start();
include_once('serendipity_config.inc.php');
if ($_REQUEST['cid'] != '' && $HTTP_RAW_POST_DATA != '') {
$comment = array();
if (!preg_match('@<author[^>]*>(.*)</author[^>]*>@i', $HTTP_RAW_POST_DATA, $name)) {
preg_match('@<dc:creator[^>]*>(.*)</dc:creator[^>]*>@i', $HTTP_RAW_POST_DATA, $name);
}
if (isset($name[1]) && !empty($name[1])) {
if (preg_match('@^(.*)\((.*)\)@i', $name[1], $names)) {
$comment['name'] = $names[2];
$comment['email'] = $names[1];
} else {
$comment['name'] = $names[1];
}
}
if (preg_match('@<link[^>]*>(.*)</link[^>]*>@i', $HTTP_RAW_POST_DATA, $link)) {
$comment['url'] = $link[1];
}
if (preg_match('@<description[^>]*>(.*)</description[^>]*>@ims', $HTTP_RAW_POST_DATA, $description)) {
if (preg_match('@^<!\[CDATA\[(.*)\]\]>@ims', $description[1], $cdata)) {
$comment['comment'] = $cdata[1];
} else {
$comment['comment'] = $description[1];
}
if (!empty($comment['comment'])) {
serendipity_saveComment($_REQUEST['cid'], $comment, 'NORMAL');
}
}
}
?>
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.196
retrieving revision 1.197
diff -u -d -r1.196 -r1.197
--- serendipity_functions.inc.php 3 Feb 2004 23:24:49 -0000 1.196
+++ serendipity_functions.inc.php 6 Feb 2004 21:56:21 -0000 1.197
@@ -1256,6 +1256,7 @@
<issued><?php echo date('Y-m-d\TH:i:s\Z', $entry['timestamp']); ?></issued>
<created><?php echo date('Y-m-d\TH:i:s\Z', $entry['timestamp']); ?></created>
<modified><?php echo date('Y-m-d\TH:i:s\Z', $entry['timestamp']); ?></modified>
+ <wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo (isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']); ?></wfw:comment>
<?php
if ($comments === false) {
@@ -1289,6 +1290,7 @@
?>
<category><?php echo utf8_encode(htmlspecialchars($entry['category_name'])); ?></category>
<comments><?php echo $guid; ?></comments>
+ <wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo (isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']); ?></wfw:comment>
<?php
if ($comments === false) {
?>
@@ -1328,6 +1330,7 @@
<dc:creator><?php echo utf8_encode(htmlspecialchars($entry['email'])) . ' (' . utf8_encode(htmlspecialchars($entry['username'])) . ')'; ?></dc:creator>
<dc:subject><?php echo utf8_encode(htmlspecialchars($entry['category_name'])); ?></dc:subject>
<dc:date><?php echo date('Y-m-d\TH:i:s\Z', $entry['timestamp']); ?></dc:date>
+ <wfw:comment><?php echo $serendipity['baseURL']; ?>wfwcomment.php?cid=<?php echo (isset($entry['entryid']) && $entry['entryid'] != '' ? $entry['entryid'] : $entry['id']); ?></wfw:comment>
<?php
if ($comments === false) {
?>
Index: NEWS
===================================================================
RCS file: /cvsroot/php-blog/serendipity/NEWS,v
retrieving revision 1.60
retrieving revision 1.61
diff -u -d -r1.60 -r1.61
--- NEWS 6 Feb 2004 14:39:12 -0000 1.60
+++ NEWS 6 Feb 2004 21:56:21 -0000 1.61
@@ -2,7 +2,7 @@
Version 0.5.1 ()
------------------------------------
-
+ * Now able to use CommentAPI to post entries to an RSS/Atom feed, like from RSS Bandit (garvinhicking)
Version 0.5 (February 6th, 2004)
------------------------------------
|