#!/usr/bin/perl
# Bookmarks: 16,1 0,0 0,0 0,0 0,0 0,0 16,18
###########################################
# (c) 2005 inpublica Software-Entwicklung #
#     Oliver "Olly" Hader                 #
#     oh@inpublica.de                     #
#     Fon +49 9289 963418                 #
#     Fax +49 9289 963215                 #
###########################################

use CGI::Carp qw(fatalsToBrowser);
use DBI;

require 'res/vars.pl';
require 'res/cgi-lib.pl';	# Allgemeine PERL-Funktionen
require 'res/all-lib.pl';	# Admin bezogene Funktionen

&ReadParse;			# Parameter übernehmen
&db_connect;			# Verbindung zur Datenbank aufbauen
$action = $in{action} = $in{ac};

################################################################################################################
# Aktulles / Home                                                                                              #
################################################################################################################
if ($action =~ /^(aktuelles)(-.+)?$/) {
	local $load = $1;
	require	'res/show/' . $load . '.pl';

	if	($action =~ /-ds$/)	{	&{$load."'detail'show"}($in{id});	}
        else				{	&{$load."'main'show"};			}

################################################################################################################
# Speisekarte                                                                                                  #
################################################################################################################
} elsif ($action =~ /^speisen(-.+)?$/) {
	require	'res/show/speisen.pl';

	&speisen'main'show;

################################################################################################################
# Kontakt                                                                                                      #
################################################################################################################
} elsif ($action =~ /^kontakt(-|$)/) {
	require 'res/show/kontakt.pl';

	if	($action =~ /-fx$/)	{	&kontakt'form'exec;		}
	else				{	&kontakt'form'show;		}

################################################################################################################
# Bild anzeigen                                                                                                #
################################################################################################################
} elsif ($action eq 'bild') {
	$daten{bild} = '/images/o/' . $in{bild} . '.jpg';
	&ReturnHtml('html/show/bild-show.htm');

################################################################################################################
# Bild - Popup-Fenster                                                                                         #
################################################################################################################
} elsif ($action eq 'bild-pop') {
	require 'res/show/bilder.pl';
	&Bilder'Popup'Show($in{id});

################################################################################################################
# Standardausgabe                                                                                              #
################################################################################################################
} else {
	print "Location: /\n\n";

}

&db_disconnect;
exit;


sub DateFormat {
	local ($datum) = @_;
	return join('.', substr($datum,6,2), substr($datum,4,2), substr($datum,0,4));
}

sub URLParser {
	local ($url) = @_;

	if ($url =~ /( |^|\n)(http:\/\/)(.*?)( |\)|\. |, |$|\n)/) {
		$url =~ s/( |^|\n)(http:\/\/)(.*?)( |\)|\. |, |$|\n)/$1<A class="content_bold_unter" href=\"$2$3\" target=\"_blank\" class=\"content-fett\">$2$3<\/A>$4/igm;
	} elsif ($url =~ /( |^|\n)(www\.)(.*?)( |\)|\. |, |$|\n)/) {
		$url =~ s/( |^|\n)(www\.)(.*?)( |\)|\. |, |$|\n)/$1<A class="content_bold_unter" href=\"http:\/\/$2$3\" target=\"_blank\" class=\"content-fett\">$2$3<\/A>$4/igm;
	}

	return $url;
}