Mambo and G2 embedding

leeman

Joined: 2005-03-19
Posts: 22
Posted: Sat, 2005-03-26 11:42

I guess my problem is that you have to be logged on to Mambo to be able to see the Gallery link ...

And when I try to log on to the gallery thru the module I get a userID error ...

I'm not a coder ..
Has anyone any Idea of how I can prohibit the mambo user id to be passed to G2 login module. ......?

 
miopa

Joined: 2005-03-28
Posts: 3
Posted: Tue, 2005-03-29 13:45

Hi all

I have embeded G2 with mambo as explained in previous posts, and it works fine to the point when gallery is not the first item in the mambo mainmenu and the sidebar module is not displayed with other menu items except gallery.

The main reason for not working properly in the mentioned cases is error in the paths. For example:

If the url of the page is

the url of the image in the random image block in the sidebar module is

and shold be

what happens is that the good relative path is added to the existing relative path, instead of replacing it in. I'm not sure if this is issue with the mambo component or G2 embed engine. It would be helpfull if someone gives me some leads about this so i could investigate further.

 
scroogie

Joined: 2005-02-21
Posts: 9
Posted: Wed, 2005-03-30 13:04
Quote:
what happens is that the good relative path is added to the existing relative path, instead of replacing it in.

Thats a gallery2 embedded issue. G2 constructs the wrong path because it just strips the integration path you set in the options. Because the current url is not the integration path, it fails.
Thats an issue that is known (you can find many threads with this issue), i therefor hope it will be corrected in the next alpha. Until then, you can help yourself by setting the $_SERVER['REQUEST_URI'] to your gallery2 integration path.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-03-30 13:41

- G2 is in beta, so there won't be a next alpha, but a next beta.
- how would you correct this issue? what does G2 wrong? IMO it's wrong input in the GalleryEmbed::init call, how should G2 not create wrong urls if it is configured incorrectly?
I'm thinking about how the whole relativepath/embedUri config could be changed, but i'm not quite sure how it could be done.

 
miopa

Joined: 2005-03-28
Posts: 3
Posted: Wed, 2005-03-30 18:17

Thanks scroogie, you're right.

Adding $_SERVER['REQUEST_URI'] = "/"; in the beggining of the modules/mod_galleryside.php does the trick.

Quote:
- how would you correct this issue? what does G2 wrong? IMO it's wrong input in the GalleryEmbed::init call, how should G2 not create wrong urls if it is configured incorrectly?

Well, scroogie already wrote, and i've tested it also, it works ok only when embedUri is substring of $_SERVER['REQUEST_URI'] (or $_SERVER['REQUEST_URI'] is the root of the site).

It appears easy to correct, just ignore $_SERVER['REQUEST_URI'] when creating url strings.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Wed, 2005-03-30 18:33

i'm planning to do something like that, but until now, this is an integral part of how G2 urls are generated. stay tuned.

 
miopa

Joined: 2005-03-28
Posts: 3
Posted: Wed, 2005-03-30 19:29

There is another (unrelated) issue i discovered. I'm using macedonian localization in mambo (with utf-8 charset), and when the gallery component is loaded the date displayed in mambo is in english.

I added Mecedonian in modules/core/classes/GalleryTranslator.class and set it as default in the galery admin menu, and now it's displayed in macedonian but with ISO-8859-5 instead of utf-8.

I've tried to specify the correct locale in the GalleryTranslator.class, but failed. It should be "mk_MK.utf-8". Looks like this is a general problem with G2 localization.

Still, i think that G2 should not mess with the site locale when called thru Embed functions.

Workaround for this issue is to set the correct locale again at the end of the components/com_gallery2/gallery2.php file in DrBob's component.

 
jrandom

Joined: 2004-12-05
Posts: 58
Posted: Fri, 2005-04-01 13:40

I've tried to embed the G2 beta 1 in Mambo 4.5.2.1, but I can't see any pictures. Setup is:
/home/me/public_html/gallery/
/home/me/public_html/main/ (for mambo)

