exists()) die("Session expired!\n"); // Retrieve adopted share data from memcached. $shid = $_POST["aid"]; $share = Share::fromShareID($memcache, $shid); if (!$share->exists()) die("The given share does not exist!\n"); if (!$share->getType() === SHARE_TYPE_ALONE) die("You cannot adopt group shares!\n"); if (!$share->isAdoptable()) die("The host of the given share does not permit adoption!\n"); // Retrieve the target share. $pin = $_POST["pin"]; $target = Share::fromGroupPIN($memcache, $pin); if (!$target->exists()) die("Session expired!\n"); // Join the shares. $target->addHost($nickname, $share->getHost())->save(); $share->getHost()->addTarget($target)->save(); echo "OK\n";