klausfriese-private/admin/index.php

118 lines
4.8 KiB
PHP

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<meta charset="utf-8">
<title></title>
<link href='dm.css' rel='stylesheet' type='text/css'>
<?php
include "functions.php";
?>
<body leftmargin=0 topmargin=0>
<div align="center">
<table width="100%" border="0" cellspacing="3" cellpadding="0">
<?php
include "header.php";
?>
<tr>
<td align="center" valign="top" class="content">
<?php
DBConnect();
$action = ( isset($_REQUEST['action'] ) ? $_REQUEST['action'] : "" );
$n = ( isset($_REQUEST['n'] ) ? $_REQUEST['n'] : "" );
$Name = ( isset($_REQUEST['Name'] ) ? $_REQUEST['Name'] : "" );
$Name_en = ( isset($_REQUEST['Name_en'] ) ? $_REQUEST['Name_en'] : "" );
$Datei = ( isset($_REQUEST['Datei'] ) ? $_REQUEST['Datei'] : "" );
$Upload = ( isset($_REQUEST['Upload'] ) ? $_REQUEST['Upload'] : "" );
$Views = ( isset($_REQUEST['Views'] ) ? $_REQUEST['Views'] : "" );
if( $action == "refresh" ) {
/*
// Nach neuen Bildern schauen
if( $_SERVER['SERVER_NAME'] == "127.0.0.1" ) {
$fulldir = "/homepage/panoramicum/p3/";
} else {
$fulldir = "/var/www/vhosts/vs148016.vserver.de/panoramicum.de/";
}
*/
print "Refresh in ".$fulldir."planeten<br>";
$handle = @opendir( $fulldir."planeten" );
$files = array();
while ($file = readdir ($handle)) {
if (!preg_match("/^\.{1,2}$/i",$file)) {
$pos = strpos( $file , ".jpg" );
if( !( $pos === false ) ) {
$query = "SELECT ID,Name,Datei FROM planeten where Datei='".$file."'";
$result = $db->query($query);
if( $result->rowCount() == 0 ) {
$upload = date( "Y-m-d" );
$query = "INSERT INTO planeten (Datei,Upload) VALUES ('$file','$upload')";
$result = $db->query($query);
print "New Image $file<br>";
}
}
}
}
}
if( $action == "edit" ) {
if( $n == 0 ) {
$query = "INSERT INTO planeten (Name,Name_en,Datei,Upload,Views) VALUES ('$Name','$Name_en','$Datei','$Upload','$Views')";
$result = $db->query($query);
} else {
$query = "UPDATE planeten SET Name='$Name',Name_en='$Name_en',Datei='$Datei',Upload='$Upload',Views='$Views' WHERE ID=$n";
print $query;
$result = $db->query($query);
}
}
if( $action == "delete" ) {
$query = "delete from planeten WHERE ID=$n";
$result = $db->query($query);
}
print "<table width=100% border='0' cellspacing='3' cellpadding='4'><tr>";
print "<td bgcolor='#CCCCCC'>Datei / Upload / Views</td><td bgcolor='#CCCCCC'>Beschreibung</td><td bgcolor='#CCCCCC'>Found</td>";
print "<td colspan='3' bgcolor='#CCCCCC'>&nbsp;</td></tr>";
$query = "SELECT ID,Name,Name_en,Datei,Views,Upload FROM planeten order by Datei";
$result = $db->query( $query );
foreach( $result as $line ) {
$query1 = "SELECT count(*) as count FROM planet_tag pt,tag t where t.id=pt.tag and pt.planet=".$line['ID'];
$result = $db->query( $query1 );
$line1 = $result->fetchColumn();
print "<tr valign='top'><td bgcolor='#EEEEEE'>".$line["Datei"]."<br>Upload: ".$line["Upload"]." / Views: ".$line["Views"]."&nbsp;</td>";
print "<td bgcolor='#EEEEEE'>".htmlspecialchars($line["Name"])."<br>".$line["Name_en"]."&nbsp;</td>";
$ln = $line["ID"];
$fileexists = "OK";
$panoklein = str_replace( ".jpg" , "_p.jpg" , $line["Datei"] );
if( !file_exists( $fulldir."/planeten/".$line["Datei"] ) ) $fileexists = $line["Datei"]." fehlt";
if( !file_exists( $fulldir."/planeten/small/".$line["Datei"] ) ) $fileexists = $fileexists."<br>small/".$line["Datei"]." fehlt";
if( !file_exists( $fulldir."/planeten/large/".$line["Datei"] ) ) $fileexists = $fileexists."<br>large/".$line["Datei"]." fehlt";
if( !file_exists( $fulldir."/planeten/panorama/".$line["Datei"] ) ) $fileexists = $fileexists."<br>panorama/".$line["Datei"]." fehlt";
if( !file_exists( $fulldir."/planeten/panorama/".$panoklein ) ) $fileexists = $fileexists."<br>panorama/".$panoklein." fehlt";
print "<td bgcolor='#EEEEEE'>".$fileexists."</td>";
if( $line1 == "0" ) {
print "<td bgcolor='#FF0000'>".$line1."</td>";
} else {
print "<td bgcolor='#EEEEEE'>".$line1."</td>";
}
print "<td bgcolor='#EEEEEE'><a href=\"edit.php?n=$ln\">Bearbeiten</a></td>";
print "<td bgcolor='#FF0000'><a href=\"index.php?n=$ln&action=delete\">Entfernen</a></td></tr>";
}
print "<tr><td bgcolor='#EEEEEE' colspan=5 align=\"center\"><a href=\"index.php?action=refresh\">Neue Bilder suchen</a></td></tr>";
print "</table>";
?>
</td>
</tr>
</table>
</div>
</body>
</html>