Reworked "remote" cookie handling
This commit is contained in:
parent
d5c37001cd
commit
ec66553032
13 changed files with 106 additions and 192 deletions
|
@ -74,34 +74,21 @@ function wall_upload_post(App $a, $desktopmode = true)
|
|||
|
||||
if ((local_user()) && (local_user() == $page_owner_uid)) {
|
||||
$can_post = true;
|
||||
} else {
|
||||
if ($community_page && remote_user()) {
|
||||
$contact_id = 0;
|
||||
if (is_array($_SESSION['remote'])) {
|
||||
foreach ($_SESSION['remote'] as $v) {
|
||||
if ($v['uid'] == $page_owner_uid) {
|
||||
$contact_id = $v['cid'];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} elseif ($community_page && !empty(remote_user($page_owner_uid))) {
|
||||
$contact_id = remote_user($page_owner_uid);
|
||||
|
||||
if ($contact_id) {
|
||||
$r = q("SELECT `uid` FROM `contact`
|
||||
WHERE `blocked` = 0 AND `pending` = 0
|
||||
AND `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($contact_id),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
if (DBA::isResult($r)) {
|
||||
$can_post = true;
|
||||
$visitor = $contact_id;
|
||||
}
|
||||
}
|
||||
$r = q("SELECT `uid` FROM `contact`
|
||||
WHERE `blocked` = 0 AND `pending` = 0
|
||||
AND `id` = %d AND `uid` = %d LIMIT 1",
|
||||
intval($contact_id),
|
||||
intval($page_owner_uid)
|
||||
);
|
||||
if (DBA::isResult($r)) {
|
||||
$can_post = true;
|
||||
$visitor = $contact_id;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!$can_post) {
|
||||
if ($r_json) {
|
||||
echo json_encode(['error' => L10n::t('Permission denied.')]);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue