<commit_before><?

$template->assign('PageTopic','VIEWING MESSAGE BOXES');

if(!isset($var['box_type_id']))
{
	$db->query('SELECT * FROM message_box_types');
	$container=array();
	$container['url'] = 'skeleton.php';
	$container['body'] = 'box_view.php';
	$PHP_OUTPUT.='<table>';
	while($db->nextRecord())
	{
		$container['box_type_id'] = $db->getField('box_type_id');
		$PHP_OUTPUT.='<tr><td><a href="'.SmrSession::get_new_href($container).'">'.$db->getField('box_type_name').'</a></td></tr>';
	}
	$PHP_OUTPUT.='</table>';
}
else
{
	$PHP_OUTPUT.=create_link(create_container('skeleton.php','box_view.php'),'Back<br />');
	$db2 = new SmrMySqlDatabase();
	$db->query('SELECT * FROM message_boxes WHERE box_type_id='.$var['box_type_id'].' ORDER BY send_time DESC');
	$container = array();
	$container['url'] = 'box_delete_processing.php';
	if ($db->getNumRows())
	{
		$PHP_OUTPUT.=create_echo_form($container);
		$PHP_OUTPUT.=('<br />');
		$PHP_OUTPUT.=('Click the name to reply<br />');
		$PHP_OUTPUT.=('<table width="100%" border="0" class="standard" cellspacing="0" cellpadding="1">');
		
		while($db->nextRecord())
		{
			$gameID = $db->getField('game_id')>0?$db->getField('game_id'):false;
			$PHP_OUTPUT.=('<tr>');
			$PHP_OUTPUT.=('<td><input type="checkbox" name="message_id[]" value="'.$db->getField('message_id').'"></td>');
			if($gameID!==false)
				$sender =& SmrPlayer::getPlayer($db->getField('sender_id'), $db->getField('game_id'));
			$sender_acc =& SmrAccount::getAccount($db->getField('sender_id'));
			$container = array();
			$container['url'] = 'skeleton.php';
			$container['body'] = 'box_reply.php';
			$container['sender_id'] = $sender_acc->getAccountID();
			$container['game_id'] = $gameID;
			$PHP_OUTPUT.=('<td nowrap="nowrap">');
			
			$sender = 'From: '.$sender_acc->login.' ('.$sender_acc->account_id.')';
			if (is_object($sender)&&$sender_acc->login != $sender->getPlayerName())
				$sender .= ' a.k.a '.$sender->getPlayerName();
			if($gameID!==false)
				$PHP_OUTPUT.=create_link($container, $sender);
			else
				$PHP_OUTPUT.=$sender;
			$PHP_OUTPUT.='</td>';
			$PHP_OUTPUT.='<td>';
			$db2->query('SELECT * FROM game WHERE game_id = ' . $db->getField('game_id'));
			if ($db2->nextRecord()) $PHP_OUTPUT.=$db2->getField('game_name'); //$trader .= ' in ' . $db2->getField('game_name');
			else $PHP_OUTPUT.=('Game no longer exists'); //$trader .= ' in a game that no longer exists.';
			$PHP_OUTPUT.=('</td></tr><tr><td colspan="3">');
			$PHP_OUTPUT.=('Sent at ' . date(DATE_FULL_SHORT, $db->getField('sent_time')));
			$PHP_OUTPUT.='</td>';
			$PHP_OUTPUT.=('</tr>');
			$PHP_OUTPUT.=('<tr>');
			$PHP_OUTPUT.=('<td width="100%" colspan="3">');
			$PHP_OUTPUT.= $db->getField('message_text');
			$PHP_OUTPUT.=('</td></tr>');
			
		}
		
		$PHP_OUTPUT.=('</table>');
		$PHP_OUTPUT.=create_submit('Delete');
		$PHP_OUTPUT.=('</form>');
		
	} else
		$PHP_OUTPUT.=('There are no reported Messages.');
}
?><commit_msg>Fix incorrect time display on box messages.<commit_after><?

$template->assign('PageTopic','VIEWING MESSAGE BOXES');

