".$lang_friends['std_here_if_sure'],false); if ($type == 'friend') { sql_query("DELETE FROM friends WHERE userid=$userid AND friendid=$targetid") or sqlerr(__FILE__, __LINE__); if (mysql_affected_rows() == 0) stderr($lang_friends['std_error'], $lang_friends['std_no_friend_found']."$targetid"); $frag = "friends"; } elseif ($type == 'block') { sql_query("DELETE FROM blocks WHERE userid=$userid AND blockid=$targetid") or sqlerr(__FILE__, __LINE__); if (mysql_affected_rows() == 0) stderr($lang_friends['std_error'], $lang_friends['std_no_block_found']."$targetid"); $frag = "blocks"; } else stderr($lang_friends['std_error'], $lang_friends['std_unknown_type']."$type"); purge_neighbors_cache(); header("Location: " . get_protocol_prefix() . "$BASEURL/friends.php?id=$userid#$frag"); die; } // main body ----------------------------------------------------------------- stdhead($lang_friends['head_personal_lists_for']. $user['username']); print("

". "

" . $lang_friends['text_personallist'] . " ".get_username($user[id])."

\n"); //Start: Friends print("
"); print("
"); print("

" . $lang_friends['text_friendlist'] . "

\n"); print("\n"); $i++; } if ($i % 2 == 1) print("
"); $i = 0; unset($friend_id_arr); $res = sql_query("SELECT f.friendid as id, u.last_access, u.class, u.avatar, u.title FROM friends AS f LEFT JOIN users as u ON f.friendid = u.id WHERE userid=$userid ORDER BY id") or sqlerr(__FILE__, __LINE__); if(mysql_num_rows($res) == 0) $friends = $lang_friends['text_friends_empty']; else while ($friend = mysql_fetch_array($res)) { $friend_id_arr[] = $friend["id"]; $title = $friend["title"]; if (!$title) $title = get_user_class_name($friend["class"],false,true,true); $body1 = get_username($friend["id"]) . " ($title)

".$lang_friends['text_last_seen_on']. gettime($friend['last_access'],true, false); $body2 = "".$lang_friends['text_remove_from_friends']."". "

".$lang_friends['text_send_pm'].""; $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($friend["avatar"]) : ""); if (!$avatar) $avatar = "pic/default_avatar.png"; if ($i % 2 == 0) print("
"); else print(""); print(""); print(""); print("
" . ($avatar ? "
" : ""). "
\n"); print(""); print("\n"); print("\n"); print("
$body1$body2
"); print("
\n"); if ($i % 2 == 1) print("
\n"); else print("
 
\n"); print($friends); print("

\n"); //End: Friends //Start: Neighbors /* print("
"); print("
"); print("

".$lang_friends['text_neighbors']."

\n"); print("\n"); $i++; $counter++; } } $total_user--; if($counter == 20 || $total_user<=0) break; //only the largest 20 } } if ($i % 2 == 1) print("
"); $i = 0; $cachefile = "cache/" . get_langfolder_cookie() . "/neighbors/" . $CURUSER['id'] . ".html"; $cachetime = 24 * 60 * 60; // 1 day if (file_exists($cachefile) && (time() - $cachetime< filemtime($cachefile))) { include($cachefile); } else { ob_start(); // start the output buffer $user_snatched = sql_query("SELECT * FROM snatched WHERE userid = $CURUSER[id]") or sqlerr(__FILE__, __LINE__); if(mysql_num_rows($user_snatched) == 0) $neighbors_info = $lang_friends['text_neighbors_empty']; else { while ($user_snatched_arr = mysql_fetch_array($user_snatched)) { $torrent_2_user_value = get_torrent_2_user_value($user_snatched_arr); $user_snatched_res_target = sql_query("SELECT * FROM snatched WHERE torrentid = " . $user_snatched_arr['torrentid'] . " AND userid != " . $user_snatched_arr['userid']) or sqlerr(__FILE__, __LINE__); // if(mysql_num_rows($user_snatched_res_target)>0) // have other peole snatched this torrent { while($user_snatched_arr_target = mysql_fetch_array($user_snatched_res_target)) // find target user's current analyzing torrent's snatch info { $torrent_2_user_value_target = get_torrent_2_user_value($user_snatched_arr_target); //get this torrent to target user's value if(!isset($other_user_2_curuser_value[$user_snatched_arr_target['userid']])) // first, set to 0 $other_user_2_curuser_value[$user_snatched_arr_target['userid']] = 0.0; $other_user_2_curuser_value[$user_snatched_arr_target['userid']] += $torrent_2_user_value_target * $torrent_2_user_value; } } } arsort($other_user_2_curuser_value,SORT_NUMERIC); $counter = 0; $total_user = count($other_user_2_curuser_value); while(1) { list($other_user_2_curuser_value_key, $other_user_2_curuser_value_val) = each($other_user_2_curuser_value); //print(" userid: " . $other_user_2_curuser_value_key . " value: " . $other_user_2_curuser_value_val . "
"); $neighbors_res = sql_query("SELECT * FROM users WHERE id = " . intval($other_user_2_curuser_value_key)) or sqlerr(__FILE__, __LINE__); if(mysql_num_rows($neighbors_res) == 1) { $neighbors_arr = mysql_fetch_array($neighbors_res) or sqlerr(__FILE__, __LINE__); if($neighbors_arr['enabled'] == 'yes') { $title = $neighbors_arr["title"]; if (!$title) $title = get_user_class_name($neighbors_arr["class"],false,true,true); $body1 = get_username($neighbors_arr["id"]) . " ($title)

