e107 + G2 session/cookie conflict?

Rash

Joined: 2006-03-04
Posts: 54
Posted: Thu, 2006-05-04 22:04

I'm using the Gallery2_e107 plugin by Mike Bremald to entigrate G2 into e107. I made a Random Image menu based on Mike's code to go along with this plugin. As I was testing the menu, I noticed that it was messing up the Chatbox and Cam's Online Menu (displays online user information). Cam's menu generates a message that the cookie might be corrupted. The Chatbox just tells me that I don't have any posts in the db (And there's plenty). After I saw this, I noticed that the G2 plugin is doing the same thing. (I hadn't noticed before because I run the Gallery in a custom layout w/out any side menus)

I've switched e107 to tracking by Session instead of cookies, and that fixed Cam's menu, but the chatbox is still hosed.

It gets more interesting... Depending on the order of the menus, what breaks changes. Example: If I do it 'Cam --> Random --> Chat' then Cam's and the Random will work, but the the chat. Rearrange it to look like 'Chat --. Random --> Cam's' and the chat works, but not Cam's. Put the Random last, and they all work. Put the Random first, and the other two die.

Here's a list of the cookies being set by my site:
GALLERYSID <== for the gallery software
PHPSESSID <== presumably set by e107 for session tracking?
e107_tzOffset <== Timezone offset? (set by e107)
e107_tdOffset <== Time of Day offset? (set by e107)
e107_tdSetTime <== Sets the time? (set by e107)

If you track by cookie, e107 sets a cookie called ECOOKIE

System Info:
Last Run Details:

Gallery version = 2.0.4 core 1.0.0.4
PHP version = 4.3.10 apache2handler
Webserver = Apache/2.0.53 (Linux/SUSE)
Database = mysql 4.1.10a
Toolkits = ArchiveUpload, Exif, ImageMagick, Thumbnail, Gd
Operating system = Linux bubbles 2.6.11.4-21.11-default #1 Thu Feb 2 20:54:26 UTC 2006 i686
Browser = Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.3) Gecko/20060426 Firefox/1.5.0.3

I'm using 2.0.4 of G2 because the plugin for e107 has not been updated yet (The author is moving back to the states from Belgium and wont be able to work on it for a while).

Anyone have any ideas why the G2 integration would be causing this kind of cookie/session conflict? Is there any other information I can give that would help? I'm pretty much clueless as to where to start. Any help would be appreciated! Thanks!

If it helps, here's the code for the Random Image menu block. It's pretty much the same as the code for the plugin (since I "borrowed" it ;) ):

<?php

if (!defined('e107_INIT')) { exit; }

$sql -> db_Select("gallery2Plugin", "*", "1");
list($id, $path, $relativeG2Path, $embedUri, $loginredirect, $displaysidebar, $displaylogin) = $sql-> db_Fetch();

//If the user is logged in to e107, we want to pass his userid
//!!!!!!!!!!Comment out this if structure and just assign the 
//value 0 to $activeuser if you just want everyone to see the
//gallery as guest
if (USERID == 'USERID') {
  $activeuser = '0';
}
else {
  $activeuser = USERID;
}
       require_once($path . 'embed.php'); 
     	   $ret = GalleryEmbed::init(array( 
          'embedUri' => $embedUri,
          'embedPath' => "/",
          'fullInit' => 'true', 
          'relativeG2Path' => $relativeG2Path, 
          'loginRedirect' => $loginredirect, 
          'activeUserId' => $activeuser)); 
          
		list ($ret, $imageBlockHtml) = GalleryEmbed::getImageBlock( array(
		'blocks'  => 'randomImage',
		'show'    => 'title',
		'maxSize' => 170));
		GalleryEmbed::done();



$text = "<div style='text-align:center'>
		$imageBlockHtml
		</div>";
$caption = "Random Photo";
$ns->tablerender($caption, $text, 'g2random_photo');
?>