<commit_before><commit_msg>Inbox: controller. #97<commit_after><?php
Auth(1, 0, false);
require(ServicePath . 'inbox.php');
$InboxID = intval(Request('Get', 'inbox_id'));
$UserInfo = array();
if(preg_match('/^[1-9][0-9]*$/', $InboxID)) {
	$DialogInfo = $DB->row('SELECT * FROM ' . PREFIX . 'inbox WHERE ID = :ID AND (SenderID = :SenderID OR ReceiverID = :ReceiverID)', array(
		'ID' => $InboxID,
		'SenderID' => $CurUserID,
		'ReceiverID' => $CurUserID,
	));
} else {
	$UserInfo = $DB->row('SELECT * FROM ' . PREFIX . 'users WHERE ID=:ID', array(
		'UserName' => $UserName
	));
	$InboxID = !empty($UserInfo) ? GetInboxID($UserInfo['ID']) : 0;
	if ($InboxID) {
		Redirect('inbox/' . $InboxID);
	}
}

$ContactUserName = $DialogInfo['SenderID'] == $CurUserID ? $DialogInfo['ReceiverName'] : $DialogInfo['SenderName'];
if (empty($InboxID) || empty($DialogInfo)){
	AlertMsg('404 Not Found', '404 Not Found', 404);
}

// 页面变量
$PageTitle   = 'Contact With ' . $ContactUserName;
$ContentFile = $TemplatePath . 'inbox.php';
include($TemplatePath . 'layout.php');
{'fraction_non_alphanumeric': 0.2184235517568851, 'fraction_numerical': 0.017094017094017096, 'mean_word_length': 5.236686390532545, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 9, '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': '4790852', 'n_tokens_mistral': 416, 'n_tokens_neox': 398, 'n_words': 80}