shitzovran
Goto Top

Seite im Neuen Fenster öffnen (Galerie PHP)

Hey Leute,
ich weiß das is jetzt ne harte Nuss... aber ich hab keine ahnung von PHP ud muss deshalb mal den gesamten Code hier posten

Hab mir fertige Skripte für ne Galerie geholt, und nun ist was doof, bzw ich will was ändern, aber hab keine ahnung wie...

Hab hier also ne Galerie und es werden automatisch Alben erstellt.
- wenn ich auf ein Album klicke, dann öffnet sich im selben Fenster die Tabelle mit allen Bildern des Albums.
- klicke ich nun auf ein Bild öffnet sich auf der Seite eine Seite, die das Foto in Groß anzeigt, mit einer Navigation (Weiter, Zurück) in der ich ein Bild weiter oder halt zurück gehen kann.

Nun möchte ich das aber so haben, dass sich wenn ich auf ein einzelnes Foto klicke, dieses Fenster nicht im gleichen, sonderm in einem neuen Fenster öffnen... hab schon versucht irgendwo im Code zu finden wo ich das einstelle, aber no chance....
<?

//function used to split user inputs after 75 characters with a blank
function mywordwrap($str, $max = 75, $break = ' ') {   

// create array by deviding at each occurrence of "<a"  
$arr = explode('<a', $str);   

// break up long words in $arr since 
// it will never contain a hyberlink 
$arr = preg_replace('/([^\s]{'.$max.'})/i',"$1$break",$arr);   

// run loop to devide remaining elements 
for($i = 1; $i < count($arr); $i++) { 

// devide each element in $arr at each occurrence of "</a>"  
$arr2 = explode('</a>', $arr[$i]);   

// break up long words in $arr2 that does not 
// contain hyberlinks 
$arr2[1] = preg_replace('/([^\s]{'.$max.'})/i',"$1$break",$arr2[1]);   

// rejoin $arr2 and assign as element in $arr 
$arr[$i] = join('</a>', $arr2);   
} 
// rejoin $arr to string and return it 
return join('<a', $arr);   
} 





//ermittelt die Grösse eines Verzeichnisses inklusive aller Unterverzeichnisse auf dem Server
//gathers the used space of a directory including all sub-directories
function fetchDirectorySize($dir,$cvs=TRUE) {
    $size=0;
    flush();
    if (is_array($dir) ) {
        foreach ($dir AS $directory ) $size+=fetchDirectorySize($directory);
    } 
	else if ( $directory=opendir($dir) ){
        $items=array();
        while ( $file=readdir($directory) ) {
            if ( $file!="." && $file!=".." && ($cvs || $file!="CVS" ) ) $items=$file;  
        }
        closedir($directory);
        foreach ( $items AS $item ) {
            if ( is_dir($transfer=$dir.(substr($dir, -1)!="/" ? "/" : "" ).$item) ) $size+=fetchDirectorySize($transfer);  
            else $size+=filesize($transfer);
        }
    }
    return $size;
}


//setzt die Rechte von vom Dateisystem erstellten Dateien neu, sodass diese vom Admin gelöscht werden können
//changes the rights of the files written by the file system to allow the user to delete them via ftp
function setzeRechte($obj) {
	if (is_dir($obj)) {
		if ($fd = opendir($obj)) {
			while (($child = readdir($fd)) != false) {
				if (!strcmp($child, ".")) {  
					continue;
				}
				if (!strcmp($child, "..")) {  
					continue;
				}
				$fullpath = "$obj/$child";  
				setzeRechte($fullpath);
			}
			@chmod($obj, 0777);
		} 
	} else if (is_file($obj)) {
		@chmod($obj, 0666);
	}
}

