WPG2 breaking WordPress in FireFox & Safari

wooter

Joined: 2006-01-07
Posts: 6
Posted: Wed, 2007-09-26 05:54

Continuing http://www.galleryembedded.com/forums/viewtopic.php?t=8318, I have found that this error does not occur when the visitor has admin rights when visiting the site. When the visitor is not logged in, however, the code breaks at the place where a WPG2-tagged image would be inserted.

 
ozgreg
ozgreg's picture

Joined: 2003-10-18
Posts: 1378
Posted: Wed, 2007-09-26 13:03

Only if you are using Lightbox right, if the lightbox script is disabled you do not have this issue?
____________________________________
Wordpress / Gallery2 (WPG2) Author

 
wooter

Joined: 2006-01-07
Posts: 6
Posted: Wed, 2007-09-26 13:16

I turned off the internal WPG2 lightbox script, and installed the Slimbox WordPress plugin, which is a drop-in replacement for Lightbox, without any result.

If you look into the document source of my webpage, you really see the code being stopped right where the first content would be where a WPG2-tagged image would be included.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Wed, 2007-09-26 16:40

Ozgreg and I chatted about this. Since it's working when you're logged in as an admin, the part of WPG2 that generates the image tag is working, in general.

Does your standalone gallery display correctly when not logged in? If so, then it's not a Gallery2 permissions issue for the guest user.

Is there anything in your embedded theme that relies on the user id? Ozgreg's thought was that your theme may be breaking the image tag for a non-registered user. Did the same theme work for a previous version of WPG2?

Is it working for you in IE? When I go to it, it breaks every time, regardless of IE or FF.

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
wooter

Joined: 2006-01-07
Posts: 6
Posted: Thu, 2007-09-27 07:24

Gallery2 works fine stand-alone and within WordPress.

The problem is theme-independent; I prefer K2 but the problem even happens in the Default WordPress theme.

The problem basically happens with the default theme, with WPG2 as only active plugin, when the WPG2 Lightbox-setting "Should WPG2 Tags have Lightbox Support?" is enabled and the user is not logged in (a normal anonymous visitor), and breaks WordPress output from the first bit of content where a WPG2-tagged image is included.

I already reinstalled WordPress (excluding the DB), WPG2, K2... All are now running on latest versions (WP2.3, WPG2 3.0RC, K2 1.0).

The post "Awaiting Delivery" has the following content in the database:

field post_content:

Quote:
Today, my dealer called me to tell a "white stork" brought "something".

<wpg2>7484</wpg2><wpg2>7490</wpg2><wpg2>7476</wpg2><a href="http://www.shush.com/gallery/d/7490-1/_MG_8739.JPG?g2_GALLERYSID=96bb64b879b82df6b9fb7015462987f5" rel="lightbox[bmw320predelivery]" title="_MG_8739.JPG"> </a>

Parsed through WPG2 and WordPress, with me as admin visiting, this becomes

Quote:
<p>Today, my dealer called me to tell a &#8220;white stork&#8221; brought &#8220;something&#8221;.</p>

<div class="wpg2tag-image"><a href="http://wouter.shush.com/v/various/auto/carpark/BMW320D/Pre-delivery/_MG_8737.JPG.html" title="_MG_8737.JPG"><img src="http://www.shush.com/gallery/d/7485-2/_MG_8737.JPG?g2_GALLERYSID=2dedf4597d281951184e049f2c9eb5c6" width="150" height="100" id="IFid1" class="ImageFrame_none" alt="_MG_8737.JPG"/></a></div>
<div class="wpg2tag-image"><a href="http://wouter.shush.com/v/various/auto/carpark/BMW320D/Pre-delivery/_MG_8739.JPG.html" title="_MG_8739.JPG"><img src="http://www.shush.com/gallery/d/7491-2/_MG_8739.JPG?g2_GALLERYSID=2dedf4597d281951184e049f2c9eb5c6" width="150" height="100" id="IFid2" class="ImageFrame_none" alt="_MG_8739.JPG"/></a></div>
<div class="wpg2tag-image"><a href="http://wouter.shush.com/v/various/auto/carpark/BMW320D/Pre-delivery/_MG_8740.JPG.html" title="_MG_8740.JPG"><img src="http://www.shush.com/gallery/d/7477-2/_MG_8740.JPG?g2_GALLERYSID=2dedf4597d281951184e049f2c9eb5c6" width="150" height="100" id="IFid3" class="ImageFrame_none" alt="_MG_8740.JPG"/></a></div>
<p><a href="http://www.shush.com/gallery/d/7490-1/_MG_8739.JPG?g2_GALLERYSID=96bb64b879b82df6b9fb7015462987f5" rel="lightbox[bmw320predelivery]" title="_MG_8739.JPG"> </a></p>

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 10:28

