diff --git a/functions.php b/functions.php index 3d58614..0e1d82a 100644 --- a/functions.php +++ b/functions.php @@ -398,8 +398,9 @@ function timeOut($ttm) return $out; } -function show_eff_inf($u, $type) +function show_eff_inf($u) { + global $db; $img = [ 1 => "travma.gif", 2 => "magic/sleep.gif", 3 => "magic/sleepf.gif", 4 => "magic/haos.gif", 5 => "magic/obezl.gif", 6 => "expx15.gif", 7 => "euphoria.png", 8 => "sleep_obj.gif", @@ -412,56 +413,22 @@ function show_eff_inf($u, $type) 1022 => "sh/hidden.gif", ]; $r = ''; - $and = ''; - $adds = ''; - if ($type == 1) { - $and = " AND `type` != 1022"; - } - $effs = db::c()->query('SELECT * FROM `users_effects` WHERE `type` <> 20 AND `owner_id` = ?i' . $and, $u)->fetch_assoc(); - /* Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 132644820 bytes) in /home/combats/web/combats.loc/public_html/functions.php on line 873 - * Если на человеке стоит type=20 - * #26 - */ - $etype = $effs['type']; - if ($type == 1) { - while ($effs) { - if ($etype == 11 || $etype == 12 || $etype == 13 || $etype == 14) { - if ($etype == 11) { - $adds = 'Легкая '; - } elseif ($etype == 12) { - $adds = 'Средняя '; - } elseif ($etype == 13) { - $adds = 'Тяжелая '; - } elseif ($etype == 14) { - $adds = 'Неизлечимая '; - } else { - $adds = ''; - } - } else { - $adds = ''; - } - $r .= '
'; - $r .= ''; - $r .= '' . $adds . $effs['name'] . ''; - if ($effs['sleep'] != 0) { - $r .= '
Эффект заморожен
'; - } else { - $r .= '
' . timeOut($effs['time'] - time()) . '
'; - } - $r .= '
'; - } - } else { - while ($effs) { - $r .= '
'; - $r .= ' '; - $r .= '' . $adds . $effs['name'] . ''; - if ($effs['sleep'] != 0) { - $r .= '
Эффект заморожен
'; - } else { - $r .= '
' . timeOut($effs['time'] - time()) . '
'; - } - $r .= '
'; + + $effs = $db->ofetchAll('SELECT * FROM users_effects WHERE type != 20 AND owner_id = ?', $u); + + $i = 0; + while ($i < count($effs)) { + + $r .= '
'; + $r .= ' effect_id . '\' onclick=\'return confirm("Удалить ' . $effs->name . '?")\'>'; + $r .= '' . $effs->name . ''; + if ($effs['sleep'] != 0) { + $r .= '
Эффект заморожен
'; + } else { + $r .= '
' . timeOut($effs->remaining_time - time()) . '
'; } + $r .= '
'; + $i++; } return $r; }