remove deprecated

This commit is contained in:
lopar 2019-06-22 18:43:05 +03:00
parent 0eb5cbef31
commit 109cfc8d93

View File

@ -93,7 +93,7 @@ class zayavka
function addteam($team, $id, $zay, $r) function addteam($team, $id, $zay, $r)
{ {
global $user; global $user;
$owntravma = mysql_fetch_array(mysql_query("SELECT `id`, `type` FROM `effects` WHERE `owner` = " . $id . " AND (`type` = 12 OR `type` = 13)")); $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); $z = $this->getlist($r, null, $zay);
if ($owntravma) { if ($owntravma) {
switch ($owntravma['type']) { switch ($owntravma['type']) {
@ -125,13 +125,8 @@ class zayavka
} }
if ($z[$zay]['t' . $team . 'min'] == 99) { if ($z[$zay]['t' . $team . 'min'] == 99) {
$toper = $z[$zay]['team' . $team][0]; $toper = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $z[$zay]['team' . $team][0])->fetch_assoc();
$toper = mysql_fetch_array(mysql_query("SELECT `id`, `login`, `align`, `klan`, `level` FROM `users` WHERE `id` = '{$toper}' LIMIT 1")); if ($user['klan'] != $toper['klan']) return "Эта заявка не может быть принята Вами.";
if (!empty($toper['klan'])) {
if ($user['klan'] != $toper['klan']) {
return "Эта заявка не может быть принята Вами.";
}
}
} else { } else {
if ($user['level'] > 0 && !($z[$zay]['t' . $team . 'min'] <= $user['level'] && $z[$zay]['t' . $team . 'max'] >= $user['level'])) { if ($user['level'] > 0 && !($z[$zay]['t' . $team . 'min'] <= $user['level'] && $z[$zay]['t' . $team . 'max'] >= $user['level'])) {
return "Эта заявка не может быть принята Вами. - " . $z[$zay]['t' . $team . 'min']; return "Эта заявка не может быть принята Вами. - " . $z[$zay]['t' . $team . 'min'];
@ -232,15 +227,13 @@ class zayavka
if (mysql_query("DELETE FROM `zayavka` WHERE `id` = {$zay} AND (`team1` LIKE '{$id};%' OR `team2` LIKE '{$id};%') LIMIT 1")) { if (mysql_query("DELETE FROM `zayavka` WHERE `id` = {$zay} AND (`team1` LIKE '{$id};%' OR `team2` LIKE '{$id};%') LIMIT 1")) {
if (count($z[$zay]['team1']) > 0) { if (count($z[$zay]['team1']) > 0) {
foreach ($z[$zay]['team1'] as $k => $v) { foreach ($z[$zay]['team1'] as $k => $v)
mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `id` = {$v}"); db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `id` = ?i', $v);
}
} }
if (count($z[$zay]['team2']) > 0) { if (count($z[$zay]['team2']) > 0) {
foreach ($z[$zay]['team2'] as $k => $v) { foreach ($z[$zay]['team2'] as $k => $v)
mysql_query("UPDATE `users` SET `zayavka` = 0 WHERE `id` = {$v}"); db::c()->query('UPDATE `users` SET `zayavka` = 0 WHERE `id` = ?i', $v);
}
} }
return 'Вы отозвали заявку.'; return 'Вы отозвали заявку.';
} else return 'delzayavka(): database error!'; } else return 'delzayavka(): database error!';
@ -474,10 +467,10 @@ class zayavka
// А ЭТО ещё что за хренотень?! О_о // А ЭТО ещё что за хренотень?! О_о
for ($i = 0; $i <= $all; $i++) { for ($i = 0; $i <= $all; $i++) {
if ($z['team1'][$i] < _BOTSEPARATOR_) { if ($z['team1'][$i] < _BOTSEPARATOR_) {
$gamer = mysql_fetch_array(mysql_query("SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = '" . $z['team1'][$i] . "' LIMIT 1")); $gamer = db::c()->query('SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = ?i', $z['team1'][$i])->fetch_assoc();
} else { } else {
$bt = mysql_fetch_array(mysql_query('SELECT `id`, `prototype` FROM `bots` WHERE `id` = "' . $z['team1'][$i] . '"')); $bt = db::c()->query('SELECT `prototype` FROM `bots` WHERE `id` = ?i', $z['team1'][$i])->fetch_assoc();
$gamer = mysql_fetch_array(mysql_query("SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = '" . $bt['prototype'] . "' LIMIT 1")); $gamer = db::c()->query('SELECT (`level`*50)+`sila`+`lovk`+`inta`+`vinos`+`intel`+`stats`+IFNULL((SELECT SUM(`cost`) FROM `inventory` WHERE `owner` = `users`.`id` AND `dressed` = 1), 0) FROM `users` WHERE `id` = ?i', $bt['prototype'])->fetch_assoc();
} }
$cost[] = array($z['team1'][$i], $gamer[0]); $cost[] = array($z['team1'][$i], $gamer[0]);
@ -749,29 +742,24 @@ if (!empty($_POST['open'])) {
if ($_GET['trainstart'] == 1 && $user['hp'] > $user['maxhp'] * 0.33 && $user['level'] <= 7) { if ($_GET['trainstart'] == 1 && $user['hp'] > $user['maxhp'] * 0.33 && $user['level'] <= 7) {
unlink("/tmp/zayavka/" . $user['id'] . ".txt"); unlink("/tmp/zayavka/" . $user['id'] . ".txt");
$zay->delzayavka($user['id'], $user['zayavka'], 1, 0); $zay->delzayavka($user['id'], $user['zayavka'], 1, 0);
mysql_query("INSERT INTO `bots` (`name`,`prototype`,`battle`,`hp`) values ('" . $user['login'] . " (Клон 1)','" . $user['id'] . "','','" . $user['maxhp'] . "');"); db::c()->query('INSERT INTO `bots` (`name`,`prototype`,`hp`) VALUES ("?s",?i,?i)', $user['login'] . ' (Клон 1)', $user['id'], $user['maxhp']);
$bot = mysql_insert_id(); $bot = db::c()->getLastInsertId();
$teams = array(); $teams = array();
$teams[$user['id']][$bot] = array(0, 0, time()); $teams[$user['id']][$bot] = array(0, 0, time());
$teams[$bot][$user['id']] = array(0, 0, time()); $teams[$bot][$user['id']] = array(0, 0, time());
mysql_query("INSERT INTO `battle` db::c()->query('INSERT INTO `battle` (`teams`,`timeout`, `type`, `t1`, `t2`, `to1`, `to2`, `clone`) VALUES ("?s", 3, 1, "?s", "?s", ?i, ?i, 1)', serialize($teams), $user['id'], $bot, time(), time());
( $id = db::c()->getLastInsertId();
`id`,`coment`,`teams`,`timeout`,`type`,`status`,`t1`,`t2`,`to1`,`to2`, `clone`
) $log_message = 'Часы показывали <span class=date>' . date("Y.m.d H.i") . '</span>, когда ' . $rr . ' бросили вызов друг другу. <BR>';
VALUES db::c()->query('INSERT INTO `logs` (`id`, `log`) VALUES (?i,"?s")', $id, $log_message);
( db::c()->query('UPDATE `bots` SET `battle` = ?i WHERE `id` = ?i', $id, $bot);
NULL,'','" . serialize($teams) . "','3','1','0','" . $user['id'] . "','" . $bot . "','" . time() . "','" . time() . "', 1
)");
$id = mysql_insert_id();
mysql_query("INSERT INTO `logs` (`id`,`log`) VALUES('{$id}','Часы показывали <span class=date>" . date("Y.m.d H.i") . "</span>, когда " . $rr . " бросили вызов друг другу. <BR>');");
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>"); 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']};"); db::c()->query('UPDATE users SET `battle` = ?i, `zayavka`= 0 WHERE `id`= ?i', $id, $user['id']);
die("<script>location.href='fbattle.php';</script>"); die("<script>location.href='fbattle.php';</script>");
///======================================================================================= ///=======================================================================================
@ -829,8 +817,7 @@ if (!empty($_POST['open'])) {
} }
if (!empty($_POST['confirm2']) AND empty($user['zayavka'])) { if (!empty($_POST['confirm2']) AND empty($user['zayavka'])) {
$z = $zay->getlist(2, null, $_REQUEST['gocombat']); $z = $zay->getlist(2, null, $_REQUEST['gocombat']);
$toper = $z[$_REQUEST['gocombat']]['team1'][0]; $toper = db::c()->query('SELECT `klan` FROM `users` WHERE `id` = ?i', $z[$_REQUEST['gocombat']]['team1'][0])->fetch_assoc();
$toper = mysql_fetch_array(mysql_query("SELECT `klan` FROM `users` WHERE `id`='{$toper}' LIMIT 1;"));
if ($user['klan'] != $toper['klan'] || $user['klan'] == '') { if ($user['klan'] != $toper['klan'] || $user['klan'] == '') {
AddChatSystem('Внимание!' . nick::id($user['id'])->short() . ' принял заявку, нужно принять вызов или отказать.'); AddChatSystem('Внимание!' . nick::id($user['id'])->short() . ' принял заявку, нужно принять вызов или отказать.');
} }