<commit_before><?php

// $Header: /cvsroot/tikiwiki/tiki/tiki-chat_loader.php,v 1.16 2006-01-24 05:43:19 rlpowell Exp $

// Copyright (c) 2002-2005, <NAME>, <NAME>, <NAME>, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.

$section = 'chat';
include_once ('tiki-setup.php');

include_once ('lib/chat/chatlib.php');

if ($feature_chat != 'y') {
	die;
}

if ($tiki_p_chat != 'y') {
	die;
}

// get a list of messages to display from messages
// use get_messages($lastMessage)
// display the messages (keep the biggest id)
// set lastMessage in the session
//refresh_user($user);
// :TODO: use a preference here instead of 1440 minutes = 1 day
$chatlib->purge_messages(1440);
$chatlib->purge_private_messages(1440);

if (isset($_REQUEST["refresh"])) {
	$refresh = $_REQUEST["refresh"];
} else {
	$refresh = 10000;
}

if (!isset($_SESSION["lastMessage"])) {
	$lastMessage = 0;
} else {
	$lastMessage = $_SESSION["lastMessage"];
}

if (!$lastMessage)
	$lastMessage = 0;

print ('<html><head>');
print ('
<SCRIPT language="JavaScript">

function chatdata_setup()
{
	self.scrollTo(0,10000);
	window.setInterval(\'location.reload()\',' . $refresh . ');
}
</SCRIPT>
');
print ('</head>');

print ('<body onload="chatdata_setup()">');

//prune_users();
//update_channel_ratio($channelId);
if (isset($_REQUEST["channelId"])) {
	$messages = $chatlib->get_messages($_REQUEST["channelId"], 0, 0);

	if (count($messages) > 0) {
		//print ("<script language='Javascript' type='text/javascript'>");

		foreach ($messages as $msg) {
			if ($msg["poster"] != $_REQUEST["nickname"]) {
				$classt = 'black';
			} else {
				$classt = 'blue';
			}
			//the order seems to be imported to parse the smile and special characteres
			$parsed = $chatlib->parse_chat_data(htmlspecialchars($msg["data"]));
			$prmsg = "<span style=\"color:$classt;\">" . $msg["posterName"] . ": " . $parsed . "</span><br />";
			//$com = "top.document.frames[0].document.write('".$prmsg."');";
			//$com = "top.chatdata.document.write('" . $prmsg . "');";
			$com = "$prmsg";

			//$com="top.document.frames[0].document.write('hey')";
			if ($msg["messageId"] > $_SESSION["lastMessage"])
				$_SESSION["lastMessage"] = $msg["messageId"];

			//print("alert('$com');");
			print ($com);
			//print("top.document.frames[0].document.write('\n');");
		}

		//print ("top.chatdata.scrollTo(0,100000)");
		//print ("</script>");
	//session_register("lastMessage");
	}
}

$messages = $chatlib->get_private_messages($_REQUEST["nickname"]);

if (count($messages) > 0) {
	//print ("<script language='Javascript' type='text/javascript'>");

	foreach ($messages as $msg) {
		$classt = 'red';

		$parsed = $chatlib->parse_chat_data($msg["data"]);
		$prmsg = "<span style=\"color:$classt;\">" . $msg["posterName"] . ": " . $parsed . "</span><br />";
		//$com = "top.chatdata.document.write('" . $prmsg . "');";
		$com = "$prmsg";
		print ($com);
	}

	//print ("top.chatdata.scrollTo(0,100000)");
	//print ("</script>");
}

//if (isset($com)) {
//print_r($messages);
//print(htmlentities($com));
//}

print ('</body></html>');

?>
<commit_msg>Missing an argument to a new function.<commit_after><?php

// $Header: /cvsroot/tikiwiki/tiki/tiki-chat_loader.php,v 1.17 2006-01-24 06:11:52 rlpowell Exp $

// Copyright (c) 2002-2005, <NAME>, <NAME>, <NAME>, et. al.
// All Rights Reserved. See copyright.txt for details and a complete list of authors.
// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details.

$section = 'chat';
include_once ('tiki-setup.php');

include_once ('lib/chat/chatlib.php');

if ($feature_chat != 'y') {
	die;
}

if ($tiki_p_chat != 'y') {
	die;
}

// get a list of messages to display from messages
// use get_messages($lastMessage)
// display the messages (keep the biggest id)
// set lastMessage in the session
//refresh_user($user);
// :TODO: use a preference here instead of 1440 minutes = 1 day
$chatlib->purge_messages(1440);
$chatlib->purge_private_messages($_REQUEST["nickname"], 1440);

if (isset($_REQUEST["refresh"])) {
	$refresh = $_REQUEST["refresh"];
} else {
	$refresh = 10000;
}

if (!isset($_SESSION["lastMessage"])) {
	$lastMessage = 0;
} else {
	$lastMessage = $_SESSION["lastMessage"];
}

if (!$lastMessage)
	$lastMessage = 0;

print ('<html><head>');
print ('
<SCRIPT language="JavaScript">

function chatdata_setup()
{
	self.scrollTo(0,10000);
	window.setInterval(\'location.reload()\',' . $refresh . ');
}
</SCRIPT>
');
print ('</head>');

print ('<body onload="chatdata_setup()">');

//prune_users();
//update_channel_ratio($channelId);
if (isset($_REQUEST["channelId"])) {
	$messages = $chatlib->get_messages($_REQUEST["channelId"], 0, 0);

	if (count($messages) > 0) {
		//print ("<script language='Javascript' type='text/javascript'>");

		foreach ($messages as $msg) {
			if ($msg["poster"] != $_REQUEST["nickname"]) {
				$classt = 'black';
			} else {
				$classt = 'blue';
			}
			//the order seems to be imported to parse the smile and special characteres
			$parsed = $chatlib->parse_chat_data(htmlspecialchars($msg["data"]));
			$prmsg = "<span style=\"color:$classt;\">" . $msg["posterName"] . ": " . $parsed . "</span><br />";
			//$com = "top.document.frames[0].document.write('".$prmsg."');";
			//$com = "top.chatdata.document.write('" . $prmsg . "');";
			$com = "$prmsg";

			//$com="top.document.frames[0].document.write('hey')";
			if ($msg["messageId"] > $_SESSION["lastMessage"])
				$_SESSION["lastMessage"] = $msg["messageId"];

			//print("alert('$com');");
			print ($com);
			//print("top.document.frames[0].document.write('\n');");
		}

		//print ("top.chatdata.scrollTo(0,100000)");
		//print ("</script>");
	//session_register("lastMessage");
	}
}

$messages = $chatlib->get_private_messages($_REQUEST["nickname"]);

if (count($messages) > 0) {
	//print ("<script language='Javascript' type='text/javascript'>");

	foreach ($messages as $msg) {
		$classt = 'red';

		$parsed = $chatlib->parse_chat_data($msg["data"]);
		$prmsg = "<span style=\"color:$classt;\">" . $msg["posterName"] . ": " . $parsed . "</span><br />";
		//$com = "top.chatdata.document.write('" . $prmsg . "');";
		$com = "$prmsg";
		print ($com);
	}

	//print ("top.chatdata.scrollTo(0,100000)");
	//print ("</script>");
}

//if (isset($com)) {
//print_r($messages);
//print(htmlentities($com));
//}

print ('</body></html>');

?>

{'fraction_non_alphanumeric': 0.22961704756022236, 'fraction_numerical': 0.022235948116121063, 'mean_word_length': 4.357320099255583, 'pattern_counts': {'":': 4, '<': 47, '<?xml version=': 0, '>': 65, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5070728', 'n_tokens_mistral': 2511, 'n_tokens_neox': 2289, 'n_words': 479}