[pLog-svn] r3743 - plog/trunk/class/gallery/dao

Oscar Renalias oscar at renalias.net
Thu Jul 20 05:57:22 GMT 2006


When talking about resources, we talk about an owner and not about a
blog. The code that handles resources was designed to be sort of an
independent library meant to be reused in other applications if
necessary.

However, every time a method needs an owner/user id parameter, we'll
be passing a blog id because resources are always owned by blogs and
not by users.

On 7/20/06, Jon Daley <plogworld at jon.limedaley.com> wrote:
>         This sounds like the sql error that has an empty owner_id.
> I just grepped through the code, and I think that something is broken with
> this function (and possibly other functions like getUserResources?) that
> should be accepting a owner_id instead of a blog_id?  The comments for
> getUserResources says blog_id, but the code says owner_id...
>         I think the blog_id is being passed in most of the cases for
> getNumUserResources.
>         Oscar - what should this be doing?
>
> On Wed, 19 Jul 2006, oscar at devel.lifetype.net wrote:
>
> > Author: oscar
> > Date: 2006-07-19 21:11:53 +0000 (Wed, 19 Jul 2006)
> > New Revision: 3743
> >
> > Modified:
> >   plog/trunk/class/gallery/dao/galleryresources.class.php
> > Log:
> > modified getNumUserResources so that no blog id needs to be provided (just leave it as '-1')
> >
> >
> > Modified: plog/trunk/class/gallery/dao/galleryresources.class.php
> > ===================================================================
> > --- plog/trunk/class/gallery/dao/galleryresources.class.php   2006-07-19 21:11:11 UTC (rev 3742)
> > +++ plog/trunk/class/gallery/dao/galleryresources.class.php   2006-07-19 21:11:53 UTC (rev 3743)
> > @@ -255,7 +255,13 @@
> >               {
> >                       $prefix = $this->getPrefix();
> >                       $table  = "{$prefix}gallery_resources";
> > -                     $cond = "owner_id = '".Db::qstr( $ownerId )."'";
> > +
> > +                     $cond = "";
> > +                     if( $ownerId != -1 )
> > +                             $cond = "owner_id = '".Db::qstr( $ownerId )."'";
> > +                     else
> > +                             $cond = "owner_id = owner_id";
> > +
> >             if( $albumId > GALLERY_NO_ALBUM )
> >               $cond .= "AND album_id = '".Db::qstr($albumId)."'";
> >                       if( $resourceType > GALLERY_RESOURCE_ANY )
> >
> > _______________________________________________
> > pLog-svn mailing list
> > pLog-svn at devel.lifetype.net
> > http://devel.lifetype.net/mailman/listinfo/plog-svn
> >
>
> --
> Jon Daley
> http://jon.limedaley.com/
>
> We are all made different, but we are all sinners.
> -- Jim Herron
> _______________________________________________
> pLog-svn mailing list
> pLog-svn at devel.lifetype.net
> http://devel.lifetype.net/mailman/listinfo/plog-svn
>


More information about the pLog-svn mailing list