<?
if ($auth->currentUserInfo['username'] == "admin") {



if ($_GET['reset']) {
	$log->clearAll($_GET['user']);
	$js = "window.close();self.close()";
}




if ($_GET['year']) {
	$year = $_GET['year'];
} else {
	$year = date("Y");
}

if ($_GET['month']) {
	$month = $_GET['month'];
} else {
	$month = date("n");
}

if ($_GET['day']) {
	$day = $_GET['day'];
} else {
	$day = date("j");
}


$uid = $_GET['uid'];

$titleDate = date("d-M-Y",mktime(0,0,0,$month,$day,$year));

if ($uid) {
	$title = $auth->id2username($_GET['uid'])." : ".$titleDate;
} else {
	$title = $lang->get("Activity log")." : ".$titleDate;
}

$logs = $log->get($_GET['uid'], $year, $month, $day);


//template header
require_once($sys['root']."/system/templates/popup/header.inc");
?>

<script language="JavaScript1.2" type="text/javascript">
<?echo $js?>
</script>

<table cellspacing="0" cellpadding="0" border="0" style="width:100%;height:100%;background-color:#F2F2F2">
<tr>
    <td background="images/popup/top-bg.gif" height="26">&nbsp;</td>
</tr>

<tr>
    <td style="padding:10px;" valign="top">
<!-- Popup Contents -->


<table width="100%" border="0" cellspacing="2" cellpadding="5">
<tr style="margin-bottom:4px;height:23px;background-color:#E0DCD8;margin-left:1px;background-image:url(images/interface/locationbarbg.gif);">
	<td style="border-right:1px solid gray;border-bottom:1px solid gray;border-left:1px solid white;padding-left:10px;"><?$lang->display("Date");?></td>
	<?if (!$uid) {?>
	<td style="border-right:1px solid gray;border-bottom:1px solid gray;border-left:1px solid white;padding-left:10px;"><?$lang->display("User");?></td>
	<?}?>
	<td style="border-right:1px solid gray;border-bottom:1px solid gray;border-left:1px solid white;padding-left:10px;"><?$lang->display("Action");?></td>
	<td style="border-right:1px solid gray;border-bottom:1px solid gray;border-left:1px solid white;padding-left:10px;"><?$lang->display("Details");?></td>
</tr>
<?
if ($settings->config['demomode']) {
?>

<tr>
	<td style="background-color:white" nowrap>13-Apr-2005 12:19</td>
		<td style="background-color:white" nowrap>admin</td>
		<td style="background-color:white;color:brown;">login</td>
	<td style="background-color:white">admin:admin@127.0.0.1</td>
</tr>
<tr>
	<td style="background-color:white" nowrap>13-Apr-2005 12:20</td>
		<td style="background-color:white" nowrap>admin</td>
		<td style="background-color:white;color:brown;">file uploaded</td>
	<td style="background-color:white">/home/afian/demo/file.ext</td>
</tr>
<tr>
	<td style="background-color:white" nowrap>13-Apr-2005 12:21</td>
		<td style="background-color:white" nowrap>admin</td>
		<td style="background-color:white;color:brown;">folder created</td>
	<td style="background-color:white">/home/afian/demo/folder</td>
</tr>
<tr>
	<td style="background-color:white" nowrap>13-Apr-2005 12:22</td>
		<td style="background-color:white" nowrap>admin</td>
		<td style="background-color:white;color:brown;">file moved</td>
	<td style="background-color:white">"/home/afian/demo/file.ext" to "/home/afian/demo/folder"</td>
</tr>
<tr>
	<td style="background-color:white" nowrap>13-Apr-2005 12:23</td>
		<td style="background-color:white" nowrap>admin</td>
		<td style="background-color:white;color:brown;">logout</td>
	<td style="background-color:white">127.0.0.1</td>
</tr>
<?
} else {
?>

<?
for ($i = 0; $i < sizeof($logs) ; $i++) {
?>
<tr>
	<td style="background-color:white" nowrap><?echo date("d-M-Y G:i", $logs[$i]['date']);?></td>
	<?if (!$uid) {?>
	<td style="background-color:white" nowrap><?echo $logs[$i]['username'];?></td>
	<?}?>
	<td style="background-color:white;color:<?echo ($logs[$i]['code']=="1")?"red":"brown"?>;"><?echo $logs[$i]['action'];?></td>
	<td style="background-color:white"><?echo nl2br($logs[$i]['details']);?></td>
</tr>
<?
}
?>

<?}?>
</table>


<?if ($settings->config['demomode']) {?>
<br>
<?$lang->display("This is just a sample log for demonstration purposes.");?>
<?}?>

	</td>
</tr>
<tr>
    <td align="center" height="20">
<table border="0" cellspacing="3" cellpadding="1" style="position:relative;top:18px;z-index:1">
<tr>
	<td><?
$tpl->btn(
$lang->get("Close"), 
"self.close();window.close()"
)
?></td>
</tr>
</table>
	</td>
</tr>
<tr>
    <td background="images/popup/bottom-bg.gif" height="46">&nbsp;</td>
</tr>
</table>

<?
//template footer
require_once($sys['root']."/system/templates/popup/footer.inc");
?>

<?
} //end if username == admin
?>