Убрана суперглобальная переменная $user, теперь в "класс" передаётся уже вызванный ранее объект.

This commit is contained in:
Igor Barkov (iwork) 2020-09-28 19:24:49 +03:00
parent 735ad73d8b
commit 19abca682c

View File

@ -41,10 +41,11 @@ class Zayavka
* @var string
*/
private $errorMessage;
private $user;
function __construct($user_id)
{
$this->user = $user_id;
}
function fteam($team)
@ -97,10 +98,8 @@ class Zayavka
public function addteam($team, $r)
{
global $user;
$id = $_SESSION['uid'];
$zay = $_REQUEST['gocombat'];
$error = null;
$owntravma = db::c()->query('SELECT `id`, `type` FROM `effects` WHERE (`type` = 12 OR `type` = 13) AND `owner` = ?i', $id)->fetch_assoc();
$z = $this->getlist($r, null, $zay);
if ($owntravma['type'] == 12 && ($z[$zay]['type'] != 4 && $z[$zay]['type'] != 5)) {
@ -108,10 +107,10 @@ class Zayavka
} elseif ($owntravma['type'] == 13) {
$this->errorMessage = "У Вас тяжелая травма, Вы не сможете драться...";
}
if (!empty($user['zayavka'])) {
if ($this->user->zayavka) {
$this->errorMessage = "Вы находитесь в заявке";
}
if ($user['hp'] < $user['maxhp'] * 0.33) {
if ($this->user->health < $this->user->maxHealth * 0.33) {
$this->errorMessage = "Вы слишком ослаблены для боя, восстановитесь.";
}
if (!$z || !empty($this->user_status($id))) {
@ -126,7 +125,7 @@ class Zayavka
foreach ($z[$zay]['team' . $teamz] as $v) {
$enemy = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $v)->fetch_assoc();
if ($user['klan'] == $enemy['klan']) {
if ($this->user->clan == $enemy['klan']) {
$this->errorMessage = "Нельзя драться против сокланов!";
}
}
@ -134,11 +133,11 @@ class Zayavka
if ($z[$zay]['t' . $team . 'min'] == 99) {
$toper = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $z[$zay]['team' . $team][0])->fetch_assoc();
if ($user['klan'] != $toper['klan']) {
if ($this->user->clan != $toper['klan']) {
$this->errorMessage = "Эта заявка не может быть принята Вами.";
}
} else {
if ($user['level'] > 0 && !($z[$zay]['t' . $team . 'min'] <= $user['level'] && $z[$zay]['t' . $team . 'max'] >= $user['level'])) {
if ($this->user->level > 0 && !($z[$zay]['t' . $team . 'min'] <= $this->user->level && $z[$zay]['t' . $team . 'max'] >= $this->user->level)) {
$this->errorMessage = "Эта заявка не может быть принята Вами. - " . $z[$zay]['t' . $team . 'min'];
}
}
@ -177,8 +176,6 @@ class Zayavka
public function addzayavka($start, $timeout, $t1c, $t2c, $type, $t1min, $t2min, $t1max, $t2max, $coment, $level, $blood = 0)
{
global $user;
if (!in_array($level, [2, 4, 5])) {
$level = 4;
} /*2-физ, 4-группа, 5-хаос*/
@ -198,13 +195,13 @@ class Zayavka
if (!in_array($timeout, [1, 3, 5, 10])) {
$timeout = 1;
}
if ($this->user_status($user['id']) != 0) {
if ($this->user_status($this->user->id) != 0) {
exit();
}
if (!$user['klan'] && $t1min == 99) {
if (!$this->user->clan && $t1min == 99) {
$this->errorMessage = "Вы не состоите в клане.";
}
if ($user['hp'] < $user['maxhp'] * 0.33) {
if ($this->user->health < $this->user->maxHealth * 0.33) {
$this->errorMessage = "Вы слишком ослаблены для боя, восстановитесь.";
}
if ($this->errorMessage) {
@ -218,8 +215,8 @@ class Zayavka
db::c()->query('INSERT INTO `zayavka`
(`start`, `timeout`, `t1c`, `t2c`, `type`, `level`, `coment`, `team1`, `t1min`, `t2min`, `t1max`, `t2max`,`podan`,`blood`)
VALUES (?i,?i,?i,?i,?i,?i,"?s","?s",?d,?i,?i,?i,?i,"?s",?i)',
$start, $timeout, $t1c, $t2c, $type, $level, $coment, $user['id'], $t1min, $t2min, $t1max, $t2max, date('H:i'), $blood);
db::c()->query('UPDATE `users` SET `zayavka` = ?i WHERE `id` = ?i', db::c()->getLastInsertId(), $user['id']);
$start, $timeout, $t1c, $t2c, $type, $level, $coment, $this->user->id, $t1min, $t2min, $t1max, $t2max, date('H:i'), $blood);
db::c()->query('UPDATE `users` SET `zayavka` = ?i WHERE `id` = ?i', db::c()->getLastInsertId(), $this->user->id);
return 'Заявка подана!';
}
}
@ -247,8 +244,7 @@ class Zayavka
public function showfiz($row)
{
global $user;
$rr = "<input type=\"radio\" " . ((in_array($user['id'], $row['team1']) || in_array($user['id'], $row['team2']) || $row['team2']) ? "disabled " : "") . " name=\"gocombat\" value=\"{$row['id']}\" /><font class=date>{$row['podan']}</font> ";
$rr = "<input type=\"radio\" " . ((in_array($this->user->id, $row['team1']) || in_array($this->user->id, $row['team2']) || $row['team2']) ? "disabled " : "") . " name=\"gocombat\" value=\"{$row['id']}\" /><font class=date>{$row['podan']}</font> ";
foreach ($row['team1'] as $k => $v) {
$rr .= Nick::id($v)->full(1);
@ -287,7 +283,7 @@ class Zayavka
$range2 = "{$row['t2min']}-{$row['t2max']}";
}
$rr = "<input type=\"radio\" " . ((in_array($user['id'], $row['team1']) || in_array($user['id'], $row['team2'])) ? "disabled " : "") . " name=\"gocombat\" value=\"{$row['id']}\"><span class=date>{$row['podan']}</span> <b>{$row['t1c']}</b>({$range1}) (";
$rr = "<input type=\"radio\" " . ((in_array($this->user->id, $row['team1']) || in_array($this->user->id, $row['team2'])) ? "disabled " : "") . " name=\"gocombat\" value=\"{$row['id']}\"><span class=date>{$row['podan']}</span> <b>{$row['t1c']}</b>({$range1}) (";
foreach ($row['team1'] as $k => $v) {
if ($k != 0) {
$rr .= ", ";
@ -312,7 +308,7 @@ class Zayavka
$rr .= "<img src=\"i/fighttype6.gif\" width=\"20\" height=\"20\" />";
}
$a = db::c()->query('SELECT `admin` FROM `users` WHERE `id` = ?i', $user['id'])->fetch_assoc();
$a = db::c()->query('SELECT `admin` FROM `users` WHERE `id` = ?i', $this->user->id)->fetch_assoc();
$rr .= ")&nbsp; тип боя: ";
if ($row['blood'] && $row['type'] == 4) {
@ -338,7 +334,7 @@ class Zayavka
public function showhaos($row)
{
global $user;
$rr = "<input type=\"radio\" " . ((in_array($user['id'], $row['team1']) || in_array($user['id'], $row['team2'])) ? "disabled " : "") . " name=\"gocombat\" value=\"{$row['id']}\" /><font class=\"date\">{$row['podan']}</font> (";
$rr = "<input type=\"radio\" " . ((in_array($this->user->id, $row['team1']) || in_array($this->user->id, $row['team2'])) ? "disabled " : "") . " name=\"gocombat\" value=\"{$row['id']}\" /><font class=\"date\">{$row['podan']}</font> (";
if ($row['bots'] == '7') {
$rr .= Nick::id(10962)->full(1);
@ -380,14 +376,8 @@ class Zayavka
$rr .= "(таймаут {$row['timeout']} мин.) <span style='color: gray;'><i >бой начнется через " . round(($row['start'] - time()) / 60, 1) . " мин. " . (($row['coment']) ? "(" . $row['coment'] . ")" : "") . "</i></span>";
if ($user['admin'] === 1) {
$rsr = ' | <a href=\'?level=haos&zid=' . $row['id'] . '&del=true\'>Удалить заявку</a>';
} else {
$rsr = '';
}
if ($user['admin'] == 1) {
$rr .= "<small><a href='?zid={$row['id']}&do=clear'>Удалить коммнтарий</a>$rsr</small><br />";
if ($this->user->admin == 1) {
$rr .= "<small><a href='?zid={$row['id']}&do=clear'>Удалить комментарий</a> | <a href=\'?level=haos&zid={$row['id']}&del=true\'>Удалить заявку</a></small><br />";
} else {
$rr .= "<br />";
}
@ -599,7 +589,7 @@ VALUES ("?s","?s",?i,?i,?i,"?s","?s",?i,?i,?i,?i)',
db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i', $id, $bot['id']);
}
}
if ($user['zayavka'] == $zay) {
if ($this->user->zayavka == $zay) {
die("<script>location.href='fbattle.php';</script>");
}
}
@ -608,7 +598,7 @@ VALUES ("?s","?s",?i,?i,?i,"?s","?s",?i,?i,?i,?i)',
$zay = new Zayavka;
header("Cache-Control: no-cache");
if (!empty($_POST['open'])) {
$f = fopen("/tmp/zayavka/" . $user['id'] . ".txt", "w+");
$f = fopen("/tmp/zayavka/" . $user->id . ".txt", "w+");
fputs($f, time());
fclose($f);
}
@ -630,11 +620,7 @@ if (!empty($_POST['open'])) {
</style>
<title></title>
</HEAD>
<body onload="top.setHP(<?= $user['hp'] ?>,<?= $user['maxhp'] ?>,<?php if (!$user['battle']) {
echo "100";
} else {
echo "0";
} ?>);">
<body>
<TABLE width=100% cellspacing=1 cellpadding=1>
<TR>
<TD colspan=5>
@ -675,38 +661,38 @@ if (!empty($_POST['open'])) {
} else {
$blood = 0;
}
echo $zay->addzayavka(0, $_POST['timeout'], 1, 1, $_POST['k'], $user['level'], 1, $user['level'], 21, '', 2, $blood);
echo $zay->addzayavka(0, $_POST['timeout'], 1, 1, $_POST['k'], $user->level, 1, $user->level, 21, '', 2, $blood);
die("<script>document.location='zayavka.php?fiz';</script>");
}
if (!empty($_POST['back'])) {
unlink("/tmp/zayavka/" . $user['id'] . ".txt");
echo $zay->delzayavka($user['id'], $user['zayavka'], 2, 0);
unlink("/tmp/zayavka/" . $user->id . ".txt");
echo $zay->delzayavka($user->id, $user->zayavka, 2, 0);
}
if (!empty($_POST['back2'])) {
$z = $zay->getlist(2, null, $user['zayavka']);
AddChatSystem('Внимание!' . Nick::id($user['id'])->short() . ' отозвал заявку.');
echo $zay->delteam($user['id'], $user['zayavka'], 2);
$z = $zay->getlist(2, null, $user->zayavka);
AddChatSystem('Внимание!' . Nick::id($user->id)->short() . ' отозвал заявку.');
echo $zay->delteam($user->id, $user->zayavka, 2);
}
if (!empty($_POST['cansel'])) {
$z = $zay->getlist(2, null, $user['zayavka']);
echo $zay->delteam($z[$user['zayavka']]['team2'][0], $user['zayavka'], 2);
AddChatSystem('Внимание!' . Nick::id($user['id'])->short() . ' отказался от поединка.');
$z = $zay->getlist(2, null, $user->zayavka);
echo $zay->delteam($z[$user->zayavka]['team2'][0], $user->zayavka, 2);
AddChatSystem('Внимание!' . Nick::id($user->id)->short() . ' отказался от поединка.');
}
if (!empty($_POST['confirm2']) && empty($user['zayavka'])) {
if (!empty($_POST['confirm2']) && empty($user->zayavka)) {
$z = $zay->getlist(2, null, $_REQUEST['gocombat']);
$toper = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $z[$_REQUEST['gocombat']]['team1'][0])->fetch_assoc();
if ($user['klan'] != $toper['klan'] || $user['klan'] == '') {
AddChatSystem('Внимание!' . Nick::id($user['id'])->short() . ' принял заявку, нужно принять вызов или отказать.');
if ($user->clan != $toper['klan'] || !$user->clan) {
AddChatSystem('Внимание!' . Nick::id($user->id)->short() . ' принял заявку, нужно принять вызов или отказать.');
}
echo $zay->addteam(2, 2);
echo "</b></font><BR>Ожидаем подтверждения боя. <input type=submit name=back2 value='Отозвать заявку'>";
}
if (!empty($_POST['gofi'])) {
$zay->battlestart($user['id'], $user['zayavka'], 2);
$zay->battlestart($user->id, $user->zayavka, 2);
}
echo "</b>";
echo '<table cellspacing=0 cellpadding=0><tr><td>';
if ($zay->user_status($user['id']) == 0) { ?>
if ($zay->user_status($user->id) == 0) { ?>
<FIELDSET>
<LEGEND><B>Подать заявку на бой</B></LEGEND>
Таймаут
@ -725,49 +711,49 @@ if (!empty($_POST['open'])) {
<INPUT TYPE=submit name=open value="Подать заявку">
</FIELDSET>
<?php }
$z = $zay->getlist(2, null, $user['zayavka']);
if ($zay->user_status($user['id']) == 1) {
if (count($z[$user['zayavka']]['team2']) > 0) {
echo "<B><font color=red>Внимание! " . Nick::id($z[$user['zayavka']]['team2'][0])->full(1) . " принял заявку на бой, нужно отказать или принять вызов.</font></b> <input type=submit value='Битва!' name=gofi> <input type=submit value='Отказать' name=cansel>";
$z = $zay->getlist(2, null, $user->zayavka);
if ($zay->user_status($user->id) == 1) {
if (count($z[$user->zayavka]['team2']) > 0) {
echo "<B><font color=red>Внимание! " . Nick::id($z[$user->zayavka]['team2'][0])->full(1) . " принял заявку на бой, нужно отказать или принять вызов.</font></b> <input type=submit value='Битва!' name=gofi> <input type=submit value='Отказать' name=cansel>";
} else {
if ($z[$user['zayavka']]['level'] == 2) {
if ($z[$user->zayavka]['level'] == 2) {
echo "Заявка на бой подана, ожидаем противника. <input type=submit name=back value='Отозвать заявку'>";
$Path = "/tmp/zayavka/" . $user['id'] . ".txt";
$Path = "/tmp/zayavka/" . $user->id . ".txt";
$f = fopen($Path, "r");
$timeFigth = fread($f, filesize($Path));
fclose($f);
if ($timeFigth < time() && ($user['level'] <= 14)) {
if ($get == 'trainstart' && $user['hp'] > $user['maxhp'] * 0.33 && ($user['level'] <= 7 || $user['admin'] == 1)) {
unlink("/tmp/zayavka/" . $user['id'] . ".txt");
$zay->delzayavka($user['id'], $user['zayavka'], 2, 0);
if ($timeFigth < time() && ($user->level <= 14)) {
if ($get == 'trainstart' && $user->health > $user->maxHealth * 0.33 && ($user->level <= 7 || $user->admin == 1)) {
unlink("/tmp/zayavka/" . $user->id . ".txt");
$zay->delzayavka($user->id, $user->zayavka, 2, 0);
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) values ('" . $user['login'] . " (Клон 1)','" . $user['id'] . "','','" . $user['maxhp'] . "');");
mysql_query("INSERT INTO `bots` (`name`, `prototype`, `battle`, `hp`) values ('" . $user->login . " (Клон 1)','" . $user->id . "','','" . $user->maxHealth . "');");
$bot = mysql_insert_id();
$teams = [];
$teams[$user['id']][$bot] = [0, 0, time()];
$teams[$bot][$user['id']] = [0, 0, time()];
$teams[$user->id][$bot] = [0, 0, time()];
$teams[$bot][$user->id] = [0, 0, time()];
mysql_query("INSERT INTO `battle`
(`teams`,`timeout`,`type`,`status`,`t1`,`t2`,`to1`,`to2`, `clone`
)
VALUES
('" . serialize($teams) . "','3','1','0','" . $user['id'] . "','" . $bot . "','" . time() . "','" . time() . "', 1
('" . serialize($teams) . "','3','1','0','" . $user->id . "','" . $bot . "','" . time() . "','" . time() . "', 1
)");
$id = mysql_insert_id();
mysql_query("UPDATE `bots` SET `battle` = {$id} WHERE `id` = {$bot} LIMIT 1");
$rr = "<b>" . Nick::id($user['id'])->full(1) . "</b> и <b>" . Nick::id($bot)->full(1) . "</b>";
$rr = "<b>" . Nick::id($user->id)->full(1) . "</b> и <b>" . Nick::id($bot)->full(1) . "</b>";
addlog($id, "Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>");
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$user['id']};");
mysql_query("UPDATE users SET `battle` ={$id},`zayavka`=0 WHERE `id`= {$user->id};");
die("<script>location.href='fbattle.php';</script>");
}
$Path = "/tmp/zayavka/" . $user['id'] . ".txt";
$Path = "/tmp/zayavka/" . $user->id . ".txt";
$f = fopen($Path, "r");
$timeFigth = fread($f, filesize($Path));
fclose($f);
if ($user['admin'] == 1) {
if ($user->admin == 1) {
echo " или <input type=button onclick=\"location.href='zayavka.php?trainstart';\" value=\"Начать тренировочный бой\">";
}
@ -775,10 +761,10 @@ if (!empty($_POST['open'])) {
}
}
}
if ($zay->user_status($user['id']) == 2 && $z[$user['zayavka']]['level'] == 2) {
if ($zay->user_status($user->id) == 2 && $z[$user->zayavka]['level'] == 2) {
echo "Ожидаем подтверждения боя. <input type=submit name=back2 value='Отозвать заявку'>";
}
echo '</td></tr></table></TD><TD align=right valign=top rowspan=2><INPUT TYPE=submit name=tmp value="Обновить"><BR><FIELDSET style="width:150px;"><LEGEND>Показывать заявки</LEGEND><table cellspacing=0 cellpadding=0 ><tr><td width=1%><input type=radio name=view value="' . $user['level'] . '" ' . (($_SESSION['view'] != null) ? "checked" : "") . '></td><td>моего уровня</td></tr><tr><td><input type=radio name=view value="" ' . (($_SESSION['view'] == null) ? "checked" : "") . '></td><td>все</td></tr></table></FIELDSET>';
echo '</td></tr></table></TD><TD align=right valign=top rowspan=2><INPUT TYPE=submit name=tmp value="Обновить"><BR><FIELDSET style="width:150px;"><LEGEND>Показывать заявки</LEGEND><table cellspacing=0 cellpadding=0 ><tr><td width=1%><input type=radio name=view value="' . $user->level . '" ' . (($_SESSION['view'] != null) ? "checked" : "") . '></td><td>моего уровня</td></tr><tr><td><input type=radio name=view value="" ' . (($_SESSION['view'] == null) ? "checked" : "") . '></td><td>все</td></tr></table></FIELDSET>';
echo '<tr><td><INPUT TYPE=hidden name=level value=fiz><INPUT TYPE=submit value="Принять вызов" NAME=confirm2><BR>';
if ($z = $zay->getlist(2, $_SESSION['view'])) {
foreach ($z as $k => $v) {
@ -790,10 +776,10 @@ if (!empty($_POST['open'])) {
if ($get == 'group') {
if ($zay->user_status($user['id']) != 0) {
$z = $zay->getlist(4, null, $user['zayavka']);
if ($z[$user['zayavka']]['level'] == 4) {
$battleStartTime = round(($z[$user['zayavka']]['start'] - time()) / 60, 1);
if ($zay->user_status($user->id) != 0) {
$z = $zay->getlist(4, null, $user->zayavka);
if ($z[$user->zayavka]['level'] == 4) {
$battleStartTime = round(($z[$user->zayavka]['start'] - time()) / 60, 1);
echo "<div><b>Ожидаем начала группового боя...</b><br>Бой начнется через: $battleStartTime мин.</div>";
}
} else { ?>
@ -865,7 +851,7 @@ if (!empty($_POST['open'])) {
<?php }
if (!empty($_POST['goconfirm']) && empty($user['zayavka'])) {
if (!empty($_POST['goconfirm']) && empty($user->zayavka)) {
echo '<TABLE width=100%><TR><TD>';
$z = $zay->getlist(4, null, $_POST['gocombat']);
echo "<B>Ожидаем начала группового боя...</B><BR>Бой начнется через: " . round(($z[$_POST['gocombat']]['start'] - time()) / 60, 1) . " мин.";
@ -905,14 +891,14 @@ if (!empty($_POST['goconfirm']) && empty($user['zayavka'])) {
echo "<b style='color: #f80000;'>";
if (!empty($_POST['confirm1']) && !empty($_POST['gocombat']) && empty($user['zayavka'])) {
if (!empty($_POST['confirm1']) && !empty($_POST['gocombat']) && empty($user->zayavka)) {
echo $zay->addteam(1, 4);
}
if (!empty($_POST['confirm2']) && $_POST['gocombat'] && empty($user['zayavka'])) {
if (!empty($_POST['confirm2']) && $_POST['gocombat'] && empty($user->zayavka)) {
echo $zay->addteam(2, 4);
}
if (!empty($_POST['open']) && empty($user['zayavka'])) {
if (!empty($_POST['open']) && empty($user->zayavka)) {
switch ($_POST['levellogin1']) {
default:
case 0 : //любой
@ -921,27 +907,27 @@ if (!empty($_POST['open']) && empty($user['zayavka'])) {
break;
case 1 : //только моего и ниже
$min1 = 0;
$max1 = $user['level'];
$max1 = $user->level;
break;
case 2 : //только ниже моего уровня
$min1 = 0;
$max1 = $user['level'] - 1;
$max1 = $user->level - 1;
break;
case 3 : //только моего уровня
$min1 = $user['level'];
$max1 = $user['level'];
$min1 = $user->level;
$max1 = $user->level;
break;
case 4 : //не старше меня более чем на уровень
$min1 = $user['level'];
$max1 = $user['level'] + 1;
$min1 = $user->level;
$max1 = $user->level + 1;
break;
case 5 : //не младше меня более чем на уровень
$min1 = $user['level'] - 1;
$max1 = $user['level'];
$min1 = $user->level - 1;
$max1 = $user->level;
break;
case 6 : //мой уровень +/- 1
$min1 = (int)$user['level'] - 1;
$max1 = (int)$user['level'] + 1;
$min1 = (int)$user->level - 1;
$max1 = (int)$user->level + 1;
break;
case 99 : // кланы
$min1 = 99;
@ -956,27 +942,27 @@ if (!empty($_POST['open']) && empty($user['zayavka'])) {
break;
case 1 : //только моего и ниже
$min1 = 0;
$max1 = $user['level'];
$max1 = $user->level;
break;
case 2 : //только ниже моего уровня
$min1 = 0;
$max1 = $user['level'] - 1;
$max1 = $user->level - 1;
break;
case 3 : //только моего уровня
$min1 = $user['level'];
$max1 = $user['level'];
$min1 = $user->level;
$max1 = $user->level;
break;
case 4 : //не старше меня более чем на уровень
$min1 = $user['level'];
$max1 = $user['level'] + 1;
$min1 = $user->level;
$max1 = $user->level + 1;
break;
case 5 : //не младше меня более чем на уровень
$min1 = $user['level'] - 1;
$max1 = $user['level'];
$min1 = $user->level - 1;
$max1 = $user->level;
break;
case 6 : //мой уровень +/- 1
$min1 = (int)$user['level'] - 1;
$max1 = (int)$user['level'] + 1;
$min1 = (int)$user->level - 1;
$max1 = (int)$user->level + 1;
break;
case 99 : // кланы
$min1 = 99;
@ -1006,7 +992,7 @@ if (!empty($_POST['open']) && empty($user['zayavka'])) {
echo "</b><INPUT TYPE=hidden name=level value=group>";
echo '</TD><TD align=right valign=top rowspan=2><INPUT TYPE=submit name=tmp value="Обновить"><BR><FIELDSET style="width:150px;"><LEGEND>Показывать заявки</LEGEND><table cellspacing=0 cellpadding=0 ><tr><td width=1%><input type=radio name=view value="' . $user['level'] . '" ' . (($_SESSION['view'] != null) ? "checked" : "") . '></td><td>моего уровня</td></tr><tr><td><input type=radio name=view value="" ' . (($_SESSION['view'] == null) ? "checked" : "") . '></td><td>все</td></tr></table></FIELDSET>';
echo '</TD><TD align=right valign=top rowspan=2><INPUT TYPE=submit name=tmp value="Обновить"><BR><FIELDSET style="width:150px;"><LEGEND>Показывать заявки</LEGEND><table cellspacing=0 cellpadding=0 ><tr><td width=1%><input type=radio name=view value="' . $user->level . '" ' . (($_SESSION['view'] != null) ? "checked" : "") . '></td><td>моего уровня</td></tr><tr><td><input type=radio name=view value="" ' . (($_SESSION['view'] == null) ? "checked" : "") . '></td><td>все</td></tr></table></FIELDSET>';
echo '<tr><td width=85%>';
echo '<BR><INPUT TYPE=submit value="Принять участие" NAME=goconfirm><BR>';
@ -1023,7 +1009,7 @@ echo '<INPUT TYPE=submit value="Принять участие" NAME=goconfirm></
if ($get == 'haos') {
if (!empty($_POST['open']) && empty($user['zayavka'])) {
if (!empty($_POST['open']) && empty($user->zayavka)) {
switch ($_POST['levellogin1']) {
default:
case 0 :
@ -1031,12 +1017,12 @@ if ($get == 'haos') {
$max1 = 21;
break;
case 3 :
$min1 = $user['level'];
$max1 = $user['level'];
$min1 = $user->level;
$max1 = $user->level;
break;
case 6 :
$min1 = (int)$user['level'] - 1;
$max1 = (int)$user['level'] + 1;
$min1 = (int)$user->level - 1;
$max1 = (int)$user->level + 1;
break;
}
@ -1051,16 +1037,16 @@ if ($get == 'haos') {
}
echo '<table cellspacing=0 cellpadding=0><tr><td>';
if ($zay->user_status($user['id']) == 0) {
if ($zay->user_status($user->id) == 0) {
echo 'Хаотичный бой - разновидность группового, где группы формируются автоматически. Бой не начнется, если собралось меньше 4-х человек. <DIV id="dv2" style="display:"><A href="#" onclick="dv1.style.display=\'\'; dv2.style.display=\'none\'; return false">Подать заявку на хаотичный бой</A></DIV><DIV id="dv1" style="display: none"><FIELDSET><LEGEND><B>Подать заявку на хаотичный бой</B> </LEGEND>Начало боя через <SELECT NAME=startime2><option value=180>3 минуты</option><option value=300 selected>5 минут</option><option value=600>10 минут</option><option value=900>15 минут</option><option value=1800>30 минут</option><option value=2700>45 минут</option><option value=3600>1 час</option></SELECT>&nbsp;&nbsp;&nbsp;&nbsp;Таймаут <SELECT NAME=timeout><OPTION value=3 SELECTED>3 мин.<OPTION value=5>5 мин.<OPTION value=10>10 мин.</SELECT><BR>Уровни бойцов &nbsp;&nbsp;<SELECT NAME=levellogin1><option value=0>любой<option value=3>только моего уровня<option value=6 selected>мой уровень +/- 1</SELECT><BR><BR>Тип боя <SELECT NAME=k><OPTION value=3>с оружием<OPTION value=5>кулачный</SELECT><BR><INPUT TYPE=checkbox NAME=travma> Бой без правил (<font class=dsc>проигравшая сторона получает инвалидность</font>)<BR><INPUT TYPE=submit name=open value="Подать заявку">&nbsp;<BR>Комментарий к бою <INPUT TYPE=text NAME=cmt maxlength=40 size=40></FIELDSET><BR></DIV>';
}
if ($zay->user_status($user['id']) != 0) {
$z = $zay->getlist(5, null, $user['zayavka']);
if ($z[$user['zayavka']]['level'] == 5) {
echo "<B>Ожидаем начала группового боя...</B><BR>Бой начнется через: " . round(($z[$user['zayavka']]['start'] - time()) / 60, 1) . " мин.";
if ($zay->user_status($user->id)) {
$z = $zay->getlist(5, null, $user->zayavka);
if ($z[$user->zayavka]['level'] == 5) {
echo "<B>Ожидаем начала группового боя...</B><BR>Бой начнется через: " . round(($z[$user->zayavka]['start'] - time()) / 60, 1) . " мин.";
}
}
echo '</td></tr></table></TD><TD align=right valign=top rowspan=2><INPUT TYPE=submit name=tmp value="Обновить"><BR><FIELDSET style="width:150px;"><LEGEND>Показывать заявки</LEGEND><table cellspacing=0 cellpadding=0 ><tr><td width=1%><input type=radio name=view value="' . $user['level'] . '" ' . (($_SESSION['view'] != null) ? "checked" : "") . '></td><td>моего уровня</td></tr><tr><td><input type=radio name=view value="" ' . (($_SESSION['view'] == null) ? "checked" : "") . '></td><td>все</td></tr></table></FIELDSET>';
echo '</td></tr></table></TD><TD align=right valign=top rowspan=2><INPUT TYPE=submit name=tmp value="Обновить"><BR><FIELDSET style="width:150px;"><LEGEND>Показывать заявки</LEGEND><table cellspacing=0 cellpadding=0 ><tr><td width=1%><input type=radio name=view value="' . $user->level . '" ' . (($_SESSION['view'] != null) ? "checked" : "") . '></td><td>моего уровня</td></tr><tr><td><input type=radio name=view value="" ' . (($_SESSION['view'] == null) ? "checked" : "") . '></td><td>все</td></tr></table></FIELDSET>';
echo '<tr><td width=85%><INPUT TYPE=hidden name=level value=haos><INPUT TYPE=submit value="Принять участие" NAME=confirm2><BR>';
if ($z = $zay->getlist(5, $_SESSION['view'])) {
foreach ($z as $k => $v) {