From 51fca792885a1ce10d0bad4d70039cad421bab95 Mon Sep 17 00:00:00 2001 From: lopar Date: Mon, 29 Jan 2018 15:15:10 +0200 Subject: [PATCH] =?UTF-8?q?=D0=9F=D1=80=D0=B0=D0=B2=D0=BA=D0=B0=20=D0=B7?= =?UTF-8?q?=D0=B0=D0=BF=D1=80=D0=BE=D1=81=D0=BE=D0=B2=20=D0=B2=20showinf?= =?UTF-8?q?=5Fpers()?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- functions.php | 64 +++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 35 deletions(-) diff --git a/functions.php b/functions.php index 6086d5d..110ef62 100644 --- a/functions.php +++ b/functions.php @@ -2282,7 +2282,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM die('Неустранимая ошибка в showinf_pers(), обратитесь к разработчику.'); } else { // $user = mysql_fetch_array(mysql_query("SELECT * FROM `users` WHERE `id` = '{$id}' LIMIT 1")); - $user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc() + $user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $id)->fetch_assoc(); $invis = $user['invis']; } @@ -2348,20 +2348,20 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= '
'; if ($user['sergi'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT `id`, `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4` FROM `inventory` WHERE `id` = '{$user['sergi']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['sergi'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { $r .= ' 2 && !$pas) ? " style='background-image:url(i/blink.gif);' " : "") . ' src="i/sh/' . $dress['img'] . '" width=60 height=20 title="' . $dress['name'] . "
Прочность " . $dress['duration'] . "/" . $dress['maxdur'] . "" . "" . (($dress['ghp'] > 0) ? "
Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "
На серьгах выгравировано '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "
Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "
Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "
Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "
Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "
Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "
Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "
Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "
Броня ног: " . plusorminus($dress['bron4']) : "") . '" />'; } } else { - $r .= ''; + $r .= ''; } $r .= '
'; if ($user['kulon'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['kulon']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['kulon'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2374,7 +2374,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= '
'; if ($user['weap'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['weap']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['weap'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2392,17 +2392,18 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM if ($user['plaw']) { $d = $user['plaw']; if ($user['bron']) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[bron]' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['bron'])->fetch_assoc(); $title .= '
--------------------
' . $dress['name'] . '
Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '' . (($dress['ghp'] > 0) ? '
Уровень жизни ' . plusorminus($dress['ghp']) : '') . (($dress['text'] != null) ? '
На одежде вышито ' . $dress['text'] . '' : '') . (($dress['gsila'] != 0) ? '
Сила ' . plusorminus($dress['gsila']) . '' : '') . (($dress['glovk'] != 0) ? '
Ловкость ' . plusorminus($dress['glovk']) . '' : '') . (($dress['ginta'] != 0) ? '
Интуиция ' . plusorminus($dress['ginta']) . '' : '') . (($dress['gintel'] != 0) ? '
Интеллект ' . plusorminus($dress['gintel']) . '' : '') . (($dress['bron1'] != 0) ? '
Броня головы: ' . plusorminus($dress['bron1']) . '' : '') . (($dress['bron2'] != 0) ? '
Броня корпуса: ' . plusorminus($dress['bron2']) . '' : '') . (($dress['bron3'] != 0) ? '
Броня пояса: ' . plusorminus($dress['bron3']) . '' : '') . (($dress['bron4'] != 0) ? '
Броня ног: ' . plusorminus($dress['bron4']) . '' : '') . ''; } if ($user['rybax']) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[rybax]' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc(); + $title .= '
--------------------
' . $dress['name'] . '
Прочность ' . $dress['duration'] . '/' . $dress['maxdur'] . '' . (($dress['ghp'] > 0) ? '
Уровень жизни ' . plusorminus($dress['ghp']) : '') . (($dress['text'] != null) ? '
На одежде вышито ' . $dress['text'] . '' : '') . (($dress['gsila'] != 0) ? '
Сила ' . plusorminus($dress['gsila']) . '' : '') . (($dress['glovk'] != 0) ? '
Ловкость ' . plusorminus($dress['glovk']) . '' : '') . (($dress['ginta'] != 0) ? '
Интуиция ' . plusorminus($dress['ginta']) . '' : '') . (($dress['gintel'] != 0) ? '
Интеллект ' . plusorminus($dress['gintel']) . '' : '') . (($dress['bron1'] != 0) ? '
Броня головы: ' . plusorminus($dress['bron1']) . '' : '') . (($dress['bron2'] != 0) ? '
Броня корпуса: ' . plusorminus($dress['bron2']) . '' : '') . (($dress['bron3'] != 0) ? '
Броня пояса: ' . plusorminus($dress['bron3']) . '' : '') . (($dress['bron4'] != 0) ? '
Броня ног: ' . plusorminus($dress['bron4']) . '' : '') . ''; } } elseif ($user['bron']) { $d = $user['bron']; if ($user['rybax']) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '$user[rybax]' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['rybax'])->fetch_assoc(); $title .= "
--------------------
$dress[name]
Прочность $dress[duration]/$dress[maxdur]" . (($dress['ghp'] > 0) ? "
Уровень жизни " . plusorminus($dress['ghp']) : "") . (($dress['text'] != null) ? "
На одежде вышито '{$dress['text']}'" : "") . (($dress['gsila'] != 0) ? "
Сила " . plusorminus($dress['gsila']) : "") . (($dress['glovk'] != 0) ? "
Ловкость " . plusorminus($dress['glovk']) : "") . (($dress['ginta'] != 0) ? "
Интуиция " . plusorminus($dress['ginta']) : "") . (($dress['gintel'] != 0) ? "
Интеллект " . plusorminus($dress['gintel']) : "") . (($dress['bron1'] != 0) ? "
Броня головы: " . plusorminus($dress['bron1']) : "") . (($dress['bron2'] != 0) ? "
Броня корпуса: " . plusorminus($dress['bron2']) : "") . (($dress['bron3'] != 0) ? "
Броня пояса: " . plusorminus($dress['bron3']) : "") . (($dress['bron4'] != 0) ? "
Броня ног: " . plusorminus($dress['bron4']) : "") . '"'; } } elseif ($user['rybax']) { @@ -2411,7 +2412,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM if ($main == true) { $title = ''; } - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$d}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $d)->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2424,7 +2425,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= '
'; if ($user['r1'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r1']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r1'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2437,7 +2438,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= ''; if ($user['r2'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r2']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r2'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2450,7 +2451,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= ''; if ($user['r3'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['r3']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['r3'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2466,7 +2467,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= '
'; if ($user['helm'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['helm']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['helm'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2479,7 +2480,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= '
'; if ($user['perchi'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['perchi']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['perchi'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2492,7 +2493,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= '
'; if ($user['shit'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['shit']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['shit'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2505,7 +2506,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= '
'; if ($user['boots'] > 0) { - $dress = mysql_fetch_array(mysql_query("SELECT * FROM `inventory` WHERE `id` = '{$user['boots']}' LIMIT 1")); + $dress = db::c()->query('SELECT `name`, `img`, `duration`, `maxdur`, `ghp`, `gsila`, `glovk`, `ginta`, `gintel`, `text`, `bron1`, `bron2`, `bron3`, `bron4`, `includemagicdex` FROM `inventory` WHERE `id` = ?i', $user['boots'])->fetch_assoc(); if ($dress['includemagicdex'] && (!$pas || ($battle && $me))) { $r .= showhrefmagic($dress); } else { @@ -2518,7 +2519,7 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM if ($invis) { $data['id'] = null; } else { - $data = mysql_fetch_array(mysql_query("SELECT * FROM `online` WHERE `date` >= " . (time() - 60) . " AND `id` = " . $user['id'] . " LIMIT 1")); + $data = db::c()->query('SELECT * FROM `online` WHERE `date` >= ?i AND `id` = ?i', time()-60, $user['id'])->fetch_assoc(); } $r .= '
'; @@ -2532,9 +2533,9 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM if (!$battle) { if ($pas) { $r .= '
'.GAMEDOMAIN.'
'; - $online = mysql_fetch_array(mysql_query('SELECT `u`.*, `o`.`date`, `u`.*, `o`.`real_time` FROM `users` AS `u`, `online` AS `o` WHERE `u`.`id` = `o`.`id` AND `u`.`id` = "' . $user['id'] . '" LIMIT 1')); + $online = db::c()->query('SELECT `u`.*, `o`.`date`, `u`.*, `o`.`real_time` FROM `users` AS `u`, `online` AS `o` WHERE `u`.`id` = `o`.`id` AND `u`.`id` = ?i ', $user['id'])->fetch_assoc(); if ($invis) { - $invis = mysql_fetch_row(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '$user1[id]' AND `type` = '1022' LIMIT 1")); + $invis = db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = 1022', $user['id'])->fetch_assoc();//FIXME Тип содержит число, невозможное в базе. } if ($invis > time()) { $data['id'] = null; @@ -2599,16 +2600,16 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= 'Опыт: ' . $user['exp'] . ' (' . $user['nextup'] . ')
'; } $r .= 'Уровень: ' . $user['level'] . '
'; - if (empty($user['admin'])) { - $r .= 'Побед: ' . $user['win'] . '
'; - $r .= 'Поражений: ' . $user['lose'] . '
'; - $r .= 'Ничьих: ' . $user['nich'] . '
'; - } + $r .= 'Побед: ' . $user['win'] . '
'; + $r .= 'Поражений: ' . $user['lose'] . '
'; + $r .= 'Ничьих: ' . $user['nich'] . '
'; + if ($user['klan'] && !$pas) { $r .= "Клан: " . ClanImage($user['klan']) . "
"; } elseif ($user['klan']) { - $clann = mysql_fetch_array(mysql_query("SELECT `name`,`short` FROM `clans` WHERE `id` = '{$user['klan']}' LIMIT 1")); +// $clann = mysql_fetch_array(mysql_query("SELECT `name`,`short` FROM `clans` WHERE `id` = '{$user['klan']}' LIMIT 1")); + $clann = db::c()->query('SELECT `name`,`short` FROM `clans` WHERE `id` = ?i', $user['klan'])->fetch_assoc(); $r .= "" . close_dangling_tags($clann['name']) . " " . close_dangling_tags($user['status']) . "
"; } elseif ($user['align'] > 0) { if ((int)$user['align'] == 1) { @@ -2624,17 +2625,10 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM $r .= "Светлое братство
"; } } - if ($user['refer'] > 0) { - $Nastavnik = mysql_fetch_array(mysql_query("SELECT `id`, `login` FROM `users` WHERE `id` = {$user['refer']} LIMIT 1")); - } - if ($Nastavnik['id'] > 0) { - $NastText = "Наставник - {$Nastavnik['login']}
"; - } if ($pas) { $date1 = explode(" ", $user['borntime']); $date2 = explode("-", $date1[0]); $date3 = "" . $date2[2] . "-" . $date2[1] . "-" . $date2[0] . ""; - if (!empty($user['admin'])) $date3 = 'Неизвестно…'; $r .= 'Место рождения: ' . $user['borncity'] . '
'; $r .= 'День рождения персонажа: ' . $date3 . '
'; $r .= $NastText; @@ -2642,9 +2636,9 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM if ($user['palcom'] && $pas) { $r .= "Сообщение от Паладинов о причине отправки в хаос/блокировке:
{$user['palcom']}"; } - $effect = mysql_fetch_array(mysql_query("SELECT `time` FROM `effects` WHERE `owner` = '{$user['id']}' AND `type` = '4' LIMIT 1")); - if ($effect['time']) { - $r .= "
Хаос еще " . timeOut($effect['time'] - time()) . ""; + $ischaos = db::c()->query('SELECT `time` FROM `effects` WHERE `owner` = ?i AND `type` = 4 ', $user['id'])->fetch_assoc(); + if ($ischaos['time']) { + $r .= "
Хаос еще " . timeOut($ischaos['time'] - time()) . ""; } } } else {