Mambo 4.5.2 and getorderby

chrix1165

Joined: 2005-06-20
Posts: 3
Posted: Mon, 2005-06-20 02:09

Sorry for posting this because I see there are others with the same problem. Problem for me is, with all these posts I have yet to see anyone answer this question.

I'm using Mambo 4.5.2 and G2 beta3. I installed com_gallery2 and it works fine. However, if I'm logged in as admin I can view pictures. If I'm logged in as a normal user, you can see thumbnails but can't click on a picture. Same thing happens with random thumbnails etc. Below is the error I receive. Anyone have a fix for this?

Fatal error: Call to undefined function: getorderby() in /home/path/gallery2/modules/core/classes/helpers/GalleryChildEntityHelper_simple.class on line 480

 
artemido
artemido's picture

Joined: 2005-02-08
Posts: 24
Posted: Wed, 2005-06-22 18:38
artemido wrote:
more information:

I ran thru the following use case as a user, admin, and guest:

1. access mambo main page
2. log in
3. click on link to embedded gallery
4. open first album
5. click on first picture
6. go to page to execute phpinfo()

In each case, I noticed that the http header data (namely the http_cookie) had some subtle differences.

as user: sessioncookie=4b6c78911a247b1d4c9a820e3ef2b04b; usercookie[username]=username; usercookie[password]=50be3f1e50be3f1e50be3f1e50be3f1e; GALLERYSID_34355e=27031eeebda9ec91801a39f7bfde98f0

as guest: sessioncookie=4b6c78911a247b1d4c9a820e3ef2b04b; GALLERYSID_34355e=bffe0c9d36eef6c250bf0c8de25d05ac

as admin: sessioncookie=4b6c78911a247b1d4c9a820e3ef2b04b; GALLERYSID_34355e=bffe0c9d36eef6c250bf0c8de25d05ac

Also, as guest I noticed that the URL contained an extra parameter tacked onto the end containing the GALLERYSID data where there was none in the other two requests. As stated before the guest and admin users function without difficulty. I scanned thru gallery2.php and noticed that the only portion of code that differentiates between users and guests+admin is below, so something must be happening in this code block that is causing problems with users... I suppose it could be a combination of other bits of code, but I didn't see anything else in the code that would execute for all users whose username != admin.

            if (!empty($my->username) && (strcasecmp($my->username, 'admin')!=0))
            {
                // Check to see if they have an album

                list ($ret, $rootAlbum) = GalleryView::_getItem();
                if ($ret->isError())
                {
                    return 0;
                }

                list ($ret, $childIds) = GalleryCoreApi::fetchChildAlbumItemIds($rootAlbum);
                if ($ret->isError())
                {
                    return 0;
                }
                if (!empty($childIds))
                {
                    list ($ret, $items) = GalleryCoreApi::loadEntitiesById($childIds);
                    if ($ret->isError())
                    {
                        return 0;
                    }

                    $found_album = false;
                    foreach ($items as $child)
                    {
                        if (strcasecmp($child->getTitle(), $my->username)==0)
                        {
                            // Yes, they have an album
                            $found_album = true;
                            break;
                        }
                    }
                    if ($found_album == false)
                    {
                        if ($special_action == 'create_album')
                        {
                            // If they want an album, create one!
                            CreateUserAlbum($my);
                        }
                        else
                        {
                            echo '<p>You currently don't have a photo album, but you're entitled to one. '
                                .'<a href="http://' . $HTTP_HOST . $PHP_SELF . '?' . $_SERVER['QUERY_STRING']
                                .'&special_action=create_album' . '">Create my album!</a></p>' . "\n";
                        }
                    }
                }
            }

 
artemido
artemido's picture

Joined: 2005-02-08
Posts: 24
Posted: Wed, 2005-06-22 18:39

oh, delete that block of code and it should fix the problem... :D

 
chrix1165

Joined: 2005-06-20
Posts: 3
Posted: Wed, 2005-06-22 22:04
artemido wrote:
oh, delete that block of code and it should fix the problem... :D

Delete the block of code? Which block and what would it fix?

 
chrix1165

Joined: 2005-06-20
Posts: 3
Posted: Thu, 2005-06-23 11:03

FIXED

Thanks to michiel_1981, I got my problem solved. Hopefully this will help others. Within my Mambo Administration, Components, Gallery2... I changed two things. I changed my Relative path to Gallery G2 from /gallery2 to just gallery2. I also changed embedUri from index.php?option=com_gallery2 to index.php?option=com_gallery2&Itemid=66.

Itemid=66 certainly would be unique to each site so you'll need to figure out which id this is for you. Hopefully this will help others, it worked for me. Thanks again to michiel_1981.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-06-23 11:12

please add this information / fix to the mambo sticky topic. kudos.

 
sketchy
sketchy's picture

Joined: 2005-06-28
Posts: 2
Posted: Tue, 2005-06-28 12:46

Maybe not fixed, because I'm thinking the problem I'm having is closely related. But I'm new to this so may be completely wrong.

Mambo 4.5.2.3, G2 beta 3 - nightly build 27th June.
Using Community Builder for user registration.

As an administrator or as a guest, I can view album thumbnails, go into albums, and then into the full size image fine from within Mambo. As a registered user, clicking on a thumbnail within an album gives me :
"Fatal error: Call to undefined function: getorderby() in ... /gallery2/modules/core/classes/helpers/GalleryChildEntityHelper_simple.class on line 508"

I have set the "Relative path to Gallery G2" to "gallery2",
and set the "embedUri:" to "index.php?option=com_gallery2&Itemid=51"
And all URL's seem to start with www.

If I go from the Gallery2 directory (bypassing Mambo), it works fine.

I have tried every permutation of the "Relative path..." and "embedUri:" parameters that I can think of, and no dice.

mambo site is at : http://www.lightwaveoz.org
gallery is at : http://www.lightwaveoz.org/gallery2/main.php

Oh, and the gum boots are dumb test images.... Any ideas appreciated.

 
michiel_1981

Joined: 2005-05-19
Posts: 430
Posted: Tue, 2005-06-28 13:27

sketchy,

give me your gallery core version and your configuration settings for gallery2 all of them?
could you make a test accaunt for me and send those to me using PM. I can't duplicate the problem and i'm using community builder also.

grtz,
Michiel

[edit]
duplicated the problem succesfully.
deactivate album creation for users for now, i though it worked and just copied it from the last component, it doesn't and it is probably community builder messing up the my->username call.
[edit2]
more problems with album creation for users, they can create albums in every album that exist except the one they created!!

put it on todo list

 
sketchy
sketchy's picture

Joined: 2005-06-28
Posts: 2
Posted: Tue, 2005-06-28 13:57

great, thanks for that.

 
rza

Joined: 2005-05-08
Posts: 34
Posted: Wed, 2005-06-29 08:10

finally i see people having same problem as me...hope they fix this soon...mine problem is slightly different..logined as site admin i get that error too..but if you are the main gallery admin, u can view the pics...weird problem...

 
rza

Joined: 2005-05-08
Posts: 34
Posted: Mon, 2005-07-25 07:51

any solution to this yet? i tried the same thing but did not get solved..

 
michiel_1981

Joined: 2005-05-19
Posts: 430
Posted: Mon, 2005-07-25 11:24

rza,

you tried this with the latest of both gallery2 and the component?

regards,
Michiel

ps: the album creation for users is still a little buggy.