diff --git a/functions.php b/functions.php
index 54f0f85..89a14f4 100644
--- a/functions.php
+++ b/functions.php
@@ -2548,32 +2548,11 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM
} else {
$rrm = $rooms[$data['room']];
}
- $r .= '
Персонаж сейчас находится в игре."' . $rrm . '"';
+ $r .= 'Персонаж сейчас находится в игре."' . $rrm . '"';
} else {
- $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 || $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 .= "Персонаж не в игре, но был тут:" . date("Y.m.d H:i", $online['date']) . "";
- $r .= "(" . $year . $month . $week . $days . $hour . $minute . " назад)";
- } else {
- $r .= "Персонаж не в игре.";
- }
+ $r .= "Персонаж не в игре.";
}
+ }
if ($user['battle'] > 0 && $user['invis'] == 0) {
$r .= '
Персонаж сейчас в поединке';
@@ -2655,160 +2634,6 @@ function showinf_pers($id, $pas = 0, $battle = 0, $me = 0, $main = false) //FIXM
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)
{
global $rooms;
@@ -3141,32 +2966,9 @@ function showpersout($id, $pas = 0, $battle = 0, $me = 0)
} else {
$rrm = $rooms[$data['room']];
}
- echo 'Персонаж сейчас находится в игре."' . $rrm . '"';
+ echo 'Персонаж сейчас находится в игре."' . $rrm . '"';
} else {
-
-
- $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 "Персонаж не в игре, но был тут:" . date("Y.m.d H:i", $online['date']) . "";
- echo "(" . $year . $month . $week . $days . $hour . $minute . " назад)";
+ echo "Персонаж не в игре.";
}
?>
if ($user['battle'] > 0 && $user['invis'] == 0) {
diff --git a/test.php b/test.php
index 5339f1c..56a207b 100644
--- a/test.php
+++ b/test.php
@@ -1,11 +1,7 @@
query('SELECT `id`, `name`, `img`, `duration`, `maxdur`,
- `ghp`, `gsila`, `glovk`, `ginta`, `gintel`,
- `bron1`, `bron2`, `bron3`, `bron4`,
- type, prototype, otdel
-FROM inventory WHERE owner = 10736 AND dressed = 1')->fetch_assoc();
-while ($items) {
- $items['id'] = $items;
-}
-print_r($items);
\ No newline at end of file
+include 'functions.php';
+
+showinf_pers(10736,1);
+
+showinf_pers(10736);