// Verändert die Bildgröße, setzt Wasserzeichen und benennt die Bilder um, legt Sicherungskopie an
// changes the image size, creates a watermark and renames the pictures, creates backup
function ChangeImage($imagefile) {
@include('config.inc.php');  
list($o_width,$o_height)=getimagesize($imagefile);
$image=ImageCreateFromJPEG($imagefile);

//Weite größer als Höhe also Bild im Querformat
if ($o_width>=$o_height) {
		//Bildweite ist größer als die gewünschte Bildweite also skalieren wir runter
		if ($o_width > $bildweite) {
			
			if ($bilderskalieren) {
				 if ($logoverwenden) {
				 	$newImage=ImageCreateTrueColor($bildweite,$bildhoehe);
				 	ImageCopyResized($newImage,$image,0,0,0,0,$bildweite,$bildhoehe,$o_width,$o_height);
				 	ImageCopyResized($newImage,$logoecke,$bildweite-10-$logownew,$bildhoehe-10-$logohnew,0,0,$logownew,$logohnew,$l_width,$l_height);
				}
				else {
					$newImage=ImageCreateTrueColor($bildweite,$bildhoehe);
					ImageCopyResized($newImage,$image,0,0,0,0,$bildweite,$bildhoehe,$o_width,$o_height);
				}
			}
			else {
				if ($logoverwenden) {
					ImageCopyResized($image,$logoecke,$o_width-10-$logownew,$o_height-10-$logohnew,0,0,$logownew,$logohnew,$l_width,$l_height);
				}
			}
		}
		//Bildweite ist nicht größer als die gewünschte Bildweite also skalieren wir nicht, weil wir hochskalieren müssen das ist unschön
		else {
			//skaliere bild neu //kopiere logo ins bild
			if ($bilderskalieren && $logoverwenden) {
					$newImage=ImageCreateTrueColor($o_width,$o_height);
					ImageCopyResized($newImage,$image,0,0,0,0,$o_width,$o_height,$o_width,$o_height);
					ImageCopyResized($newImage,$logoecke,$bildweite-10-$logownew,$bildhoehe-10-$logohnew,0,0,$logownew,$logohnew,$l_width,$l_height);
			}
			if ($bilderskalieren && !$logoverwenden) {
					$newImage=ImageCreateTrueColor($o_width,$o_height);
					ImageCopyResized($newImage,$image,0,0,0,0,$o_width,$o_height,$o_width,$o_height);
			}
			if (!$bilderskalieren && $logoverwenden) {
				ImageCopyResized($image,$logoecke,$o_width-10-$logownew,$o_height-10-$logohnew,0,0,$logownew,$logohnew,$l_width,$l_height);
		   	}
		}
		
}
//Weite nicht größer als Höhe also Bild im Hochformat
else {
	 	//original Bildweite ist größer als die gewünschte Bildweite also skalieren wir runter
		if ($o_width>$bildweite) {
			//skaliere Bild neu wenn gewünscht
		 	//entweder mit logo
			if ($bilderskalieren && $logoverwenden) {
					$newImage=ImageCreateTrueColor($bildhoehe,$bildweite);
					ImageCopyResized($newImage,$image,0,0,0,0,$bildhoehe,$bildweite,$o_width,$o_height);
					ImageCopyResized($newImage,$logoecke,$bildhoehe-10-$logownew,$bildweite-10-$logohnew,0,0,$logownew,$logohnew,$l_width,$l_height);
			}
			//oder ohne logo
			if ($bilderskalieren && !$logoverwenden)  {
					$newImage=ImageCreateTrueColor($bildhoehe,$bildweite);
					ImageCopyResized($newImage,$image,0,0,0,0,$bildhoehe,$bildweite,$o_width,$o_height);
			}
			//kopiere logo ins bild wenn skalieren nicht gewünscht
			if (!$bilderskalieren && $logoverwenden) { 
				ImageCopyResized($image,$logoecke,$o_height-10-$logownew,$o_width-10-$logohnew,0,0,$logownew,$logohnew,$l_width,$l_height);
			}
		}
		//Bildweite ist nicht größer als die gewünschte Bildweite also skalieren wir nicht, weil wir hochskalieren müssen das ist unschön
		else {
			//bilderskalieren wird ignoriert
			if ($bilderskalieren && $logoverwenden) {
					$newImage=ImageCreateTrueColor($o_width,$o_height);
					ImageCopyResized($newImage,$image,0,0,0,0,$o_width,$o_height,$o_width,$o_height);
					ImageCopyResized($newImage,$logoecke,$o_width-10-$logownew,$o_height-10-$logohnew,0,0,$logownew,$logohnew,$l_width,$l_height);
			}
			if ($bilderskalieren && !$logoverwenden) {
					$newImage=ImageCreateTrueColor($o_width,$o_height);
					ImageCopyResized($newImage,$image,0,0,0,0,$o_width,$o_height,$o_width,$o_height);
			}
			//kopiere logo ins bild
			if (!$bilderskalieren && $logoverwenden) {
				ImageCopyResized($image,$logoecke,$o_width-10-$logownew,$o_height-10-$logohnew,0,0,$logownew,$logohnew,$l_width,$l_height);
			}
		}
}

if (($bilderskalieren) && (strchr($imagefile,".jpg"))) @ImageJPEG($newImage,str_replace('.jpg','.resized.jpg',$imagefile),100);  
if (($bilderskalieren) && (strchr($imagefile,".JPG"))) @ImageJPEG($newImage,str_replace('.JPG','.resized.jpg',$imagefile),100);  
if ((!$bilderskalieren) && (strchr($imagefile,".jpg"))) @ImageJPEG($image,str_replace('.jpg','.resized.jpg',$imagefile),100);  
if ((!$bilderskalieren) && (strchr($imagefile,".JPG"))) @ImageJPEG($image,str_replace('.JPG','.resized.jpg',$imagefile),100);  
$sicherungsordner=substr($imagefile,0,strrpos($imagefile,'/')+1).'sicherung';  
if (!$delete && !@opendir($sicherungsordner)) @mkdir($sicherungsordner, 0777);
if (!$delete) @copy($imagefile,$sicherungsordner.substr($imagefile,strrpos($imagefile,'/')));  
@unlink($imagefile);
imagedestroy($image);
if ($bilderskalieren) imagedestroy($newImage);
if ($logoverwenden) imagedestroy($logoecke);
}

//Liefert einen Array mit allen Thumbnailbildern aus dem übergebenen Verzeichnis.
//Wenn zu einem Bild kein Thumbnail existiert,wird eins erzeugt.
function getJPGThumbnails($url) {
$verz=opendir($url);
$flag=false;
while ($file = readdir ($verz)) {  
	if (stristr($file,'.jpg') && !strstr($file,'resized') && !stristr($file,"_tn.jpg")) {  
															ChangeImage($url.'/'.$file);  
															$flag=true;
															}
}
closedir($verz);
$pfad=pathinfo($url);
if ($flag) setzeRechte($pfad["dirname"]);  
$verz=opendir($url);
while ($file = readdir ($verz)) {  
	if (((strchr($file,".jpg") && !strchr($file,"_tn.jpg")))) {  
								if (file_exists($url.'/'.str_replace('.jpg','_tn.jpg',$file))) {  
											$JPGArray=str_replace('.jpg','_tn.jpg',$file);  
											}
								else {
											createThumbnail($url.'/'.$file);  
											$JPGArray=str_replace('.jpg','_tn.jpg',$file);  
											}			
										
	}
}
closedir($verz); 
natsort($JPGArray);
array_unshift($JPGArray,$url);
return $JPGArray;
}

