Внедрение шаблонизатора.

This commit is contained in:
Igor Barkov (iwork) 2020-09-30 14:49:17 +03:00
parent 56a3a437a5
commit 8262dd3f45
3 changed files with 14 additions and 21 deletions

View File

View File

@ -9,8 +9,7 @@ $is_now = db::c()->query('SELECT `id`, `uid` FROM `abils_user` WHERE `uid` = ?i'
function add_user_abil($ab, $cost)
{
global $user, $banks;
if (isset($ab)) {
if ($banks['ekr'] >= $cost) {
if (isset($ab) && $banks['ekr'] >= $cost) {
$isset = mysql_fetch_array(mysql_query('SELECT `id`, `' . $ab . '` FROM `abils_user` WHERE `uid` = "' . $user['id'] . '" LIMIT 1'));
$isset[$ab] += 1;
mysql_query('UPDATE `abils_user` SET `' . $ab . '` = "' . $isset[$ab] . '" WHERE `uid` = "' . $user['id'] . '" LIMIT 1');
@ -18,12 +17,11 @@ function add_user_abil($ab, $cost)
mysql_query('UPDATE `bank` SET `ekr` = "' . $banks['ekr'] . '" WHERE `id` = "' . $user['id'] . '" LIMIT 1');
return true;
}
}
return false;
}
$cost = array(1, 2, 10, 0.50, 0.80, 1, 1, 0.10, 0.20, 4, 0.02, 20, 10, 1, 1);
$mag = array('sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone');
$cost = [1, 2, 10, 0.50, 0.80, 1, 1, 0.10, 0.20, 4, 0.02, 20, 10, 1, 1];
$mag = ['sleep15', 'sleep30', 'closebattle', 'heal20', 'heal35', 'heal50', 'travmoff', 'attack', 'bloodattack', 'death', 'comment', 'openbattle', 'reamdeath', 'clone', 'unclone'];
if (isset($_POST['type'], $_POST['user'])) {
if (isset($user['id'])) {

15
inf.php
View File

@ -1,21 +1,16 @@
<?php
session_start();
include_once 'config.php';
$login = urldecode($_SERVER['QUERY_STRING']) ?? '';
$userInfo = new UserInfo($login);
$presentsModel = new PresentsModel($userInfo->id);
$presentsList = $presentsModel->getAllPresents();
$userInfo->watcher_id = $userInfo->id ?? null;
Template::header('Информация о'.$userInfo->login);
if (empty($userInfo->id)): ?>
Ошибка: персонаж <em><?= $login ?></em> не найден...
<p><a style="color: #99f" href="javascript:window.history.go(-1);">←назад</a></p>
<?php exit(); endif; ?>
<?php
Template::header('Информация о ' . $userInfo->login);
if (!$userInfo->id) {
sprintf('Ошибка: персонаж <em>%s</em> не найден...<p><a style="color: #99f;" href="javascript:window.history.go(-1);">←назад</a></p>', $login);
exit;
}
try {
$userInfo->showUserInfo();