diff --git a/functions.php b/functions.php index d94eee6..62b5192 100644 --- a/functions.php +++ b/functions.php @@ -3004,16 +3004,23 @@ function stack($it_id) } } +/** + * @param $time + * @param $vars + * @param $vls + * @param $uid + * @return bool + */ function addActions($time, $vars, $vls, $uid) { - mysql_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) . '")'); + db::c()->query('LOCK TABLES `actions` WRITE'); + $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) { return true; } else { return false; } - mysql_query('UNLOCK TABLES'); } 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') { global $user; @@ -3256,6 +3270,14 @@ function show_shop_items($it, $from = 'shop') return $r; } +/** + * По ходу, главная функция отображения предметов. + * + * @param $row + * @param $type + * @param bool $returned + * @return string + */ function showitem($row, $type, $returned = false) { global $user, $runes_exp; @@ -3830,11 +3852,13 @@ function show_item($row, $txt, $place) return $r; } -// magic +/** + * @param $id + * @return array + */ function magicinf($id) { - return mysql_fetch_array(mysql_query("SELECT * FROM `magic` WHERE `id` = '{$id}' LIMIT 1")); - return db::c()->query()->fetch_assoc_array() + return db::c()->query('SELECT * FROM `magic` WHERE `id` = ?i', $id)->fetch_assoc(); } /**