[pLog-svn] r5040 - in plugins/branches/lifetype-1.2/validatetrackback: . class/action class/security class/view locale templates
pwestbro at devel.lifetype.net
pwestbro at devel.lifetype.net
Sat Mar 10 17:29:55 EST 2007
Author: pwestbro
Date: 2007-03-10 17:29:55 -0500 (Sat, 10 Mar 2007)
New Revision: 5040
Modified:
plugins/branches/lifetype-1.2/validatetrackback/class/action/adminvalidatetrackbackpluginupdatesettingsaction.class.php
plugins/branches/lifetype-1.2/validatetrackback/class/security/validatetrackbackfilter.class.php
plugins/branches/lifetype-1.2/validatetrackback/class/view/adminvalidatetrackbackpluginsettingsview.class.php
plugins/branches/lifetype-1.2/validatetrackback/locale/locale_ca_ES.php
plugins/branches/lifetype-1.2/validatetrackback/locale/locale_en_UK.php
plugins/branches/lifetype-1.2/validatetrackback/locale/locale_es_ES.php
plugins/branches/lifetype-1.2/validatetrackback/locale/locale_zh_TW.php
plugins/branches/lifetype-1.2/validatetrackback/pluginvalidatetrackback.class.php
plugins/branches/lifetype-1.2/validatetrackback/templates/pluginsettings.template
Log:
Added an option to the validate trackback plugin to make sure that the post,
referenced in the trackback, actually contains a link to the post that the
trackback is being sent to.
Modified: plugins/branches/lifetype-1.2/validatetrackback/class/action/adminvalidatetrackbackpluginupdatesettingsaction.class.php
===================================================================
--- plugins/branches/lifetype-1.2/validatetrackback/class/action/adminvalidatetrackbackpluginupdatesettingsaction.class.php 2007-03-10 19:56:11 UTC (rev 5039)
+++ plugins/branches/lifetype-1.2/validatetrackback/class/action/adminvalidatetrackbackpluginupdatesettingsaction.class.php 2007-03-10 22:29:55 UTC (rev 5040)
@@ -31,6 +31,9 @@
$this->_dnsAntiSpam = $this->_request->getValue( "dnsCheckingEnabled" );
$this->_dnsAntiSpam = ($this->_dnsAntiSpam != "" );
+
+ $this->_checkForLinks = $this->_request->getValue( "linkCheckingEnabled" );
+ $this->_checkForLinks = ($this->_checkForLinks != "" );
return true;
}
@@ -46,7 +49,9 @@
$blogSettings->setValue( "plugin_validatetrackback_trackback_enabled", $this->_validateTrackbacksUrls );
$blogSettings->setValue( "plugin_validatetrackback_dns_enabled", $this->_dnsAntiSpam );
+ $blogSettings->setValue( "plugin_validatetrackback_linkchecking_enabled", $this->_checkForLinks );
+
$this->_blogInfo->setSettings( $blogSettings );
// save the blogs settings
Modified: plugins/branches/lifetype-1.2/validatetrackback/class/security/validatetrackbackfilter.class.php
===================================================================
--- plugins/branches/lifetype-1.2/validatetrackback/class/security/validatetrackbackfilter.class.php 2007-03-10 19:56:11 UTC (rev 5039)
+++ plugins/branches/lifetype-1.2/validatetrackback/class/security/validatetrackbackfilter.class.php 2007-03-10 22:29:55 UTC (rev 5040)
@@ -102,11 +102,19 @@
}
}
+ $url = "";
+ $page = "";
+
+ if( $blogSettings->getValue( "plugin_validatetrackback_trackback_enabled" ) ||
+ $blogSettings->getValue( "plugin_validatetrackback_linkchecking_enabled" )) {
+
+ // Get the page
+ $url = TextFilter::htmlDecode( $userUrl );
+ $page = $this->fetchPage( $url );
+ }
+
if ( $blogSettings->getValue( "plugin_validatetrackback_trackback_enabled" ) ) {
- // Get the page
- $url = TextFilter::htmlDecode( $userUrl );
- $page = $this->fetchPage( $url );
// Get the trackback client
lt_include( PLOG_CLASS_PATH."class/dao/trackbackclient.class.php" );
@@ -121,7 +129,34 @@
return $result;
}
}
+
+ if ( $blogSettings->getValue( "plugin_validatetrackback_linkchecking_enabled" ) ) {
+ lt_include( PLOG_CLASS_PATH."class/dao/article.class.php");
+ lt_include( PLOG_CLASS_PATH."class/dao/articles.class.php");
+ // Make sure that the page referenced in the trackback actually includes a
+ // Link to this article
+
+ $articles = new Articles();
+ $item = $articles->getBlogArticle($articleId);
+
+ // Get the permalink to this article
+ $rg = $blogInfo->getBlogRequestGenerator();
+ $postUrl = $rg->postLink($item);
+
+ // Now deterimine if the page contains the post url
+
+ // XXX Ideally this would not just use strpos, but would actually look for a
+ // <a> link that contains this url
+ if( strpos($page, $postUrl) === FALSE) {
+ // there were no trackback links in the page
+ $this->trackbackLog( "Validate Trackback: Page doesn't contain link to this post" );
+ $locale = $blogInfo->getLocale();
+ $result = new PipelineResult( false, VALIDATE_TRACKBACK_SPAM, $locale->tr("error_comment_spam_throw_away") );
+ return $result;
+ }
+ }
+
// if everything went fine, we can say so by returning
// a positive PipelineResult object
$result = new PipelineResult( true );
Modified: plugins/branches/lifetype-1.2/validatetrackback/class/view/adminvalidatetrackbackpluginsettingsview.class.php
===================================================================
--- plugins/branches/lifetype-1.2/validatetrackback/class/view/adminvalidatetrackbackpluginsettingsview.class.php 2007-03-10 19:56:11 UTC (rev 5039)
+++ plugins/branches/lifetype-1.2/validatetrackback/class/view/adminvalidatetrackbackpluginsettingsview.class.php 2007-03-10 22:29:55 UTC (rev 5040)
@@ -21,12 +21,14 @@
$checkTrackbackUrls = $blogSettings->getValue( "plugin_validatetrackback_trackback_enabled" );
$useDnsChecks = $blogSettings->getValue( "plugin_validatetrackback_dns_enabled" );
+ $useLinkChecks = $blogSettings->getValue( "plugin_validatetrackback_linkchecking_enabled" );
// create a view and export the settings to the template
$this->setValue( "pluginEnabled", $pluginEnabled );
$this->setValue( "trackbackUrlCheckingEnabled", $checkTrackbackUrls );
$this->setValue( "dnsCheckingEnabled", $useDnsChecks );
+ $this->setValue( "linkCheckingEnabled", $useLinkChecks );
parent::render();
}
Modified: plugins/branches/lifetype-1.2/validatetrackback/locale/locale_ca_ES.php
===================================================================
--- plugins/branches/lifetype-1.2/validatetrackback/locale/locale_ca_ES.php 2007-03-10 19:56:11 UTC (rev 5039)
+++ plugins/branches/lifetype-1.2/validatetrackback/locale/locale_ca_ES.php 2007-03-10 22:29:55 UTC (rev 5040)
@@ -5,6 +5,7 @@
$messages["validatetrackback_plugin_enabled"] = "Activa el complement";
$messages["trackback_url_checking_enabled"] = "Activa aquesta opció per només acceptar retroenllaços de blocs o pàgines web que disposin d'URL de retroenllaç";
$messages["dns_checking_enabled"] = "Activa aquesta opció per només acceptar retroenllaços de servidors que no figurin a les llistes negres de servidors open relay.";
+$messages["link_checking_enabled"] = "Enable this to only accept trackbacks when the article referenced in the trackback actually includes a link to the local article.";
$messages["validatetrackback_plugin"] = "Validació de retroenllaços";
$messages["validatetrackback_settings_saved_ok"] = "Configuració del complement Validació de retroenllaços actualitzada correctament";
@@ -13,4 +14,5 @@
$messages["label_enable"] = "Activa";
$messages["label_enable_trackback_url"] = "Activa el complement Validació de retroenllaços";
$messages["label_enable_dns_checking"] = "Utilitza les llistes negres de servidors open relay per validar els retroenllaços";
+$messages["label_enable_link_checking"] = "Enable checking for valid links";
?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/validatetrackback/locale/locale_en_UK.php
===================================================================
--- plugins/branches/lifetype-1.2/validatetrackback/locale/locale_en_UK.php 2007-03-10 19:56:11 UTC (rev 5039)
+++ plugins/branches/lifetype-1.2/validatetrackback/locale/locale_en_UK.php 2007-03-10 22:29:55 UTC (rev 5040)
@@ -5,6 +5,7 @@
$messages["validatetrackback_plugin_enabled"] = "Enable this plugin";
$messages["trackback_url_checking_enabled"] = "Enable this to only accept trackback pings where the web page also has a trackback url";
$messages["dns_checking_enabled"] = "Enable this to only accept trackbacks when the dns blacklists says it is not from a open relay.";
+$messages["link_checking_enabled"] = "Enable this to only accept trackbacks when the article referenced in the trackback actually includes a link to the local article.";
$messages["validatetrackback_plugin"] = "Validate Trackbacks Plugin";
$messages["validatetrackback_settings_saved_ok"] = "Validate Trackbacks settings saved successfully!";
@@ -13,4 +14,5 @@
$messages["label_enable"] = "Enable";
$messages["label_enable_trackback_url"] = "Enable checking for valid trackback urls";
$messages["label_enable_dns_checking"] = "Use the dns black lists to check trackbacks";
+$messages["label_enable_link_checking"] = "Enable checking for valid links";
?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/validatetrackback/locale/locale_es_ES.php
===================================================================
--- plugins/branches/lifetype-1.2/validatetrackback/locale/locale_es_ES.php 2007-03-10 19:56:11 UTC (rev 5039)
+++ plugins/branches/lifetype-1.2/validatetrackback/locale/locale_es_ES.php 2007-03-10 22:29:55 UTC (rev 5040)
@@ -11,6 +11,7 @@
$messages["trackback_url_checking_enabled"] = "Enable this to only accept trackback pings where the web page also has a trackback url";
$messages["dns_checking_enabled"] = "Enable this to only accept trackbacks when the dns blacklists says it is not from a open relay.";
+$messages["link_checking_enabled"] = "Enable this to only accept trackbacks when the article referenced in the trackback actually includes a link to the local article.";
$messages["validatetrackback_plugin"] = "Plugin Validar Trackbacks";
@@ -21,5 +22,6 @@
$messages["label_enable_trackback_url"] = "Enable checking for valid trackback urls";
$messages["label_enable_dns_checking"] = "Use the dns black lists to check trackbacks";
+$messages["label_enable_link_checking"] = "Enable checking for valid links";
?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/validatetrackback/locale/locale_zh_TW.php
===================================================================
--- plugins/branches/lifetype-1.2/validatetrackback/locale/locale_zh_TW.php 2007-03-10 19:56:11 UTC (rev 5039)
+++ plugins/branches/lifetype-1.2/validatetrackback/locale/locale_zh_TW.php 2007-03-10 22:29:55 UTC (rev 5040)
@@ -6,6 +6,7 @@
$messages["trackback_url_checking_enabled"] = "Enable this to only accept trackback pings where the web page also has a trackback url";
$messages["dns_checking_enabled"] = "Enable this to only accept trackbacks when the dns blacklists says it is not from a open relay.";
+$messages["link_checking_enabled"] = "Enable this to only accept trackbacks when the article referenced in the trackback actually includes a link to the local article.";
$messages["validatetrackback_plugin"] = "å¼ç¨ç¶²åé©èå¤æç¨å¼";
$messages["validatetrackback_settings_saved_ok"] = "å¼ç¨ç¶²åé©è¨å®å²åæåã";
@@ -15,6 +16,6 @@
$messages["label_enable_trackback_url"] = "Enable checking for valid trackback urls";
$messages["label_enable_dns_checking"] = "Use the dns black lists to check trackbacks";
+$messages["label_enable_link_checking"] = "Enable checking for valid links";
-
?>
\ No newline at end of file
Modified: plugins/branches/lifetype-1.2/validatetrackback/pluginvalidatetrackback.class.php
===================================================================
--- plugins/branches/lifetype-1.2/validatetrackback/pluginvalidatetrackback.class.php 2007-03-10 19:56:11 UTC (rev 5039)
+++ plugins/branches/lifetype-1.2/validatetrackback/pluginvalidatetrackback.class.php 2007-03-10 22:29:55 UTC (rev 5040)
@@ -88,6 +88,7 @@
Array( "name" => "plugin_validatetrackback_enabled", "type" => "boolean" ),
Array( "name" => "plugin_validatetrackback_trackback_enabled", "type" => "boolean" ),
Array( "name" => "plugin_validatetrackback_dns_enabled", "type" => "boolean" ),
+ Array( "name" => "plugin_validatetrackback_linkchecking_enabled", "type" => "boolean" ),
));
}
Modified: plugins/branches/lifetype-1.2/validatetrackback/templates/pluginsettings.template
===================================================================
--- plugins/branches/lifetype-1.2/validatetrackback/templates/pluginsettings.template 2007-03-10 19:56:11 UTC (rev 5039)
+++ plugins/branches/lifetype-1.2/validatetrackback/templates/pluginsettings.template 2007-03-10 22:29:55 UTC (rev 5040)
@@ -26,6 +26,13 @@
</div>
</div>
+ <div class="field">
+ <label for="linkCheckingEnabled">{$locale->tr("label_enable_link_checking")}</label>
+ <div class="formHelp">
+ <input class="checkbox" type="checkbox" name="linkCheckingEnabled" id="linkCheckingEnabled" {if $linkCheckingEnabled} checked="checked" {/if} value="1" />{$locale->tr("link_checking_enabled")}
+ </div>
+ </div>
+
</fieldset>
<div class="buttons">
More information about the pLog-svn
mailing list