|
Revision 2, 1.5 kB
(checked in by sven, 3 years ago)
|
importing elgg-0.1.1a
|
| Line | |
|---|
| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
if (isset($parameter) && (isset($parameter[0])) && ($parameter[0] != $_SESSION['userid']) && logged_on) { |
|---|
| 5 |
|
|---|
| 6 |
$user_id = (int) $parameter[0]; |
|---|
| 7 |
$result = db_query("select count(ident) as friend from friends |
|---|
| 8 |
where owner = " . $_SESSION['userid'] . " |
|---|
| 9 |
and friend = $user_id"); |
|---|
| 10 |
$result = (int) $result[0]->friend; |
|---|
| 11 |
if ($result == 0) { |
|---|
| 12 |
$run_result = " |
|---|
| 13 |
<form action=\"/".$_SESSION['username']."/friends/\" method=\"post\" style=\"display: inline\"> |
|---|
| 14 |
<input type=\"hidden\" name=\"action\" value=\"friend\" /> |
|---|
| 15 |
<input type=\"hidden\" name=\"friend_id\" value=\"$user_id\" /> |
|---|
| 16 |
<input type=\"image\" src=\"/_friends/gfx/friend.gif\" border=\"0\" width=\"17\" height=\"18\" alt=\"Friend\" title=\"Friend\" onClick=\"return confirm('Are you sure you want to add this user to your friends list?')\" /> |
|---|
| 17 |
</form>"; |
|---|
| 18 |
} else { |
|---|
| 19 |
$run_result = " |
|---|
| 20 |
<form action=\"/".$_SESSION['username']."/friends/\" method=\"post\" style=\"display: inline\"> |
|---|
| 21 |
<input type=\"hidden\" name=\"action\" value=\"unfriend\" /> |
|---|
| 22 |
<input type=\"hidden\" name=\"friend_id\" value=\"$user_id\" /> |
|---|
| 23 |
<input type=\"image\" src=\"/_friends/gfx/unfriend.gif\" border=\"0\" width=\"17\" height=\"18\" alt=\"Un-Friend\" title=\"Un-Friend\" onClick=\"return confirm('Are you sure you want to remove this user from your friends list?')\"/> |
|---|
| 24 |
</form>"; |
|---|
| 25 |
} |
|---|
| 26 |
|
|---|
| 27 |
} |
|---|
| 28 |
|
|---|
| 29 |
?> |
|---|