I just recently switched my installation of zenphoto to a new server that's running PHP5, and I think that transition is what caused this.
I'm getting the error on my page:
[i]Fatal error: Call to a member function on a non-object in /home/ballenty2/www/cubistmediagroup.com/clientzen2/zp-core/template-functions.php on line 1185[/i]
It looks like this is being called when next_image() is being called, and specifically this line:
`$_zp_images = $_zp_current_album->getImages($all ? 0 : ($imagePage), $firstPageCount, $sorttype);`
I am using a slightly out of date version of ZP, but I can't upgrade (I've hacked the hell out of this install, everything I've done would be impossible to transition to the new version). This is the whole next_image() function:
` function next_image($all=false, $firstPageCount=0, $sorttype=null, $overridePassword=false) {
global $_zp_images, $_zp_current_image, $_zp_current_album, $_zp_page, $_zp_current_image_restore, $_zp_conf_vars, $_zp_current_search, $_zp_gallery;
if (!$overridePassword) { if (checkforPassword()) { return false; } }
$imagePageOffset = getTotalPages(true) - 1; /* gives us the count of pages for album thumbs */
if ($all) {
$imagePage = 1;
} else {
$_zp_conf_vars['images_first_page'] = $firstPageCount; /* save this so pagination can see it */
$imagePage = $_zp_page - $imagePageOffset;
}
if ($firstPageCount > 0) {
$imagePage = $imagePage + 1; /* can share with last album page */
}
if ($imagePage <= 0) {
return false; /* we are on an album page */
}
if (is_null($_zp_images)) {
if (in_context(ZP_SEARCH)) {
$searchtype = true;
$_zp_images = $_zp_current_search->getImages($all ? 0 : ($imagePage), $firstPageCount);
} else {
$_zp_images = $_zp_current_album->getImages($all ? 0 : ($imagePage), $firstPageCount, $sorttype);
}
if (empty($_zp_images)) { return false; }
$_zp_current_image_restore = $_zp_current_image;
if (in_context(ZP_SEARCH)) {
$img = array_shift($_zp_images);
$_zp_current_image = new Image(new Album($_zp_gallery, $img['folder']), $img['filename']);
} else {
$_zp_current_image = new Image($_zp_current_album, array_shift($_zp_images));
}
save_context();
add_context(ZP_IMAGE);
return true;
} else if (empty($_zp_images)) {
$_zp_images = NULL;
$_zp_current_image = $_zp_current_image_restore;
restore_context();
return false;
} else {
if (in_context(ZP_SEARCH)) {
$img = array_shift($_zp_images);
$_zp_current_image = new Image(new Album($_zp_gallery, $img['folder']), $img['filename']);
} else {
$_zp_current_image = new Image($_zp_current_album, array_shift($_zp_images));
}
return true;
}
}`
I'm not too familiar with OOP, especially with PHP, so I'm having trouble figuring out what's happening. I think the main issue is with $_zp_current_album. Is it not being defined correctly somehow?