Выдача информации с учётом статусов.
This commit is contained in:
parent
2a0f454343
commit
b9ed3a039e
@ -1,6 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
||||||
class User
|
class User
|
||||||
{
|
{
|
||||||
public $id;
|
public $id;
|
||||||
@ -34,6 +33,7 @@ class User
|
|||||||
public $stat_points;
|
public $stat_points;
|
||||||
|
|
||||||
//Статусы того, кто смотрит на информацию.
|
//Статусы того, кто смотрит на информацию.
|
||||||
|
public $watcher_id;
|
||||||
protected $watcherIsAdmin;
|
protected $watcherIsAdmin;
|
||||||
protected $watcherIsModerator;
|
protected $watcherIsModerator;
|
||||||
|
|
||||||
@ -42,18 +42,11 @@ class User
|
|||||||
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)
|
||||||
@ -73,7 +66,7 @@ EMPTY_SLOT;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showUserInfo()
|
public function UserInfo()
|
||||||
{
|
{
|
||||||
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
|
$dressed_items = db::c()->query('SELECT * FROM inventory WHERE owner_id = ?i AND dressed_slot > 0', $this->id);
|
||||||
while ($row = $dressed_items->fetch_assoc()) {
|
while ($row = $dressed_items->fetch_assoc()) {
|
||||||
@ -188,12 +181,12 @@ EMPTY_SLOT;
|
|||||||
|
|
||||||
if ($this->watcherIsAdmin || $this->watcherIsModerator) {
|
if ($this->watcherIsAdmin || $this->watcherIsModerator) {
|
||||||
echo '<div class="secret-info">';
|
echo '<div class="secret-info">';
|
||||||
$infoString = '<b>Личное дело</b><br>ИД Игрока: %s<br> ДР Игрока: %s<br> IP Регистрации: %s';
|
$infoString = '<b>Личное дело</b><br>E-Mail: %s<br> ДР Игрока: %s<br> IP Регистрации: %s';
|
||||||
echo sprintf($infoString, $this->id, date('d.m.Y', strtotime($this->borndate)), $this->ip);
|
echo sprintf($infoString, $this->email, date('d.m.Y', strtotime($this->borndate)), $this->ip);
|
||||||
if ($this->watcherIsAdmin) {
|
if ($this->watcherIsAdmin) {
|
||||||
$this->Bank = new Bank($this->id);
|
$this->Bank = new Bank($this->id);
|
||||||
$infoString = '<br><span>ИД Комнаты: %s<br> Деньги: %s<br> Деньги в банке: %s<br> Опыт: %s<br> Нераспределённые очки: %s<br> E-Mail: %s<br> Текущая сессия: %s</span>';
|
$infoString = '<br><span>ИД Игрока: %s<br> ИД Комнаты: %s<br> Деньги: %s<br> Деньги в банке: %s<br> Опыт: %s<br> Нераспределённые очки: %s<br> Текущая сессия: %s</span>';
|
||||||
echo sprintf($infoString, $this->room, $this->money, $this->Bank->money, $this->experience, $this->stat_points, $this->email, $this->session_id);
|
echo sprintf($infoString, $this->id, $this->room, $this->money, $this->Bank->money, $this->experience, $this->stat_points, $this->email, $this->session_id);
|
||||||
}
|
}
|
||||||
$this->UserLogs = new UserLogModel($this->id);
|
$this->UserLogs = new UserLogModel($this->id);
|
||||||
echo '<div class="secret-info-user-log">';
|
echo '<div class="secret-info-user-log">';
|
||||||
@ -205,21 +198,51 @@ EMPTY_SLOT;
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function showStarSign() {
|
private function WatcherStatus() {
|
||||||
/*
|
$query = db::c()->query('SELECT `align`,`admin` FROM `users` WHERE `id` = ?i', $this->watcher_id)->fetch_assoc();
|
||||||
* 1 aries
|
if ($query['admin']) {
|
||||||
* 2 taurus
|
$this->watcherIsAdmin = 1;
|
||||||
* 3 gemini
|
}
|
||||||
* 4 cancer
|
if ($query['align'] == 1) {
|
||||||
* 5 leo
|
$this->watcherIsModerator = 1;
|
||||||
* 6 virgo
|
}
|
||||||
* 7 libra
|
}
|
||||||
* 8 scorpio
|
|
||||||
* 9 sagittarios
|
public function showUserInfo()
|
||||||
* 10 capricorn
|
{
|
||||||
* 11 aquarius
|
$this->effects = new EffectsModel($this->id);
|
||||||
* 12 pisches
|
$this->WatcherStatus();
|
||||||
*/
|
|
||||||
|
if ($this->block && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) {
|
||||||
|
throw new Exception('<span class="error">Персонаж ' . $this->login . ' заблокирован!</span>');
|
||||||
|
} elseif ($this->effects->getHideUserInfoStatus() && (!$this->watcherIsAdmin || !$this->watcherIsModerator)) {
|
||||||
|
if ($this->effects->getHideUserInfoStatus() == -1) {
|
||||||
|
$date = 'навсегда';
|
||||||
|
} else {
|
||||||
|
$date = 'до' . date('d.m.Y', strtotime($this->effects->getHideUserInfoStatus()));
|
||||||
|
}
|
||||||
|
throw new Exception('<span class="error">Персонаж ' . $this->login . ' обезличен ' . $date . '.</span>');
|
||||||
|
} else {
|
||||||
|
$this->UserInfo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function showStarSign()
|
||||||
|
{
|
||||||
|
/*
|
||||||
|
* 1 aries
|
||||||
|
* 2 taurus
|
||||||
|
* 3 gemini
|
||||||
|
* 4 cancer
|
||||||
|
* 5 leo
|
||||||
|
* 6 virgo
|
||||||
|
* 7 libra
|
||||||
|
* 8 scorpio
|
||||||
|
* 9 sagittarios
|
||||||
|
* 10 capricorn
|
||||||
|
* 11 aquarius
|
||||||
|
* 12 pisches
|
||||||
|
*/
|
||||||
$zodiac[356] = "10";
|
$zodiac[356] = "10";
|
||||||
$zodiac[326] = "09";
|
$zodiac[326] = "09";
|
||||||
$zodiac[296] = "08";
|
$zodiac[296] = "08";
|
||||||
@ -235,7 +258,7 @@ EMPTY_SLOT;
|
|||||||
$zodiac[0] = "10";
|
$zodiac[0] = "10";
|
||||||
$dayOfYear = date("z", strtotime($this->borndate));
|
$dayOfYear = date("z", strtotime($this->borndate));
|
||||||
$isLeapYear = date("L", strtotime($this->borndate)); //Высокосный?
|
$isLeapYear = date("L", strtotime($this->borndate)); //Высокосный?
|
||||||
if ($isLeapYear && $dayOfYear >59) {
|
if ($isLeapYear && $dayOfYear > 59) {
|
||||||
--$dayOfYear;
|
--$dayOfYear;
|
||||||
}
|
}
|
||||||
foreach ($zodiac as $day => $sign) {
|
foreach ($zodiac as $day => $sign) {
|
||||||
@ -246,17 +269,4 @@ 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
9
inf.php
9
inf.php
@ -1,14 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
session_start();
|
session_start();
|
||||||
include_once 'config.php';
|
include_once 'config.php';
|
||||||
//include_once 'models/PresentsModel.php';
|
|
||||||
|
|
||||||
$login = urldecode($_SERVER['QUERY_STRING']) ?? '';
|
$login = urldecode($_SERVER['QUERY_STRING']) ?? '';
|
||||||
$uid = $_SESSION['uid'] ?? null;
|
|
||||||
$user = new User($login);
|
$user = new User($login);
|
||||||
$presentsModel = new PresentsModel($user->id);
|
$presentsModel = new PresentsModel($user->id);
|
||||||
$presentsList = $presentsModel->getAllPresents();
|
$presentsList = $presentsModel->getAllPresents();
|
||||||
|
$user->watcher_id = $_SESSION['uid'] ?? null;
|
||||||
if (empty($user->id)): ?>
|
if (empty($user->id)): ?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="ru">
|
<html lang="ru">
|
||||||
@ -32,11 +30,6 @@ if (empty($user->id)): ?>
|
|||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$hideInfo = new EffectsModel($user->id);
|
|
||||||
if ($hideInfo->getHideUserInfoStatus()) {
|
|
||||||
exit('<h3>Персонаж обезличен!</h3>');
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$user->showUserInfo();
|
$user->showUserInfo();
|
||||||
} catch (Exception $e_showUserInfo) {
|
} catch (Exception $e_showUserInfo) {
|
||||||
|
Loading…
Reference in New Issue
Block a user