Config for component:
Full path: /home/me/public_html/gallery/
Rel path: ../gallery/
EmbedURI: index.php?option=com_gallery2
Login redirect: index.php
Sidebar: NO
Login: NO

Module is published on the first position on the right, no title. I tried everything suggested in the forums, nothing worked. Also tried all possible combinations for paths (and some impossible ones as well). What am I doing wrong? If you can help me (and others) by posting some sort of Howto in the forums, it would be greatly appreciated.

 
jrandom

Joined: 2004-12-05
Posts: 58
Posted: Fri, 2005-04-01 14:18

For the record, I also tried to append the &Itemid=2 (in my case) to the embedURi string. As a matter of fact, I copy/pasted the links from my site and some links from DrBob's site (where G2 works just fine), and there seems to be no difference, except that mine doesn't show any images.

For the random image:
DrBob/index.php?option=com_gallery2&Itemid=x&g2_view=core:ShowItem&g2_itemId=y&g2_GALLERYSID=z
MySite/index.php?option=com_gallery2&Itemid=x&g2_view=core:ShowItem&g2_itemId=y&g2_GALLERYSID=z

For a thumbnail:
DrBob/index.php?option=com_gallery2&Itemid=x&g2_view=core:ShowItem&g2_itemId=y&g2_GALLERYSID=z
MySite/index.php?option=com_gallery2&Itemid=x&g2_view=core:ShowItem&g2_itemId=y&g2_GALLERYSID=z

Any ideas?

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-04-02 00:35

miopa, and all who are interested. I have changed how urls are created in embedded G2. There is no longer a dependency of the generated urls on the REQUEST_URI (the url with which you accessed embedded G2).

See GalleryEmbed::init. There's a new parameter 'embedPath'. Take a look at the last post of the Embedding & Integration topic.

I would really like to encourage one of you guys to update the mambo integration code such that i can commit it to the gallery cvs repository.
then, you could always get the newest version of the mambo module from galleryupdates.jpmullan.com.

 
ShadowX

Joined: 2005-04-04
Posts: 7
Posted: Mon, 2005-04-04 20:58

I've updated the mambo component and module to reflect that change - and I made a "transparent" matrix theme that looks good when gallery is embedded in mambo. They worked with the nightly from 31 march. Test before using on production sites etc etc :)

Here they are:

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-04-04 21:10

ShadowX, kudos! Can we see a demo and can I add the code to the cvs?

 
ShadowX

Joined: 2005-04-04
Posts: 7
Posted: Mon, 2005-04-04 21:12

Personal discovery, which might be interesting to the rest of the class:

I had Mambo configured on a subdomain (mambo.mysite.com) and gallery on another (gallery.mysite.com), and I just couldn't get them to work together. Naturally, I had two folders (mambo and gallery) in my public_html folder, and I configured each on its own subdomain. WRONG. Mambo just didn't want to access gallery (which, in hindsight, doesn't seem to be that out of the ordinary, considering that it tried to form URLs like "mambo.mysite.com/gallery/..." which obviously do not exist.

Solution: configured the mambo. subdomain to redirect to www .mysite.com/mambo, and configured Mambo (manually edited the configuration.php) main page as www .mysite.com/mambo. Worked like a charm. Hope that helps.

[edit] I'm not giving the address of my site here because it's not finished yet. Only the software is in place, and I have a load of pictures to upload. When I'll have at least a few shots in the gallery, I'll post the link here so you can have a look.

 
ShadowX

Joined: 2005-04-04
Posts: 7
Posted: Mon, 2005-04-04 21:16

Ok... darn :) address is www.loridani.net , let me upload a few pics :)

 
ShadowX

Joined: 2005-04-04
Posts: 7
Posted: Mon, 2005-04-04 21:31

Like I said, there's nothing there, just the software. I have some 6GB of pics to process before creating the gallery proper. I've temporarily added 4 pics so that you can see the embedding at work. I'm using the latest mambo (4.5.2.1) and a recent G2 nightly (I think the one from 2nd or 3rd of april). I remember now having to upgrade, because the march 31st nightly didn't have the embedPath yet. Valiant, if you're happy with the way it works, you can commit it to CVS. Unfortunately I don't have time to develop it further, but maybe someone else can take over the user integration.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-04-04 21:35

