cvs: pearweb /include/Damblan Trackback.php
| From: | Tobias Schlitt | Date: | Mon, 23 May 2005 21:09:28 +0000 |
| Subject: | cvs: pearweb /include/Damblan Trackback.php | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-cvs+get-32086@lists.php.net to get a copy of this message | ||
toby Mon May 23 17:09:28 2005 EDT
Modified files:
/pearweb/include/Damblan Trackback.php
Log:
* Migration to Services_Trackback 0.5.0.
http://cvs.php.net/diff.php/pearweb/include/Damblan/Trackback.php?r1=1.9&r2=1.10&ty=u
Index: pearweb/include/Damblan/Trackback.php
diff -u pearweb/include/Damblan/Trackback.php:1.9 pearweb/include/Damblan/Trackback.php:1.10
--- pearweb/include/Damblan/Trackback.php:1.9 Fri Mar 11 10:28:24 2005
+++ pearweb/include/Damblan/Trackback.php Mon May 23 17:09:27 2005
@@ -1,7 +1,6 @@
<?php
require_once 'Services/Trackback.php';
-require_once 'Net/DNSBL.php';
class Damblan_Trackback extends Services_Trackback {
@@ -21,14 +20,6 @@
*/
var $_approved = false;
- /**
- * The IP adress from where the trackback has been send.
- *
- * @var string
- * @since
- */
- var $_ip = '';
-
// How many trackbacks may be posted in a specific timespan?
var $_repostCount = 3;
// In which timespan?
@@ -65,28 +56,13 @@
foreach ($data as $key => $val) {
if ($key == 'approved')
$val = ($val == 'true');
+ if ($key == 'ip')
+ $this->set('host', $val);
$this->set($key, $val);
}
}
/**
- * Check if the sending host is blacklisted.
- * This method will be moved to Services_Trackback soon.
- *
- * @access public
- * @return mixed True, if the host is not listed, otherwise PEAR::Error.
- */
- function checkSpam()
- {
- $dnsbl = new Net_DNSBL();
- $dnsbl->setBlacklists($this->_blacklists);
- if ($dnsbl->isListed($this->_ip)) {
- return PEAR::raiseError('Your host seems to be listed as a known spam host. If
your trackback is rejected by mistake, please contact pear-webmaster@lists.phph.net.');
- }
- return true;
- }
-
- /**
* Get number of all in all available trackbacks.
*
*
@@ -118,7 +94,7 @@
function checkRepost(&$dbh)
{
$sql = 'SELECT COUNT(timestamp) FROM trackbacks WHERE
- ip = '.$dbh->quoteSmart($this->get('ip')).' AND
+ ip = '.$dbh->quoteSmart($this->get('host')).' AND
timestamp > '.$dbh->quoteSmart($this->get('timestamp') -
$this->_repostTimespan).'
GROUP BY ip';
$res = $dbh->getOne($sql);
@@ -183,7 +159,7 @@
*/
function save(&$dbh)
{
- $necessaryData = array('id', 'title', 'url',
'excerpt', 'blog_name');
+ $necessaryData = array('id', 'title', 'url',
'excerpt', 'blog_name', 'host');
$this->_checkData($necessaryData);
$data = $this->_getDecodedData($necessaryData);
// $this->set('timestamp', time());
@@ -196,7 +172,7 @@
".$dbh->quoteSmart($this->get('blog_name')).",
".$dbh->quoteSmart($this->get('approved')).",
".$dbh->quoteSmart($this->get('timestamp')).",
- ".$dbh->quoteSmart($this->get('ip'))."
+ ".$dbh->quoteSmart($this->get('host'))."
)";
$res = $dbh->query($sql);
if (DB::isError($res)) {
@@ -247,6 +223,9 @@
if ($key == 'approved') {
$val = ($val == 'true');
}
+ if ($key == 'ip') {
+ $this->set('host', $val);
+ }
$this->set($key, $val);
}
return true;