select( 'messages', [ 'messageid (id)', 'messagetext (text)', 'messagedate (date)', 'to', 'from' ], [ "AND" => [ "OR" => [ // TODO: fix to => null "to" => $_SESSION['uid'], "from" => $_SESSION['uid'] ], "deleted" => 0 ], "ORDER" => [ "messagedate" => "DESC" ], "LIMIT" => "50"] ); $usercache = []; if (count($messages) > 0) { foreach ($messages as $msg) { $to = null; if (!isset($usercache[$msg['from']])) { $usercache[$msg['from']] = getUserByID($msg['from']); } if (is_null($msg['to'])) { $to['name'] = lang("all users", false); $to['username'] = lang("all users", false); } else { if (!isset($usercache[$msg['to']])) { $usercache[$msg['to']] = getUserByID($msg['to']); } $to = $usercache[$msg['to']]; } ?>
" . lang("no messages", false) . ""; } ?>