Mike’s Linux Desktop Experiences

January 8, 2009

Experimentation with Zenphoto

Filed under: Uncategorized — Mr. Mike @ 5:42 am

I’ve been doing some experimentation with Zenphoto. Trying to create a good php feed for Facebook so that I can be a bit more lazy about posting travel updates. Right now I can transcode a bunch of videos and images on my machine, upload them to Zenphoto, visit the gallery and it will generate the rss feeds and thumbs and everything on the fly.

The problem, or a problem, because there have been many, is that Facebook seems to mess up the RSS feeds. I sent them a message to find out if they could do anything about it. A URL like:

http://www.kallies.ca/photos/zp-core/i.php?a=080705-12%20Sudbury%20to%20Port%20Perry&i=DSCN1110.JPG

Gets converted to

http://www.kallies.ca/photos/zp-core/i.php?a=080705-12%20Sudbury%20to%20Port%20Perry&%3Bi=DSCN1110.JPG

So I did some searching about mod_rewrite and stuff, but instead found a nice idea to just replace some of the variables right off the bat. This is much more precise and should not introduce gaping security holes… unless they’re already there. At the top of i.php in zencore I added:

<?php
// Hack around a facebook bug where & gets changed to &amp%3B
if(isset($_GET['amp;i']))
{
  $_GET['i']=$_GET['amp;i'];
}
if(isset($_GET['amp;s']))
{
  $_GET['s']=$_GET['amp;s'];
}
if(isset($_GET['amp;ch']))
{
  $_GET['ch']=$_GET['amp;ch'];
}
if(isset($_GET['amp;t']))
{
  $_GET['t']=$_GET['amp;t'];
}
if(isset($_GET['amp;cw']))
{
  $_GET['cw']=$_GET['amp;cw'];
}
?>

It seems to work. I’m posting it here, because well, I need to have this somehwere so that when I eventually upgrade, I remember what I did.

What I’m not sure about is why the %3B is converted to a semicolon in the variable names.  I know %3B is a semicolon, but why is it *converted*?  I’m surprised that a semicolon is a valid array index in PHP.

No Comments Yet »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a comment

Blog at WordPress.com.