list(
$totalsentbox
,
$totalinbox
) = cot_message_count(
$usr
[
'id'
]);
$title
[] =
array
(cot_url(
'pm'
),
$L
[
'Private_Messages'
]);
<strong>
if
(
$f
==
'sentbox'
)
{
$sqlfilter
=
"pm_fromuserid = '"
.
$usr
['id
']."'
AND pm_fromstate <> 3";
$title
[] =
array
(cot_url(
'pm'
,
'f=sentbox'
),
$L
[
'pm_sentbox'
]);
$subtitle
=
$L
[
'pm_sentboxsubtitle'
];
$totalcount
=
$totalsentbox
;
}
else
{
$f
=
'inbox'
;
$sqlfilter
=
"pm_touserid = '"
.
$usr
['id
']."'
AND pm_tostate <> 3";
$title
[] =
array
(cot_url(
'pm'
),
$L
[
'pm_inbox'
]);
$subtitle
=
$L
[
'pm_inboxsubtitle'
];
$totalcount
=
$totalintbox
;
}
if
(
$filter
==
'unread'
)
{
$sqlfilter
.=
" AND pm_tostate = 0"
;
$title
[] =
$L
[
'pm_unread'
];
}
elseif
(
$filter
==
'starred'
)
{
$sqlfilter
.= (
$f
==
'sentbox'
) ?
" AND pm_fromstate = 2"
:
" AND pm_tostate = 2"
;
$title
[] =
$L
[
'pm_starred'
];
}</strong>
foreach
(cot_getextplugins(
'pm.list.main'
)
as
$pl
)
{
include
$pl
;
}
$title_params
=
array
(
'PM'
=>
$L
[
'Private_Messages'
],
'COUNT'
=>
$totalcount
,
'BOX'
=>
$subtitle
);
$out
[
'subtitle'
] = cot_title(
'{BOX} ({COUNT}) - {PM}'
,
$title_params
);
$out
[
'head'
] .=
$R
[
'code_noindex'
];
Resources::linkFileFooter(cot::
$cfg
[
'modules_dir'
].
'/pm/js/pm.js'
);
<strong>
$totallines
=
$db
->query(
"SELECT COUNT(*) FROM $db_pm WHERE $sqlfilter"
)->fetchColumn();
$elem
= (
$f
==
'sentbox'
) ?
'pm_touserid'
:
'pm_fromuserid'
;
$pm_sql
=
$db
->query("SELECT p.*, u.* FROM
$db_pm
AS p
LEFT JOIN
$db_users
AS u
ON u.user_id = p.
$elem
WHERE
$sqlfilter
ORDER BY pm_date DESC LIMIT
$d
,".
$cfg
[
'pm'
][
'maxpmperpage'
]);</strong>