forked from MightyGorgon/icy_phoenix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
profile_view_popup.php
61 lines (52 loc) · 1.88 KB
/
profile_view_popup.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?php
/**
*
* @package Icy Phoenix
* @version $Id$
* @copyright (c) 2008 Icy Phoenix
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*
*/
define('IN_ICYPHOENIX', true);
if (!defined('IP_ROOT_PATH')) define('IP_ROOT_PATH', './');
if (!defined('PHP_EXT')) define('PHP_EXT', substr(strrchr(__FILE__, '.'), 1));
include(IP_ROOT_PATH . 'common.' . PHP_EXT);
// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();
// End session management
$current_time = time();
$user_id = $user->data['user_id'];
$last_view = $user->data['user_last_profile_view'];
$sql = "SELECT p.*, u.username, u.user_active, u.user_color
FROM " . PROFILE_VIEW_TABLE . " p, " . USERS_TABLE . " u
WHERE p.user_id = " . $user_id . "
AND p.view_stamp >= " . $last_view . "
AND u.user_id = p.viewer_id
ORDER BY p.view_stamp DESC";
$result = $db->sql_query($sql);
while ($row = $db->sql_fetchrow($result))
{
$viewer = $row['viewer_id'];
$template->assign_block_vars('row', array(
'VIEW_BY' => colorize_username($viewer, $row['username'], $row['user_color'], $row['user_active']),
'STAMP' => create_date_ip($user->data['user_dateformat'], $row['view_stamp'], $user->data['user_timezone'])
)
);
}
$template->assign_vars(array(
'PROFILE' => '<a href="'.append_sid(CMS_PAGE_PROFILE . '?mode=viewprofile&' . POST_USERS_URL . '=' . $user_id).'" target="_new" class="nav-current">'.$user->data['username'].'</a>',
'L_VIEW_TITLE' => $meta_content['page_title'],
'L_CLOSE' => $lang['Close_window'],
'L_VIEWER' => $lang['Username'],
'L_STAMP' => $lang['Last_updated']
)
);
$sql = "UPDATE " . USERS_TABLE . "
SET user_profile_view = '0', user_last_profile_view = '$current_time'
WHERE user_id = " . $user_id;
$db->sql_query($sql);
$gen_simple_header = true;
full_page_generation('profile_view_popup_body.tpl', $lang['Profile'] . ' - ' . $lang['Views'], '', '');
?>