Lange
Легенда
НЕ АДАПТИРОВАННЫЙ ВАРИАНТ!!!!!!!!!!!1111111
PHP:
// Мод кто просматривал профиль by _Xz_
$sql = $db->fetch_rowset("SELECT v.*, u.username, u.user_opt, u.user_rank, u.user_avatar, u.user_avatar_type, u.user_allowavatar
FROM bb_user_view v
LEFT JOIN bb_users u ON(u.user_id = v.profile_id)
WHERE v.user_id = {$profiledata['user_id']}
ORDER BY v.time DESC");
$insert = true;
$limit = 0;
foreach($sql as $i => $row)
{
if($row['profile_id'] == $userdata['user_id'])
{
$insert = false;
if($i) $time = '';
else $time = $row['time'];
}
if($hide = bf($row['user_opt'], 'user_opt', 'allow_viewonline'))
{
if(!IS_ADMIN) continue;
}
$limit++;
if($limit > 5) continue; //Скока выводить
$user_avatar = $bb_cfg['no_avatar'];
if($row['user_allowavatar'])
{
switch($row['user_avatar_type'])
{
case USER_AVATAR_UPLOAD:
$user_avatar = ($bb_cfg['allow_avatar_upload']) ? $bb_cfg['avatar_path'] .'/'. $row['user_avatar'] : '';
break;
case USER_AVATAR_REMOTE:
$user_avatar = ($bb_cfg['allow_avatar_remote']) ? $row['user_avatar'] .'" alt="'. $lang['Avatar'] : '';
break;
case USER_AVATAR_GALLERY:
$user_avatar = ($bb_cfg['allow_avatar_local']) ? $bb_cfg['avatar_gallery_path'] .'/'. $row['user_avatar'] : '';
break;
}
}
$template->assign_block_vars('view', array(
'CLASS' => ($i % 2) ? 'row2' : 'row1',
'HIDE' => $hide,
'POSTER_AVATAR' => $user_avatar,
'USERNAME' => '<a href="'. PROFILE_URL . $row['profile_id'] .'">'. wbr($row['username']) .'</a>',
'TIME' => bb_date($row['time'])
));
}
if(!$limit) $template->assign_block_vars('not_view', array());
if(!($profiledata['user_id'] == $userdata['user_id']) && !IS_GUEST)
{
$data = array(
'user_id' => $profiledata['user_id'],
'profile_id' => $userdata['user_id'],
'time' => TIMENOW,
);
if($insert)
{
$sql = $db->build_array('INSERT', $data);
$db->query("INSERT INTO bb_user_view ". $sql);
}
else
{
if($time < (TIMENOW - 300))
{
$db->query("UPDATE bb_user_view SET time = '". TIMENOW ."'
WHERE user_id = {$profiledata['user_id']}
AND profile_id = {$userdata['user_id']}
LIMIT 1");
}
}
}
HTML:
<div class="bold cat border bw_TB tLeft vTop">Последние посетители</div>
<!-- BEGIN view -->
<div class="pad_4 border bw_B tLeft {view.CLASS}"<!-- IF view.HIDE --> style="background-color: #F9FCFF;"<!-- ENDIF -->>
<div class="floatL"><img style="padding-right: 10px;" src="{AVATARS_URL}/{view.POSTER_AVATAR}" height="32" width="32"></div>
{view.USERNAME}<br />
<div class="spacer_2"></div>
<span class="med"><i>{view.TIME}</i></span>
<div class="clear"></div>
</div>
<!-- END view -->
<!-- BEGIN not_view -->
<div class="med pad_4 border bw_B row1">
Нет просмотров
</div>
<!-- END not_view -->
<div class="spacer_4"></div>
<!-- ENDIF -->