excellent work ShadowX. i'll commit it to cvs, so that everyone can download it from http://galleryupdates.jpmullan.com#integrations (or directly from cvs).

 
aravot
aravot's picture

Joined: 2005-03-05
Posts: 61
Posted: Tue, 2005-04-05 00:16

Nice work ShadowX, one comment, one question.

Question: Is this the revised version of DrBob's work or completely different

Comment: Version number for the build(s) would be nice.

 
ShadowX

Joined: 2005-04-04
Posts: 7
Posted: Tue, 2005-04-05 07:35

Aravot, this is indeed the revised version of DrBob's work, and all credit goes to him and whoever else made this happen. I just added the code for embedPath.

Let me repeat: if someone has time and knowledge enough to continue this integration, (s)he's welcome to it, because I have neither. I hacked this just to make it work on my site, and I published it here so that others can profit from my two hours' work :)

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Wed, 2005-04-06 23:22

I tried testing these out. I get errors when I try to install the module and component into Mambo.

The original module and component at the beginning of this thread installs/uninstalls fine but these give me this error when I try to install them:

Upload component failed:
public_html/media/install_42546e9391a5e/com_gallery2/gallery2.php does not exist!

I think they may have been packed wrong.

The download had folder com_gallery2/gallery2/<files>

I changed it to com_gallery2/<files> and it installed OK. :-?

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Thu, 2005-04-07 00:10

OK, after making the changes I mentioned above, it's working. It looks MUCH better now. It fits real nice now.

It kind of acts weird though.

SOmetimes when I click on an album it works fine. Sometimes I get:

Quote:
Forbidden
You don't have permission to access /index.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

I then have to close my browser, wait a few seconds and open it up again and it works. Strange.

 
steinmb01
steinmb01's picture

Joined: 2005-04-07
Posts: 31
Posted: Thu, 2005-04-07 00:35

I also have problem installing the module and component:
Installing module com_gallery or
mod_g2_sidebar I get:
Could not find an XML setup file in the package.

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Thu, 2005-04-07 12:38

Yeah, just repack it like I did.

Basically, all I did was extract the files to my HD. Then movied the files up one level, deleting the "gallery2" folder" and it installed fine.

Do the same for the module.

 
steinmb01
steinmb01's picture

Joined: 2005-04-07
Posts: 31
Posted: Thu, 2005-04-07 14:42

mmmm did that, and still prob. It is looking like this now:
mod_g2_sidebar.zip
drwxr-xr-x 5 steinmag steinmag 170 7 Apr 16:30 module
./module:
-rw-r--r-- 1 steinmag steinmag 3230 4 Apr 17:12 mod_galleryside.php
-rw-r--r-- 1 steinmag steinmag 544 4 Apr 17:12 mod_mostrated.xml

com_gallery2.zip
-rw-r--r-- 1 steinmag steinmag 4293 4 Apr 17:12 admin.gallery2.html.php
-rw-r--r-- 1 steinmag steinmag 4075 4 Apr 17:12 admin.gallery2.php
-rw-r--r-- 1 steinmag steinmag 4077 4 Apr 17:12 gallery2.php
-rw-r--r-- 1 steinmag steinmag 3542 4 Apr 17:12 gallery2.xml
drwxr-xr-x 4 steinmag steinmag 136 7 Apr 16:30 images
-rw-r--r-- 1 steinmag steinmag 1237 4 Apr 17:12 toolbar.gallery2.php

Same error messages. Strange....
Using Mambo 4.5.1a Stable and Apache/1.3.33 (Darwin) PHP/5.0.3

--
Stein

 
steinmb01
steinmb01's picture

Joined: 2005-04-07
Posts: 31
Posted: Thu, 2005-04-07 16:00

