| 1 |
<?php |
|---|
| 2 |
|
|---|
| 3 |
|
|---|
| 4 |
|
|---|
| 5 |
if (logged_on) { |
|---|
| 6 |
|
|---|
| 7 |
global $page_owner; |
|---|
| 8 |
|
|---|
| 9 |
if (run("users:type:get", $page_owner) == "person" && run("permissions:check",array("userdetails:change", $page_owner))) { |
|---|
| 10 |
|
|---|
| 11 |
$title = run("profile:display:name") . " :: ". gettext("Friendship requests") .""; |
|---|
| 12 |
|
|---|
| 13 |
$pending_requests = db_query("select friends_requests.ident as request_id, users.*, icons.filename from friends_requests left join users on users.ident = friends_requests.owner left join icons on icons.ident = users.icon where friends_requests.friend = $page_owner order by users.name asc"); |
|---|
| 14 |
if (sizeof($pending_requests) > 0) { |
|---|
| 15 |
|
|---|
| 16 |
$body .= "<p>" . gettext("The following users would like to add you as a friend. They need your approval to do this (to change this setting, visit the 'account settings' page).") . "</p>"; |
|---|
| 17 |
|
|---|
| 18 |
foreach($pending_requests as $pending_user) { |
|---|
| 19 |
|
|---|
| 20 |
$where = run("users:access_level_sql_where",$_SESSION['userid']); |
|---|
| 21 |
$description = db_query("select * from profile_data where ($where) and name = 'minibio' and owner = " . $pending_user->ident); |
|---|
| 22 |
if (sizeof($description) > 0) { |
|---|
| 23 |
$description = "<p>" . stripslashes($description[0]->value) . "</p>"; |
|---|
| 24 |
} else { |
|---|
| 25 |
$description = "<p> </p>"; |
|---|
| 26 |
} |
|---|
| 27 |
|
|---|
| 28 |
$icon = $pending_user->filename; |
|---|
| 29 |
|
|---|
| 30 |
$request_id = $pending_user->request_id; |
|---|
| 31 |
|
|---|
| 32 |
$col1 = "<p><b>" . stripslashes($pending_user->name) . "</b></p>" . $description; |
|---|
| 33 |
$col1 .= "<p>"; |
|---|
| 34 |
$col1 .= "<a href=\"" . url . $pending_user->username . "/\">" . gettext("Profile") . "</a> | "; |
|---|
| 35 |
$col1 .= "<a href=\"" . url . $pending_user->username . "/weblog/\">" . gettext("Blog") . "</a></p>"; |
|---|
| 36 |
$col2 = "<p><a href=\"" .url. "_friends/requests.php?action=friends:approve:request&request_id=$request_id\">Approve</a> | <a href=\"" .url. "_friends/requests.php?action=friends:decline:request&request_id=$request_id\">Decline</a></p>"; |
|---|
| 37 |
$ident = $pending_user->ident; |
|---|
| 38 |
|
|---|
| 39 |
$body .= run("templates:draw", array( |
|---|
| 40 |
'context' => 'adminTable', |
|---|
| 41 |
'name' => "<img src=\"" . url . "_icons/data/" . $icon . "\" />", |
|---|
| 42 |
'column1' => $col1, |
|---|
| 43 |
'column2' => $col2 |
|---|
| 44 |
) |
|---|
| 45 |
); |
|---|
| 46 |
|
|---|
| 47 |
} |
|---|
| 48 |
|
|---|
| 49 |
} else { |
|---|
| 50 |
$body .= "<p>" . gettext("You have no pending friendship requests.") . "</p>"; |
|---|
| 51 |
} |
|---|
| 52 |
|
|---|
| 53 |
$run_result = run("templates:draw", array( |
|---|
| 54 |
'context' => 'contentholder', |
|---|
| 55 |
'title' => $title, |
|---|
| 56 |
'body' => $body |
|---|
| 57 |
) |
|---|
| 58 |
); |
|---|
| 59 |
|
|---|
| 60 |
} |
|---|
| 61 |
|
|---|
| 62 |
} |
|---|
| 63 |
|
|---|
| 64 |
?> |
|---|