Alle geförderten Orgeln
$mysqli = new mysqli("localhost", "admin", "fohH5gah", "kiba");
// Vorgaben und Definitionen
if(!isset($_POST["jahr"])) $_POST["jahr"] = "alle";
if(!isset($_POST["q"])) $_POST["q"] = "(Suchbegriff)";
define("STIFTUNG", 2);
define("AELTERE_PROJEKTE", 6); // Ältere Projekte von vor Jahren
define("FOTOPATH", "https://www.stiftung-kiba.de/projektfotos");
// "Umleitung", falls Bundesland vorgegeben
if(isset($_GET["bu"]) and trim($_GET["bu"])!="" and intval($_GET["bu"])!=0) {
$query = $mysqli->query("select b.bundesland_id from pdb_bundesland b, pdb_projekt p where b.bundesland_id = ".intval($_GET["bu"])." and b.bundesland_id = p.bundesland_id and p.stiftung_id = ".STIFTUNG." and p.sperre = 0 group by b.bundesland_id");
if($mysqli->affected_rows==1) {
$row = $query->fetch_object();
$_POST["bundesland"] = $row->bundesland_id;
$_POST["go"] = true;
}
}
// ...und falls Jahr vorgegeben
if(isset($_GET["jahr"]) and trim($_GET["jahr"])!="" and intval($_GET["jahr"])!=0) {
$query = $mysqli->query("select j.jahr from pdb_projekt p, pdb_foerderjahr j where p.projekt_id = j.projekt_id and j.jahr = ".intval($_GET["jahr"])." and p.stiftung_id = ".STIFTUNG." and p.sperre = 0 and j.sperre = 0 group by j.jahr");
if($mysqli->affected_rows==1) {
$row = $query->fetch_object();
$_POST["jahr"] = $row->jahr;
$_POST["go"] = true;
}
}
// Zufallskirche
if(isset($_GET["zufall"])) {
$query = $mysqli->query("select p.projekt_id from pdb_projekt p, pdb_foerderjahr j where p.stiftung_id = ".STIFTUNG." and p.sperre = 0 and p.projekt_id = j.projekt_id and j.sperre = 0 group by p.projekt_id order by rand() limit 0,1");
$row = $query->fetch_object();
$_GET["id"] = $row->projekt_id;
}
// Kirche anzeigen
if(isset($_GET["id"]) and $_GET["id"]!="") {
$query = $mysqli->query("select p.*, l.bezeichnung as landeskirche, b.bezeichnung as bundesland, b.bundesland_id from pdb_projekt p, pdb_landeskirche l, pdb_bundesland b where p.bundesland_id = b.bundesland_id and p.landeskirche_id = l.landeskirche_id and p.stiftung_id = ".STIFTUNG." and p.sperre = 0 and p.projekt_id = ".intval($_GET["id"]));
if($mysqli->affected_rows==1) {
$kirche = $query->fetch_object();
?>
if($kirche->links!="") {
?>
1990) $params[] = "j.jahr = ".$_POST["jahr"];
$sql = "select p.* from pdb_projekt p, pdb_foerderjahr j where ".implode(" and ", $params)." group by p.projekt_id order by p.name asc";
$query = $mysqli->query($sql);
$n = $mysqli->affected_rows;
if($n>0) {
echo "
echo utf8_encode($kirche->name); ?>
$fotos = $mysqli->query("select dateiname, bildunterschrift from pdb_foto where projekt_id = ".$kirche->projekt_id." order by reihenfolge asc"); $out = array(); if($mysqli->affected_rows>0) { while($foto = $fotos->fetch_object()) $out[] = "dateiname."\" title=\"".$foto->bildunterschrift."\" rel=\"lightbox[]\">dateiname."\" alt=\"".$foto->bildunterschrift."\" title=\"".$foto->bildunterschrift."\" /> "; echo "".implode("", $out)."
";
}
?>
Kirche | if(in_array($kirche->kirchenname, array("Kirche", "Dorfkirche"))) $kirche->kirchenname .= " ".$kirche->name; echo utf8_encode($kirche->kirchenname); ?> | Orgelbauer | echo utf8_encode($kirche->orgelbauer)." (".$kirche->baujahr.")"; ?> | } ?>
---|---|
Ort | echo $kirche->plz." ".utf8_encode($kirche->ort.", ".$kirche->strasse)." ".$kirche->hausnr; ?> |
Homepage | $urls = explode("oder", $kirche->website); $out = array(); foreach($urls as $u) { $url = parse_url($u); $out[] = "".$url["host"].$url["path"].""; } echo implode(" oder ", $out); ?> |
Landkreis | echo utf8_encode($kirche->landkreis); ?> |
Bundesland | echo utf8_encode($kirche->bundesland); ?> |
Landeskirche | echo utf8_encode($kirche->landeskirche); ?> |
Förderjahr(e) | $out = array(); while($foerderjahr = $foerderjahre->fetch_object()) $out[] = "jahr."\">".$foerderjahr->jahr.""; echo implode(", ", $out); ?> |
Beschreibung | echo utf8_encode(nl2br(stripslashes($kirche->projektbeschreibung))); ?> |
Karte | .php?go= echo md5($kirche->projekt_id); ?>">auf der Landkarte anzeigen |
-
foreach(explode("\n", $kirche->links) as $element) {
$part = explode(",", $element);
$target = (isset($part[2]) and $part[2]!="") ? " target=\"".trim($part[2])."\" " : " ";
echo "
- ".trim($part[1])." "; } ?>
Ein Fehler ist aufgetreten...
"; } } else { ?> // Parameter für SQL-Statement zusammenstellen if(isset($_POST["go"])) { $params = array(); $params[] = "p.projekt_id = j.projekt_id and p.stiftung_id = ".STIFTUNG." and p.sperre = 0 and j.sperre = 0"; if($_POST["q"]!="") { $q = preg_replace("/\((.*)\)/msU", "", trim($_POST["q"])); if($q!="") $params[] = "(ort like '".addslashes($q)."%' or plz like '".addslashes($q)."%' or kirchenname like '%".addslashes($q)."%' or p.name like '".trim(addslashes($q))."%')"; } if($_POST["bundesland"]!="") $params[] = "p.bundesland_id = ".intval($_POST["bundesland"]); if($_POST["jahr"]=="aktuelle") { $jahre = array(); for($i=0;$i".$n." Projekt"; if($n>1) echo "e"; echo " gefunden
"; echo "- ";
while($row = $query->fetch_object()) {
// Bild vorhanden?
$foto = "";
$fotoQuery = $mysqli->query("select dateiname from pdb_foto where projekt_id = ".$row->projekt_id." order by reihenfolge asc limit 0,1");
if($mysqli->affected_rows==1) {
$fotoRow = $fotoQuery->fetch_object();
$foto = "projekt_id."\">dateiname."\" />";
}
$out = utf8_encode($row->name.", ".$row->kirchenname);
echo "
- ";
echo "projekt_id)."\">» Karte";
echo "".$foto."projekt_id."\">".$out."
"; echo "".$row->plz." ".utf8_encode($row->ort.", ".$row->strasse." ".$row->hausnr).""; } echo "
Keine passenden Kirchen gefunden. Verwenden Sie andere Suchbegriffe.
"; } } else { ?>Listen Sie hier unsere geförderten Orgeln nach Bundesland und/oder Zeitraum auf. Darüber hinaus können Sie Ort, PLZ und sogar den Namen einer Kirche als Suchbegriff verwenden. Das funktioniert auch mit Wortbestandteilen.
} } ?>