File size: 3.45Kb
<?php
require_once dirname(__DIR__) . '/system/core.php';
if (!$user) exit;
$exp_needed = get_exp_needed($user['level']);
$new_msg = (int)db_query("SELECT COUNT(*) FROM `mail_messages` WHERE `user_id` = ? AND `read` = '0' AND `sender_id` != ?", [$myID, $myID])->fetchColumn();
$new_support = (int)db_query("SELECT COUNT(*) FROM `support_tickets` WHERE `user_id` = ? AND `status` = '1'", [$myID])->fetchColumn();
$open_support = (int)db_query("SELECT COUNT(*) FROM `support_tickets` WHERE `user_id` = ? AND `status` = '0'", [$myID])->fetchColumn();
$admin_tickets = 0;
if ((int)$user['admin'] > 0) {
$admin_tickets = (int)db_query("SELECT COUNT(*) FROM `support_tickets` WHERE `status` = '0'")->fetchColumn();
}
if ($user['level'] < 100) {
$prg = min(100, round(($user['exp'] / $exp_needed) * 100, 1));
echo '<div class="exp_bar-new"><div class="exp_progress-new" style="width:'.$prg.'%;"></div></div>';
}
echo '<div class="userPanel-bg-new">
<div class="userPanel-lvl-new"><a href="/profile.php"><div class="userPanel-lvlValue-new">'.$user['level'].'</div></a></div>';
$stats = [
['l'=>'28%','i'=>'str','v'=>n_f($user['str'])],
['l'=>'50%','i'=>'block','v'=>n_f($user['def'])],
['l'=>'72%','i'=>'hp','v'=>(int)$user['hp']]
];
foreach ($stats as $s) {
echo '<div style="position:absolute;left:'.$s['l'].';top:50%;transform:translate(-50%, -50%);width:65px;height:25px;">
<div class="cell-bgMiddle-new" style="display:flex;align-items:center;justify-content:center;">
<img src="/design/images/head-new-style/'.$s['i'].'.png" style="width:18px;height:18px;margin-right:4px;">
<span>'.$s['v'].'</span>
</div>
</div>';
}
echo '<div class="userPanel-mailBg-new"></div>
<a href="/mail/"><div class="'.($new_msg > 0 ? 'iconPanelnew-new' : 'iconPanel-new').' userPanel-mailIcon-new">
'.($new_msg > 0 ? '<div class="userPanel-unreadBadge-new">'.$new_msg.'</div>' : '').'
</div></a>
</div>';
echo '<div class="cntr-new" style="display:flex;justify-content:center;gap:10px;margin-top:5px;">
<div class="cell-now-new pointer-new" style="display:flex;align-items:center;padding:4px 8px;">
<img src="/design/images/head-money-new-style/silver.png" style="width:16px;height:16px;margin-right:5px;">
<div class="middle-new">'.n_f($user['silver']).'</div>
</div>
<div class="cell-now-new pointer-new" style="display:flex;align-items:center;padding:4px 8px;">
<img src="/design/images/head-money-new-style/gold.png" style="width:16px;height:16px;margin-right:5px;">
<div class="middle-new">'.n_f($user['gold']).'</div>
</div>';
if ($admin_tickets > 0) {
echo '<a href="/panel/support.php" style="text-decoration:none;">
<div class="cell-now-new pointer-new" style="display:flex;align-items:center;padding:4px 8px; border:1px solid #ff4444;">
<div class="middle-new" style="color:#ff4444; font-size:11px;">Тикеты +'.$admin_tickets.'</div>
</div>
</a>';
}
if ($new_support > 0 || $open_support > 0) {
echo '<a href="/support/" style="text-decoration:none;">
<div class="cell-now-new pointer-new" style="display:flex;align-items:center;padding:4px 8px; border:1px solid '.($new_support > 0 ? '#08aa00' : '#183543').';">
<div class="middle-new" style="color:'.($new_support > 0 ? '#08aa00' : '#9bc2e0').'; font-size:11px;">Помощь '.($new_support > 0 ? '(!)' : '').'</div>
</div>
</a>';
}
echo '</div>';