Update of /cvsroot/php-blog/serendipity
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9606
Modified Files:
serendipity_functions.inc.php serendipity_config.inc.php
Log Message:
* moved some hardcoded limits to the config file for better accessibility
* Adjusted RSS feed. Comments will only update its last_modified stamps when
the article is younger than 7 days. This is to not force very old updates
into a conditional get RSS feed again
Index: serendipity_config.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_config.inc.php,v
retrieving revision 1.83
retrieving revision 1.84
diff -u -d -r1.83 -r1.84
--- serendipity_config.inc.php 9 Jul 2004 09:34:52 -0000 1.83
+++ serendipity_config.inc.php 14 Jul 2004 08:11:21 -0000 1.84
@@ -31,6 +31,17 @@
// Is the possibility to comment and entry enabled by default?
$serendipity['allowCommentsDefault'] = true;
+// How much time is allowed to pass since the publising of an entry, so that a comment to that entry
+// will update it's LastModified stamp? If the time is passed, a comment to an old entry will no longer
+// push an article as being updated.
+$serendipity['max_last_modified'] = 60 * 60 * 24 * 7;
+
+// Clients can send a If-Modified Header to the RSS Feed (Conditional Get) and receive all articles beyond
+// that date. However it is still limited by the number below of maximum entries
+$serendipity['max_fetch_limit'] = 50;
+
+// How many bytes are allowed for fetching trackbacks, so that no binary files get accidently trackbacked?
+$serendipity['trackback_filelimit'] = 150 * 1024;
/*
* Load main language file
Index: serendipity_functions.inc.php
===================================================================
RCS file: /cvsroot/php-blog/serendipity/serendipity_functions.inc.php,v
retrieving revision 1.328
retrieving revision 1.329
diff -u -d -r1.328 -r1.329
--- serendipity_functions.inc.php 13 Jul 2004 15:41:08 -0000 1.328
+++ serendipity_functions.inc.php 14 Jul 2004 08:11:21 -0000 1.329
@@ -667,7 +667,7 @@
if ($unix_modified != -1) {
$and = ' WHERE last_modified >= ' . $unix_modified;
if (!empty($limit)) {
- $limit = ($limit > 50 ? $limit : 50);
+ $limit = ($limit > $serendipity['max_fetch_limit'] ? $limit : $serendipity['max_fetch_limit']);
}
$orderby = 'last_modified DESC';
}
@@ -1596,7 +1596,7 @@
function serendipity_saveComment($id, $commentInfo, $type = 'NORMAL') {
global $serendipity;
- $query = "SELECT allow_comments FROM {$serendipity['dbPrefix']}entries WHERE id = '$id'";
+ $query = "SELECT allow_comments, last_modified, timestamp FROM {$serendipity['dbPrefix']}entries WHERE id = '$id'";
$ca = serendipity_db_query($query, true);
if (serendipity_db_bool($ca['allow_comments']) || !is_array($ca)) {
@@ -1622,7 +1622,16 @@
serendipity_db_query($query);
$field = ($type == 'NORMAL' ? 'comments' : 'trackbacks');
- $lm = time();
+
+ // Check when the entry was published. If it is older than max_last_modified allows, the last_modified date of that entry
+ // will not be pushed. With this we make sure that an RSS feed will not be updated on a client's reader and marked as new
+ // only because someone made an comment to an old entry.
+ if ($ca['timestamp'] > time() - $serendipity['max_last_modified']) {
+ $lm = time();
+ } else {
+ $lm = $ca['last_modified'];
+ }
+
$query = "UPDATE {$serendipity['dbPrefix']}entries SET $field=$field+1, last_modified=$lm WHERE id='$id'";
serendipity_db_query($query);
@@ -2114,8 +2123,7 @@
}
function serendipity_reference_autodiscover($loc, $url, $author, $title, $text) {
-
- $filelimit = 150 * 1024; // We do not check files larger than 150kb
+global $serendipity;
$timeout = 30;
$u = parse_url($loc);
@@ -2146,13 +2154,13 @@
fputs($fp, "Referer: {$GLOBALS['serendipity']['baseURL']}\r\n");
fputs($fp, "Connection: close\r\n\r\n");
- while ($fp && !feof($fp) && strlen($res) < $filelimit) {
+ while ($fp && !feof($fp) && strlen($res) < $serendipity['trackback_filelimit']) {
$res .= fgets($fp, 4096);
}
fclose($fp);
- if (strlen($res) >= $filelimit) {
- printf(TRACKBACK_SIZE, $filelimit);
+ if (strlen($res) >= $serendipity['trackback_filelimit']) {
+ printf(TRACKBACK_SIZE, $serendipity['trackback_filelimit']);
echo '<br />';
return;
}
|