forked from 4ducky/4ducky
128 lines
3.4 KiB
PHP
128 lines
3.4 KiB
PHP
<?php include( $templates.'header.tpl.php' ); ?>
|
|
|
|
<?php if( !empty( $msgErrors ) ) { ?>
|
|
<?php if( $msgErrors["usernotfound"] == true ) { ?>
|
|
<div class="warn">
|
|
<ul>
|
|
<li class="error">User not found.</li>
|
|
</ul>
|
|
</div>
|
|
<?php }?>
|
|
<?php if( $msgErrors["userblocked"] == true ) { ?>
|
|
<div class="warn">
|
|
<ul>
|
|
<li class="error">User blocked you.</li>
|
|
</ul>
|
|
</div>
|
|
<?php }?>
|
|
<?php }?>
|
|
|
|
<br/><br/>
|
|
<table class="duckytable" align="center" width="800px" border="0" cellspacing="0" cellpadding="0">
|
|
<caption>Messages:</caption>
|
|
|
|
<?php
|
|
|
|
$messages = DB::query("SELECT from_m as sender, title_m as title, created FROM pl_messages WHERE to_m=:1 GROUP BY from_m",$user->id);
|
|
|
|
if ( count($messages) == 0 ){ ?>
|
|
<tr>
|
|
<td width="400px">
|
|
<div class="userInfo" style="border:1px solid #d2d9e7;padding:8px;">
|
|
Your inbox is empty.
|
|
</div>
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
<?php }
|
|
|
|
foreach (array_keys($messages) as $k){
|
|
$temp = DB::query("SELECT created FROM pl_messages WHERE from_m=:1 ORDER BY created DESC",$messages[$k]["sender"]);
|
|
|
|
$messages[$k]["created"] = $temp[0]["created"];
|
|
}
|
|
|
|
function sortByOption($a, $b) {
|
|
return strcmp($b['created'], $a['created']);
|
|
}
|
|
|
|
usort($messages, 'sortByOption');
|
|
|
|
foreach($messages as $s){
|
|
|
|
$userinformation = DB::getRow("SELECT * FROM pl_users WHERE id=:1",$s["sender"]);
|
|
$blockedrow = DB::getRow("SELECT id,users FROM pl_blocked WHERE id=:1",$user->id);
|
|
$blockeduser = array_map('strtolower', unserialize($blockedrow['users']));
|
|
$lower = strtolower($userinformation["name"]);
|
|
if (!in_array($userinformation["name"],$blockeduser)){
|
|
$unread = DB::getRow("SELECT COUNT(*) as c, read_m FROM pl_messages WHERE from_m=:1 AND read_m=0 AND to_m=:2",$s["sender"],$user->id);
|
|
|
|
if ($unread["c"] > 0) {
|
|
|
|
$unreadborder = ' border:1px solid #FFD600; ';
|
|
|
|
}elseif ($unread["c"] == 0){
|
|
|
|
if ($user->stylecolor == "black") {
|
|
$unreadborder="border:1px solid #333;";
|
|
}else{
|
|
$unreadborder = ' border:1px solid #d2d9e7; ';
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
<tr>
|
|
<td width="400px">
|
|
|
|
<div class="userInfo" style="margin:5px;min-height:40px;<?php echo $unreadborder; ?>" >
|
|
<img class="avatar" width="40" height="40" src="<?php echo Config::$absolutePath.$userinformation['avatar']; ?>"/>
|
|
<div class="name">
|
|
<strong>
|
|
<a href="<?php echo Config::$absolutePath.'inbox/'.$userinformation['name']; ?>"><?php echo $userinformation['name']; ?></a>
|
|
</strong>
|
|
</div>
|
|
<div class="info">
|
|
ID: <strong><?php echo $userinformation['id']; ?></strong> /
|
|
Images: <strong><?php echo $userinformation['images']; ?></strong>
|
|
|
|
<?php if( !empty($userinformation['website'])) { ?>/
|
|
Website: <strong><a href="<?php echo htmlspecialchars($userinformation['website']); ?>" target="_blank">
|
|
<?php echo htmlspecialchars($userinformation['website']); ?>
|
|
</a></strong>
|
|
<?php } ?>
|
|
<?php if (strlen ($s["title"]) > 1 ){ ?>
|
|
|
|
/ Subject: <strong> <?php
|
|
|
|
$s["title"] = strip_tags($s["title"]);
|
|
$s["title"] = preg_replace(
|
|
'#(?<!\w)((http://)|(www\.))([^\s<>]+)#i',
|
|
"<a href=\"http://$3$4\">$3$4</a>",
|
|
nl2br( htmlspecialchars($s["title"])));
|
|
|
|
|
|
|
|
echo $s["title"]; ?>
|
|
|
|
|
|
</strong><br />
|
|
<?php } ?>
|
|
</div>
|
|
|
|
|
|
</div>
|
|
|
|
</td>
|
|
|
|
|
|
</tr>
|
|
|
|
|
|
<?php }} ?>
|
|
|
|
|
|
</table> <br/>
|
|
|
|
<?php include("templates/footer.tpl.php"); ?>
|