addaction(), magicinf() function fixes

This commit is contained in:
lopar 2018-03-01 12:57:27 +02:00
parent abdd25855e
commit 8ee5ee1008

View File

@ -3004,16 +3004,23 @@ function stack($it_id)
} }
} }
/**
* @param $time
* @param $vars
* @param $vls
* @param $uid
* @return bool
*/
function addActions($time, $vars, $vls, $uid) function addActions($time, $vars, $vls, $uid)
{ {
mysql_query('LOCK TABLES `actions` WRITE'); db::c()->query('LOCK TABLES `actions` WRITE');
$ins = mysql_query('INSERT INTO `actions` (`uid`, `time`, `city`, `room`, `vars`, `ip`, `vals`) VALUES ("' . $uid . '", "' . $time . '", "capitalcity", "0", "' . mysql_real_escape_string($vars) . '", "' . mysql_real_escape_string($_SERVER['HTTP_X_REAL_IP']) . '", "' . mysql_real_escape_string($vls) . '")'); $ins = db::c()->query('INSERT INTO `actions` (`uid`,`time`,`city`,`room`,`vars`,`ip`,`vals`) VALUES (?i, ?i, "?s", ?i, "?s", "?s", "?s")', $uid, $time, "capitalcity", 0, $_SERVER['HTTP_X_REAL_IP'], $vls);
db::c()->query('UNLOCK TABLES');
if ($ins) { if ($ins) {
return true; return true;
} else { } else {
return false; return false;
} }
mysql_query('UNLOCK TABLES');
} }
function unstack($it_id, $it_count) function unstack($it_id, $it_count)
@ -3057,6 +3064,13 @@ function plusorminus($n, $shownum = 1)
} }
} }
/**
* Показать предмет в магазине
*
* @param $it
* @param string $from
* @return string
*/
function show_shop_items($it, $from = 'shop') function show_shop_items($it, $from = 'shop')
{ {
global $user; global $user;
@ -3256,6 +3270,14 @@ function show_shop_items($it, $from = 'shop')
return $r; return $r;
} }
/**
* По ходу, главная функция отображения предметов.
*
* @param $row
* @param $type
* @param bool $returned
* @return string
*/
function showitem($row, $type, $returned = false) function showitem($row, $type, $returned = false)
{ {
global $user, $runes_exp; global $user, $runes_exp;
@ -3830,11 +3852,13 @@ function show_item($row, $txt, $place)
return $r; return $r;
} }
// magic /**
* @param $id
* @return array
*/
function magicinf($id) function magicinf($id)
{ {
return mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '{$id}' LIMIT 1")); return db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $id)->fetch_assoc();
return db::c()->query()->fetch_assoc_array()
} }
/** /**