disabling gallery outside of mambo

dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-09-15 16:22

Would it be possible to make it so that if a visitor accidentally reaches the non-embedded version of a Gallery page on my site, they would be redirected to the embedded version (or even just to the main page)?

With all the customization I've done to the embedded version of the site, the non-embedded version loooks pretty bad and I would rather people didn't see that, even if accidentally.

The only problem is that I administrate the site in the non-embedded version. So, would I be able to make it so that if the admin was not logged in to a non-embedded page, it would redirt you?

I'm not really sure where I could start with this, so if someone could point me in the right direction, that would be great.

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-15 17:42

you can set mode.embed.only in config.php of g2 to true.
but then, Gallery Remote won't work anymore (that's a bug).

also, you can access all g2 admin sites (site admin) througth embedded g2, no need to do that from g2 standalone.

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-09-15 18:06

Unfortunately, I think it's a bit more complicated for me. I'm using an older version of the embedding component in mambo and I'm not sure it will allow administrating the site from within mambo. Also, I've made so many modifications to the templates and styles, I'm not sure I could get all the system links and admin options to work in there anymore.

Basically, I know the logic I want to be able to insert into my templates (I would probably just need to put it into the album and photo templates for my purposes), but I don't know how to code it with smarty and Gallery's variables. It would be something like this in pseudo code:

if ( (user != admin) && (gallery == standalone) {
redirect to index.php
}

If anyone can either help me code this or direct me to a resource that might help me figure out how to code this myself, I would really appreciate it.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Thu, 2005-09-15 18:39

you can add this to your theme.tpl file

{if !$isEmbedded && !$user.isAdmin}
{php}
header("Location: /index.php");
{/php}
{/if}

That does assume you have output buffering turned on (because of the header statement).

 
valiant

Joined: 2003-01-04
Posts: 32509
Posted: Thu, 2005-09-15 18:46

i didn't say you can administer g2 from mambo, i said you can administer g2 when accessed from mambo.
in the embedded g2, you still have the site admin link in g2 which lets you do anything you can do in standalome g2.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Thu, 2005-09-15 18:49

I run embedded Mambo and I have no problem administering the gallery2. I am using 2.08 but I was using 2.06 and didn't have any problems then either. What version of the Mambo component are you using?

Steve Lineberry

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-09-15 19:01

Like I said before, I have heavily customized this and one of the modifications I made was to remove the site admin link from the mambo portion of the site (Idon't want it visible to users). So, getting to the admin section isn't really possible through mambo. It's very much possible I did this in a way I shouldn't have - I'm obviously not a developer - but, up until this issue, it has worked fine for me.

Not really sure what version of the component I'm using, but I know it was one of the first versions of it though. I never changed it because I got it working and I wasn't sure I would be able to successfully update it and have it work again. :)

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-09-15 19:04

Also, I just tried the code you posted shocksll and it gave me the following error:

Warning: Cannot modify header information - headers already sent by (output started at /home/dsphoto/public_html/g2data/smarty/templates_c/%%2737391778/%%3A^3A8^3A818B59%%theme.tpl.php:6) in /home/dsphoto/public_html/g2data/smarty/templates_c/%%2737391778/%%3A^3A8^3A818B59%%theme.tpl.php on line 7

I tried it at a few different places in the document with no luck.

I also tried replacing the php redirect with a javascript redirect. That worked in the non-embedded pages, but it also, unfortunately, worked in the embedded pages (so, anytime I visited the embedded gallery section, it redirected to index.php).

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-09-15 19:04

double post

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-09-15 19:28

Just looking around a little bit at my site and I've found that the navBar with the "site admin" link isn't getting created in the embedded version of the site. The code where it should be just has the divs and nothing between, but it does get created in the non-embedded version.

I'm kinda confused now...

(p.s. the code tag doesn't seem to be working for me...)

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-09-15 21:23

I just looked up the isEmbedded variable and it appears I am running a version of Gallery from a week before that was implemented. I don't really want to have to upgrade either - every time I have, something has gone wrong and I have had to do so much work to correct things and my site is currently too close to being done for me to take the chance that I'll have to do that again. :(

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Thu, 2005-09-15 21:31

First of all, I said that is you plan on using the Header function you need to have output buffering turned on (look in your php.ini file). Second, I would HIGHLY suggest upgrading to unpossible, I had a smooth upgrade on all 9 of my gallery2 installs.
Also, please explain what you did to remove the site admin link from gallery2? That link won't show up to anyone that isn't an admin. Are all your users admins?
Steve Lineberry

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-09-15 22:20

Well, I haven't had a smooth time of it with each of my three gallery installs. In fact, I have had to redo all of my customizations each time. I don't know that it is necessarily a problem with gallery, but possibly with my server or with my connection to it.

The link I don't want displayed to my users is the login link. No, they won't be able to log in (I'm the only account, the only admin), but I just didn't want to display the link to them. I hid these links on the mambo page via css, but that shouldn't get rid of the content of the div.

Like I said, I don't have a clue why the site admin link doesn't get created at all in the embedded page. All that is there are the divs that would surround the navBar content, but the navBar isn't there. But then it is present in the non-embedded version. I wouldn't even know how to do that if I tried, so I can't say what happened to produce that result.

 
shocksll
shocksll's picture

Joined: 2005-06-22
Posts: 352
Posted: Thu, 2005-09-15 22:47

There should be some options in your mambo component on whether to show the login link or not. Are you coping any modified files into a local directory before modifing theme? if not, that is probably why your customizations aren't keeping when you upgrade.

Steve Lineberry

 
dsawchuk

Joined: 2005-01-22
Posts: 84
Posted: Thu, 2005-09-15 23:19

Well, I just decided to show and hide content via css and javascript based on whether the admin is logged in and it seems to work. It's not an ideal solution, but it will do until I figure something better out.

As for installing, yes, I have been putting all my modified files into local directories, but I still have problems.