Перенос отображения подарков в класс.
This commit is contained in:
parent
16a2b0e5da
commit
25a6f17d7e
@ -6,7 +6,6 @@ class User
|
||||
public $id;
|
||||
public $login;
|
||||
public $email;
|
||||
private $pass;
|
||||
public $realname;
|
||||
public $borndate;
|
||||
public $info;
|
||||
@ -41,4 +40,26 @@ class User
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function showPresents()
|
||||
{
|
||||
//$presents = db::c()->query('SELECT img, sender FROM `users_presents` WHERE expiration_date >= "?s" AND owner = ?i', date('Y-m-d'), $user->id);
|
||||
$presents_query = db::c()->query();
|
||||
if ($presents_query->getNumRows()) {
|
||||
echo <<<PRESENT_BEFORE
|
||||
<div>
|
||||
<legend>Подарки</legend>
|
||||
PRESENT_BEFORE;
|
||||
while ($row = $presents_query->fetch_assoc()) {
|
||||
echo <<<PRESENT
|
||||
<img src = "{$row['img']}" title = "{$row['sender']}" alt = "{$row['sender']}" >
|
||||
PRESENT;
|
||||
}
|
||||
echo <<<PRESENT_AFTER
|
||||
</div>
|
||||
PRESENT_AFTER;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
18
inf.php
18
inf.php
@ -22,13 +22,6 @@ function private_access($uid)
|
||||
return false;
|
||||
}
|
||||
|
||||
//$presents = db::c()->query('SELECT img, sender FROM `users_presents` WHERE expiration_date >= "?s" AND owner = ?i', date('Y-m-d'), $user->id);
|
||||
function getnumrows()
|
||||
{
|
||||
}
|
||||
|
||||
$presents = [];
|
||||
|
||||
if (empty($user->id)): ?>
|
||||
<!doctype html>
|
||||
<html lang="ru">
|
||||
@ -86,16 +79,7 @@ if (!empty($user->realname)) {
|
||||
?>
|
||||
<p style="font-family: Consolas,monospace;"><?= nl2br($user->info) ?></p>
|
||||
<hr>
|
||||
<?php if ($presents->getNumRows()): ?>
|
||||
<div>
|
||||
<legend>Подарки</legend>
|
||||
<?php
|
||||
while ($row = $presents->fetch_assoc()): ?>
|
||||
<img src="<?= $row['img'] ?>" title="<?= $row['sender'] ?>" alt="<?= $row['sender'] ?>">
|
||||
<?php endwhile; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php $user->showPresents(); ?>
|
||||
<?php
|
||||
# Секретный раздел
|
||||
# Если я любой паладин, и смотрю не админа, или я сам админ.
|
||||
|
Loading…
Reference in New Issue
Block a user