Replay to my self :) Created the repacked zip-files on a Mac but someting dont work. Created a tar-file of the component and it installed sucessfully!

I had also to remove both the module and the gallery2 folder on the sidebar module package.... Now it installed scuessfully, but is not listed in the list of installed modules ?????

 
ShadowX

Joined: 2005-04-04
Posts: 7
Posted: Thu, 2005-04-07 18:17

Funny... I didn't get any errors at all. Maybe upgrading will solve your issues - I use 4.5.2 and a G2 nightly (3 or 4th of April, version 0.9.6). Of course I tested this before publishing it here, wouldn't anyone? :)

By the way, I've put together a small demo site, with a howto describing what I've done, and the pitfalls I barely escaped from. I'll keep it there for a while - I don't have my contents up and running anyway. You can find it at www.loridani.net . Hope it helps. If you find any bugs, please let me know as well (or post them here).

[update] I just checked the sister thread on the mambo forums: http://forum.mamboserver.com/showthread.php?t=22917&page=2&highlight=gallery+integration . It's been made sticky and it's the first thread on the Custom Development forum (title is "Gallery Menalto team is looking for Mambo developers to help"). Hopefully we'll get someone to help us with the user authentication as well.

[update 2, to keep this small] Stein, don't remove the "modules" dir from the modules component. That's why the modules are not displayed.

[update 3 final, for KAC] I checked in the mambo installation, and indeed the com_gallery2 folder doesn't have a gallery2 subfolder. On the other hand, the zip file from which I installed said component does have one. Most strange, this. In other words, me don't get it. I looked at DrBob's original zipfiles, and they also have the gallery2 subfolder in there (you may also check, they're on the first page of this thread). If you could install from a com_gallery2.zip that contains the gallery2 folder and then check with a file manager the \components\com_gallery2 and \administrator\components\com_gallery2 folders, that might shed some light on the issue. Here's the code from the gallery2.xml:

    <administration>
        <menu link="option=com_gallery">Gallery2</menu>
        <files>
            <filename>admin.gallery2.php</filename>
            <filename>admin.gallery2.html.php</filename>
            <filename>toolbar.gallery2.php</filename>
        </files>
        <images>
            <filename>images/logo-228x67.png</filename>
        </images>
    </administration>

I compared it with a few other components, and it looks just fine to me.

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Thu, 2005-04-07 19:15

ShadowX,

I totally understand what you're saying. I saw the same thing. DrBob's original component zip DID have the gallery2 folder.

I tried it at least 4 times though. His installed and uninstalled fine, yours didn't until I removed the gallery2 folder........?....and it appears steinmb01 found the same thing.

I'm running 4.5.2 Mambo with the 4-4-05 G2 Snapshot.

Your first "[update]" is pretty exciting. I hope we get some people on this cuz G2 is great and the combination would be super.

BTW, I didn't repack the module, just the component. I simply installed DrBob's module and overwrote the individual files via FTP. It worked.

Also, feel free to take a peak at my family site: http://www.seemypics.net

 
ShadowX

Joined: 2005-04-04
Posts: 7
Posted: Thu, 2005-04-07 19:55

Hmm... maybe it's because I edited and then packed it under Windows? I continue to not get it.

 
steinmb01
steinmb01's picture

Joined: 2005-04-07
Posts: 31
Posted: Thu, 2005-04-07 22:17

I upgraded Mambo from 4.5.1 to 4.5.2 but it did not do the trick.
G2 is an CVS version (6 april).
removed the old php and xml file from mambo/modules dir.
Downloaded this version of Sidebar:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=25979

It now installed, but it does not view the images and so on:

G2 i running OK if I load it like this:
http://85.164.213.222/~steinmagnebjorklund/Mambo/index.php?option=com_gallery2

Loading the main page, it looks like this:
http://85.164.213.222/~steinmagnebjorklund/Mambo/index.php?option=com_frontpage&Itemid=1

--
Stein

 
randycarver
randycarver's picture

Joined: 2005-04-08
Posts: 1
Posted: Fri, 2005-04-08 15:40

