Файл: _core/_class/user.php
Строк: 132
<?php
# mark core v1.0
# author Drk in
# date 24.10.19
# class user
class user {
public static function chat($ID) # chat users
{
$data = cache_user::get($ID);
if ($data['id'] == 0):
return '<span class="access-sys">Система</span>';
else:
$access = ($data['admin'] == 0 ? 'user':null).($data['admin'] == 1 ? 'dev':null).($data['admin'] == 2 ? 'adm':null).($data['admin'] == 3 ? 'mod':null);
$online = ($data['data_aut'] > time()-600 ? '<img width="5px" alt="[online]" title="онлайн" src="'.ico.'online.png">':null);
return $online.' <span class="access-'.$access.'"><a href="/id/'.$ID.'">'.system::check($data['login']).'</a></span>';
endif;
}
public static function mail($ID) # mail users
{
$data = cache_user::get($ID);
if ($data['id'] == 0):
return '<span class="access-sys">Система</span>';
else:
$access = ($data['admin'] == 0 ? 'user':null).($data['admin'] == 1 ? 'dev':null).($data['admin'] == 2 ? 'adm':null).($data['admin'] == 3 ? 'mod':null);
$online = ($data['data_aut'] > time()-600 ? '<img width="5px" alt="[online]" title="онлайн" src="'.ico.'online.png">':null);
return $online.' <span class="access-'.$access.'">'.system::check($data['login']).'</span>';
endif;
}
public static function id($ID) # id users
{
$data = cache_user::get($ID);
$access = ($data['admin'] == 0 ? 'user':null).($data['admin'] == 1 ? 'dev':null).($data['admin'] == 2 ? 'adm':null).($data['admin'] == 3 ? 'mod':null);
$as = ($data['admin'] == 0 ? 'Сталкер':null).($data['admin'] == 1 ? 'Разработчик':null).($data['admin'] == 2 ? 'Администратор':null).($data['admin'] == 3 ? 'Модератор':null);
$online = ($data['data_aut'] > time()-600 ? '<img width="5px" alt="[online]" title="онлайн" src="'.ico.'online.png">':null);
return '<strong>'.$online.' '.system::check($data['login']).'</strong><br><small><span class="access-'.$access.'">'.$as.'</span></small>';
}
public static function ava($ava) # ava users
{
return '<img src = "'.ico.'ava/'.($ava == null ? 'default.png':$ava).'">';
}
public static function min_ava($ava) # ava users
{
return '<img src = "'.ico.'ava/'.($ava == null ? 'min_default.png':'min_'.$ava).'" style="border-radius: 3px; width: 40px;height: 40px;">';
}
public static function rg($exp) # rang users
{
if ($exp == 0 || $exp <= 100):
$msg = 'Приезжий';
elseif ($exp > 100 && $exp <= 300):
$msg = 'Опытный диггер';
elseif ($exp > 300 && $exp <= 30000):
$msg = 'Известная личность';
elseif ($exp > 30000 && $exp <= 40000):
$msg = 'Герой подземелья';
elseif ($exp > 40000 && $exp <= 100000):
$msg = 'Мастер выживания';
elseif ($exp > 100000 && $exp <= 550000):
$msg = 'Начальник станции';
elseif ($exp > 550000 && $exp <= 600000 || $exp > 600000):
$msg = 'Начальник Метро';
endif;
return $msg;
}
public static function rgh() # rang level header user
{
global $user; $exp = $user['exp']; $lvl = $user['lvl'];
# lvl 1
if ($exp == 0 || $exp <= 250):
$h = ($exp == 0 ? 0 : $exp * 100 / 250);
# lvl 2
elseif ($exp > 250 && $exp <= 750):
$h = $exp * 100 / 750; if ($lvl != 2):
DB :: $dbh -> query("UPDATE user SET lvl = ? WHERE id = ? LIMIT 1;", array(2,$user['id']));
cache_user::save($user['id']);
endif;
# lvl 3
elseif ($exp > 750 && $exp <= 1500):
$h = $exp * 100 / 1500; if ($lvl != 3):
DB :: $dbh -> query("UPDATE user SET lvl = ? WHERE id = ? LIMIT 1;", array(3,$user['id']));
cache_user::save($user['id']);
endif;
# lvl 4
elseif ($exp > 1500 && $exp <= 3000):
$h = $exp * 100 / 3000; if ($lvl != 4):
DB :: $dbh -> query("UPDATE user SET lvl = ? WHERE id = ? LIMIT 1;", array(4,$user['id']));
cache_user::save($user['id']);
endif;
# lvl 5
elseif ($exp > 3000 && $exp <= 7500):
$h = $exp * 100 / 7500; if ($lvl != 5):
DB :: $dbh -> query("UPDATE user SET lvl = ? WHERE id = ? LIMIT 1;", array(5,$user['id']));
cache_user::save($user['id']);
endif;
# lvl 6
elseif ($exp > 7500 && $exp <= 15000):
$h = $exp * 100 / 15000; if ($lvl != 6):
DB :: $dbh -> query("UPDATE user SET lvl = ? WHERE id = ? LIMIT 1;", array(6,$user['id']));
cache_user::save($user['id']);
endif;
# lvl 7
elseif ($exp > 15000 && $exp <= 25000):
$h = $exp * 100 / 25000; if ($lvl != 7):
DB :: $dbh -> query("UPDATE user SET lvl = ? WHERE id = ? LIMIT 1;", array(7,$user['id']));
cache_user::save($user['id']);
endif;
# lvl 8
elseif ($exp > 25000 && $exp <= 40000):
$h = $exp * 100 / 40000; if ($lvl != 8):
DB :: $dbh -> query("UPDATE user SET lvl = ? WHERE id = ? LIMIT 1;", array(8,$user['id']));
cache_user::save($user['id']);
endif;
# lvl 9
elseif ($exp > 40000 && $exp <= 60000):
$h = $exp * 100 / 60000; if ($lvl != 9):
DB :: $dbh -> query("UPDATE user SET lvl = ? WHERE id = ? LIMIT 1;", array(9,$user['id']));
cache_user::save($user['id']);
endif;
# lvl 10
elseif ($exp > 60000 && $exp <= 90000):
$h = $exp * 100 / 90000; if ($lvl != 10):
DB :: $dbh -> query("UPDATE user SET lvl = ? WHERE id = ? LIMIT 1;", array(10,$user['id']));
cache_user::save($user['id']);
endif;
elseif ($exp > 90000): $h = 100; endif;
return '<div class="exp-block-mini"><div class="exp-mini"><div style="width: '.$h.'%;" class="exp-line-mini"></div></div></div>';
}
public static function gp($ID) # grups users
{
$gp = cache_gp::get($ID);
return system::check($gp['name']);
}
}
?>