[pLog-svn] r6633 - plog/branches/lifetype-1.2/class/action/admin
jondaley at devel.lifetype.net
jondaley at devel.lifetype.net
Sat Jun 21 15:39:18 EDT 2008
Author: jondaley
Date: 2008-06-21 15:39:18 -0400 (Sat, 21 Jun 2008)
New Revision: 6633
Modified:
plog/branches/lifetype-1.2/class/action/admin/adminpostmanagementcommonaction.class.php
Log:
validate trackback urls
Modified: plog/branches/lifetype-1.2/class/action/admin/adminpostmanagementcommonaction.class.php
===================================================================
--- plog/branches/lifetype-1.2/class/action/admin/adminpostmanagementcommonaction.class.php 2008-06-21 19:38:59 UTC (rev 6632)
+++ plog/branches/lifetype-1.2/class/action/admin/adminpostmanagementcommonaction.class.php 2008-06-21 19:39:18 UTC (rev 6633)
@@ -63,12 +63,41 @@
$this->registerFieldValidator( "sendTrackbacks", new IntegerValidator(), true );
$this->registerFieldValidator( "sendPings", new IntegerValidator(), true );
$this->registerFieldValidator( "commentsEnabled", new IntegerValidator(), true );
- // TODO - use validate() and validate by fieldtype?
$this->registerFieldValidator( "customField", new ArrayValidator(), true );
- $this->registerFieldValidator( "trackbackUrls", new ArrayValidator( new HttpUrlValidator() ), true );
+ $this->registerFieldValidator( "trackbackUrls", new StringValidator(), true);
$this->registerFieldValidator( "postUser", new IntegerValidator(), true );
}
-
+
+ function validate()
+ {
+ if(!parent::validate())
+ return false;
+
+ // TODO: validate customFields based on fieldType
+
+ // check trackback URLs
+ $trackbackUrls = $this->_request->getValue( "trackbackUrls" );
+ if($trackbackUrls != ""){
+ lt_include( PLOG_CLASS_PATH."class/data/filter/urlconverter.class.php" );
+ $f = new UrlConverter();
+ $trackbackLinks = Array();
+ foreach(explode( "\r\n", $trackbackUrls ) as $host ) {
+ trim($host);
+ if( $host != "" && $host != "\r\n" && $host != "\r" && $host != "\n" ){
+ $host = $f->filter($host);
+ array_push( $trackbackLinks, $host );
+ }
+ }
+ $val = new ArrayValidator( new HttpUrlValidator() );
+ if(!$val->validate($trackbackLinks)){
+ $this->validationErrorProcessing();
+ return false;
+ }
+ }
+
+ return true;
+ }
+
function _fetchPostDateInformation()
{
// fetch the timestamp that the post will have
More information about the pLog-svn
mailing list