Thanks for your work DrBob, Shadowx and Valiant!

The mod_g2_sidebar.zip has a mod_mostrated.xml that should be named mod_galleryside.xml. This also needs to be changed in CVS.

In DrBob's Mod_g2_sidebar.zip there is a mod_mostrated.zip as well as a mod_mostrated.php and mod_mostrated.xml. Is mod_mostrated part of the gallery release or is that what DrBob used for his template? I don't think its needed!

I also had problems installing the component until I repacked it from the com_gallery2 directory.

Attached is the sidebar module I used and here's what I did to create it:
1. I unpacked ShadowX's mod_g2_sidebar.zip
2. Renamed mod_g2_sidebar/module/mod_mostrated.xml to mod_g2_sidebar/module/mod_galleryside.xml.
3. Made a new zip from that contains /module/mod_galleryside.xml and /module/mod_gallerside.php (from the mod_g2_sidebar dir)

BTW if you want to reinstall the sidebar, make sure you delete the php and xml files as well as the database row in mos_modules.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-04-08 16:15

i don't know mambo at all, i'm just the maintainer of the gallery2 integrations cvs.

could someone verify that the changes of randycarver are an improvement? (no offence, if it works for 1 person, it's not sure it works for all)
then i could change it accordingly in the cvs.

 
jimmy_boi

Joined: 2005-04-05
Posts: 50
Posted: Fri, 2005-04-08 21:40
DrBob wrote:
Over the week-end I dedicated some time to find a way to embed G2 into Mambo 4.5.1 (latest version). I started from the embedding component for Gallery 1 and some other code I found here (php-nuke integration).

So first and foremost, thanks to the people who created that code. I merely adapted it :-)

Attached you will find the component which you should install in Mambo using the admin and create a suitable menu link to it. You will also have to provide the following values for the component.

1) The full absolute path to the gallery installation
2) The relative path to the gallery installation

I installed the component on my site here

There are still some thing going wrong like the displaying of the gallery (CSS issue?) Also, there is no real integration now (just embedding).

I really hope that this can be the starting point for more advanced php goeroes since I'm a VERY beginner in PHP.

Kind regards,
DrBob

hi

thx for the info...but i'm still having some problems to embed my gallery to mambo..can someone help me out?

mambo (v4.5.2) and gallery (v1.4.4 p6) is already installed and working fine alone..but now i want to embed my gallery to mambo...

i read ur thread...i downloaded those 2 zipped files and extracted it...then i copied the all files from the "gallery2" folder to my ftp account /public_html/gallery/contrib/mambo/.

then i logged in to mambo as a super administrator...chose "Components-->install/uninstall-->inserted the path (/public_html/gallery/contrib/mambo/gallery2.xml) -->Upload File & Install"

but then i get this message..

**** Upload component - Upload Failed
ERROR: Could not find an XML setup file in the package.

[ Continue ... ]

****Upload component - Failed
Installation file not found:
/home/mydomain/public_html/Mambo/media/install_4256f49778fc8/
[ Continue ... ]

what am i doing wrong? need help..thank you

jimmy

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Fri, 2005-04-15 20:36

I need a little help!

Everything seemed to be working OK. I have Gallery2 embedded into Mambo with It set up so that you can not see the G2 sidebar module or the link to the gallery without being logged in.

One user pointed out to me that she could not "view" the comments she added under a picture. So what I did was log in as the admin to G2 to edit the permissions of the root album so "Everybody" can "view comments".

After doing that, I got that 404 Forbidden error. I explained earlier in this thread:

Quote:
Forbidden
You don't have permission to access /administrator/index2.php on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

--------------------------------------------------------------------------------

Apache/1.3.33 Server at www.francofriends.com Port 80

I then closed the browser, reopened it, went back to the site homepage.
All was good until I logged into mambo. As soon as I log into mambo, it took me straight to the default white Gallery Login page. It was not embedded. It was just the default G2 template covering the whole page.

I then tried to log in but could not. I type in my info and it doesn't do anything. Therefore, I can't access the site admin area.

