Repository navigation
Expand file tree
/
Copy pathsuggestedFriends.php
More file actions
70 lines (47 loc) · 1.75 KB
/
Copy pathsuggestedFriends.php
File metadata and controls
70 lines (47 loc) · 1.75 KB
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
62
63
64
65
66
67
68
69
70
<?php
require 'php/classes/graph.php';
$users_graph = array();
$query = $current_user->getPeople();
//Filling the users_graph array
while($row=mysql_fetch_assoc($query)){
$str=substr($row['friend_array'], 1, strlen($row['friend_array'])-2);
$users_graph[$row['id']] = explode(",",$str);
};
$g = new Graph($users_graph);
$start_indicator=0;
?>
<div class="suggested_friends">
<?php
$query = $current_user->getPeople();
while($row=mysql_fetch_assoc($query)){
$output = $g->breadthFirstSearch($user_id, $row['id']);
if($output==2)
{
if($start_indicator==0){
echo "<h3>People you may know:</h3>";
}
$start_indicator++;
$suggested_user=new User($row['id']);
$suggested_user_info=$suggested_user->getAll();
?>
<a href="<?= $suggested_user_info['profile_name']?>">
<img src="<?= $suggested_user_info['profile_image'] ?>" style="width:40px;height:40px">
<?= $suggested_user_info['first_name'] . " " . $suggested_user_info['last_name'] ?>
</a>
<br>
<?php
}
}
?>
</div>
<!--
Example of the array while filled:
$graph = array(
'A' => array('B', 'F'),
'B' => array('A', 'D', 'E'),
'C' => array('F'),
'D' => array('B', 'E'),
'E' => array('B', 'D', 'F'),
'F' => array('A', 'E', 'C'),
);
-->