EngineGP/system/library/users.php

54 lines
1.2 KiB
PHP
Raw Normal View History

2023-03-04 23:45:46 +00:00
<?php
2023-05-05 01:17:19 +00:00
if (!DEFINED('EGP'))
exit(header('Refresh: 0; URL=http://' . $_SERVER['SERVER_NAME'] . '/404'));
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
class users
{
public static function ava($user)
2023-03-05 13:59:34 +00:00
{
2023-05-05 01:17:19 +00:00
global $cfg;
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
$file = 'upload/avatars/' . $user . '.';
$link = $cfg['http'] . 'upload/avatars/' . $user . '.';
2023-03-04 23:45:46 +00:00
if (file_exists(DIR . $file . 'jpg'))
2023-05-05 01:17:19 +00:00
return $link . 'jpg';
2023-03-04 23:45:46 +00:00
if (file_exists(DIR . $file . 'png'))
2023-05-05 01:17:19 +00:00
return $link . 'png';
2023-03-04 23:45:46 +00:00
if (file_exists(DIR . $file . 'gif'))
2023-05-05 01:17:19 +00:00
return $link . 'gif';
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
return $cfg['http'] . 'template/images/avatar.png';
}
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
public static function nav($active)
{
global $cfg, $html;
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
$aUnit = array('index', 'settings', 'auth', 'logs', 'security');
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
$html->get('gmenu', 'sections/user');
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
$html->set('home', $cfg['http']);
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
foreach ($aUnit as $unit)
if ($unit == $active) $html->unit($unit, 1); else $html->unit($unit);
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
$html->pack('main');
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
$html->get('vmenu', 'sections/user');
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
$html->set('home', $cfg['http']);
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
foreach ($aUnit as $unit)
if ($unit == $active) $html->unit($unit, 1); else $html->unit($unit);
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
$html->pack('vmenu');
2023-03-04 23:45:46 +00:00
2023-05-05 01:17:19 +00:00
return NULL;
2023-03-05 13:59:34 +00:00
}
2023-05-05 01:17:19 +00:00
}
2023-03-04 23:45:46 +00:00
?>