I deleted all the GALLERSID related cookies hoping that was it but that did not help.

I had to disable the G2 sidebar so that site would still work after logging in without going straight to the Gallery login page.

It sounds like something got corrupt.

Any ideas?

I have lots of e-mails asking what happened to my site.......??????? Help!

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Fri, 2005-04-15 21:13

KAC, I hope someone who's familiar with Mambo and this integration can help you. As you see, there's noone really supporting the mambo integration.

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Sat, 2005-04-16 20:00

valiant,

I don't think it's a problem with the embedding or with Mambo, I think it's a problem with the Gallery. The reason is, I have uninstalled the Gallery2 module and component for Mambo then I updated my Gallery install to the latest snapshot build and ran the "Upgrade" process successfully.

At the end of the upgrade process it says "go to you gallery" (or something like that. I click on it and at this point I'm expecting Gallery to work in standalone mode. Am I wrong?

I have the gallery installed in a subfolder as follows:
http://www.francofriends.com/g2gallerymain/main.php

When I enter that address in my browser, it automatically redirects me to:
http://www.francofriends.com/g2gallerymain/main.php?g2_view=core:UserAdmin&g2_subView=core:UserLogin&g2_return=http%3A%2F%2Fwww.francofriends.com%2Fg2gallerymain%2Fmain.php&g2_returnName=album&g2_navId=

Now I'm at the gallery log in screen but it won't let me log in. I type my login name and password and nothing happens.

At this point, I just want G2 running standalone and I'll worry about the embedding stuff later.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-04-16 20:12

- clear all your GALLERYSID cookies of the domain.
- try again to login.

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Sat, 2005-04-16 21:49

OK, that was it. That was probably my problem the whole time.

I deleted the GALLERYSID files by searching for GALLERYSID using X1 Search on my PC. After looking at the cookies in Firefox, I found there were some more that X1 did not list.

Well I'm back in business now. Thanks for taking the time to read this valiant!

Now to set up the embedding again. :D

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Sat, 2005-04-16 21:57

yes i mean clearing the cookies on your pc.
if that didn't help, erm.
empty the folder g2data/sessions/
and try again deleting all GALLERYSID cookies on your pc.
it can't be anything else in standalone G2.

 
decomike

Joined: 2004-11-25
Posts: 13
Posted: Sun, 2005-04-17 12:47

I think i overlook something, i can't get it work :evil:

Mambo 4.5.2 and gallery 2 beta 2, all working fine but not when i use mambo to call gallery, then i see only i white screen.

Gallery is installed in:
/home/httpd/vhosts/domain.com/httpdocs/www/gallery_2/

Mambo is installed in:
/home/httpd/vhosts/domain.com/httpdocs/www/

Component settings: (use several different settings)
Full path: /home/httpd/vhosts/domain.com/httpdocs/www/gallery_2/
Relative path to G2: /gallery_2
Path to mambo: /www
embedUri: index.php?option=com_gallery2&Itemd=69

Where do I go wrong????

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Sun, 2005-04-17 19:22

decomike,

I see two things that look wrong to me. Try this:

1) You have: Relative path to G2: /gallery_2
Should be: Relative path to G2: ../gallery_2
or
Should be: Relative path to G2: ./gallery_2

The "." period(s) before "/gallery_2" should be there.

2) You have: Path to mambo: /www
Should be: Path to mambo: /

Nothing after the "/"

Give that a go! :-)

 
decomike

Joined: 2004-11-25
Posts: 13
Posted: Mon, 2005-04-18 08:17

Thanks for the input KAC!

I try these option with no luck. Still got the same problem.

Gr. Mike.

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Mon, 2005-04-18 15:06

Ok, try the things I listed above with:

embedUri: index.php?option=com_gallery2

Take out the "&Itemd=69"

 
[kings]Egg

Joined: 2005-04-18
Posts: 9
Posted: Mon, 2005-04-18 15:18

Hi all,