This is strange. Now, I'm seeing the three images that are in the WPG2 tags, but no the one that's in the HTML lighbox tag. Same in both IE and FF.

Ahh. It's because there is no img tag within the a tag. Please try deleting that one. It shouldn't affect the wpg2 tags.

But at least I'm seeing the wpg2 tagged images now. Are you seeing them?

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
wooter

Joined: 2006-01-07
Posts: 6
Posted: Thu, 2007-09-27 12:01

Oh yes, the reason is I disabled lightbox support. Let me turn it back on.

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 12:41

I'm seeing the error again.

Could you make a new admin account, something like wpg2, and send Ozgreg and me PMs with the password so that we can look at it from behind the scenes?

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 15:39

<wpg2>7484</wpg2><wpg2>7490</wpg2><wpg2>7476</wpg2>
I fixed it. It turns out that on your server the lightbox part of the code is case sensitive. It only works if the tags are upper case: WPG2

I changed it to
<WPG2>7484</WPG2><WPG2>7490</WPG2><WPG2>7476</WPG2>
and it worked.

Now, this is very strange, because G2Image Chooser puts out lower case tags, and they work on my dev box, my demo site, and www.wpg2next.com. So, I'm not sure why it has to be upper case on your server.

Ozgreg, have you seen anything like this before?

EDIT: I changed the code to look for lower case by default, and removed the logic that could allow the replacement to be case sensitive. (That logic was never used, so I'm still not sure how your server is case sensitive, unless it's ignoring the case insensitive flag on the preg_replace.) I also can't figure out why it is case sensitive for LightBox, but not in normal ops...

EDIT 2: Please try the latest SVN snapshot to see if that removes the case sensitivity for you.

EDIT 3: Never mind. I just looked at the post again, and the WordPress "auto HTML clean-up" code automatically makes the tags lower case, even if you edit them to be upper case. Unless you updated to the SVN snapshot between my first and second look, I think what fixed that entry was removing the messed-up hyperlink that I suggested removing above. (It didn't have an img tag within it.)

<a href="http://www.shush.com/gallery/d/7490-1/_MG_8739.JPG?g2_GALLERYSID=96bb64b879b82df6b9fb7015462987f5"
rel="lightbox[bmw320predelivery]" title="_MG_8739.JPG"> </a>

So, while all of the changes that I just made do clean the code up a little, they really don't matter for this issue...

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
wooter

Joined: 2006-01-07
Posts: 6
Posted: Thu, 2007-09-27 19:31

I didn't have any time to roll out SVN snapshots. What I could see now, is that it still is broken, and within the Wordpress Manage>Posts, the content of the post in code is:

Quote:
Today, my dealer called me to tell a "white stork" brought "something".

<wpg2>7484</wpg2><wpg2>7490</wpg2><wpg2>7476</wpg2>

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 19:46

This is killing me... (Not your fault, just (bleep)ing computers.)

Ok, so now I'm still seeing the links work in FF, even when logged out with cache disabled. But in IE, I'm not seeing them work. (I suspect my FF is really caching, even though I'm using the Web Developer plugin to disable it.)

I'll take another look...

EDIT: Yeah, it's still broken. No clue. Will ponder while stuck in traffic...

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Thu, 2007-09-27 21:22

Wooter,

OK, I found that it was the "Download Item" URL rewrite that was breaking it. Which led me to find an error in the LightBox URL generation function. Please try the latest SVN snapshot again. (It may not fix it on your server, but it fixed the error on my dev box.)

(By the way, I turned your "Site Admin" URL rewrite off, because it's not working right now. I think I'm getting closer to having it working, but it's not there yet.)

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website

 
wooter

Joined: 2006-01-07
Posts: 6
Posted: Fri, 2007-09-28 05:52

I put up the snapshot, and turned the original theme and plugins on. I figure you changed something, since as an admin, lightbox works, but as a visitor, you just get the mod-rewrite link to the wpg2 gallery picture :)

 
capt_kirk

Joined: 2006-01-24
Posts: 492
Posted: Fri, 2007-09-28 10:03

Hmm. Well that fixed the broken wpg2 links, at least!

The "Download Items" URL rewrite is still the immediate culprit. If I turn it off, Lightbox works as guest, too. But that breaks your HTML links, so that's not a real fix, just a troubleshooting pointer.

I cannot recreate this problem on my dev box or on my demo site. I'll try to think of a reason the Download Items rewrite rule would cause this behavior. I probably won't get to any more troubleshooting until Sunday at the earliest because of a Boy Scout campout.

At least your site isn't hard broken now, just not doing lightbox like it should...

Kirk
____________________________________
G2Image Documentation, G2Image Demo Page, My Family Website