<?php
/************************************************************************
	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åÐ 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:			clearchat.php
	- Developer: 	Todd Henderson / Mods by Laurent (AdNovea)
	- Date:			November 4, 2008
	- version:		(3.2.0) 1.0
	- Description:  Clear chat room messages and uploaded files

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

	require("./inc/config/config.uebimiau.php");
	require("./".PATH_LANGS."$chat_language.php");
	$chat_data_file	= DB_CHAT_DATA;
  $chat_online_file = DB_CHAT_ONLINE;
  $chat_upload_dir = DB_CHAT_UPLOAD;
	$nick = $_GET['nick'];
	$lid = $_GET['lid'];
	$tid = $_GET['tid'];
	$selected_theme 	= $themes[$tid]["path"];

	define("__BACK__","<br><br><input class='button' type='button' onclick=\"javascript:window.location.href='./startchat.php?lid=$lid&tid=$tid'\" value='".CHAT_BACK."'></center>");

	$date = date($chat_date_format);
	$line = CHAT_CLEARED." $nick\n";


// Clear messages and uploaded files
	$file = fopen($temporary_directory.DB_CHAT_DATA, 'w');
	fwrite($file, $line);
	fclose($file);
	
	$folder = dir($temporary_directory.DB_CHAT_UPLOAD);
	while ($entry = $folder->read()) if ($entry != "." && $entry != "..") {
		unlink($temporary_directory.DB_CHAT_UPLOAD.$entry);
	}
	$folder->close();
	
	header("cache-Control: no-cache, must-revalidate"); 
	header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); 
	echo "
		<link rel='stylesheet' type='text/css' href='./themes/$selected_theme/$chat_default_theme'>
		<script type='text/javascript'>
			<!--
			function delayer(){
				document.location = './startchat.php?lid=$lid&tid=$tid';
			}
			//-->
		</script>
	
	<body onLoad=\"setTimeout('delayer()',0)\">
	";	
	echo "<br><center>".CHAT_CLEARED_BY." <b>$nick</b>".__BACK__;
	echo "</body></html>"

?>