First off, thanks to all those who developed the mambo integration for G2. It worked fine for me, but I needed pass-through user authentication - so I've spent the last day or so implementing this. The scheme I've used is for the Mambo component to silently create a new G2 user whenever a registered Mambo user uses the component. I've also added an option that allows users to auto-create themselves an album in the root album with the same name as their username. This is mainly for my own website but thought it might be useful to others, so you can enable it from the Mambo admin interface if you like.
Things to bear in mind: i haven't checked it, it might well be very buggy, it could do with a refactor, and I'm a bit of a mambo / gallery / PHP n00b so it might not be the best code in the world. Also, users are not deleted from Gallery if you remove them from Mambo. A usr tidying option on the admin interface could sort that out. Anyway, if some people try it out and find that it works, then maybe valiant could add it to the CVS... :D

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-04-18 15:36

[kings]Egg, I'm a G2 dev and responsible for the integrations, i.e. I try to help people like you integrating G2 in other applications.
I just took a look at your code and have a couple of "improvements". It's great what you accomplished and you seem to understand the API of G2.

1. You don't use the GalleryEmbed API, (see embed.php in Gallery). It should simplify a lot. i.e. you create a G2 user manually .
That way you miss the mambo user <-> G2 user mapping.
And you if mambo also uses md5 for password hashes, you can set the G2 password directly, without using a random password.
2. And you call fetchusercount on each request which is kind of slow.

see my porposed solution:
http://gallery.menalto.com/index.php?name=PNphpBB2&file=viewtopic&t=25027&start=60#129275
the phpnuke integration uses also this pattern.

It would be great if you could also use the same pattern or tell me if you have a better solution.

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Mon, 2005-04-18 16:01

[kings]Egg,

Good stuff. Thank god for people like you. :-)

Would this module automatically log you into Gallery once you log into Mambo or does it just create the user name and password in Gallery?

 
decomike

Joined: 2004-11-25
Posts: 13
Posted: Mon, 2005-04-18 17:14

KAC, still nothing. Still got nothing, nada, noppes, niets.

 
[kings]Egg

Joined: 2005-04-18
Posts: 9
Posted: Mon, 2005-04-18 17:19

KAC: Cheers, and yes, it automatically logs you in if you're logged in in mambo.
valiant: Thanks for the comments, i'll have a look at it this evening if I get time. I don't have a clue about the gallery2 API - my knowledge of it is based on using Ctrl-F a lot of times last night so clues on what to do are great! :D

 
[kings]Egg

Joined: 2005-04-18
Posts: 9
Posted: Mon, 2005-04-18 20:55

Right then.
Here's the latest version, complete with the recommended GalleryEmbed pattern for user logins. Thi s means that (hashed) Mambo passwords are now copied across along with full name and email data, so the user is cloned properly. It also makes the scripts smaller and faster. Thanks valiant! much easier with that method 8)
When I get round to it I'll probably add a CleanUserTables admin function to remove user data when the person has been removed from Mambo. Unless somebody else wants to do it of course!

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Mon, 2005-04-18 21:03

YOU DA MAN [kings]Egg!

I'll toast to you tonight. :D

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Mon, 2005-04-18 21:32

[kings]Egg, great!
if a couple of you mambo guys have tested the new code, i will commit it to the G2 cvs repository.

[kings]Egg, i have just thought about my small code snippet. acutally, the second GalleryEmbe::init request could just be a GalleryEmbed::checkActiveUser request. it's a little faster... not that important though, because not that more fast.

see http://gallery.menalto.com/index.php?name=PNphpBB2&file=posting

 
KAC

Joined: 2004-12-01
Posts: 164
Posted: Mon, 2005-04-18 22:04

[kings]Egg,

I installed your component. First off, I had to repack it in order for it to install succesfully. I repacked it just like I did for the one ShadowX posted ealier in this thread. Then it installed just fine.

Secondly, it works great for ne users I create in Mambo.

When I try to login to Mambo with my admin password and go to Gallery2, I get this error:

Quote:
Error (GALLERY_SUCCESS)

* in at line 0