Пример #1
0
$UserID = $LoggedUser['ID'];
authorize();
replace */
if (!isset($_POST['messages']) || !is_array($_POST['messages'])) {
    error('You forgot to select messages to delete.');
    header('Location: ' . Inbox::get_inbox_link());
    die;
}
$Messages = $_POST['messages'];
foreach ($Messages as $ConvID) {
    $ConvID = trim($ConvID);
    if (!is_number($ConvID)) {
        error(0);
    }
}
$ConvIDs = implode(',', $Messages);
$DB->query("\n\tSELECT COUNT(ConvID)\n\tFROM pm_conversations_users\n\tWHERE ConvID IN ({$ConvIDs})\n\t\tAND UserID={$UserID}");
list($MessageCount) = $DB->next_record();
if ($MessageCount != count($Messages)) {
    error(0);
}
if (isset($_POST['delete'])) {
    $DB->query("\n\t\tUPDATE pm_conversations_users\n\t\tSET\n\t\t\tInInbox='0',\n\t\t\tInSentbox='0',\n\t\t\tSticky='0',\n\t\t\tUnRead='0'\n\t\tWHERE ConvID IN({$ConvIDs})\n\t\t\tAND UserID={$UserID}");
} elseif (isset($_POST['unread'])) {
    $DB->query("\n\t\tUPDATE pm_conversations_users\n\t\tSET Unread='1'\n\t\tWHERE ConvID IN({$ConvIDs}) AND UserID={$UserID}");
} elseif (isset($_POST['read'])) {
    $DB->query("\n\t\tUPDATE pm_conversations_users\n\t\tSET Unread='0'\n\t\tWHERE ConvID IN({$ConvIDs}) AND UserID={$UserID}");
}
$Cache->delete_value('inbox_new_' . $UserID);
header('Location: ' . Inbox::get_inbox_link());
Пример #2
0
    $DB->query("\n\t\tUPDATE pm_conversations_users\n\t\tSET UnRead = '0'\n\t\tWHERE ConvID = '{$ConvID}'\n\t\t\tAND UserID = '{$UserID}'");
    // Clear the caches of the inbox and sentbox
    $Cache->decrement("inbox_new_{$UserID}");
}
View::show_header("View conversation {$Subject}", 'comments,inbox,bbcode,jquery.validate,form_validate');
// Get messages
$DB->query("\n\tSELECT SentDate, SenderID, Body, ID\n\tFROM pm_messages\n\tWHERE ConvID = '{$ConvID}'\n\tORDER BY ID");
?>
<div class="thin">
	<h2><?php 
echo $Subject . ($ForwardedID > 0 ? " (Forwarded to {$ForwardedName})" : '');
?>
</h2>
	<div class="linkbox">
		<a href="<?php 
echo Inbox::get_inbox_link();
?>
" class="brackets">Back to inbox</a>
	</div>
<?php 
while (list($SentDate, $SenderID, $Body, $MessageID) = $DB->next_record()) {
    ?>
	<div class="box vertical_space">
		<div class="head" style="overflow: hidden;">
			<div style="float: left;">
				<strong><?php 
    echo $Users[(int) $SenderID]['UserStr'];
    ?>
</strong> <?php 
    echo time_diff($SentDate);
    ?>
Пример #3
0
 public function load_inbox()
 {
     $NewMessages = G::$Cache->get_value('inbox_new_' . G::$LoggedUser['ID']);
     if ($NewMessages === false) {
         $QueryID = G::$DB->get_query_id();
         G::$DB->query("\n\t\t\t\tSELECT COUNT(UnRead)\n\t\t\t\tFROM pm_conversations_users\n\t\t\t\tWHERE UserID = '" . G::$LoggedUser['ID'] . "'\n\t\t\t\t\tAND UnRead = '1'\n\t\t\t\t\tAND InInbox = '1'");
         list($NewMessages) = G::$DB->next_record();
         G::$DB->set_query_id($QueryID);
         G::$Cache->cache_value('inbox_new_' . G::$LoggedUser['ID'], $NewMessages, 0);
     }
     if ($NewMessages > 0) {
         $Title = 'You have ' . ($NewMessages == 1 ? 'a' : $NewMessages) . ' new message' . ($NewMessages > 1 ? 's' : '');
         $this->create_notification(self::INBOX, 0, $Title, Inbox::get_inbox_link(), self::INFO);
     }
 }