function hoody_sort($uid1, $uid2, $distance, $popularity) { // clean up the distance data if ($distance == -1) { $distance = 0; } else { if ($distance > 100) { $distance = 100; } } // Get the numbers of common friends $common_friends = count(common_check($uid1, $uid2, 9)); // Get the degrees of separation $degrees_of_separation = 0; // if uid1 and uid2 are Facebook friends if (common_check($uid1, $uid2, 8)) { $degrees_of_separation = 2; } else { if ($common_friends > 0) { $degrees_of_separation = 1; } } // Get the numbers of common interests $common_interests = count(common_check($uid1, $uid2, 1)) + count(common_check($uid1, $uid2, 2)) + count(common_check($uid1, $uid2, 3)) + count(common_check($uid1, $uid2, 4)) + count(common_check($uid1, $uid2, 5)) + count(common_check($uid1, $uid2, 6)); // calculate the index of coefficient $result = (100 - $distance) * 1 + $degrees_of_separation * $degrees_of_separation * 50 + $common_friends * 10 + $common_interests * 2 + $popularity * 2; return $result; }
echo $domain_secondary; ?> attachements/unverified_icon2.png' /> <p class='interest_content'>Unverified Seller</p> <?php } ?> </div> <?php if ($user && $seller_uid != $user) { ?> <?php $common_interests = count(common_check($seller_uid, $user, 1)) + count(common_check($seller_uid, $user, 2)) + count(common_check($seller_uid, $user, 3)) + count(common_check($seller_uid, $user, 4)) + count(common_check($seller_uid, $user, 5)) + count(common_check($seller_uid, $user, 6)); $common_friends = count(common_check($seller_uid, $user, 9)); if ($common_friends) { ?> <div class='common_interest'> <img class='interest_icon' src='<?php echo $domain_secondary; ?> attachements/fb_friend.png' /> <p class='interest_content'><?php echo $common_friends; ?> friends in common</p> </div> <?php }
search.php?sort=hoody'>see more</a></div> <?php $query = "SELECT title,price,pricing_model,listing_id,fb_uid FROM result_table ORDER BY hoody_sort DESC"; $result1 = mysql_query($query) or die(minor_error(216, $user, $user, $today, $query, mysql_error())); ?> <?php for ($counter = 1; $counter < 9 && ($row = mysql_fetch_array($result1)); $counter++) { ?> <?php $common_activities_list = common_check($row[fb_uid], $user, 1); $common_interests_list = common_check($row[fb_uid], $user, 2); $common_music_list = common_check($row[fb_uid], $user, 3); $common_tv_list = common_check($row[fb_uid], $user, 4); $common_movies_list = common_check($row[fb_uid], $user, 5); $common_books_list = common_check($row[fb_uid], $user, 6); $common_friend_list = common_check($row[fb_uid], $user, 9); // Extract pictures for the listing $picture_sql = "SELECT picture_id_1 FROM Listing_Pictures WHERE listing_id='" . $row[listing_id] . "'"; $picture_result = mysql_query($picture_sql) or die(minor_error(217, $user, $user, $today, $picture_sql, mysql_error())); $picture_row = mysql_fetch_array($picture_result, MYSQL_ASSOC); $url_sql = "SELECT URL FROM Pictures_Lookup WHERE pictures_id='" . $picture_row[picture_id_1] . "'"; $url_result = mysql_query($url_sql) or die(minor_error(218, $user, $user, $today, $url_sql, mysql_error())); $url_row = mysql_fetch_array($url_result, MYSQL_ASSOC); ?> <div class='recommend'> <div class='recommend_box'> <div class='recommend_service_pic'> <a href='<?php echo $working_directory . "service/" . $row[listing_id] . "/"; ?>
</p> </li> <?php } ?> </ul> </div> <!--end .sect_content2--> </div> <!--end #common_interests--> <?php } //if ($fb_uid != $user && $user) ?> <?php if ($user) { $common_friend_list = common_check($fb_uid, $user, 9); } ?> <?php if ($fb_uid != $user && $user && count($common_friend_list) > 0) { // Common Friends ?> <?php if (count($common_friend_list) > 0) { // code for updating user's friendslist into the database $fql = "SELECT name,uid,pic_square from user where "; $i = 0; foreach ($common_friend_list as $key) { if ($i == 0) { $fql .= "uid=" . $key; } else {