".$lang_friends['text_last_seen_on']. gettime($neighbors_arr['last_access'], true, false); $body2 = ((empty($friend_id_arr)||(!in_array($neighbors_arr["id"],$friend_id_arr))) ? "".$lang_friends['text_add_to_friends']."" : "".$lang_friends['text_remove_from_friends']."") . "

".$lang_friends['text_send_pm'].""; $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($neighbors_arr["avatar"]) : ""); if (!$avatar) $avatar = "pic/default_avatar.png"; if ($i % 2 == 0) print("
"); else print(""); print(""); print(""); print("
" . ($avatar ? "
" : ""). "
\n"); print(""); print("\n"); print("\n"); print("
$body1$body2
"); print("
\n"); if ($i % 2 == 1) print("
\n"); else print("
 
\n"); print($neighbors_info); print("

\n"); // CACHE END ////////////////////////////////////////////////// // open the cache file for writing $fp = fopen($cachefile, 'w'); // save the contents of output buffer to the file fwrite($fp, ob_get_contents()); // close the file fclose($fp); // Send the output to the browser ob_end_flush(); ///////////////////////////////////////////////////////// } if(mysql_num_rows($friendadd) == 0) $friendsno = $lang_friends['text_friends_empty']; else while ($friend = mysql_fetch_array($friendadd)) { $title = $friend["title"]; if (!$title) $title = get_user_class_name($friend["class"],false,true,true); $body1 = get_username($friend["fuid"]) . " ($title)

".$lang_friends['text_last_seen_on']. $friend['last_access'] . "
(" . get_elapsed_time(strtotime($friend[last_access])) . $lang_friends['text_ago'].")"; $body2 = "".$lang_friends['text_add_to_friends']."". "

".$lang_friends['text_send_pm'].""; $avatar = ($CURUSER["avatars"] == "yes" ? htmlspecialchars($friend["avatar"]) : ""); if (!$avatar) $avatar = "pic/default_avatar.png"; if ($i % 2 == 0) print("
"); else print(""); print(""); print(""); print("
" . ($avatar ? "
" : ""). "
\n"); print(""); print("\n"); print("\n"); print("
$body1$body2
"); print("
\n"); if ($i % 2 == 1) print("
\n"); else print("\n"); $i++; } if ($i % 2 == 1) print(" \n"); print($neighbors_info); print("
\n"); */ //End: Neighbors $res = sql_query("SELECT blockid as id FROM blocks WHERE userid=$userid ORDER BY id") or sqlerr(__FILE__, __LINE__); if(mysql_num_rows($res) == 0) $blocks = $lang_friends['text_blocklist_empty']; else { $i = 0; $blocks = ""; while ($block = mysql_fetch_array($res)) { if ($i % 6 == 0) $blocks .= ""; $blocks .= ""; if ($i % 6 == 5) $blocks .= ""; $i++; } $blocks .= "
[D] " . get_username($block["id"]) . "
\n"; } print("

"); print(""); print("
"); print("

".$lang_friends['text_blocked_users']."

"); print($blocks); print("
\n"); print("\n"); if (get_user_class() >= $viewuserlist_class) print("

".$lang_friends['text_find_user']."

"); stdfoot(); ?>