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