<?php
define( '_UEXEC', 1 ); 
/************************************************************************
	UebiMiau is a GPL'ed software developed by 
	
	 - Aldoir Ventura - aldoir@users.sourceforge.net
	 - http://uebimiau.sourceforge.net
	
	Fell free to contact, send donations or anything to me :-)
	São Paulo - Brasil
	
	**********************************************
	Version 3.2.0 Upgrades and templates developed by
	 
	 - Todd Henderson - Lead Developer
	 - http://tdah.us
	 - Email: todd@tdah.us
	 
	 - Dave Rodgers - Project Consultant
	 - http://www.manvel.net 
	 - Email: Davenmanvel@inbox.com
	
	Feel free to contact us, send donations or anything to me as well...
	
	Special thanks to the developers at telaen.org, codeworxtech.com, tinymce.moxiecode.com
	without help this project wouldn't be possible 

	**********************************************
	- File:			admin/log.php
	- Developer: 	Created by Laurent (AdNovea)
	- Date:			November 4, 2008
	- version:		(3.2.0) 1.0
	- Description:  Display the logs

*************************************************************************/


	require_once('common.php');

// Clear log file and recreate empty log file
	if ( (isset($_GET['clear'])) && ($_GET['clear'] == 'ok') ) {
		if (file_exists(ADMIN_LOGS)) unlink(ADMIN_LOGS);
	} 
	
	if (!file_exists(ADMIN_LOGS)) {
		$logFile = fopen(ADMIN_LOGS,"a+");
        fwrite($logFile, "<span class=\"log_date\">".date(LOG_DATE)."</span><span class=\"log_event\">$admin_log_cleared <b>".$_SESSION['userName']."</b></span><br>\n");
		fclose($logFile);
		Header("Location: log.php?lid=$lid&tid=$tid");
		exit;
	}
	
	header("cache-Control: no-cache, must-revalidate"); 
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 

	$html = DOC_TYPE."
	<html>
	<head>
		<meta http-equiv=\"Content-Type\" content=\"text/html; charset=$default_char_set\">
		<title>$admin_title</title>
		<link href=\"../themes/$selected_theme/css/admin.css\" rel=\"stylesheet\" type=\"text/css\">
		<script type=\"text/javascript\" src=\"../themes/$selected_theme/js/webmail.js\"></script>	   
	</head>
	
	<body onload=\"javascript:reSizeElementHeight('data',100); document.getElementById('data').scrollTop = document.getElementById('data').scrollHeight\" onresize=\"javascript:reSizeElementHeight('data',100);\">
		<center>
			<p class=\"caption\">$admin_view_log<br></p>
			<div id=\"data\">
	";
	
	if (file_exists(ADMIN_LOGS)) {
		$flag = file(ADMIN_LOGS);
		$content = "";
		foreach ($flag as $value) {
			$content .= $value;
		}
		$html .= $content;
	}

	$html .= "
			</div>
			<br>
			<input type=\"button\" class=\"button\" onClick=\"javascript:location='./log.php?lid=$lid&tid=$tid&clear=ok'\" value=\"$bt_clear\">&nbsp;
			<input type=\"button\" class=\"button\" onClick=\"javascript:location='./index.php?lid=$lid&tid=$tid'\" value=\"$bt_back\">
		</center>
		
	</body>
	</html>";

	echo $html;
	
?>
