RSS module and Beta2?

ballsmag

Joined: 2005-04-14
Posts: 3
Posted: Thu, 2005-04-14 17:10

Rss.inc (0.2.4 -- is there newer?) fails on (line number might be off because I've made changes):

Fatal error: Call to a member function on a non-object in /home/cash/public_html/g2b2/modules/rss/Rss.inc on line 149

It appears to break as a result of:

        $query = sprintf('
            SELECT DISTINCT
              [GalleryEntity::id], [GalleryEntity::creationTimestamp]
            FROM
              [GalleryEntity], [GalleryPermissionMap],
                [GalleryItemAttributesMap=1], [GalleryItemAttributesMap=2],
                [GalleryPhotoItem]
            WHERE
              [GalleryPermissionMap::itemId] = [GalleryEntity::id]
            AND (
                    [GalleryPermissionMap::userId] = ?
                    OR
                    [GalleryPermissionMap::groupId] IN ( %1$s )
                )
            AND
              %2$s > ?
            AND
              [GalleryItemAttributesMap=2::itemId] = ?
            AND
              [GalleryItemAttributesMap=1::parentSequence] LIKE %3$s
            AND
              [GalleryItemAttributesMap=1::itemId] = [GalleryEntity::id]
            AND
              [GalleryEntity::id] = [GalleryPhotoItem::id]
            ORDER BY
              [GalleryEntity::creationTimestamp] %4$s, [GalleryEntity::id] %4$s',
            $groupIdMarkers, $andPermission, $concatParentSequenceItemId, $direction);


        $data[] = $gallery->getActiveUserId();
        array_splice($data, sizeof($data), 0, $groupIds);
        $data[] = $storage->convertIntToBits($permissionBits);
        $data[] = $storage->convertIntToBits(0);
        $data[] = $itemId;
        $options = array();
        $options['limit'] = array('count' => $maxItems, 'offset' => 0);

        list ($ret, $searchResults) = $gallery->search($query, $data, $options);

My first thought is this has to do with a new permission scheme? That's pure speculation, as I don't really know much (anything) about the g2 internals. I'm working on it myself but posting in case anyone can provide insight.

I do note, however, that it would probably be better served if this massive query could be accomplished through API calls which might prevent this going forward.

 
ballsmag

Joined: 2005-04-14
Posts: 3
Posted: Thu, 2005-04-14 17:54

I looked at it a bit more and found the problem to be, as I suspected, with the GalleryPermissionMap. It's an awful cheap hack which totally ignores permissions, but it works (and it has a couple other changes to the RSS output I've added for my own purposes, which I will detail in another post if there is interest)

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-04-14 18:01

lol, ignoring permissions. :)

however. an official rss module is in the works, but it might take a while.

 
ballsmag

Joined: 2005-04-14
Posts: 3
Posted: Thu, 2005-04-14 18:27

I know I know :)

I don't use view permissions at all, so it's not a big deal for me. Among the other changes are the additions of maxItems and direction query variables, which gives you more specific control over the RSS feed without making global changes. The typical way you'll use this is to add &g2_maxItems=10&g2_direction=ASC (direction can be ASC or DESC meaning ascending or descending).

I use this to generate a photoblog page from a Gallery album.

 
c4actbe
c4actbe's picture

Joined: 2004-09-01
Posts: 83
Posted: Sat, 2005-04-16 05:41

Hack didn't work...
* in modules/core/classes/helpers/GalleryUserHelper_medium.class at line 209 (gallerystatus::error)
* in modules/core/classes/GalleryCoreApi.class at line 488 (galleryuserhelper_medium::assertsiteadministrator)
* in modules/core/SiteAdmin.inc at line 46 (gallerycoreapi::assertuserissiteadministrator)
* in modules/core/classes/GalleryView.class at line 239 (siteadminview::loadtemplate)
* in main.php at line 293 (siteadminview::doloadtemplate)
* in main.php at line 79
* in main.php at line 70

 
HorsePunchKid
HorsePunchKid's picture

Joined: 2005-05-04
Posts: 89
Posted: Wed, 2005-05-04 22:15

Thanks for your hacked version, ballsmag. It took some additional hacking to get it working; mainly just commenting out some lines in Rss.inc relating to preferredid and thumbnailid. I can't say I was paying much attention to the changes I made, but at least it's working!

This helped me do something I've been wanting to do for a long time now: have a gallery of n of the most recently created or modified items. So I just used the RSS feed in conjunction with Magpie to produce this page, which does exactly what I want.