| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
$url = url; |
|---|
| 6 |
|
|---|
| 7 |
if (isset($parameter[0])) { |
|---|
| 8 |
|
|---|
| 9 |
$user_id = (int) $parameter[0]; |
|---|
| 10 |
|
|---|
| 11 |
$result = db_query("select users.*, friends.ident as friendident from friends |
|---|
| 12 |
join users on users.ident = friends.friend |
|---|
| 13 |
where friends.owner = $user_id and users.user_type = 'person'"); |
|---|
| 14 |
|
|---|
| 15 |
$body = <<< END |
|---|
| 16 |
<div class="networktable"> |
|---|
| 17 |
<table> |
|---|
| 18 |
<tr> |
|---|
| 19 |
END; |
|---|
| 20 |
$i = 1; |
|---|
| 21 |
if (sizeof ($result) > 0) { |
|---|
| 22 |
|
|---|
| 23 |
$icon = "default.png"; |
|---|
| 24 |
$defaulticonparams = @getimagesize(path . "_icons/data/default.png"); |
|---|
| 25 |
|
|---|
| 26 |
foreach($result as $key => $info) { |
|---|
| 27 |
list($width, $height, $type, $attr) = $defaulticonparams; |
|---|
| 28 |
|
|---|
| 29 |
// if ($info->icon != -1) { |
|---|
| 30 |
$icon = db_query("select filename from icons where ident = " . $info->icon . " and owner = " . $info->ident); |
|---|
| 31 |
if (sizeof($icon) == 1) { |
|---|
| 32 |
$icon = $icon[0]->filename; |
|---|
| 33 |
if (!(list($width, $height, $type, $attr) = @getimagesize(path . "_icons/data/" . $icon))) { |
|---|
| 34 |
$icon = "default.png"; |
|---|
| 35 |
list($width, $height, $type, $attr) = $defaulticonparams; |
|---|
| 36 |
} |
|---|
| 37 |
} else { |
|---|
| 38 |
$icon = "default.png"; |
|---|
| 39 |
} |
|---|
| 40 |
|
|---|
| 41 |
|
|---|
| 42 |
if (sizeof($parameter[1]) > 4) { |
|---|
| 43 |
$width = round($width / 2); |
|---|
| 44 |
$height = round($height / 2); |
|---|
| 45 |
} |
|---|
| 46 |
$friends_username = stripslashes($info->username); |
|---|
| 47 |
$friends_name = htmlentities(stripslashes($info->name)); |
|---|
| 48 |
$friends_menu = run("users:infobox:menu",array($info->ident)); |
|---|
| 49 |
$body .= <<< END |
|---|
| 50 |
<td> |
|---|
| 51 |
<p> |
|---|
| 52 |
<a href="{$url}{$friends_username}/"> |
|---|
| 53 |
<img src="{$url}_icons/data/{$icon}" width="{$width}" height="{$height}" alt="{$friends_name}" border="0" /></a><br /> |
|---|
| 54 |
<span class="userdetails"> |
|---|
| 55 |
{$friends_name} |
|---|
| 56 |
{$friends_menu} |
|---|
| 57 |
</span> |
|---|
| 58 |
</p> |
|---|
| 59 |
</td> |
|---|
| 60 |
END; |
|---|
| 61 |
if ($i % 5 == 0) { |
|---|
| 62 |
$body .= "</tr><tr>"; |
|---|
| 63 |
} |
|---|
| 64 |
$i++; |
|---|
| 65 |
} |
|---|
| 66 |
} else { |
|---|
| 67 |
if ($user_id == $_SESSION['userid']) { |
|---|
| 68 |
$body .= "<td><p>" . gettext("You don't have any friends listed! To add a user as a friend, click the 'friend' button underneath a user's icon.") . "</p></td>"; |
|---|
| 69 |
} else { |
|---|
| 70 |
$body .= "<td><p>" . gettext("This user doesn't currently have any friends listed. Maybe if you list them as a friend, it'll start the ball rolling ..?") . "</p></td>"; |
|---|
| 71 |
} |
|---|
| 72 |
} |
|---|
| 73 |
$body .= <<< END |
|---|
| 74 |
</tr> |
|---|
| 75 |
</table> |
|---|
| 76 |
</div> |
|---|
| 77 |
END; |
|---|
| 78 |
|
|---|
| 79 |
|
|---|
| 80 |
$run_result = $body; |
|---|
| 81 |
|
|---|
| 82 |
} |
|---|
| 83 |
|
|---|
| 84 |
?> |
|---|