moving to imgclass

This commit is contained in:
Igor Barkov [iwork] 2019-01-16 18:26:16 +02:00
parent cb29429a2a
commit 813a741b2a
2 changed files with 20 additions and 11 deletions

View File

@ -43,4 +43,9 @@ NAME;
onclick="location='/admin.php'">
BTN;
}
public function getId()
{
return $this->id;
}
}

View File

@ -32,7 +32,7 @@ if ($_SESSION['receiverName']) {
} else {
$receiverId = $receiver['id'];
$submit = filter_input(INPUT_POST, 'action');
$sendItemId = filter_input(INPUT_POST,'item_id');
$sendItemId = filter_input(INPUT_POST, 'item_id');
$telegraphText = filter_input(INPUT_POST, 'message');
if ($submit == 'sendMessage' && $telegraphText && $user['money'] >= 1) {
@ -52,8 +52,8 @@ if ($_SESSION['receiverName']) {
db::c()->query('UPDATE `users` SET `money` = `money` - 1 WHERE id=?i', $user['id']);
db::c()->query('UPDATE `inventory` SET `owner` = ?i WHERE `id`= ?i AND `owner`= ?i', $receiverId, $sendItemId, $_SESSION['uid']);
//TODO: Добавить логи и статистику.
$statusMessage = 'Предмет "' . $res['name'] . '" передан персонажу ' . $receiverId;
db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, 'Почтовый перевод: '. $res['name'] .' от персонажа ' .$user['login']. '.');
$statusMessage = 'Предмет "' . $res['name'] . '" передан персонажу ' . $receiverId;
db::c()->query('INSERT INTO `telegraph` (`receiver`,`text`) VALUES (?i,"?s")', $receiverId, 'Почтовый перевод: ' . $res['name'] . ' от персонажа ' . $user['login'] . '.');
}
}
$queryItems = db::c()->query('SELECT `inventory`.*,
@ -64,6 +64,10 @@ if ($_SESSION['receiverName']) {
`magic`.`targeted` AS `magic_targeted`,
`magic`.`needcharge` AS `magic_needcharge`,
`magic`.`img` AS `magic_img` FROM `inventory` LEFT JOIN `magic` ON `magic` = `magic`.`id` WHERE `owner` = ?i AND `dressed` = 0 AND `setsale` = 0 AND `present` = "?s" AND `artefact` = 0 ORDER BY `update` DESC', $_SESSION['uid'], null);
$iteminfo = [];
while ($row = $queryItems->fetch_assoc()) {
$iteminfo[] = new InventoryItem($row);
}
}
}
?>
@ -107,22 +111,22 @@ if ($_SESSION['receiverName']) {
<td valign=top align=right>
<table class="zebra" WIDTH=100%">
<th colspan="2">Передача предметов</th>
<?php while ($row = $queryItems->fetch_assoc()): ?>
<?php foreach ($iteminfo as $ii): ?>
<tr>
<td align=center>
<img src="i/sh/<?= $row['img'] ?>"><br>
<td bgcolor='#d3d3d3'>
<?php $ii->printImage(); ?>
<form method="post">
<input type="hidden" name="action" value="sendItem">
<input type="hidden" name="item_id" value="<?= $row['id'] ?>">
<input type="hidden" name="item_id" value="<?= $ii->getId() ?>">
<input type="submit" value="Передать за 1кр.">
</form>
</td>
<td valign=top>
<?php showitem($row, '','',true); ?>
<td bgcolor='#d3d3d3'>
<?php $ii->printInfo(); ?>
</td>
</tr>
<?php endwhile ?>
<?php if ($queryItems->getNumRows() == 0): ?>
<?php endforeach; ?>
<?php if (empty($queryItems->getNumRows())): ?>
<tr>
<td align=center bgcolor=#C7C7C7>Нечего передавать...</td>
</tr>