Hey marcus,
we changed a bit the lightbox.php file and now it works, you can see results at
http://www.exil.be/index.php?fr_info
It was the preg_replace he (he as in 'the server') didn't like, don't know why, apparently the $1 in $linkreplacer was a problem...
Here is the modified lightbox:
Code: Select all
<?php
// MAKE LIGHTBOX v1.0.1
// marcus@localhorst (m.o.) 03.04.2007
//
// ------------------------------------
// The red lights mean you're leaving
// The white ones mean returning
// Tell me how this story ends
// And I'll keep them fires burning
// --------------------- ARCADE FIRE --
//
# \|/
# --o--
# /|\
$template_default_article_imagelist_table_class = $template_default['article']['imagelist_table_class'];
$template_default_article_imagelist_class = $template_default["article"]["imagelist_class"];
$template_default_article_imagelist_caption_class = $template_default["article"]["imagelist_caption_class"];
//echo "<pre>";print_r($GLOBALS["phpwcms"]);echo "</pre>";
// change the following only if required!
function makelightbox($img,$thumb,$caption="",$pos="gallery_0") {
$img = base64_decode($img);
$thumb = stripslashes($thumb); // holds the pure orginal htmlcode for displaying the thumbimage
// $caption = convert_to_anything($caption); //maybe you need to check the caption for something illegal ;-)
list($img, $width_height) = explode('?', $img);
$img = $GLOBALS["phpwcms"]["content_path"].$GLOBALS['phpwcms']['cimage_path'].$img;
// #------------------------------------------------------------------------------
// if you use phpwcms version 1.1 use this line!
// $img = $GLOBALS["phpwcms"]["file_tmp"]."".$GLOBALS["phpwcms"]["dir_preview"]."".$img;
// #------------------------------------------------------------------------------
// if you want to use an other presentation methode or an other script you can change the linkage here.
$image ="<a href=\"".$img."\" rel=\"lightbox[".$pos."]\" title=\"".$caption."\">".$thumb."</a>";
return $image;
}
// first search for given css class $template_default_article_imagelist_class to seperate each gallery-table
$searchcp ='#<table.*[^>]class="'.$template_default_article_imagelist_table_class.'">(.*)<\/table>#Us'; // U = ungreedy
preg_match_all($searchcp,$content["all"],$matchcp, PREG_PATTERN_ORDER);
// if found one or more picture tables loop through then and replace for each.
foreach($matchcp[0] as $mypos => $piccp) {
if (!$mypos > 0) {
$block["htmlhead"] .="<!-- Lightbox 2.02 -->\n";
$block["htmlhead"] .="<script type=\"text/javascript\" src=\"".$phpwcms['templates']."inc_app/lightbox/js/prototype.js\"></script>\n";
$block["htmlhead"] .="<script type=\"text/javascript\" src=\"".$phpwcms['templates']."inc_app/lightbox/js/scriptaculous.js?load=effects\"></script>\n";
$block["htmlhead"] .="<script type=\"text/javascript\" src=\"".$phpwcms['templates']."inc_app/lightbox/js/lightbox.js\"></script>\n";
$block["htmlhead"] .="<link href=\"".$phpwcms['templates']."/inc_app/lightbox/css/lightbox.css\" rel=\"stylesheet\" type=\"text/css\" />\n";
$block["htmlhead"] .="<!-- //Lightbox 2.02 -->\n";
}
$pos = "gallery_".$mypos; // this give unique names for the gallery slideshow.
// search for imagelisttd which describe the image table
$search ='#<td class="'.$template_default_article_imagelist_class.'">(.*)<\/td>#U'; // U = ungreedy
preg_match_all($search,$matchcp[0][$mypos],$match, PREG_PATTERN_ORDER);
//print_r($match);
// search for .imglistcaption class to grab the caption
$searchcapt ='#<td class="'.$template_default_article_imagelist_caption_class.'">(.*)<\/td>#U'; // U = ungreedy
preg_match_all($searchcapt,$matchcp[0][$mypos],$matchcapt, PREG_PATTERN_ORDER);
if(is_array($match[1])) {
// now loop through the matches and replace them with the custom code from function makelightbox
// var_dump($match[1]);
foreach($match[1] as $i => $imgcell) {
// begin philippe at piezo (or ple AT alter DOT be)
// just a hack, not secure, but works as possible
$pletabtemp = split('<a href=',$imgcell);
if(count($pletabtemp)>1){
$pletabtemp2=split("show=",$pletabtemp[1]);
$pletabtemp3=split("%3D%3D",$pletabtemp2[1]);
$ple_img_code =$pletabtemp3[0];
$ple_img_decode =base64_decode($pletabtemp3[0]);
$pletabtemp5 = split("\?",$ple_img_decode);
$ple_img_decode = $pletabtemp5[0];
$pletabtemp4 = split('\" ',$match[1][$i]);
$ple_vars = $pletabtemp4[2].'" '.$pletabtemp4[3].'" '.$pletabtemp4[4].'" '.$pletabtemp4[5].'" '.$pletabtemp4[6].'" ';
$ple_img_src = '<img src="'.$GLOBALS["phpwcms"]["content_path"].$GLOBALS['phpwcms']['cimage_path'].$ple_img_decode.'"'.$ple_vars.'/>';
$linkreplacer =makelightbox($ple_img_code,$ple_img_src,'','$pos');
//echo $ple_img_src;
//$caption=$matchcapt[1][$i]; // get image caption if available - if not, it's empty
//$linkfind ='#<a href="image_zoom.php\?show=(.*)".*[^>]>(.*)</a>#Ue';
$content["all"] = str_replace($match[1][$i], $linkreplacer, $content["all"]);
}
// end philippe
/*$caption=$matchcapt[1][$i]; // get image caption if available - if not, it's empty
$linkfind ='#<a href="image_zoom.php\?show=(.*)".*[^>]>(.*)</a>#Ue';
$linkreplacer ="makelightbox('$1','$2','$caption','$pos')";
$replace = preg_replace($linkfind,$linkreplacer,$match[1][$i]);
// last thing is replace the exact strings with the new one
//$content["all"] = str_replace($match[1][$i], $linkreplacer, $content["all"]);*/
}
}
}
?>
Philippe (vow), who did the coding says he didn't check it thouroughly so it might not be very 'clean' or even secure, can you tell me what you think about it?
Thanks for your help,
Cheers