$challenge = ((x($_GET,'challenge')) ? $_GET['challenge'] : '');
$sec = ((x($_GET,'sec')) ? $_GET['sec'] : '');
$dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0);
+ $perm = ((x($_GET,'perm')) ? $_GET['perm'] : 'r');
$direction = (-1);
if(strlen($s)) {
- $xml = simplexml_load_string($s);
+ $xml = parse_xml_string($s);
if((int) $xml->status == 1) {
$_SESSION['authenticated'] = 1;
$challenge = ((x($_POST,'challenge')) ? $_POST['challenge'] : '');
$url = ((x($_POST,'url')) ? $_POST['url'] : '');
$sec = ((x($_POST,'sec')) ? $_POST['sec'] : '');
- $ptype = ((x($_POST,'type')) ? $_POST['type'] : '');
+ $ptype = ((x($_POST,'type')) ? $_POST['type'] : '');
$dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
+ $perm = ((x($_POST,'perm')) ? $_POST['perm'] : 'r');
if($ptype === 'profile-check') {
if(! count($r))
killme();
+ $contact = $r[0];
$owner_uid = $r[0]['uid'];
$contact_id = $r[0]['id'];
// NOTREACHED
}
else {
+
+ // Update the writable flag if it changed
+ logger('dfrn_poll: post request feed: ' . print_r($_POST,true),LOGGER_DATA);
+ if($dfrn_version >= 2.21) {
+ if($perm === 'rw')
+ $writable = 1;
+ else
+ $writable = 0;
+
+ if($writable != $contact['writable']) {
+ q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1",
+ intval($writable),
+ intval($contact_id)
+ );
+ }
+ }
+
header("Content-type: application/atom+xml");
$o = get_feed_for($a,$dfrn_id, $a->argv[1], $last_update, $direction);
echo $o;
$destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url'] : '');
$sec = ((x($_GET,'sec')) ? $_GET['sec'] : '');
$dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0);
+ $perm = ((x($_GET,'perm')) ? $_GET['perm'] : 'r');
$direction = (-1);
if(strpos($dfrn_id,':') == 1) {
}
if(($type === 'profile') && (strlen($sec))) {
- // URL reply
-
+ // URL reply
if($dfrn_version < 2.2) {
$s = fetch_url($r[0]['poll']
'sec' => $sec
));
}
+
+ $profile = $r[0]['nickname'];
switch($destination_url) {
case 'profile':
$dest = $a->get_baseurl() . '/photos/' . $profile;
break;
case 'status':
- default:
+ case '':
$dest = $a->get_baseurl() . '/profile/' . $profile;
break;
+ default:
+ $dest = $destination_url;
+ break;
}
logger("dfrn_poll: sec profile: " . $s, LOGGER_DATA);
if(strlen($s) && strstr($s,'<?xml')) {
- $xml = simplexml_load_string($s);
+ $xml = parse_xml_string($s);
logger('dfrn_poll: profile: parsed xml: ' . print_r($xml,true), LOGGER_DATA);
dbesc($session_id)
);
}
- $profile = $r[0]['nickname'];
goaway($dest);
}