//Prüft ob mit der User IP in den letzten 24 Stunden schon mal auf die Datei geklickt wurde.
function checkIPforFileClick($file) {

$DateinameIP    = $file;
$Zeitsperre     = 86400; // Sekunden
$Gefunden = FALSE;
if (file_exists($file)) {
$IPListe=file($DateinameIP);
if (isset($IPListe))
foreach ($IPListe as $Zeile)
{	
	
	$GesplitteteZeile = explode("|", $Zeile);  
	if(($GesplitteteZeile+$Zeitsperre)>time())
	{
		$NeueIPListe= trim($Zeile)."\n";  
	}
}
if (isset($NeueIPListe))
foreach ($NeueIPListe as $Zeile)
{	
	$GesplitteteZeile = explode("|", $Zeile);  
	
	if(trim($GesplitteteZeile[1])==getenv("REMOTE_ADDR"))  
	{
		$Gefunden = TRUE;
	}
}

$FilePointerIP = fopen($DateinameIP,"w");  
if (isset($NeueIPListe))
foreach ($NeueIPListe as $Zeile)
{	
	fwrite($FilePointerIP,trim($Zeile)."\n");  
}

fclose($FilePointerIP);
}
return ($Gefunden);
}

//Trägt die User IP für diese Log-Datei als gesperrt an.
function saveIPforFileClick($file) {
$data=time()."|".getenv("REMOTE_ADDR")."\n";  
$FilePointerIP = fopen($file,"a");  
fwrite($FilePointerIP,$data);
fclose($FilePointerIP); 
}

//Liefert den Dateinamen des großen Bildes zu einem Thumbnail
function getBigPicture($url) {
if (strchr($url,".jpg"))  return (str_replace("_tn.jpg",".jpg",$url));  
return 0;
}

//Liefert die Anzahl der nicht Thumbnail JPG-Dateien in einem Verzeichnis
function getJPGAnzahl($url){
$verz=opendir($url);
$JPGArray=$url;
while ($file = readdir ($verz)) {  
	if(!stristr($file,"_tn.jpg") && stristr($file,".jpg")) $JPGArray=$file;  
	}
closedir($verz); 
return sizeof($JPGArray)-1;

}

//Macht aus dem übergebenen Image-File ein Thumbnail.
function createThumbnail($imagefile) {
@include('config.inc.php');  
list($o_width,$o_height)=getimagesize($imagefile);
$verhaeltnis=($o_width/$o_height);
$verz=substr($imagefile,0,strrpos($imagefile,"/"));  
if (decoct(fileperms($verz))!="40777" && decoct(fileperms($verz))!="100777") die("Kann keine Thumbnails erzeugen, Verzeichnisrechte manuell auf 777 ändern");  
//Größe der Thumbnails
if ($o_width>$o_height) {
		$n_width=$tnwidth;
		$n_height=ceil($tnwidth/$verhaeltnis);
	}
else {
		$n_width=ceil($tnwidth*$verhaeltnis);
		$n_height=$tnwidth;
	}
$im=ImageCreateFromJPEG($imagefile);
$tn=ImageCreateTrueColor($n_width,$n_height);
ImageCopyResized($tn,$im,0,0,0,0,$n_width,$n_height,$o_width,$o_height);
	if (strchr($imagefile,".jpg")) @ImageJPEG($tn,str_replace('.jpg','_tn.jpg',$imagefile),100);  
imagedestroy($tn);
imagedestroy($im);
}

//Liest die Anzahl der Imageclicks aus der dat-Datei und gibt den Wert zurück
function getImageClicks($image) {
clearstatcache();
if (strchr($image,".jpg"))  $file=str_replace(".jpg",".click.dat",$image);  

if (file_exists($file)) {
				$fp=fopen($file,'r');  
				$str=fgets($fp,100);
				fclose($fp);
				return($str);
				}
else return (0);

}

//Erhöht die Anzahl der Clicks für ein Bild in der dat-Datei
function incImageClicks($image) {
$anz=getImageClicks($image);
$anz+=1;
if (strchr($image,".jpg")) $file=str_replace(".jpg",".click.dat",$image);  


$fp=fopen($file,'w+');  
fwrite($fp,$anz."\n");  
fclose($fp);

}

//Fügt ein Kommentar zu dem übergebenen Bild in der dat-Datei hinzu.
function writeComment($stelle,$album,$comment,$author) {
if (strlen($comment)>200) {
	showPicture($stelle,$album);
	exit;
}
if (strlen($author)>20) {
	showPicture($stelle,$album);
	exit;
}

$bilder=getJPGThumbnails($album);
$image=$bilder."/".getBigPicture($bilder[$stelle]);  
if (strchr($image,".jpg")) $file=str_replace(".jpg",".comments.dat",$image);  
$fp=fopen($file,'a');  
$commentnew=strip_tags($comment);
$commentnew=str_replace("\r\n",' ',$commentnew);  
$commentnew=str_replace("|","]",$commentnew);  
$authornew=strip_tags($author);
$authornew=str_replace("\r\n",' ',$authornew);  
$authornew=str_replace("|","]",$authornew);  



if ($author<> "" and $comment<> "Kommentar")  fwrite($fp,$authornew.'|'.$commentnew.'|'.date("d.m.Y H:i:s").'|'.$_SERVER['REMOTE_ADDR']."\n");  
fclose($fp);
showPicture($stelle,$album);
}

