Удаление неиспользуемого кода. Тесты.
This commit is contained in:
parent
af712c037e
commit
cec43f9e79
208
functions.php
208
functions.php
@ -2548,32 +2548,11 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM
|
|||||||
} else {
|
} else {
|
||||||
$rrm = $rooms[$data['room']];
|
$rrm = $rooms[$data['room']];
|
||||||
}
|
}
|
||||||
$r .= '<center>Персонаж сейчас находится в игре.</center><center><b>"' . $rrm . '"</b></center>';
|
$r .= '<center>Персонаж сейчас находится в игре.<b>"' . $rrm . '"</b></center>';
|
||||||
} else {
|
} else {
|
||||||
$date = getDateInterval($online['date']);
|
$r .= "<center>Персонаж не в игре.</center>";
|
||||||
$year = year_text($date['year']);
|
|
||||||
$month = month_text($date['month']);
|
|
||||||
$week = week_text($date['week']);
|
|
||||||
$days = days_text($date['day']);
|
|
||||||
$hour = hour_text($date['hour']);
|
|
||||||
$minute = minute_text($date['minute']);
|
|
||||||
if ($days > 0 || $week > 0 || $month > 0 || $year > 0) {
|
|
||||||
$minute = "";
|
|
||||||
}
|
|
||||||
if ($week > 0 || $month > 0 || $year > 0) {
|
|
||||||
$hour = "";
|
|
||||||
}
|
|
||||||
if ($month > 0 || $year > 0) {
|
|
||||||
$week = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($user['admin'])) {
|
|
||||||
$r .= "<center>Персонаж не в игре, но был тут:</center><center>" . date("Y.m.d H:i", $online['date']) . "<img src=\"i/clok3_2.png\" /></center>";
|
|
||||||
$r .= "<center>(" . $year . $month . $week . $days . $hour . $minute . " назад)</center>";
|
|
||||||
} else {
|
|
||||||
$r .= "<center>Персонаж не в игре.</center>";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if ($user['battle'] > 0 && $user['invis'] == 0) {
|
if ($user['battle'] > 0 && $user['invis'] == 0) {
|
||||||
$r .= '<br />Персонаж сейчас в <a target="_blank" href="logs.php?log=' . $user['battle'] . '">поединке</a>';
|
$r .= '<br />Персонаж сейчас в <a target="_blank" href="logs.php?log=' . $user['battle'] . '">поединке</a>';
|
||||||
@ -2655,160 +2634,6 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM
|
|||||||
return $r;
|
return $r;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDateInterval($pointDate)
|
|
||||||
{//FIXME Лолшто?! ))))))
|
|
||||||
$pointNow = time();
|
|
||||||
$times = array('year' => 60 * 60 * 24 * 365, 'month' => 60 * 60 * 24 * 31, 'week' => 60 * 60 * 24 * 7, 'day' => 60 * 60 * 24, 'hour' => 60 * 60, 'minute' => 60);
|
|
||||||
$pointInterval = $pointDate > $pointNow ? $pointDate - $pointNow : $pointNow - $pointDate;
|
|
||||||
$returnDate = array();
|
|
||||||
$returnDate['year'] = floor($pointInterval / $times['year']);
|
|
||||||
$pointInterval = $pointInterval % $times['year'];
|
|
||||||
$returnDate['month'] = floor($pointInterval / $times['month']);
|
|
||||||
$pointInterval = $pointInterval % $times['month'];
|
|
||||||
$returnDate['week'] = floor($pointInterval / $times['week']);
|
|
||||||
$pointInterval = $pointInterval % $times['week'];
|
|
||||||
$returnDate['day'] = floor($pointInterval / $times['day']);
|
|
||||||
$pointInterval = $pointInterval % $times['day'];
|
|
||||||
$returnDate['hour'] = floor($pointInterval / $times['hour']);
|
|
||||||
$pointInterval = $pointInterval % $times['hour'];
|
|
||||||
$returnDate['minute'] = floor($pointInterval / $times['minute']);
|
|
||||||
// $pointInterval = $pointInterval % $times['minute'];
|
|
||||||
return $returnDate;
|
|
||||||
}
|
|
||||||
|
|
||||||
function year_text($days)
|
|
||||||
{
|
|
||||||
$s = substr($days, strlen($days) - 1, 1);
|
|
||||||
if (strlen($days) >= 2) {
|
|
||||||
if (substr($days, strlen($days) - 2, 1) == '1') {
|
|
||||||
$ok = true;
|
|
||||||
return $days . " лет ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$ok) {
|
|
||||||
if ($days == 0) {
|
|
||||||
return "";
|
|
||||||
} elseif ($s == 0 || $s >= 5) {
|
|
||||||
return $days . " лет ";
|
|
||||||
} elseif ($s == 1) {
|
|
||||||
return $days . " год ";
|
|
||||||
} elseif ($s >= 2 && $s <= 4) {
|
|
||||||
return $days . " года ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function month_text($days)
|
|
||||||
{
|
|
||||||
$s = substr($days, strlen($days) - 1, 1);
|
|
||||||
if (strlen($days) >= 2) {
|
|
||||||
if (substr($days, strlen($days) - 2, 1) == '1') {
|
|
||||||
$ok = 1;
|
|
||||||
return $days . " месяцев ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$ok) {
|
|
||||||
if ($days == 0) {
|
|
||||||
return "";
|
|
||||||
} elseif ($s == 0 || $s >= 5) {
|
|
||||||
return $days . " месяцев ";
|
|
||||||
} elseif ($s == 1) {
|
|
||||||
return $days . " месяц ";
|
|
||||||
} elseif ($s >= 2 && $s <= 4) {
|
|
||||||
return $days . " месяца ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function week_text($days)
|
|
||||||
{
|
|
||||||
$s = substr($days, strlen($days) - 1, 1);
|
|
||||||
if (strlen($days) >= 2) {
|
|
||||||
if (substr($days, strlen($days) - 2, 1) == '1') {
|
|
||||||
return $days . " недель ";
|
|
||||||
$ok = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$ok) {
|
|
||||||
if ($days == 0) {
|
|
||||||
return "";
|
|
||||||
} elseif ($s == 0 || $s >= 5) {
|
|
||||||
return $days . " недель ";
|
|
||||||
} elseif ($s == 1) {
|
|
||||||
return $days . " неделю ";
|
|
||||||
} elseif ($s >= 2 && $s <= 4) {
|
|
||||||
return $days . " недели ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function days_text($days)
|
|
||||||
{
|
|
||||||
$s = substr($days, strlen($days) - 1, 1);
|
|
||||||
if (strlen($days) >= 2) {
|
|
||||||
if (substr($days, strlen($days) - 2, 1) == '1') {
|
|
||||||
return $days . " дней ";
|
|
||||||
$ok = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$ok) {
|
|
||||||
if ($days == 0) {
|
|
||||||
return "";
|
|
||||||
} elseif ($s == 0 || $s >= 5) {
|
|
||||||
return $days . " дней ";
|
|
||||||
} elseif ($s == 1) {
|
|
||||||
return $days . " день ";
|
|
||||||
} elseif ($s >= 2 && $s <= 4) {
|
|
||||||
return $days . " дня ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function hour_text($days)
|
|
||||||
{
|
|
||||||
$s = substr($days, strlen($days) - 1, 1);
|
|
||||||
if (strlen($days) >= 2) {
|
|
||||||
if (substr($days, strlen($days) - 2, 1) == '1') {
|
|
||||||
return $days . " часов ";
|
|
||||||
$ok = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$ok) {
|
|
||||||
if ($days == 0) {
|
|
||||||
return "";
|
|
||||||
} elseif ($s == 0 || $s >= 5) {
|
|
||||||
return $days . " часов ";
|
|
||||||
} elseif ($s == 1) {
|
|
||||||
return $days . " час ";
|
|
||||||
} elseif ($s >= 2 && $s <= 4) {
|
|
||||||
return $days . " часа ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function minute_text($days)
|
|
||||||
{
|
|
||||||
$s = substr($days, strlen($days) - 1, 1);
|
|
||||||
if (strlen($days) >= 2) {
|
|
||||||
if (substr($days, strlen($days) - 2, 1) == '1') {
|
|
||||||
return $days . " минут ";
|
|
||||||
$ok = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!$ok) {
|
|
||||||
if ($days == 0) {
|
|
||||||
return "1 минуту";
|
|
||||||
} elseif ($s == 0 || $s >= 5) {
|
|
||||||
return $days . " минут ";
|
|
||||||
} elseif ($s == 1) {
|
|
||||||
return $days . " минуту ";
|
|
||||||
} elseif ($s >= 2 && $s <= 4) {
|
|
||||||
return $days . " минуты ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function showpersout($id, $pas = 0, $battle = 0, $me = 0)
|
function showpersout($id, $pas = 0, $battle = 0, $me = 0)
|
||||||
{
|
{
|
||||||
global $rooms;
|
global $rooms;
|
||||||
@ -3141,32 +2966,9 @@ function showpersout($id, $pas = 0, $battle = 0, $me = 0)
|
|||||||
} else {
|
} else {
|
||||||
$rrm = $rooms[$data['room']];
|
$rrm = $rooms[$data['room']];
|
||||||
}
|
}
|
||||||
echo '<center>Персонаж сейчас находится в игре.</center><center><B>"' . $rrm . '"</B></center>';
|
echo '<center>Персонаж сейчас находится в игре.<B>"' . $rrm . '"</B></center>';
|
||||||
} else {
|
} else {
|
||||||
|
echo "<center>Персонаж не в игре.</center>";
|
||||||
|
|
||||||
$date = getDateInterval($online['date']);
|
|
||||||
$year = year_text($date['year']);
|
|
||||||
$month = month_text($date['month']);
|
|
||||||
$week = week_text($date['week']);
|
|
||||||
$days = days_text($date['day']);
|
|
||||||
$hour = hour_text($date['hour']);
|
|
||||||
$minute = minute_text($date['minute']);
|
|
||||||
|
|
||||||
|
|
||||||
if ($days > 0 or $week > 0 or $month > 0 or $year > 0) {
|
|
||||||
$minute = "";
|
|
||||||
}
|
|
||||||
if ($week > 0 or $month > 0 or $year > 0) {
|
|
||||||
$hour = "";
|
|
||||||
}
|
|
||||||
if ($month > 0 or $year > 0) {
|
|
||||||
$week = "";
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
echo "<center>Персонаж не в игре, но был тут:</center><center>" . date("Y.m.d H:i", $online['date']) . "<IMG src=\"i/clok3_2.png\" /></center>";
|
|
||||||
echo "<center>(" . $year . $month . $week . $days . $hour . $minute . " назад)</center>";
|
|
||||||
}
|
}
|
||||||
?><?
|
?><?
|
||||||
if ($user['battle'] > 0 && $user['invis'] == 0) {
|
if ($user['battle'] > 0 && $user['invis'] == 0) {
|
||||||
|
14
test.php
14
test.php
@ -1,11 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
include 'config.php';
|
include 'config.php';
|
||||||
$items = db::c()->query('SELECT `id`, `name`, `img`, `duration`, `maxdur`,
|
include 'functions.php';
|
||||||
`ghp`, `gsila`, `glovk`, `ginta`, `gintel`,
|
|
||||||
`bron1`, `bron2`, `bron3`, `bron4`,
|
showinf_pers(10736,1);
|
||||||
type, prototype, otdel
|
|
||||||
FROM inventory WHERE owner = 10736 AND dressed = 1')->fetch_assoc();
|
showinf_pers(10736);
|
||||||
while ($items) {
|
|
||||||
$items['id'] = $items;
|
|
||||||
}
|
|
||||||
print_r($items);
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user