| 1 |
<?php
|
| 2 |
// $Id$
|
| 3 |
|
| 4 |
/**
|
| 5 |
* @file
|
| 6 |
* Handles the conversation view.
|
| 7 |
*/
|
| 8 |
|
| 9 |
/**
|
| 10 |
* Builds a page with a conversation view. A form to post a message to the other
|
| 11 |
* user's profile may be at the top. If it is and if the user has JavaScript
|
| 12 |
* enabled in their browser, the view will update via AJAX when the message is
|
| 13 |
* submitted.
|
| 14 |
*/
|
| 15 |
function _facebook_status_conversation() {
|
| 16 |
global $user;
|
| 17 |
$view = 'facebook_status_cross_post';
|
| 18 |
$args = explode(',', arg(2));
|
| 19 |
if (in_array($user->name, $args) || in_array($user->uid, $args) || count($args) === 1) {
|
| 20 |
if (count($args) === 1 && ($args[0] == $user->uid || $args[0] == $user->name)) {
|
| 21 |
drupal_not_found();
|
| 22 |
return;
|
| 23 |
}
|
| 24 |
else if (count($args) === 1) {
|
| 25 |
if (is_numeric($args[0])) {
|
| 26 |
$account = user_load(array('uid' => $args[0]));
|
| 27 |
}
|
| 28 |
else {
|
| 29 |
$account = user_load(array('name' => $args[0]));
|
| 30 |
}
|
| 31 |
}
|
| 32 |
else {
|
| 33 |
if (is_numeric($args[0])) {
|
| 34 |
$key = array_search($user->uid, $args);
|
| 35 |
if ($key === 1) {
|
| 36 |
$key = 0;
|
| 37 |
}
|
| 38 |
else if ($key === 0) {
|
| 39 |
$key = 1;
|
| 40 |
}
|
| 41 |
$account = user_load(array('uid' => $args[$key]));
|
| 42 |
}
|
| 43 |
else {
|
| 44 |
$key = array_search($user->name, $args);
|
| 45 |
if ($key === 1) {
|
| 46 |
$key = 0;
|
| 47 |
}
|
| 48 |
else if ($key === 0) {
|
| 49 |
$key = 1;
|
| 50 |
}
|
| 51 |
$account = user_load(array('name' => $args[$key]));
|
| 52 |
}
|
| 53 |
}
|
| 54 |
if (user_access('post on all profiles') && $account->uid) {
|
| 55 |
return theme('facebook_status_form_display', $account, variable_get('facebook_status_size_long', 40), $view);
|
| 56 |
}
|
| 57 |
else if ($account->uid) {
|
| 58 |
return views_embed_view($view, 'default', arg(2));
|
| 59 |
}
|
| 60 |
drupal_not_found();
|
| 61 |
return;
|
| 62 |
}
|
| 63 |
if (is_numeric($args[0])) {
|
| 64 |
$account1 = user_load(array('uid' => $args[0]));
|
| 65 |
$account2 = user_load(array('uid' => $args[1]));
|
| 66 |
}
|
| 67 |
else {
|
| 68 |
$account1 = user_load(array('name' => $args[0]));
|
| 69 |
$account2 = user_load(array('name' => $args[1]));
|
| 70 |
}
|
| 71 |
if ($account1->uid && $account2->uid) {
|
| 72 |
return views_embed_view($view, 'default', arg(2));
|
| 73 |
}
|
| 74 |
drupal_not_found();
|
| 75 |
}
|