//Liefert einen Array mit allen Kommentaren zu dem übergebenen Bild zurück
function getComments($image) {
if (strchr($image,".jpg")) $file=str_replace(".jpg",".comments.dat",$image);  
if (file_exists($file)) $inhalt=file($file);
if (!isset($inhalt)) return(null);
	$comments=array();
	foreach ($inhalt as $Zeile)
	{	
		
		$GesplitteteZeile=explode('|', $Zeile);  
		$comments=array('name' => $GesplitteteZeile,  
						'comment' => mywordwrap(str_replace("\\n"," ",$GesplitteteZeile[1]),25," "),  
						'zeit' => $GesplitteteZeile[2],  
						'ip' => $GesplitteteZeile[3]);  
	}
return($comments);
}

//Liefert einen Array aller Verzeichnisse die Bilder enthalten an der angegebenen URL zurück
//Der Admin muss sicherstellen das dies ein Albumordner ist.
function getAlben($url) {
clearstatcache();
$verz=opendir($url);
while ($file = readdir($verz)) {  
	if(($file!="..")&&(filetype($url.'/'.$file)=='dir')&&($file!=".") && (getJPGAnzahl($url.'/'.$file)>0)) $albumArray=$url.'/'.$file;  
	}
closedir($verz); 
@usort ($albumArray,"sortiere");  
if (isset($albumArray)) {
	while (list ($key,$value) = each ($albumArray)) {
		  	$returnArray=$value;
		  }
	return $returnArray;
	}
return (null);

}

//Sortiert zwei Dateien nach ihrem Datum am Anfang des Namens Format: dd.mm.yy

function sortiere($b,$a) {

$abase=basename($a);
$bbase=basename($b);

$adatum=substr($abase,0,8);
$ajahr=substr($adatum,6,2);
$amonat=substr($adatum,3,2);
$atag=substr($adatum,0,2);

$bdatum=substr($bbase,0,8);
$bjahr=substr($bdatum,6,2);
$bmonat=substr($bdatum,3,2);
$btag=substr($bdatum,0,2);



	if (intval($ajahr)>intval($bjahr)) return 1;
	if (intval($ajahr)<intval($bjahr)) return -1;
	if (intval($ajahr)==intval($bjahr)) {
		if (intval($amonat)>intval($bmonat)) return 1;
		if (intval($amonat)<intval($bmonat)) return -1;
		if (intval($amonat)==intval($bmonat)) {
			if (intval($atag)>intval($btag)) return 1;
			if (intval($atag)<intval($btag)) return -1;
			if (intval($atag)==intval($btag)) {
				$arest=substr($abase,8);
				$brest=substr($bbase,8);
				$e=strcasecmp($arest,$brest);
				if ( $e>0 )	return -1;
				if ( $e<0 )	return 1;
				if ( $e==0 )	return 0;
			}
		}
	}

}




//präpariert den Kommentarstring damit es keine Fehler gibt.
function stringumwandeln($str) {
$new=str_replace("'","\'",$str);  
$new=str_replace("\"","&quot;",$new);  

return $new;
}



/*Generates the Gallery Overview page where the user can select an album
 	
	$url - relative path to the gallery albums folder has to be defined in the config.inc.php
	$galleryTotalRows
	$galleryTotalColumns
	$showUsedWebspace
    	
	css-Classes
	table:	galleryOverview
	td:		albumColumn
	table:	usedWebspace

	Language
	$languageNOALBUM
	$languageWEBSPACE

*/

