if (empty($action)) $action="main";
switch ($action)
{
case "main":
if (isset($_GET['p'])) $p = $_GET['p'];
$data = file($gbdata);
$entry_count = count($data);
if (empty($p)) $p = 0;
$last = ($p+1) * $entries_per_page;
if ($last > $entry_count) $last = $entry_count;
$show="main";
break;
case "entry":
$show="form";
break;
case "login":
if (isset($_SESSION['admin'])) { session_destroy(); header("location: ".basename($_SERVER["PHP_SELF"])); die("<a href="".basename($_SERVER["PHP_SELF"])."">further...</a>"); }
else $show="login form";
break;
}
################################################################################
// Begin HTML
// Here you could include a header --> include("header.html");
################################################################################
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<title>Wallwitzburg Dessau e.V. - Verein für den Wiederaufbau der Wallwitzburg - Gästebuch</title>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />
<LINK href="s.css" type=text/css rel=stylesheet><style>
BODY, Table, TD {
FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
font-size: 11;
color: #000000;
}
A:link {
COLOR: #333333;
text-decoration: none;
}
A:hover {
COLOR: #cccccc;
text-decoration: none;
}
A:active {
COLOR: #333333;
text-decoration: none;
}
A:visited {
COLOR: #999999;
text-decoration: none;
}
</style>
</head>
<body>
<b><?php echo $title; ?></b>
<p class="gb-browse">
<?php if ($show=="main") { ?>[ <a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>?action=entry"><?php echo $new_entry; ?></a> ]<?php }
else { ?>[ <a href="<?php echo basename($_SERVER["PHP_SELF"]); ?>"><?php echo $back; ?></a> ]<?php } ?>
</p>
<?php
switch ($show)
{
case "main":
if ($entry_count == 0) { echo "<i>".$still_no_entries_marking."</i>"; }
for ($i = $p*$entries_per_page; $i < $last; $i++)
{
if (trim($data[$i]) != "")
{
$nr = $entry_count -$i;
$parts = explode("|", $data[$i]);
$name = urldecode($parts[3]);
$email = base64_decode(urldecode($parts[4]));
if ($email != "")
{
$email_parts = explode("@", $email);
$email_name = $email_parts[0];
$email_domain_tld = $email_parts[1];
$domain_parts = explode(".", $email_domain_tld);
$email_domain = "";
for ($x = 0; $x < count($domain_parts)-1; $x++)
{
$email_domain .= $domain_parts[$x].".";
}
$email_tld = $domain_parts[$x];
}
$hp = urldecode($parts[5]);
$place = urldecode($parts[6]);
$text = urldecode($parts[7]);
$comment = urldecode($parts[8]);
$text = htmlspecialchars(stripslashes($text));
#$text = htmlspecialchars(stripslashes($text));
$text = nl2br($text);
if ($autolink == true) $text = make_link($text);
if ($bbcode == true) $text = bbcode($text);
if (isset($smiley_folder) && $smiley_folder != "") $text = smilies($text);
$comment = htmlspecialchars(stripslashes($comment));
$comment = nl2br($comment);
if ($autolink == true) $comment = make_link($comment);
if ($bbcode == true) $comment = bbcode($comment);
if (isset($smiley_folder) && $smiley_folder != "") $comment = smilies($comment);
?>
<div class="gb">
<div class="gb-author">
<p class="gb-author-left">
<?php
echo "<b>" . htmlspecialchars(stripslashes($name)) . "</b>";
if ($email != "" or $hp != "") { echo " <span >"; }
if ($hp != "") { if (isset($homepage_icon) && $homepage_icon != "") { ?><a href="http://<?php echo $hp; ?>"><img src="<?php echo $homepage_icon; ?>" alt="<?php echo $hp_link_marking; ?>" title="<?php echo $hp_link_marking; ?>" /></a><?php } else echo "[ <a href="http://" .$hp ."">".$hp_link_marking."</a> ]"; }
if ($email != "" && $hp != "") { echo " "; }
if ($email != "") { if (empty($email_icon) or $email_icon == "") echo "[ "; ?><script type="text/javascript">
<!--
document.write('<a href="mailto:'); document.write('<?php echo $email_name; ?>'); document.write('@'); document.write('<?php echo $email_domain; ?>'); document.write('<?php echo $email_tld; ?>'); document.write('">');
//-->
</script><?php if (isset($email_icon) && $email_icon != "") { ?><img src="<?php echo $email_icon; ?>" alt="<?php echo $email_link_marking; ?>" title="<?php echo $email_link_marking; ?>" /><?php } else echo $email_link_marking;
?><script type="text/javascript">
<!--
document.write('</a>');
//-->
</script><?php
if (empty($email_icon) or $email_icon == "") echo " ]"; }
if ($email != "" or $hp != "") echo "</span>";
?></p>
<p class="gb-author-right">
<?php
if ($place != "") { echo htmlspecialchars(stripslashes($place)) . ", "; }
echo parse_time(strftime($time_format, $parts[1]));
?></p></div>
<div class="gb-entry"><?php echo $text; ?>
<?php if (substr($comment,0,3)!="xxx") { ?><p class="comment"><?php echo $comment; ?></p><?php }
if (isset($_SESSION['admin'])) { ?><form method="post" action="<?php echo basename($_SERVER["PHP_SELF"]); ?>"><p class="gb-admin-buttons"><input type="hidden" name="entry_uniqid" value="<?php echo $parts[0]; ?>" /><input type="hidden" name="delete_name" value="<?php echo $parts[3]; ?>" /><input type="submit" name="edit" value="<?php echo $edit_button; ?>" /> <input type="submit" name="delete" value="<?php echo $delete_button; ?>" /></p></form><?php }
?></div></div>
<?php
}
}
browse();
break;
case "form":
if(isset($errors))
{
?><p class="caution"><?php echo $error_marking; ?></p><ul><?php foreach($errors as $f) { ?><li><?php echo $f; ?></li><?php } ?></ul><br /><?php
}
elseif (empty($errors) && isset($_POST['preview']))
{
$pr_text = htmlspecialchars(stripslashes($text));
$pr_text = nl2br($pr_text);
if ($autolink == true) $pr_text = make_link($pr_text);
if ($bbcode == true) $pr_text = bbcode($pr_text);
if (isset($smiley_folder) && $smiley_folder != "") $pr_text = smilies($pr_text);
$pr_comment = htmlspecialchars(stripslashes($comment));
$pr_comment = nl2br($pr_comment);
if ($autolink == true) $pr_comment = make_link($pr_comment);
if ($bbcode == true) $pr_comment = bbcode($pr_comment);
if (isset($smiley_folder) && $smiley_folder != "") $pr_comment = smilies($pr_comment);
?>
<p class="caution"><?php echo $preview_marking; ?></p>
<div class="gb">
<div class="gb-author">
<p class="gb-author-left">
<?php
echo "<b>" . htmlspecialchars(stripslashes($name)) . "</b>";
if ($email != "" or $hp != "") { echo " <span >"; }
if ($hp != "") { if (isset($homepage_icon) && $homepage_icon != "") { ?><a href="http://<?php echo $hp; ?>"><img src="<?php echo $homepage_icon; ?>" alt="<?php echo $hp_link_marking; ?>" /></a><?php } else echo "[ <a href="http://" .$hp ."">".$hp_link_marking."</a> ]"; }
if ($email != "" && $hp != "") { echo " "; }
if ($email != "") { if (isset($email_icon) && $email_icon != "") { ?><a href="mailto:<?php echo $email; ?>"><img src="<?php echo $email_icon; ?>" alt="<?php echo $email_link_marking; ?>" /></a><?php } else echo "[ <a href="mailto:" .$email ."">".$email_link_marking."</a> ]"; }
if ($email != "" or $hp != "") { echo " </span>"; }
?>
</p>
<p class="gb-author-right">
<?php
if ($place != "") { echo htmlspecialchars(stripslashes($place)) . ", "; }
if ($action=="edit") { echo parse_time(strftime($time_format, $_POST['time'])); } else echo parse_time(strftime($time_format));
?></p></div>
<div class="gb-entry"><?php echo $pr_text; ?>
<?php if (substr($pr_comment,0,3)!="xxx") { ?><p class="comment"><?php echo $pr_comment; ?></span></p><?php } ?>
</div>
</div><br />
<?php
}