| 1 |
<?php</span> |
|---|
| 2 |
<span class="code-lang">$root_path = './'; |
|---|
| 3 |
require ($root_path . 'include/config.php'); |
|---|
| 4 |
require ($root_path . 'include/bbcode/bbcode.lib.php'); |
|---|
| 5 |
require ($root_path . 'include/functions_selects.php'); |
|---|
| 6 |
|
|---|
| 7 |
$userdata = session_pagestart( $user_ip ); |
|---|
| 8 |
init_userprefs( $userdata ); |
|---|
| 9 |
loggedinorreturn(); |
|---|
| 10 |
|
|---|
| 11 |
$action = request_var('action', ''); |
|---|
| 12 |
$id = request_var('id', 0); |
|---|
| 13 |
$username = request_var('un', ''); |
|---|
| 14 |
|
|---|
| 15 |
$sql = 'SELECT u.*, co.flagpic AS country_pic, co.name AS country_name, u.user_posts</span> |
|---|
| 16 |
<span class="code-lang"> FROM ' . USERS_TABLE . ' u, ' . COUNTRIES_TABLE . ' co |
|---|
| 17 |
WHERE ' . ( $username ? 'u.name = \'' . $db->sql_escape($username) . '\'' : 'u.uid = ' . $id ) . ' AND u.country = co.id'; |
|---|
| 18 |
$result = $db->sql_query( $sql );</span> |
|---|
| 19 |
<span class="code-lang">if ( !$user = $db->sql_fetchrow($result) ) { |
|---|
| 20 |
trigger_error( sprintf( $lang['invalid_id'], $id ) ); |
|---|
| 21 |
} |
|---|
| 22 |
|
|---|
| 23 |
if ( !$user['status'] ) { |
|---|
| 24 |
trigger_error( $lang['pending_user'] ); |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
$id = $user['uid']; |
|---|
| 28 |
$seo->set_user_url($user['name'], $id); |
|---|
| 29 |
|
|---|
| 30 |
$files = array();</span> |
|---|
| 31 |
<span class="code-lang">if ( $dir = opendir($root_path . 'include/userdetails/') ) { |
|---|
| 32 |
while ( false !== ($file = readdir($dir)) ) { |
|---|
| 33 |
if ( $file != '.' && $file != '..' ) { |
|---|
| 34 |
$file = substr($file, 0, strpos($file, '.php')); |
|---|
| 35 |
$files[] = $file; |
|---|
| 36 |
} |
|---|
| 37 |
} |
|---|
| 38 |
} |
|---|
| 39 |
|
|---|
| 40 |
if ( $action ) { |
|---|
| 41 |
if ( in_array($action, $files) ) { |
|---|
| 42 |
require_once($root_path . 'include/userdetails/' . $action . '.php'); |
|---|
| 43 |
} |
|---|
| 44 |
} |
|---|
| 45 |
|
|---|
| 46 |
|
|---|
| 47 |
$sql = 'SELECT COUNT(*) AS comments_count FROM ' . COMMENTS_TABLE . ' WHERE comment_user = ' . $id; |
|---|
| 48 |
$result = $db->sql_query( $sql ); |
|---|
| 49 |
$user['comments_count'] = ( $row = $db->sql_fetchrow( $result ) ) ? $row['comments_count'] : 0 ; |
|---|
| 50 |
$db->sql_freeresult(); |
|---|
| 51 |
|
|---|
| 52 |
$sql = 'SELECT port, peer_id, useragent FROM ' . PEERS_TABLE . ' WHERE uid = ' . $id . ' ORDER BY mtime DESC LIMIT 1'; |
|---|
| 53 |
$result = $db->sql_query( $sql ); |
|---|
| 54 |
$con_arr = $db->sql_fetchrow( $result ); |
|---|
| 55 |
|
|---|
| 56 |
$joindate = create_date($user['added']); |
|---|
| 57 |
$joindate .= ' (' . ( $user['added'] ? get_elapsed_time( $user['added'] ) : $lang['never'] ) . ')'; |
|---|
| 58 |
$lastseen = ( $user['user_session_time'] ? create_date($user['user_session_time']) . ' (' . get_elapsed_time( $user['user_session_time'] ) . ')' : $lang['never'] ); |
|---|
| 59 |
|
|---|
| 60 |
if ( $user['upload'] ) { |
|---|
| 61 |
if ( $user['upload'] < 1000 * 1024 ) { |
|---|
| 62 |
$upload = ( $user['upload'] / 1024 ) . ' ' . utf_ucfirst(utf_strtolower($lang['kilobytes'] ) ) . '/' . $lang['seconds_short']; |
|---|
| 63 |
} elseif ( $user['upload'] < 1000 * 1048576 ) { |
|---|
| 64 |
$upload = ( $user['upload'] / 1048576 ) . ' ' . utf_ucfirst(utf_strtolower($lang['megabytes'] ) ) . '/' . $lang['seconds_short']; |
|---|
| 65 |
} |
|---|
| 66 |
$upload = '<img src="' . $root_path . 'pic/speed_up.png" alt="' . $lang['internet_speed_upload'] . '" style="margin-left: 8pt" /> ' . $upload; |
|---|
| 67 |
} |
|---|
| 68 |
if ( $user['download'] ) { |
|---|
| 69 |
if ( $user['download'] < 1000 * 1024 ) { |
|---|
| 70 |
$download = ( $user['download'] / 1024 ) . ' ' . utf_ucfirst(utf_strtolower($lang['kilobytes'] ) ) . '/' . $lang['seconds_short']; |
|---|
| 71 |
} elseif ( $user['download'] < 1000 * 1048576 ) { |
|---|
| 72 |
$download = ( $user['download'] / 1048576 ) . ' ' . utf_ucfirst(utf_strtolower($lang['megabytes'] ) ) . '/' . $lang['seconds_short']; |
|---|
| 73 |
} |
|---|
| 74 |
$download = '<img src="' . $root_path . 'pic/speed_down.png" alt="' . $lang['internet_speed_download'] . '" style="margin-left: 8pt" /> ' . $download; |
|---|
| 75 |
} |
|---|
| 76 |
$gender = ( !$user['gender'] ? '<img src="' . $images['male'] . '" alt="' . $lang['gender_male'] . '" />' : '<img src="' . $images['female'] . '" alt="' . $lang['gender_female'] . '" />' ); |
|---|
| 77 |
$enabled = $user['enabled'] == 1; |
|---|
| 78 |
|
|---|
| 79 |
$user_sig = ( $config['allow_sig'] && $user['user_sig'] != '' ? $user['user_sig'] : '' ); |
|---|
| 80 |
if ( $user_sig ) { |
|---|
| 81 |
|
|---|
| 82 |
$user_sig = ( $config['allow_sig'] == 2 ) ? preg_replace( '#((\r)+?(\n)+?)*(\[url?(.*)\])?\[img.*?\]((ht|f)tp://)([^\r\n\t<\"]*?)\[/img.*?\](\[/url\])?#i', '', $user_sig ) : $user_sig; |
|---|
| 83 |
|
|---|
| 84 |
$bb_code = new bbcode($user_sig); |
|---|
| 85 |
$user_sig = $bb_code->get_html(); |
|---|
| 86 |
} |
|---|
| 87 |
|
|---|
| 88 |
if ( ( $user['class'] == UC_VIP || $user['privacy'] <> PRIVACY_LEVEL_LOW ) && ( $userdata['class'] < UC_MODERATOR && $userdata['uid'] != $id ) ) { |
|---|
| 89 |
$dayUpload = '---'; |
|---|
| 90 |
$dayDownload = '---'; |
|---|
| 91 |
$sr = '---'; |
|---|
| 92 |
$user_uploaded = '---'; |
|---|
| 93 |
$user_downloaded = '---'; |
|---|
| 94 |
$ratio_color = ''; |
|---|
| 95 |
$total_seed_time = '---'; |
|---|
| 96 |
$bonus = '---'; |
|---|
| 97 |
} else { |
|---|
| 98 |
$seconds = mkprettytime( time() - $user['added'] ); |
|---|
| 99 |
$days = explode( $lang['days_short'] . " ", $seconds ); |
|---|
| 100 |
if ( sizeof( $days ) > 1 ) { |
|---|
| 101 |
$dayUpload = $user['uploaded'] / $days[0]; |
|---|
| 102 |
$dayDownload = $user['downloaded'] / $days[0]; |
|---|
| 103 |
} else { |
|---|
| 104 |
$dayUpload = $user['uploaded']; |
|---|
| 105 |
$dayDownload = $user['downloaded']; |
|---|
| 106 |
} |
|---|
| 107 |
$dayUpload = mksize( $dayUpload ); |
|---|
| 108 |
$dayDownload = mksize( $dayDownload ); |
|---|
| 109 |
$sr = get_ratio( $user['uploaded'], $user['downloaded'] ); |
|---|
| 110 |
$ratio_color = get_ratio_color( $sr ); |
|---|
| 111 |
$user_uploaded = mksize( $user['uploaded'] ); |
|---|
| 112 |
$user_downloaded = mksize( $user['downloaded'] ); |
|---|
| 113 |
$total_seed_time = mkprettytime( $user['total_seed_time'] ); |
|---|
| 114 |
$bonus = ( $config['allow_my_bonus'] ? ( number_format( $config['my_bonus_points'] * ( $user['total_seed_time'] / 3600 ), 2 ) ) : '' ); |
|---|
| 115 |
} |
|---|
| 116 |
|
|---|
| 117 |
if ( $sr == 'Inf.' || $sr == '---' ) { |
|---|
| 118 |
$smile_ratio = ''; |
|---|
| 119 |
} elseif ( $sr >= 4 ) { |
|---|
| 120 |
$smile_ratio = ' <img src="' . $root_path . 'pic/smilies/w00t.gif" alt="" />'; |
|---|
| 121 |
} elseif ( $sr >= 2 ) { |
|---|
| 122 |
$smile_ratio = ' <img src="' . $root_path . 'pic/smilies/grin.gif" alt="" />'; |
|---|
| 123 |
} elseif ( $sr >= 1 ) { |
|---|
| 124 |
$smile_ratio = ' <img src="' . $root_path . 'pic/smilies/smile1.gif" alt="" />'; |
|---|
| 125 |
} elseif ( $sr >= 0.5 ) { |
|---|
| 126 |
$smile_ratio = ' <img src="' . $root_path . 'pic/smilies/noexpression.gif" alt="" />'; |
|---|
| 127 |
} elseif ( $sr >= 0.25 ) { |
|---|
| 128 |
$smile_ratio = ' <img src="' . $root_path . 'pic/smilies/sad.gif" alt="" />'; |
|---|
| 129 |
} else { |
|---|
| 130 |
$smile_ratio = ' <img src="' . $root_path . 'pic/smilies/cry.gif" alt="" />'; |
|---|
| 131 |
} |
|---|
| 132 |
|
|---|
| 133 |
$age = get_age( $user['birthday'] ); |
|---|
| 134 |
|
|---|
| 135 |
$uploaded_tor_count = $leech_tor_count = $seeding_tor_count = $completed_tor_count = $helped_tor_count = 0; |
|---|
| 136 |
|
|---|
| 137 |
if ( $user['privacy'] != PRIVACY_LEVEL_HIGH || $userdata['class'] >= UC_MODERATOR || $userdata['uid'] == $id ) { |
|---|
| 138 |
$sql = 'SELECT COUNT(*) AS count |
|---|
| 139 |
FROM ' . TORRENTS_TABLE . ' |
|---|
| 140 |
WHERE owner = ' . $id; |
|---|
| 141 |
$result = $db->sql_query($sql); |
|---|
| 142 |
$uploaded_tor_count = ( $row = $db->sql_fetchrow( $result ) ) ? $row['count'] : 0; |
|---|
| 143 |
|
|---|
| 144 |
$sql = 'SELECT `left`, COUNT(*) AS c |
|---|
| 145 |
FROM ' . PEERS_TABLE . ' |
|---|
| 146 |
WHERE uid = ' . $id . ( defined('USE_XBTT') ? ' AND active = 1' : '' ) . ' |
|---|
| 147 |
GROUP BY fid'; |
|---|
| 148 |
$result = $db->sql_query( $sql ); |
|---|
| 149 |
if ( $row = $db->sql_fetchrow( $result ) ) { |
|---|
| 150 |
do { |
|---|
| 151 |
if ( $row['left'] ) { |
|---|
| 152 |
$leech_tor_count = $leech_tor_count + $row['c']; |
|---|
| 153 |
} |
|---|
| 154 |
else { |
|---|
| 155 |
$seeding_tor_count = $seeding_tor_count + $row['c']; |
|---|
| 156 |
} |
|---|
| 157 |
} |
|---|
| 158 |
while ( $row = $db->sql_fetchrow($result) ); |
|---|
| 159 |
} |
|---|
| 160 |
|
|---|
| 161 |
if ( $userdata['class'] >= UC_MODERATOR || $userdata['uid'] == $id ) { |
|---|
| 162 |
$sql = 'SELECT COUNT(*) AS count |
|---|
| 163 |
FROM ' . SNATCHED_TABLE . ' |
|---|
| 164 |
WHERE completedat <> 0 AND userid = ' . $id; |
|---|
| 165 |
$result = $db->sql_query($sql); |
|---|
| 166 |
$completed_tor_count = ( $row = $db->sql_fetchrow( $result ) ) ? $row['count'] : 0; |
|---|
| 167 |
|
|---|
| 168 |
$sql = 'SELECT COUNT(t.fid) AS count |
|---|
| 169 |
FROM ' . SNATCHED_TABLE . ' s, ' . TORRENTS_TABLE . ' t |
|---|
| 170 |
WHERE s.uploaded > 0 |
|---|
| 171 |
AND s.downloaded < t.size |
|---|
| 172 |
AND s.userid= ' . $id . ' |
|---|
| 173 |
AND t.owner != ' . $id . ' |
|---|
| 174 |
AND t.fid = s.torrentid'; |
|---|
| 175 |
$result = $db->sql_query($sql); |
|---|
| 176 |
$helped_tor_count = ( $row = $db->sql_fetchrow( $result ) ) ? $row['count'] : 0; |
|---|
| 177 |
} |
|---|
| 178 |
} |
|---|
| 179 |
|
|---|
| 180 |
if ( !isset($ranks) ) { |
|---|
| 181 |
$ranks = $cache->obtain_ranks(); |
|---|
| 182 |
} |
|---|
| 183 |
|
|---|
| 184 |
$user['rank'] = ( isset($ranks[$user['user_rank_id']]['rank_name']) ? $ranks[$user['user_rank_id']]['rank_name'] : '' ); |
|---|
| 185 |
|
|---|
| 186 |
if ( $userdata['uid'] == $user['uid'] ) { |
|---|
| 187 |
$u_simpaty = append_sid($root_path . 'my.php?type=simpaty'); |
|---|
| 188 |
} |
|---|
| 189 |
elseif ( $userdata['class'] >= UC_MODERATOR ) { |
|---|
| 190 |
$u_simpaty = append_sid($root_path . 'modtask.php?action=simpaty&user_id=' . $user['uid']); |
|---|
| 191 |
} |
|---|
| 192 |
else { |
|---|
| 193 |
$u_simpaty = ''; |
|---|
| 194 |
} |
|---|
| 195 |
|
|---|
| 196 |
if ( $con_arr ) { |
|---|
| 197 |
$connectable_port = $con_arr['port']; |
|---|
| 198 |
} |
|---|
| 199 |
else { |
|---|
| 200 |
$connectable_port = ''; |
|---|
| 201 |
} |
|---|
| 202 |
|
|---|
| 203 |
$template->assign_vars( array( |
|---|
| 204 |
'U_EDIT_ACCOUNT' => ( $userdata['class'] >= UC_MODERATOR && $user['class'] < $userdata['class'] ? append_sid( 'modtask.php?action=editacc&id=' . $id ) : '' ), |
|---|
| 205 |
'U_DELETE_DEAD_CONNECTONS' => ( $id == $userdata['uid'] ? append_sid($root_path . 'userdetails.php?' . ( $username ? 'un=' . $username : 'id=' . $id ) . '&action=delete_dead' ) : '' ), |
|---|
| 206 |
'S_UPLOADED_TORRENTS_DESCR' => ( $uploaded_tor_count ? sprintf( $lang['uploaded_torrents_descr'], $uploaded_tor_count ) : '' ), |
|---|
| 207 |
'S_SEEDING_NOW_DESCR' => ( $seeding_tor_count ? sprintf( $lang['seeding_now_descr'], $seeding_tor_count ) : '' ), |
|---|
| 208 |
'S_LEECHING_NOW_DESCR' => ( $leech_tor_count ? sprintf( $lang['leeching_now_descr'], $leech_tor_count ) : '' ), |
|---|
| 209 |
'S_DOWNLOADED_TORRENTS_DESCR' => ( $completed_tor_count ? sprintf( $lang['downloaded_torrents_descr'], $completed_tor_count ) : '' ), |
|---|
| 210 |
'S_HELPED_TORRENTS_DESCR' => ( $helped_tor_count ? sprintf( $lang['helped_torrents_descr'], $helped_tor_count ) : '' ), |
|---|
| 211 |
'L_TTL' => ( ( isset( $config['ttl'] ) && ( $config['ttl'] > 0 ) ) ? $lang['TTL'] : '' ), |
|---|
| 212 |
'AVERAGE_TO_DAY' => $lang['average_to_day'], |
|---|
| 213 |
'ID' => $id, |
|---|
| 214 |
'USERNAME' => $user['name'], |
|---|
| 215 |
'USER_ICONS' => get_user_icons( $user, true ), |
|---|
| 216 |
'COUNTRY_NAME' => $user['country_name'], |
|---|
| 217 |
'COUNTRY_PIC' => $user['country_pic'], |
|---|
| 218 |
'ENABLED' => $enabled, |
|---|
| 219 |
'REGISTER_DATE' => $joindate, |
|---|
| 220 |
'LAST_ACCESS' => $lastseen, |
|---|
| 221 |
'EMAIL' => ( $userdata['class'] >= UC_MODERATOR ? $user['email'] : '' ), |
|---|
| 222 |
'IP' => ( $userdata['class'] >= UC_MODERATOR || $user['uid'] == $userdata['uid'] ? $user['ip'] : '' ), |
|---|
| 223 |
'UPLOADED' => $user_uploaded, |
|---|
| 224 |
'AVERAGE_UPLOADED' => $dayUpload, |
|---|
| 225 |
'DOWNLOADED' => $user_downloaded, |
|---|
| 226 |
'AVERAGE_DOWNLOADED' => $dayDownload, |
|---|
| 227 |
'TOTAL_SEED_TIME' => $total_seed_time, |
|---|
| 228 |
'BONUS' => $bonus, |
|---|
| 229 |
'WARN_PANEL' => ( $user['class'] < UC_MODERATOR ? ( $userdata['class'] >= UC_MODERATOR ? ( !$user['warn'] ? ' - ' : ' <a href="' . append_sid( 'modtask.php?action=warn&warn=minus&id=' . $id ) . '">-</a> ' ) . warn_panel( $user['warn'] ) . ' <a href="' . append_sid( 'modtask.php?action=warn&warn=plus&id=' . $id ) . '">+</a>' : warn_panel( $user['warn'] ) ) : '' ), |
|---|
| 230 |
'CLIENT' => ( $con_arr ? getagent( $con_arr['useragent'], $con_arr['peer_id'] ) : '' ) , |
|---|
| 231 |
'CONNECTABLE_PORT' => $connectable_port, |
|---|
| 232 |
'RATIO_COLOR' => $ratio_color, |
|---|
| 233 |
'RATIO' => $sr, |
|---|
| 234 |
'RATIO_SMILE' => $smile_ratio, |
|---|
| 235 |
'UPLOAD' => $upload, |
|---|
| 236 |
'DOWNLOAD' => $download, |
|---|
| 237 |
'ICQ' => $user['icq'], |
|---|
| 238 |
'MSN' => $user['msn'], |
|---|
| 239 |
'AIM' => $user['aim'], |
|---|
| 240 |
'YAHOO' => $user['yahoo'], |
|---|
| 241 |
'SKYPE' => $user['skype'], |
|---|
| 242 |
'AVATAR' => get_user_avatar($id, $user['avatar']), |
|---|
| 243 |
'CLASS' => get_user_class_name( $user['class'] ), |
|---|
| 244 |
'TITLE' => $user['title'], |
|---|
| 245 |
'RANK' => $user['rank'], |
|---|
| 246 |
'GENDER' => $gender, |
|---|
| 247 |
'AGE' => $age, |
|---|
| 248 |
'BIRTHDAY' => $user['birthday'], |
|---|
| 249 |
'COMMENTS' => ( $user['comments_count'] ? '<a href="' . append_sid($root_path . 'userdetails.php?' . ( $username ? 'un=' . $username : 'id=' . $id ) . '&action=comments_history' ) . '">' . $user['comments_count'] . '</a>' : 0 ), |
|---|
| 250 |
'FORUM_POSTS' => ( $user['user_posts'] ? '<a href="' . append_sid($root_path . 'phpbb2.php?page=search&search_author=' . $user['name']) . '">' . $user['user_posts'] . '</a>' : 0 ), |
|---|
| 251 |
'USER_SIGNATURE' => censor_text( $user_sig ), |
|---|
| 252 |
|
|---|
| 253 |
'USER_POINTS_LEVEL' => $user['user_reputation_level'], |
|---|
| 254 |
'USER_POINTS' => $user['user_reputation'], |
|---|
| 255 |
|
|---|
| 256 |
'U_SIMPATY' => $u_simpaty |
|---|
| 257 |
)); |
|---|
| 258 |
|
|---|
| 259 |
if ( $userdata['uid'] != $user['uid'] && $enabled ) { |
|---|
| 260 |
$sql = 'SELECT COUNT(*) AS count FROM ' . FRIENDS_TABLE . ' WHERE userid=' . $userdata['uid'] . ' AND friendid=' . $id; |
|---|
| 261 |
$result = $db->sql_query( $sql ); |
|---|
| 262 |
$friend = ( $row = $db->sql_fetchrow( $result ) ) ? intval( $row['count'] ) : 0; |
|---|
| 263 |
$sql = 'SELECT COUNT(*) AS count FROM ' . FRIENDS_TABLE . ' WHERE userid=' . $userdata['uid'] . ' AND blockid=' . $id; |
|---|
| 264 |
$result = $db->sql_query( $sql ); |
|---|
| 265 |
$block = ( $row = $db->sql_fetchrow( $result ) ) ? intval( $row['count'] ) : 0; |
|---|
| 266 |
$template->assign_block_vars( 'switch_friend_section', array( |
|---|
| 267 |
'U_ADD_FRIEND' => append_sid( 'my.php?type=friends&action=add_friend&fr_type=1&targetid=' . $id ), |
|---|
| 268 |
'U_DEL_FRIEND' => append_sid( 'my.php?type=friends&action=del_friend&fr_type=1&targetid=' . $id ), |
|---|
| 269 |
'U_ADD_BLOCK' => append_sid( 'my.php?type=friends&action=add_friend&fr_type=2&targetid=' . $id ), |
|---|
| 270 |
'U_DEL_BLOCK' => append_sid( 'my.php?type=friends&action=del_friend&fr_type=2&targetid=' . $id ), |
|---|
| 271 |
'FRIEND' => $friend, |
|---|
| 272 |
'BLOCK' => $block ) |
|---|
| 273 |
); |
|---|
| 274 |
} |
|---|
| 275 |
|
|---|
| 276 |
if ( $user['icq'] || $user['msn'] || $user['aim'] || $user['yahoo'] || $user['skype'] ) { |
|---|
| 277 |
$template->assign_block_vars( 'switch_messengers_section', array() ); |
|---|
| 278 |
} |
|---|
| 279 |
if ( $userdata['uid'] != $user['uid'] ) { |
|---|
| 280 |
$template->assign_block_vars( 'switch_buttons', array( 'U_SEND_PM' => append_sid( 'message.php?receiver=' . $id . '&action=send' ), |
|---|
| 281 |
'U_REPORT' => append_sid( 'reports.php?action=send_report&id=' . $id . '&type=user' ) ) |
|---|
| 282 |
); |
|---|
| 283 |
} |
|---|
| 284 |
|
|---|
| 285 |
require ($root_path . 'include/modtask/edituser.php'); |
|---|
| 286 |
|
|---|
| 287 |
stdhead(sprintf($lang['userdetails'], $user['name'])); |
|---|
| 288 |
$template->set_filenames(array( |
|---|
| 289 |
'body' => 'userdetails.html' |
|---|
| 290 |
)); |
|---|
| 291 |
stdfoot(); |
|---|
| 292 |
|
|---|
| 293 |
?> |
|---|