<?php session_start(); ?><!DOCTYPE html>
<html class="">
<head>
<title></title>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Goldfish 3.9 http://www.fishbeam.com" />
<link rel="stylesheet" href="../global_style.css" type="text/css" />
<link type="text/css" href="../jquery/css/smoothness/jquery-ui-1.10.2.custom.min.css" rel="Stylesheet" />
<script type="text/javascript" src="../jquery/js/jquery-1.9.1.js"></script>
<script type="text/javascript" src="../jquery/js/jquery-ui-1.10.2.custom.min.js"></script>
<script type="text/javascript">
var pathToSupport="../";
</script>
<script type="text/javascript" src="script.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" />
</head>
<body class="commentsBody8769f0d2b2b163b8">
<?php
/**************************************************************************************************
* Goldfish Comments Script (works only with jQuery)
* This javascript is created by Goldfish from Fishbeam Software: http://www.fishbeam.com
* All rights reserved. © 2009 Yves Pellot
**************************************************************************************************/

//Configuration
$stringDateFormat="d.m.Y";
$commentsId="146";
$adminPassword="1952";
$allowReply=true;
$repliesClass="commentsReplies11de8922cf613276";

//Check adminPassword: Allow to delete comments
if(isSet($_SESSION['adminPassword']) && $_SESSION['adminPassword']==$adminPassword)
	$admin=true;

//Function to print comments with a specific parent
function printComments($parent) {
	global $comments, $stringDateFormat, $commentsId, $admin, $allowReply, $repliesClass;
	if(array_key_exists($parent, $comments)) {
		foreach($comments[$parent] as $comment) {
			echo '<div class="comment" id="comments_'.$commentsId.'_comment_'.$comment['id'].'"><p>';
			if($allowReply)
				echo '<img src="reply.png" class="addReply" id="addReply_'.$commentsId.'_'.$comment['id'].'" />';
			if($admin)
				echo '<img src="remove.png" class="removeComment" id="removeComment_'.$commentsId.'_'.$comment['id'].'" /><a href="mailto:'.$comment['email'].'"><img src="mail.png" class="addMail" title="'.$comment['email'].'" /></a>';
			echo '<b>'.$comment['name'].' ('.date($stringDateFormat, $comment['date']).')</b><br>';
			echo $comment['text'];
			echo '</p>';
			echo '<div class="'.$repliesClass.'">';
			printComments($comment['id']);
			echo '</div>';
			echo '</div>';
		}
	}
}

//Read comments
$comments=array();
if(file_exists("../saved/comments_".$commentsId.".php")) {
	$data=file("../saved/comments_".$commentsId.".php");
	//In the first line is php code for security reasons
	for($i=1; $i<count($data); $i=$i+6) {
		$entry=array();
		$entry['id']=trim($data[$i]);
		$parent=trim($data[$i+1]);
		$entry['name']=trim($data[$i+2]);
		$entry['date']=trim($data[$i+3]);
		$entry['text']=trim($data[$i+4]);
		$entry['email']=trim($data[$i+5]);
		if(!array_key_exists($parent, $comments))
			$comments[$parent]=array();
  		array_push($comments[$parent], $entry);
	}
}
//Sorted from newest to oldest
if(array_key_exists(0, $comments))
	$comments[0]=array_reverse($comments[0]);

//print comments
printComments(0);

?></body>
</html>
