$list=array();
function parseFile($galleryfile) {
$parser=xml_parser_create();
xml_set_element_handler($parser,"tag_open","tag_close");
if (!($fp=fopen ($galleryfile,"r"))) { die("could not open XML input file: $galleryfile"); }
$data="
"; $line=""; $markerfound=FALSE;
while (!(feof($fp) || ($markerfound && strchr($line,'')))) {
$line=fgets($fp,4096);
if ($markerfound) $data=$data . $line;
else
if (strchr($line,'')) $markerfound=TRUE;
}
$data=$data . "";
// printf("data:
%s
", htmlentities($data));
if (!xml_parse($parser,$data)) {
die(sprintf("XML error %s, at line %d:
%s
",
xml_error_string(xml_get_error_code($parser)),
xml_get_current_line_number($parser),
htmlentities($data)
));
}
xml_parser_free($parser);
}
function tag_open($parser,$name,$Uattributes) {
global $list;
global $number;
$name=strtolower($name);
$attributes=array();
while (list($key,$val)=each($Uattributes)) $attributes[strtolower($key)]=$val;
// array_change_key_case($attributes,CASE_LOWER);
if ("a"==$name && 'image-link'==$attributes['class']) {
$number=ereg_replace("^.*image=","",$attributes['href']);
}
if ("img"==$name && -1!=$number) {
$list[$number]=$attributes['src'];
$number=-1;
}
}
function tag_close($parser,$name) {
}
/*
$selfpath="http://" . $_SERVER['SERVER_NAME'] . ":" . $_SERVER['SERVER_PORT'] . $_SERVER['PHP_SELF'];
$galleryfile= eregi_replace("/[^/]+$","/",$selfpath);
include("../_src/class.galleryparser.inc");
*/
// while (list($key,$val)=each($GLOBALS)) {print "$key:$val
";}
$selfpath=$GLOBALS['SCRIPT_URI'];
if (""==$selfpath)
$selfpath="http://" . $HTTP_SERVER_VARS['SERVER_NAME'] . ":" . $HTTP_SERVER_VARS['SERVER_PORT'] . $HTTP_SERVER_VARS['PHP_SELF'];
$galleryfile=eregi_replace("/[^/]+$","/",$selfpath);
parsefile($galleryfile);
$slides=$list;
$number=$HTTP_GET_VARS['image'];
if ($number<1) $number=$_REQUEST['image'];
if ($number >1) $prev=$number-1; else {$prev=FALSE; $number=1;}
if ($number < count($slides)) $next=$number+1; else {$next=FALSE; $number=count($slides); $prev=$number-1;}
$image=eregi_replace("styles_small/","styles/",$slides[$number]);
$artist=eregi_replace(".*(astrid|petra|kai|thorsten).*","\\1",$image);
$style=eregi_replace(".*styles/([^/]+)/.*","\\1",$image);
?>
if ($prev) { ?>
zurück } ?>
if ($next) { ?>
weiter } ?>
echo ucfirst($artist)?>
echo ucfirst($style)?>
