Вывод личного дела через класс.
This commit is contained in:
parent
f671855131
commit
3317ab845d
@ -32,20 +32,27 @@ class User
|
|||||||
public $stats;
|
public $stats;
|
||||||
public $shadow;
|
public $shadow;
|
||||||
|
|
||||||
const EMPTY_SLOT = <<<EMPTY_SLOT
|
//Статусы того, кто смотрит на информацию.
|
||||||
<img src="/i/sh/noitem.png" class="item-wrap-normal" title="Пустой слот" alt="Пустой слот>
|
protected $watcherIsAdmin;
|
||||||
EMPTY_SLOT;
|
protected $watcherIsModerator;
|
||||||
|
|
||||||
use Rooms;
|
use Rooms;
|
||||||
|
|
||||||
public function __construct($user)
|
public function __construct($user)
|
||||||
{
|
{
|
||||||
$user_query = db::c()->query('SELECT * FROM users WHERE id = "?s" OR login = "?s"', $user, $user)->fetch_assoc();
|
$user_query = db::c()->query('SELECT * FROM users WHERE id = "?s" OR login = "?s"', $user, $user)->fetch_assoc();
|
||||||
|
$watchingUser_query = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $_SESSION['uid'])->fetch_assoc();
|
||||||
foreach ($this as $key => $value) {
|
foreach ($this as $key => $value) {
|
||||||
if (isset($user_query[$key])) {
|
if (isset($user_query[$key])) {
|
||||||
$this->$key = $user_query[$key];
|
$this->$key = $user_query[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if ($watchingUser_query['admin']) {
|
||||||
|
$this->watcherIsAdmin = 1;
|
||||||
|
}
|
||||||
|
if ($watchingUser_query['align'] == 1) {
|
||||||
|
$this->watcherIsModerator = 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function showItem($item = 0)
|
protected function showItem($item = 0)
|
||||||
@ -178,9 +185,15 @@ EMPTY_SLOT;
|
|||||||
}
|
}
|
||||||
echo '</div><!-- user-info-container-lower -->';
|
echo '</div><!-- user-info-container-lower -->';
|
||||||
|
|
||||||
$this->Bank = new Bank($this->id);
|
if ($this->watcherIsAdmin || $this->watcherIsModerator) {
|
||||||
echo sprintf('Денег в банке: %s. <br> session_uid: %s.', $this->Bank->money, $_SESSION['uid']);
|
echo '<div class="secretInfo">';
|
||||||
|
echo sprintf('<b>Личное дело</b><br>ИД Игрока: %s<br> ДР Игрока: %s<br> IP Регистрации: %s', $this->id, date('d.m.Y', strtotime($this->borndate)), $this->ip);
|
||||||
|
if ($this->watcherIsAdmin) {
|
||||||
|
$this->Bank = new Bank($this->id);
|
||||||
|
echo sprintf('<span>ИД Комнаты: %s<br> Деньги в банке: %s<br> E-Mail: %s<br> Текущая сессия: %s</span>>', $this->room, $this->Bank->money, $this->email, $this->session_id);
|
||||||
|
}
|
||||||
|
echo '</div>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showStarSign() {
|
public function showStarSign() {
|
||||||
@ -223,4 +236,18 @@ EMPTY_SLOT;
|
|||||||
}
|
}
|
||||||
return $sign ?? null;
|
return $sign ?? null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function showPrivateUserInfo() {
|
||||||
|
$this->watchingUser;
|
||||||
|
function privateAccessCheck()
|
||||||
|
{
|
||||||
|
$own = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $uid)->fetch_assoc();
|
||||||
|
if ($own['admin'] == 1) {
|
||||||
|
return ADMINISTRATOR_ACCESS;
|
||||||
|
} elseif ($own['align'] == 1) {
|
||||||
|
return MODERATOR_ACCESS;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
@ -409,4 +409,13 @@ div.debug {
|
|||||||
border:1px dashed #faf;
|
border:1px dashed #faf;
|
||||||
border-radius:5px;
|
border-radius:5px;
|
||||||
padding:5px;
|
padding:5px;
|
||||||
|
}
|
||||||
|
div.secretInfo {
|
||||||
|
background:#fee;
|
||||||
|
border:1px dashed #faa;
|
||||||
|
border-radius:5px;
|
||||||
|
padding:5px;
|
||||||
|
}
|
||||||
|
div.secretInfo > span {
|
||||||
|
color: #f80000;
|
||||||
}
|
}
|
Loading…
Reference in New Issue
Block a user