function showGallery($url) {
	//include config to get all the user defined parameters
	@include('config.inc.php');  
	//Set AlbumOverviewPage to 1 if not defined in GET variables
	if (!isset($_GET['AlbumActualPage']) or $_GET['AlbumActualPage']=='') $_GET['AlbumActualPage']=1;  
	if ($galleryTotalColumns<1) $galleryTotalColumns=1;
	if ($galleryTotalRows<1) $galleryTotalRows=1; 
	$albumsOnPage=$galleryTotalColumns*$galleryTotalRows;
	//get references to all album folders
	$alben=getAlben($url);
	//Show no album table
	echo('<div class="albumsheader">'.$languageALBUMHEADER.'</div>'  
);
	if (sizeof($alben)==0) echo ('<table class="albumstable"><tr><td>'.$languageNOALBUM.'</td></tr></table>');  
	//open Gallery table	
	echo ('  
	<table id="albumstable">  
	');  
	$albumControl=$_GET['AlbumActualPage']*$albumsOnPage-$albumsOnPage;  
	for ($currentRow=1;$currentRow<=$galleryTotalRows;$currentRow++) {
		echo '<tr>  
	';  
		for ($currentColumn=1;$currentColumn<=$galleryTotalColumns;$currentColumn++) {
			echo '<td class="albumscolumn">';  
			if ($albumControl < sizeof($alben) &&  $albumControl<($_GET['AlbumActualPage']*$albumsOnPage)) {  
				echo writeAlbum($alben[$albumControl]);
			}			 
			echo '</td>  
	';	  
			$albumControl++;
		}
		echo '</tr>  
	';  
	}
	//close Gallery table
	echo '</table>  
';   
	$totalPages=ceil((sizeof($alben)-1)/$albumsOnPage);
	//Code to switch pages
	echo pageControl($_GET['AlbumActualPage'],$totalPages);  
	//Calculate and show used Webspace
	if ($showUsedWebspace) {
		$space=round(fetchDirectorySize($url)/1000000);
		echo ('<div class="usedWebSpace">'.$languageWEBSPACE.$space.' MB</div>  
');  
	}
	
}


function writeAlbum($album) {
	@include('config.inc.php');  
	//Number of images in album
	$totalImages=getJPGAnzahl($album);
	$clickfile=$album.'/clicks.dat';  
	//Clicks on album
	if (file_exists($clickfile)) {
		$fp=fopen($clickfile,'r');  
		$totalClicks=fread($fp,filesize($clickfile));
		fclose($fp);
	}
	else  $totalClicks=0;
	//lineup image finden
	$bilder=getJPGThumbnails($album);
	$lineupthumb=$bilder.'/'.$bilder[1];  
	for($j=1;$j<sizeof($bilder);$j++) {
		if (strchr($bilder[$j],'lu')) {  
				$lineupthumb=  $bilder.'/'.$bilder[$j];  
				break;
		}
	}
	list($width,$height)=getimagesize($lineupthumb);
	if ($width > $height) $querformat=true;
	
	//check if album is password saved
	$locked=false;
	if ($securemode) {
		
		$codefile=$album.'/code.php';  
		if (file_exists($codefile)) $locked=true;
	}
	//Date
	//Name
	//Description
	//Author
	//Password
	//Preview
	
	$tooltip='<table width=&quot;100%&quot;class=&quot;albumtooltip&quot;><tr><td><img src=&quot;bilder/total.gif&quot; style=&quot;vertical-align:middle&quot; alt=&quot;images&quot; width=&quot;25&quot; border=&quot;0&quot;>&nbsp;'.$totalImages.'</td></tr><tr><td><img src=&quot;bilder/visit.gif&quot; style=&quot;vertical-align:middle&quot; width=&quot;25&quot; alt=&quot;views&quot; border=&quot;0&quot;>&nbsp;'.$totalClicks.'</td></tr></table>';  
			
	If ($locked==False) {
	echo '<div class="album"><a onmouseover="this.T_WIDTH=0;this.T_DELAY=100; return escape(\''.$tooltip.'\')" class="albenlink" href="'.$_SERVER['PHP_SELF'].'?todo=showalbum&album='.$album.'&AlbumActualPage='.$_GET['AlbumActualPage'].'"><img class="albumsthumbnail" src="'.$lineupthumb.'"';  
	//If ($querformat)  echo 'width="'.$previewwidth.'"'; else echo 'height="'.$previewwidth.'"';  
	echo '></a></div><div class="albumtitle">'.substr(strrchr($album,'/'),1).'</div> ';  
	}
	else
	{
	echo '<div class="album"><a onmouseover="this.T_WIDTH=0;this.T_DELAY=100; return escape(\''.$tooltip.'\')" class="albenlink" href="'.$_SERVER['PHP_SELF'].'?todo=showalbum&album='.$album.'&AlbumActualPage='.$_GET['AlbumActualPage'].'"><img class="albumsthumbnail" src="bilder/lock.png"';  
	echo 'width="80" border="0">';   
	echo '</a></div><div class="albumtitle" style="width:'.$previewwidth.';">'.substr(strrchr($album,'/'),1).'</div> ';  
	}
	
	




}



/*
	PageControl returns HTML output for switching between pages
	actualPage	Page that is actually displayed
	totalPages	Total number of Pages

	CSS-Classes
		a.pagecontrol
*/
function pageControl ($actualPage,$totalPages)  {

	$str='<div class="PageLinks">';  
	if ($actualPage!=1) {
		$str= $str.'<span class="pagelinkbox"><a href="'.$_SERVER['PHP_SELF'].'?todo=showalben&AlbumActualPage='.($actualPage-1).'"><img src="bilder/links.gif" alt="" border="0"></a></span> ';  
	}
	if ($totalPages!=1) {
		for ($page=1;$page<=$totalPages;$page++) {
			if ($page!=$actualPage){
				$str = $str.'<span class="pagelinkbox"><a href="'.$_SERVER['PHP_SELF'].'?todo=showalben&AlbumActualPage='.$page.'" class="pageControl">'.$page.'</a></span> ';  
			}
			else $str=$str.'<span class="pagelinkbox">'.$page.'</span> ';  
		}
	}
	if ($actualPage<$totalPages) {
		 $str=$str.'<span class="pagelinkbox"><a href="'.$_SERVER['PHP_SELF'].'?todo=showalben&AlbumActualPage='.($actualPage+1).'"><img src="bilder/rechts.gif" alt="" border="0"></a></span> ';  
	}
	$str=$str.'</div>  
';  
	return $str;
}

//gibt einen Bilderordner formatiert auf dem Browser aus

/*
 	
	$album - relative path to  album folder
	
    	
	css-Classes
	table:	.pwform
			#leftcolumn
			#rightcolumn
			
			albumueberschrift
			tooltipkommentar
			tooltipkommentartop	

	Language
	$languageBACK
	$languageDIE
	$languageSAYS
	$languagePASSWORD
	$languageBUTTON
	

*/

function showalbum($album) {
@include('config.inc.php');  

//Password input mask
if ($securemode && file_exists($album.'/code.php') && $_SESSION['album']!=$album) {  
	echo('  
	<table class="pwform">  
	<form action="'.$_SERVER['PHP_SELF'].'" method="post">  
	<input type="hidden" name="todo" value="securealbum">  
	<input type="hidden" name="album" value="'.$album.'">  
	<input type="hidden" name="AlbumActualPage" value="'.$_GET['AlbumActualPage'].'">  
	<tr><td colspan="2">'.$languagePASSWORD.'</td></tr>  
	<tr><td id="leftcolumn"><input type="password" name="passwort" maxlength="50" size="10"></td>  
	    <td id="rightcolumn"><input type="submit" value="'.$languageBUTTON.'"></td>  
		<tr><td colspan="2" style="text-align:center"><a class="back" href='.$_SERVER['PHP_SELF'].'?AlbumActualPage='.$_GET['AlbumActualPage'].'>'.$languageBACK.'</td></a></td></tr>  
	</form>
	</table>');  
	
	exit;
}

if (!isset($_GET['pos']) or $_GET['pos']=='') $_GET['pos']=1;  

$IPfile=$album.'/ips.dat';  
$clickfile=$album.'/clicks.dat';  
if (file_exists($clickfile)) {
				$fp=fopen($clickfile,'r+');  
				$str=fread($fp,filesize($clickfile));
				rewind($fp);
				if (!checkIPforFileClick($IPfile)) {
										fwrite($fp,$str+1);
										saveIPforFileClick($IPfile);
										}
				fclose($fp);
				}
	else  {
		clearstatcache();
		if (decoct(fileperms($album))!="40777" && decoct(fileperms($album))!="100777")   
							die($languageNORIGHTS);
		$fp=fopen($clickfile,'w');  
		fwrite($fp,1);
		fclose($fp);
		chmod($clickfile, 0600);	
		}
$bilder=getJPGThumbnails($album);
echo ('  
');  
echo ('<div class="back"><a class="back" href="'.$_SERVER['PHP_SELF'].'?AlbumActualPage='.$_GET['AlbumActualPage'].'">'.$languageBACK.'</a></div>  
');  

if ($albumTotalColumns<1) $albumTotalColumns=1;
if ($albumTotalRows<1) $albumTotalRows=1; 
$anzahlthumbs=$albumTotalColumns*$albumTotalRows;

echo '<table id="imagetable">  
';  
$k=$_GET['pos'];  
for ($i=1;$i<=$albumTotalRows;$i++) {
	echo '	<tr>  
		';  
	for ($j=1;$j<=$albumTotalColumns;$j++) {
		echo '<td class="imagecolumn">';  
		if ($k < sizeof($bilder) &&  $k<($_GET['pos']+$anzahlthumbs)) {  
			$pic=$bilder.'/'.getBigPicture($bilder[$k]);  
			list($width,$height)=getimagesize($bilder.'/'.$bilder[$k]);  
			if ($width > $height) $querformat=true;
			else $querformat=false;
			$clicks=trim(getImageClicks($pic));
			$CommentArray=getComments($pic);
			$anzKommentare= sizeof($CommentArray);
			if ($usecomments) $tooltip='<table width=&quot;100%&quot; class=&quot;imagetooltip&quot;><tr><td class=&quot;r1c1&quot;><img src=&quot;bilder/visit.gif&quot; style=&quot;vertical-align:middle&quot; width=&quot;25&quot; alt=&quot;'.$languageVIEWS.'&quot; border=&quot;0&quot;>&nbsp;'.$clicks.'</td><td class=&quot;r1c2&quot; style=&quot;text-align:right&quot;><img src=&quot;bilder/bubble.gif&quot; style=&quot;vertical-align:middle&quot; width=&quot;25&quot; alt=&quot;'.$languageCOMMENTS.'&quot; border=&quot;0&quot;>&nbsp;'.$anzKommentare.'</td></tr>';  
			else $tooltip='<table width=&quot;100%&quot; class=&quot;imagetooltip&quot;><tr><td class=&quot;r1c1&quot;><img src=&quot;bilder/visit.gif&quot; style=&quot;vertical-align:middle&quot; width=&quot;25&quot; alt=&quot;'.$languageVIEWS.'&quot; border=&quot;0&quot;>&nbsp;'.$clicks.'</td></tr>';  
			if ($usecomments && $anzKommentare>0) {
				$tooltip=$tooltip.'<tr><td class=&quot;r2&quot; colspan=&quot;2&quot; class=&quot;tooltipkommentartop&quot;>'.$languageLASTCOMMENT.'</td></tr><tr><td class=&quot;r3c1&quot;>'.stringumwandeln($CommentArray[$anzKommentare-1]['name']).'</td><td class=&quot;r3c2&quot;>'.$languageSAYS.'</td></tr><tr><td colspan=&quot;2&quot;class=&quot;tooltipcomment&quot;>'.stringumwandeln($CommentArray[$anzKommentare-1]['comment']).'</td></tr>';  
	   		 	
			}
			$tooltip=$tooltip.'</table>';  
			if ($usetooltip) echo '<div class="image"><a href="'.$_SERVER['PHP_SELF'].'?todo=showPicture&stelle='.$k.'&album='.$album.'&AlbumActualPage='.$_GET['AlbumActualPage'].'&pos='.$_GET['pos'].'" target="'.$target.'"><img src="'.$bilder."/".$bilder[$k].'" class="imagethumbnail" onmouseover="this.T_WIDTH=100;this.T_DELAY=100; return escape(\''.$tooltip.'\')"></a></div>';  
			else echo '<div class="image"><a href="'.$_SERVER['PHP_SELF'].'?todo=showPicture&stelle='.$k.'&album='.$album.'&AlbumActualPage='.$_GET['AlbumActualPage'].'&pos='.$_GET['pos'].'" target="'.$target.'"><img src="'.$bilder."/".$bilder[$k].'" class="imagethumbnail"></a></div>';  
			
			
		} 
		else echo '';  
		echo '</td>  
		';	  
		$k++;
	}
	echo '</tr>  
';  
}



echo '</table>  
<div class="pagecontrol">';   

$views=ceil((sizeof($bilder)-1)/$anzahlthumbs);


if ($_GET['pos']!=1) echo('<a href="'.$_SERVER['PHP_SELF'].'?todo=showalbum&album='.$album.'&pos='.($_GET['pos']-$anzahlthumbs).'&AlbumActualPage='.$_GET['AlbumActualPage'].'"><img src="bilder/links.gif" alt="" border="0"></a>');  

if ($views!=1) {
	for ($j=1;$j<=$views;$j++) {
		if ((($j-1)*$anzahlthumbs+1)!=$_GET['pos']){  
		echo ('<a href="'.$_SERVER['PHP_SELF'].'?todo=showalbum&album='.$album.'&pos='.(($j-1)*$anzahlthumbs+1).'&AlbumActualPage='.$_GET['AlbumActualPage'].'" class="pagecontrol">'.$j.'</a> ');  
		}
		else echo ($j.' ');  
		
	
	
	}
}

if (sizeof($bilder)-1-$_GET['pos']>=$anzahlthumbs) echo('<a href="'.$_SERVER['PHP_SELF'].'?todo=showalbum&album='.$album.'&pos='.($_GET['pos']+$anzahlthumbs).'&AlbumActualPage='.$_GET['AlbumActualPage'].'"><img src="bilder/rechts.gif" alt="" border="0"></a>');  

echo('</div>  
');  
echo ('<div class="back"><a class="back" href="'.$_SERVER['PHP_SELF'].'?AlbumActualPage='.$_GET['AlbumActualPage'].'">'.$languageBACK.'</a></div>  
');  
if ($showUsedAlbumspace) {
		$space=round(fetchDirectorySize($album)/1000000);
		echo ('<div class="usedwebspace">'.$languageWEBSPACE.$space.' MB</div>  
');  
	}
//Copyright and Backlink
echo backlink();
}


	
	
	




//gibt ein Bild im Großformat formatiert auf dem Browser aus
function showPicture($stelle,$album)  {
include('config.inc.php');  
if ($securemode && file_exists($album.'/code.php') && $_SESSION['album']!=$album) die('<div class="wrongpw"><span class="wrongpw">'.$languageNOACCESS.'</span></div>');  
if ($PhotoInNewWindow) $target='_blank';  
else $target='_blank';  
$bilder=getJPGThumbnails($album);
$pic=$bilder."/".getBigPicture($bilder[$stelle]);  

if (strchr($pic,'.jpg') && !checkIPforFileClick(str_replace('.jpg','.ip.dat',$pic))) {  
										incImageClicks($pic);
										saveIPforFileClick(str_replace('.jpg','.ip.dat',$pic));  
										}
$CommentArray=getComments($pic);


if (!$PhotoInNewWindow) echo('<div class="back"><a class="back" href="'.$_SERVER['PHP_SELF'].'?todo=showalbum&album='.$album.'&pos='.$_GET['pos'].'&AlbumActualPage='.$_GET['AlbumActualPage'].'">'.$languageALBUMBACK.'</a></div>  
');  

// Slideshowformular wird dargestellt
if ($enableSlideshow) {
	echo ('  

	<div class="slideshow">  
	<form action="'.$_SERVER['PHP_SELF'].'" method="GET">  
	<input type="hidden" name="todo" value="startslideshow">  
	<input type="hidden" name="album" value="'.$album.'">  
	<input type="hidden" name="stelle" value="'.$stelle.'">  
	<div class="slideshowheader">'.$languageSLIDESHOWHEADER.'</div>  
	<table class="slideshowtable"><tr>  
	<td><input type="submit" value="'.$languageSTARTSLIDESHOW.'"></td>  
	
	<td><select name="zeit" size="1" >  
	<option>1</option>
	<option>2</option>
	<option>3</option>
	<option>4</option>
	<option selected>5</option>
	<option>10</option>
	</select></td>
	</form>
	<form action="'.$_SERVER['PHP_SELF'].'" method="GET">  
	<input type="hidden" name="todo" value="stopslideshow">  
	<input type="hidden" name="album" value="'.$album.'">  
	<input type="hidden" name="stelle" value="'.$stelle.'">  
	<td><input type="submit" value="'.$languageSTOPSLIDESHOW.'"></td></tr></table>  
	</form>
	
	</div>');  
	}

// großes Bild wird dargestellt
if ($usetooltip) {
	$tooltip1='<img src=&quot;'.$bilder.'/'.$bilder[$stelle-1].'&quot; alt=&quot;'.$languageBACKIMAGE.'&quot; class=&quot;prev&quot;>';  
	$tooltip2='<img src=&quot;'.$bilder.'/'.$bilder[$stelle+1].'&quot; class=&quot;next&quot; alt=&quot;'.$languageNEXTIMAGE.'&quot; class=&quot;next&quot;>';  
	}
echo ('<table id="bigpicture">  
	<tr>');  
	echo('<td colspan="2" class="center"><img class="bigpicture" src="'.$pic.'"></td></tr>  
');  
if ($stelle > 1) echo ('<tr><td class="left"><a class="prevnextlink" href="'.$_SERVER['PHP_SELF'].'?todo=showPicture&stelle='.($stelle-1).'&album='.$album.'" onmouseover="this.T_WIDTH=100;this.T_DELAY=100; return escape(\''.$tooltip1.'\')"><div class="left">'.$languagePREVIOUS.'</div></a></td>');  
else echo ('<tr><td class="left"><div class="left">&nbsp;</div></td>');  

if ($stelle< (sizeof($bilder)-1) ) echo('<td class="right"><a class="prevnextlink" href="'.$_SERVER['PHP_SELF'].'?todo=showPicture&stelle='.($stelle+1).'&album='.$album.'" onmouseover="this.T_WIDTH=100;this.T_DELAY=100; return escape(\''.$tooltip2.'\')"><div class="right">'.$languageNEXT.'</div></a></td></tr>');  
else echo ('<td class="right"><div class="right">&nbsp;</div></td></tr>');  
echo('  
</table>
');  


if ($usecomments) {
	if (sizeof($CommentArray)>0) {
		echo('  
    	<tr><td colspan="3">  
		<table class="commenttable">  
		<tr><td colspan="3" class="commenttableheaderheader">'.$languageCOMMENTHEADER.'</td></tr>  
		<tr><td class="commenttableheaderleft">'.$languageNAME.'</td><td class="commenttableheadercenter">'.$languageDATE.'</td><td class="commenttableheaderright">'.$languageCOMMENT.'</td></tr>  
		
		');  
	

		for ($i=0;$i<sizeof($CommentArray);$i++) {
			echo ('<tr><td class="commenttablename">'.$CommentArray[$i]['name'].'</td><td class="commenttabledate">'.$CommentArray[$i]['zeit'].'</td>  
		  		   <td class ="commenttablecomment" colspan="2">'.$CommentArray[$i]['comment'].'</td></tr>');  
		}
	echo '</table>';  
	}

echo('  
    
	<div>
	<table class="CommentForm">  
	<tr><th align="center">'.$languageLEAVECOMMENT.'</th></tr>  
	<tr>
	<form action="'.$_SERVER['PHP_SELF'].'?todo=writeComment" method="POST">  
	<input type="hidden" name="album" value="'.$album.'">  
	<input type="hidden" name="stelle" value="'.$stelle.'">  
	<td>'.$languageCOMMENTNAME.'  
	<input name="username" type="text size="30" maxlength="30">  
	</td></tr>
	<tr><td>
	<textarea name="comment" cols="30" rows="10"></textarea>  
	</td></tr>
	<tr><td><input type="submit" value="'.$languageBUTTON.'"></td></tr>  
	</form>
	</table>
	</td></tr>
    </table></div>');  
 }
if (!$PhotoInNewWindow) echo('<div class="back"><a class="back" href="'.$_SERVER['PHP_SELF'].'?todo=showalbum&album='.$album.'&pos='.$_GET['pos'].'&AlbumActualPage='.$_GET['AlbumActualPage'].'">'.$languageALBUMBACK.'</a></div>');  
 echo backlink();
 }

 
 function backlink() {
 	//Copyright and Backlink
 return ('<div class="backlink"></div>  
');  

 
 }
 
 
function slideshow($stelle,$album,$zeit) {
	$bilder=getJPGThumbnails($album);
	$laenge=sizeof($bilder)-1;
	if ($stelle<$laenge) $index= $stelle+1; 
	else $index=1;
	echo("  
		<script type=\"text/javascript\">  
		var slideShowSpeed = ".($zeit*1000)."  
		function replace() {
		document.location.replace('".$_SERVER['PHP_SELF']."?todo=startslideshow&stelle=".$index."&album=".$album."&zeit=".$zeit."')  
		}
		var t
		t = setTimeout('replace()', slideShowSpeed)   
		</script>
		");  
}

?>

ich weiß, ne Menge Holz aber hoffe jemand macht sich die mühe

Content-Key: 113811

Url: https://administrator.de/contentid/113811

Printed on: April 25, 2024 at 10:04 o'clock

Member: nxclass
nxclass Apr 20, 2009 at 10:19:49 (UTC)
Goto Top
code Zeile: 560. und 566. - dort wird der HTML code für die Galerie erzeugt.

Es sollte reichen im '<a ...> .. </a>' Tag ein 'target="_blank"' einzufügen.
Oder du machst es mit javascript 'onclick="window.open(...)"'.
Member: ShitzOvran
ShitzOvran Apr 20, 2009 at 11:45:11 (UTC)
Goto Top
Danke, war zwar die falsche Klasse... aber jetzt wusste ich, wonach ich suchen muss...

Reihe 713 und 714

So hab ich es nun, dass die Alben und die Voransicht noch im gleichen Fenster geöffnet werden nur wenn ich auf das einzelne Bild klicke wird die Großansicht in einem Neuen Fenster angezeigt ;) thx