Файл: 3020.ru/file_3020/_system/_function/user.func.php
Строк: 89
<?
/*
* Функция ника
*/
function login($id, $link = 0, $icon = 0) {
global $sql, $system;
$id = (int) $id;
$ank = $sql -> fetch("SELECT `login`, `my_links`, `id`, `date_last`, `level`, `pol`, `color1`, `color2` FROM `users` WHERE `id` = '$id' LIMIT 1");
if ($ank['id'] == 0) {
$ank = array('id' => '0', 'my_links' => 'SUPPORT_4i4i', 'login' => 'Система оповещений', 'level' => '1', 'pol' => '1', 'color1' => null, 'color2' => null, 'date_last' => time());
} elseif (!$ank['id']) {
$ank = array('id' => $id, 'login' => 'Удален', 'level' => '1', 'pol' => '1', 'color1' => null, 'color2' => null, 'date_last' => (time() - 100500));
}
if (isset($ank['id'])) {
if ($link == 0) {
return $ank['login'];
} else {
if ($ank['date_last'] > (time() - 1800)){
$online = '';
} else {
$online = '.0';
}
if ($ank['color1'] != null && $ank['color2'] != null) {
$ank['login'] = gradient($ank['login'], $ank['color1'], $ank['color2']);
}
if ($link == 2) {
if ($icon == 1) {
$icon = ' <img src="/themes/' . $system['design'] . '/user/' . $ank['level'] . '.' . $ank['pol'] . $online . '.png" /> ';
} else {
$icon = '';
}
return $icon . ' '. $ank['login'];
}
if ($icon == 1) {
$icon = ' <img src="/themes/' . $system['design'] . '/user/' . $ank['level'] . '.' . $ank['pol'] . $online . '.png" /> ';
} else {
$icon = '';
}
return $icon . ' <a href="/wm/' . $ank['my_links'] . ' ">' . $ank['login'] . '</a> ';
}
}
}
/*
* Функция аватара
*/
function avatar($id, $type = 1, $css = 1) {
global $sql, $user;
$id = (int) $id;
if (isset($user) && $user['view_avatar'] == 0 && $type == 1) {
$block = true;
}
$ank = $sql -> fetch("SELECT `login`, `my_links`, `id`, `date_last`, `level`, `pol`, `color1`, `color2` FROM `users` WHERE `id` = '$id' LIMIT 1");
$style = 'border: 1px solid #ffffff;';
if ($ank['date_last'] > (time() - 1800)) {
$style = 'border: 2px solid #0bc112;';
}
if (!isset($block)) {
if (is_file(ROOT.'_images/avatar/' . $id . '.png')) {
return ' <img class="'.($css == 1 ? "avatar-user":"").'" style="'. $style .'" src="/_src/img.php?link=' . base64_encode(ROOT.'_images/avatar/' . $id . '.png') . '&type=' . $type . '" /> ';
} else {
return ' <img class="'.($css == 1 ? "avatar-user":"").'" style="'. $style .'" src="/_src/img.php?link=' . base64_encode(ROOT.'_images/images/avatar.gif') . '&type=' . $type . '" /> ';
}
}
}
?>