exists()) die($LANG['session_expired']."\n"); // Retrieve adopted share data from memcached. $shid = $_POST["aid"]; $share = Share::fromShareID($memcache, $shid); if (!$share->exists()) die($LANG['share_not_found']."\n"); if (!$share->getType() === SHARE_TYPE_ALONE) die($LANG['group_share_not_adoptable']."\n"); if (!$share->isAdoptable()) die($LANG['share_adoption_not_allowed']."\n"); if ($share->getHost()->isEncrypted()) die($LANG['e2e_adoption_not_allowed']."\n"); // Retrieve the target share. $pin = $_POST["pin"]; $target = Share::fromGroupPIN($memcache, $pin); if (!$target->exists()) die($LANG['session_expired']."\n"); // Join the shares. $target->addHost($nickname, $share->getHost())->save(); $share->getHost()->addTarget($target)->save(); echo "OK\n";