if(!isset($var['box_type_id']))
{
	$db->query('SELECT * FROM message_box_types');
	$container=array();
	$container['url'] = 'skeleton.php';
	$container['body'] = 'box_view.php';
	$PHP_OUTPUT.='<table>';
	while($db->nextRecord())
	{
		$container['box_type_id'] = $db->getField('box_type_id');
		$PHP_OUTPUT.='<tr><td><a href="'.SmrSession::get_new_href($container).'">'.$db->getField('box_type_name').'</a></td></tr>';
	}
	$PHP_OUTPUT.='</table>';
}
else
{
	$PHP_OUTPUT.=create_link(create_container('skeleton.php','box_view.php'),'Back<br />');
	$db2 = new SmrMySqlDatabase();
	$db->query('SELECT * FROM message_boxes WHERE box_type_id='.$var['box_type_id'].' ORDER BY send_time DESC');
	$container = array();
	$container['url'] = 'box_delete_processing.php';
	if ($db->getNumRows())
	{
		$PHP_OUTPUT.=create_echo_form($container);
		$PHP_OUTPUT.=('<br />');
		$PHP_OUTPUT.=('Click the name to reply<br />');
		$PHP_OUTPUT.=('<table width="100%" border="0" class="standard" cellspacing="0" cellpadding="1">');
		
		while($db->nextRecord())
		{
			$gameID = $db->getField('game_id')>0?$db->getField('game_id'):false;
			$PHP_OUTPUT.=('<tr>');
			$PHP_OUTPUT.=('<td><input type="checkbox" name="message_id[]" value="'.$db->getField('message_id').'"></td>');
			if($gameID!==false)
				$sender =& SmrPlayer::getPlayer($db->getField('sender_id'), $db->getField('game_id'));
			$sender_acc =& SmrAccount::getAccount($db->getField('sender_id'));
			$container = array();
			$container['url'] = 'skeleton.php';
			$container['body'] = 'box_reply.php';
			$container['sender_id'] = $sender_acc->getAccountID();
			$container['game_id'] = $gameID;
			$PHP_OUTPUT.=('<td nowrap="nowrap">');
			
			$sender = 'From: '.$sender_acc->login.' ('.$sender_acc->account_id.')';
			if (is_object($sender)&&$sender_acc->login != $sender->getPlayerName())
				$sender .= ' a.k.a '.$sender->getPlayerName();
			if($gameID!==false)
				$PHP_OUTPUT.=create_link($container, $sender);
			else
				$PHP_OUTPUT.=$sender;
			$PHP_OUTPUT.='</td>';
			$PHP_OUTPUT.='<td>';
			$db2->query('SELECT * FROM game WHERE game_id = ' . $db->getField('game_id'));
			if ($db2->nextRecord()) $PHP_OUTPUT.=$db2->getField('game_name'); //$trader .= ' in ' . $db2->getField('game_name');
			else $PHP_OUTPUT.=('Game no longer exists'); //$trader .= ' in a game that no longer exists.';
			$PHP_OUTPUT.=('</td></tr><tr><td colspan="3">');
			$PHP_OUTPUT.=('Sent at ' . date(DATE_FULL_SHORT, $db->getField('send_time')));
			$PHP_OUTPUT.='</td>';
			$PHP_OUTPUT.=('</tr>');
			$PHP_OUTPUT.=('<tr>');
			$PHP_OUTPUT.=('<td width="100%" colspan="3">');
			$PHP_OUTPUT.= $db->getField('message_text');
			$PHP_OUTPUT.=('</td></tr>');
			
		}
		
		$PHP_OUTPUT.=('</table>');
		$PHP_OUTPUT.=create_submit('Delete');
		$PHP_OUTPUT.=('</form>');
		
	} else
		$PHP_OUTPUT.=('There are no reported Messages.');
}
?>
{'fraction_non_alphanumeric': 0.25725371120107965, 'fraction_numerical': 0.005735492577597841, 'mean_word_length': 5.40280777537797, 'pattern_counts': {'":': 0, '<': 67, '<?xml version=': 0, '>': 123, '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': '892497', 'n_tokens_mistral': 2441, 'n_tokens_neox': 2190, 'n_words': 296}