[pLog-svn] r3536 - in plog/trunk: class/action
class/data/validator/rules templates/rss
Paul Westbrook
paul at westbrooks.org
Wed Jun 7 16:17:32 GMT 2006
Hello,
With this change, the following warnings are happening:
[client 64.78.155.100] PHP Notice: Use of undefined constant
DEFAULT_PROFILE - assumed 'DEFAULT_PROFILE' in /var/www/plog-1.0/
class/action/rssaction.class.php on line 29
I don't see DEFAULT_PROFILE defined anywhere. Is this supposed to be
RSS_VIEW_DEFAULT_PROFILE?
--Paul
On Jun 5, 2006, at 4:38 PM, jondaley at devel.lifetype.net wrote:
> Author: jondaley
> Date: 2006-06-05 23:38:33 +0000 (Mon, 05 Jun 2006)
> New Revision: 3536
>
> Modified:
> plog/trunk/class/action/commentaction.class.php
> plog/trunk/class/action/defaultaction.class.php
> plog/trunk/class/action/resourceserveraction.class.php
> plog/trunk/class/action/rssaction.class.php
> plog/trunk/class/action/viewalbumaction.class.php
> plog/trunk/class/action/viewarticleaction.class.php
> plog/trunk/class/action/viewarticletrackbacksaction.class.php
> plog/trunk/class/action/viewresourceaction.class.php
> plog/trunk/class/data/validator/rules/uintrule.class.php
> plog/trunk/templates/rss/atom.template
> plog/trunk/templates/rss/rss10.template
> Log:
> merged revs 3424 through 3535 from the 1.0.5 branch
>
> Modified: plog/trunk/class/action/commentaction.class.php
> ===================================================================
> --- plog/trunk/class/action/commentaction.class.php 2006-06-05
> 23:32:42 UTC (rev 3535)
> +++ plog/trunk/class/action/commentaction.class.php 2006-06-05
> 23:38:33 UTC (rev 3536)
> @@ -27,6 +27,7 @@
>
> // data validation
> $this->registerFieldValidator( "articleId", new IntegerValidator
> ());
> + $this->registerFieldValidator( "parentId", new IntegerValidator
> ());
> $this->setValidationErrorView( new ErrorView( $this-
> >_blogInfo, "error_incorrect_article_id" ));
> }
>
>
> Modified: plog/trunk/class/action/defaultaction.class.php
> ===================================================================
> --- plog/trunk/class/action/defaultaction.class.php 2006-06-05
> 23:32:42 UTC (rev 3535)
> +++ plog/trunk/class/action/defaultaction.class.php 2006-06-05
> 23:38:33 UTC (rev 3536)
> @@ -2,6 +2,8 @@
>
> require_once( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
> require_once( PLOG_CLASS_PATH."class/plugin/
> pluginmanager.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> stringvalidator.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> integervalidator.class.php" );
>
> /**
> * \ingroup Action
> @@ -23,10 +25,20 @@
> function DefaultAction( $actionInfo, $request )
> {
> $this->BlogAction( $actionInfo, $request );
> +
> + $this->registerFieldValidator( "postCategoryId", new
> IntegerValidator(), true );
> + $this->registerFieldValidator( "postCategoryName", new
> StringValidator(), true );
> + $this->registerFieldValidator( "userId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "userName", new StringValidator
> (), true );
> +
> + $this->setValidationErrorView( new ErrorView( $this->_blogInfo,
> "error_fetching_articles" ));
> }
>
> function validate()
> {
> + if( !parent::validate())
> + return false;
> +
> // value of the Date parameter from the request
> $this->_date = $this->_request->getValue( "Date", -1 );
>
>
> Modified: plog/trunk/class/action/resourceserveraction.class.php
> ===================================================================
> --- plog/trunk/class/action/resourceserveraction.class.php
> 2006-06-05 23:32:42 UTC (rev 3535)
> +++ plog/trunk/class/action/resourceserveraction.class.php
> 2006-06-05 23:38:33 UTC (rev 3536)
> @@ -8,6 +8,8 @@
> include_once( PLOG_CLASS_PATH."class/gallery/dao/
> galleryresources.class.php" );
> include_once( PLOG_CLASS_PATH."class/security/
> pipeline.class.php" );
> include_once( PLOG_CLASS_PATH."class/plugin/
> pluginmanager.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> stringvalidator.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> integervalidator.class.php" );
>
> /**
> * \ingroup Action
> @@ -31,6 +33,23 @@
> $this->_session = $session['SessionInfo'];
>
> $this->_config =& Config::getConfig();
> +
> + $this->registerFieldValidator( "resource", new StringValidator
> (), true );
> + $this->registerFieldValidator( "resId", new IntegerValidator(),
> true );
> + $this->registerFieldValidator( "albumId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "albumName", new StringValidator
> (), true );
> + $this->registerFieldValidator( "blogId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "blogName", new StringValidator
> (), true );
> + $this->registerFieldValidator( "userId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "blogUserName", new
> StringValidator(), true );
> +
> + // since this class does not return HTML code but files, we cannot
> + // return HTML so let's return 404 status code with a custom
> error message
> + $view = new ResourceServerView();
> + $view->addHeaderResponse( "HTTP/1.1 404 Not Found" );
> + $view->addHeaderResponse( "Status: 404 Not Found" );
> + $view->addHeaderResponse( "X-LifeType-Error: Invalid
> parameters" );
> + $this->setValidationErrorView( $view );
> }
>
> /**
> @@ -99,6 +118,9 @@
>
> function validate()
> {
> + if( !parent::validate())
> + return false;
> +
> // before we do anything, let's find out the blogId and if
> there isn't any, quit
> $this->_getBlogInfo();
> if( $this->_blogInfo == false ) {
> @@ -106,7 +128,7 @@
> $this->_view = new ResourceServerView();
> $this->_view->addHeaderResponse( "HTTP/1.1 404 Not Found" );
> $this->_view->addHeaderResponse( "Status: 404 Not Found" );
> - $this->_view->addHeaderResponse( "X-pLog-Error: Blog is not
> correct" );
> + $this->_view->addHeaderResponse( "X-LifeType-Error: Blog
> $resId is not correct" );
>
> return false;
> }
> @@ -128,7 +150,7 @@
> $this->_view = new ResourceServerView();
> $this->_view->addHeaderResponse( "HTTP/1.1 403 Forbidden" );
> $this->_view->addHeaderResponse( "Status: 403 Forbidden" );
> - $this->_view->addHeaderResponse( "X-pLog-Error: Access is
> blocked" );
> + $this->_view->addHeaderResponse( "X-LifeType-Error: Access is
> blocked" );
>
> return false;
> }
> @@ -151,7 +173,7 @@
> $this->_view = new ResourceServerView();
> $this->_view->addHeaderResponse( "HTTP/1.1 404 Not Found" );
> $this->_view->addHeaderResponse( "Status: 404 Not Found" );
> - $this->_view->addHeaderResponse( "X-pLog-Error: Album
> $albumId not found" );
> + $this->_view->addHeaderResponse( "X-LifeType-Error: Album
> $albumId not found" );
> return false;
> }
> $this->_albumId = $album->getId();
> @@ -198,7 +220,7 @@
> $this->_view = new ResourceServerView();
> $this->_view->addHeaderResponse( "HTTP/1.1 404 Not Found" );
> $this->_view->addHeaderResponse( "Status: 404 Not Found" );
> - $this->_view->addHeaderResponse( "X-pLog-Error: Resource $this-
> >_resId not found" );
> + $this->_view->addHeaderResponse( "X-LifeType-Error: Resource
> $this->_resId not found" );
>
> return false;
> }
>
> Modified: plog/trunk/class/action/rssaction.class.php
> ===================================================================
> --- plog/trunk/class/action/rssaction.class.php 2006-06-05 23:32:42
> UTC (rev 3535)
> +++ plog/trunk/class/action/rssaction.class.php 2006-06-05 23:38:33
> UTC (rev 3536)
> @@ -2,6 +2,8 @@
>
> include_once( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
> include_once( PLOG_CLASS_PATH."class/view/rssview.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> stringvalidator.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> integervalidator.class.php" );
>
> /**
> * \ingroup Action
> @@ -19,6 +21,14 @@
> function RssAction( $blogInfo, $request )
> {
> $this->BlogAction( $blogInfo, $request );
> +
> + $this->registerFieldValidator( "categoryId", new
> IntegerValidator(), true );
> + $this->registerFieldValidator( "profile", new StringValidator
> (), true );
> +
> + // generate a dummy view with nothing in it to signal an error
> + $view = new RssView( $this->_blogInfo, DEFAULT_PROFILE );
> + $view->setValue( "articles", Array());
> + $this->setValidationErrorView( $view );
> }
>
> /**
>
> Modified: plog/trunk/class/action/viewalbumaction.class.php
> ===================================================================
> --- plog/trunk/class/action/viewalbumaction.class.php 2006-06-05
> 23:32:42 UTC (rev 3535)
> +++ plog/trunk/class/action/viewalbumaction.class.php 2006-06-05
> 23:38:33 UTC (rev 3536)
> @@ -3,6 +3,7 @@
>
> include_once( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
> include_once( PLOG_CLASS_PATH."class/view/blogview.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> stringvalidator.class.php" );
>
> define( "VIEW_ALBUMS_TEMPLATE", "albums" );
> define( "VIEW_ALBUM_TEMPLATE", "album" );
> @@ -21,11 +22,19 @@
> function ViewAlbumAction( $actionInfo, $request )
> {
> $this->BlogAction( $actionInfo, $request );
> +
> + $this->registerFieldValidator( "albumId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "albumName", new StringValidator
> (), true );
> +
> + $this->setValidationErrorView( new ErrorView( $this->_blogInfo,
> "error_fetching_album" ));
> }
>
> // checks that the articleId is valid
> function validate()
> {
> + if( !parent::validate())
> + return false;
> +
> $this->_albumId = $this->_request->getValue( "albumId", 0 );
> $this->_albumName = $this->_request->getValue( "albumName" );
> // get the page from the request
>
> Modified: plog/trunk/class/action/viewarticleaction.class.php
> ===================================================================
> --- plog/trunk/class/action/viewarticleaction.class.php 2006-06-05
> 23:32:42 UTC (rev 3535)
> +++ plog/trunk/class/action/viewarticleaction.class.php 2006-06-05
> 23:38:33 UTC (rev 3536)
> @@ -1,6 +1,8 @@
> <?php
>
> include_once( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> integervalidator.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> stringvalidator.class.php" );
>
> /**
> * \ingroup Action
> @@ -24,14 +26,25 @@
> function ViewArticleAction( $actionInfo, $request )
> {
> $this->BlogAction( $actionInfo, $request );
> +
> + $this->registerFieldValidator( "articleId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "articleName", new
> StringValidator(), true );
> + $this->registerFieldValidator( "postCategoryId", new
> IntegerValidator(), true );
> + $this->registerFieldValidator( "postCategoryName", new
> StringValidator(), true );
> + $this->registerFieldValidator( "userId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "userName", new StringValidator
> (), true );
> +
> + $this->setValidationErrorView( new ErrorView( $this->_blogInfo,
> "error_fetching_article" ));
> }
>
> // checks that the articleId is valid
> function validate()
> {
> + if( !parent::validate())
> + return( false );
> +
> $this->_articleId = $this->_request->getValue
> ( "articleId" );
> $this->_articleName = $this->_request->getValue( "articleName" );
> -
> // find some other additional parameters and use some 'null'
> values
> // in casuse they're empty
> $this->_categoryId = $this->_request->getValue
> ( "postCategoryId", -1 );
> @@ -40,7 +53,7 @@
> $this->_userName = $this->_request->getValue( "userName" );
> $this->_date = $this->_request->getValue( "Date", -1 );
> $this->_isCommentAdded = ($this->_request->getValue( "op" ) ==
> "AddComment" );
> -
> +
> // Calculate the correct article date period
> $adjustedDates = $this->_getCorrectedDatePeriod( $this-
> >_date );
> $this->_date = $adjustedDates["adjustedDate"];
>
> Modified: plog/trunk/class/action/
> viewarticletrackbacksaction.class.php
> ===================================================================
> --- plog/trunk/class/action/viewarticletrackbacksaction.class.php
> 2006-06-05 23:32:42 UTC (rev 3535)
> +++ plog/trunk/class/action/viewarticletrackbacksaction.class.php
> 2006-06-05 23:38:33 UTC (rev 3536)
> @@ -1,6 +1,7 @@
> <?php
>
> include_once( PLOG_CLASS_PATH."class/action/blogaction.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> stringvalidator.class.php" );
>
> define( "VIEW_TRACKBACKS_TEMPLATE", "posttrackbacks" );
>
> @@ -24,11 +25,22 @@
> function ViewArticleTrackbacksAction( $actionInfo, $request )
> {
> $this->BlogAction( $actionInfo, $request );
> +
> + $this->registerFieldValidator( "articleId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "articleName", new
> StringValidator(), true );
> + $this->registerFieldValidator( "postCategoryId", new
> IntegerValidator(), true );
> + $this->registerFieldValidator( "postCategoryName", new
> StringValidator(), true );
> + $this->registerFieldValidator( "userId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "userName", new StringValidator
> (), true );
> +
> + $this->setValidationErrorView( new ErrorView( $this->_blogInfo,
> "error_fetching_article" ));
> }
>
> -
> function validate()
> {
> + if( !parent::validate())
> + return false;
> +
> $this->_articleId = $this->_request->getValue
> ( "articleId" );
> $this->_articleName = $this->_request->getValue
> ( "articleName" );
> $this->_categoryId = $this->_request->getValue
> ( "postCategoryId", -1 );
>
> Modified: plog/trunk/class/action/viewresourceaction.class.php
> ===================================================================
> --- plog/trunk/class/action/viewresourceaction.class.php 2006-06-05
> 23:32:42 UTC (rev 3535)
> +++ plog/trunk/class/action/viewresourceaction.class.php 2006-06-05
> 23:38:33 UTC (rev 3536)
> @@ -4,6 +4,7 @@
> include_once( PLOG_CLASS_PATH."class/view/errorview.class.php" );
> include_once( PLOG_CLASS_PATH."class/gallery/dao/
> galleryresources.class.php" );
> include_once( PLOG_CLASS_PATH."class/data/validator/
> integervalidator.class.php" );
> + include_once( PLOG_CLASS_PATH."class/data/validator/
> stringvalidator.class.php" );
>
> define( "VIEW_RESOURCE_TEMPLATE", "resource" );
>
> @@ -24,11 +25,21 @@
> function ViewResourceAction( $actionInfo, $request )
> {
> $this->BlogAction( $actionInfo, $request );
> +
> + $this->registerFieldValidator( "resId", new IntegerValidator(),
> true );
> + $this->registerFieldValidator( "resouce", new StringValidator
> (), true );
> + $this->registerFieldValidator( "albumId", new IntegerValidator
> (), true );
> + $this->registerFieldValidator( "albumName", new StringValidator
> (), true );
> +
> + $this->setValidationErrorView( new ErrorView( $this->_blogInfo,
> "error_fetching_resource" ));
> }
>
> // checks that the articleId is valid
> function validate()
> {
> + if( !parent::validate())
> + return false;
> +
> $this->_resourceId = $this->_request->getValue( "resId" );
> $this->_resourceName = $this->_request->getValue
> ( "resource" );
> $this->_albumId = $this->_request->getValue( "albumId" );
>
> Modified: plog/trunk/class/data/validator/rules/uintrule.class.php
> ===================================================================
> --- plog/trunk/class/data/validator/rules/uintrule.class.php
> 2006-06-05 23:32:42 UTC (rev 3535)
> +++ plog/trunk/class/data/validator/rules/uintrule.class.php
> 2006-06-05 23:38:33 UTC (rev 3536)
> @@ -2,7 +2,7 @@
>
> include_once(PLOG_CLASS_PATH."class/data/validator/rules/
> regexprule.class.php");
>
> - define( "UINT_RULE_REG_EXP", "^([1-9][0-9]*)|0$");
> + define( "UINT_RULE_REG_EXP", "^([0-9]+)$");
> define( "ERROR_RULE_UINT_FORMAT_WRONG",
> "error_rule_uint_format_wrong");
>
> /**
>
> Modified: plog/trunk/templates/rss/atom.template
> ===================================================================
> --- plog/trunk/templates/rss/atom.template 2006-06-05 23:32:42 UTC
> (rev 3535)
> +++ plog/trunk/templates/rss/atom.template 2006-06-05 23:38:33 UTC
> (rev 3536)
> @@ -2,11 +2,13 @@
> <feed version="0.3" xmlns="http://purl.org/atom/ns#"
> xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="{$locale-
> >getLanguageId()|lower}">
> <title>{$blog->getBlog()|escape}</title>
> <link rel="alternate" type="text/html" href="{$url->blogLink()}" />
> -{assign var="newestDate" value=$posts[0]->getDateObject()}
> -<modified>{$locale->formatDate($newestDate, "%Y-%m-%dT%H:%M:%S%O",
> $blog)}</modified>
> +{if $posts}
> + {assign var="newestDate" value=$posts[0]->getDateObject()}
> + <modified>{$locale->formatDate($newestDate, "%Y-%m-%dT%H:%M:%S%
> O", $blog)}</modified>
> +{/if}
> <tagline>{$blog->getAbout()|escape}</tagline>
> <generator url="http://www.lifetype.net/"
> version="1.0.2">LifeType</generator>
> -{assign var="blogOwner" value=$posts[0]->getUserInfo()}
> +{assign var="blogOwner" value=$blog->getOwnerInfo()}
> <copyright>Copyright (c) {$blogOwner->getUsername()|escape}</
> copyright>
> {foreach from=$posts item=post}
> <entry>
>
> Modified: plog/trunk/templates/rss/rss10.template
> ===================================================================
> --- plog/trunk/templates/rss/rss10.template 2006-06-05 23:32:42 UTC
> (rev 3535)
> +++ plog/trunk/templates/rss/rss10.template 2006-06-05 23:38:33 UTC
> (rev 3536)
> @@ -11,7 +11,7 @@
> <title>{$blog->getBlog()|escape}</title>
> <link>{$url->blogLink()}</link>
> <description>{$blog->getAbout()|escape}</description>
> - {assign var="blogOwner" value=$posts[0]->getUserInfo()}
> + {assign var="blogOwner" value=$blog->getOwnerInfo()}
> <dc:creator>{$blogOwner->getUsername()}</dc:creator>
> <dc:date>{$smarty.now|date_format:"%Y-%m-%dT%H:%M:%S"}Z</dc:date>
> <admin:generatorAgent rdf:resource="http://www.lifetype.net" />
>
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>
--
Paul Westbrook
paul at westbrooks.org
<http://www.westbrooks.org>
More information about the pLog-svn
mailing list