initial dfrn update to pass perms

pull/1/head
Friendika 2011-04-10 18:38:55 -07:00
parent 12bc4a44cf
commit 940d216395
6 changed files with 22 additions and 9 deletions

View File

@ -4,7 +4,7 @@ set_time_limit(0);
define ( 'FRIENDIKA_VERSION', '2.1.945' ); define ( 'FRIENDIKA_VERSION', '2.1.945' );
define ( 'DFRN_PROTOCOL_VERSION', '2.2' ); define ( 'DFRN_PROTOCOL_VERSION', '2.2' );
define ( 'DB_UPDATE_VERSION', 1047 ); define ( 'DB_UPDATE_VERSION', 1048 );
define ( 'EOL', "<br />\r\n" ); define ( 'EOL', "<br />\r\n" );
define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' ); define ( 'ATOM_TIME', 'Y-m-d\TH:i:s\Z' );

View File

@ -85,6 +85,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`priority` tinyint(3) NOT NULL, `priority` tinyint(3) NOT NULL,
`blocked` tinyint(1) NOT NULL DEFAULT '1', `blocked` tinyint(1) NOT NULL DEFAULT '1',
`readonly` tinyint(1) NOT NULL DEFAULT '0', `readonly` tinyint(1) NOT NULL DEFAULT '0',
`writable` tinyint(1) NOT NULL DEFAULT '0',
`pending` tinyint(1) NOT NULL DEFAULT '1', `pending` tinyint(1) NOT NULL DEFAULT '1',
`rating` tinyint(1) NOT NULL DEFAULT '0', `rating` tinyint(1) NOT NULL DEFAULT '0',
`reason` text NOT NULL, `reason` text NOT NULL,

View File

@ -867,14 +867,14 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if($dissolve) if($dissolve)
$postvars['dissolve'] = '1'; $postvars['dissolve'] = '1';
if(($contact['rel']) && ($contact['rel'] != REL_FAN) && (! $contact['blocked']) && (! $contact['readonly'])) {
$postvars['data'] = $atom; if((($contact['rel']) && ($contact['rel'] != REL_FAN) && (! $contact['blocked'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) {
}
elseif($owner['page-flags'] == PAGE_COMMUNITY) {
$postvars['data'] = $atom; $postvars['data'] = $atom;
$postvars['perm'] = 'rw';
} }
else { else {
$postvars['data'] = str_replace('<dfrn:comment-allow>1','<dfrn:comment-allow>0',$atom); $postvars['data'] = str_replace('<dfrn:comment-allow>1','<dfrn:comment-allow>0',$atom);
$postvars['perm'] = 'r';
} }
if($rino && $rino_allowed && (! $dissolve)) { if($rino && $rino_allowed && (! $dissolve)) {
@ -916,7 +916,6 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if((! $curl_stat) || (! strlen($xml))) if((! $curl_stat) || (! strlen($xml)))
return(-1); // timed out return(-1); // timed out
if(strpos($xml,'<?xml') === false) { if(strpos($xml,'<?xml') === false) {
logger('dfrn_deliver: phase 2: no valid XML returned'); logger('dfrn_deliver: phase 2: no valid XML returned');
logger('dfrn_deliver: phase 2: returned XML: ' . $xml, LOGGER_DATA); logger('dfrn_deliver: phase 2: returned XML: ' . $xml, LOGGER_DATA);
@ -926,7 +925,6 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$res = parse_xml_string($xml); $res = parse_xml_string($xml);
return $res->status; return $res->status;
} }

View File

@ -10,6 +10,12 @@ function dfrn_notify_post(&$a) {
$data = ((x($_POST,'data')) ? $_POST['data'] : ''); $data = ((x($_POST,'data')) ? $_POST['data'] : '');
$key = ((x($_POST,'key')) ? $_POST['key'] : ''); $key = ((x($_POST,'key')) ? $_POST['key'] : '');
$dissolve = ((x($_POST,'dissolve')) ? intval($_POST['dissolve']) : 0); $dissolve = ((x($_POST,'dissolve')) ? intval($_POST['dissolve']) : 0);
$perm = ((x($_POST,'perm')) ? notags(trim($_POST['perm'])) : 'r');
$writable = (-1);
if($dfrn_version >= 2.21) {
$writable = (($perm === 'rw') ? 1 : 0);
}
$direction = (-1); $direction = (-1);
if(strpos($dfrn_id,':') == 1) { if(strpos($dfrn_id,':') == 1) {

View File

@ -16,6 +16,7 @@ function dfrn_poll_init(&$a) {
$challenge = ((x($_GET,'challenge')) ? $_GET['challenge'] : ''); $challenge = ((x($_GET,'challenge')) ? $_GET['challenge'] : '');
$sec = ((x($_GET,'sec')) ? $_GET['sec'] : ''); $sec = ((x($_GET,'sec')) ? $_GET['sec'] : '');
$dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0); $dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0);
$perm = ((x($_GET,'perm')) ? $_GET['perm'] : 'r');
$direction = (-1); $direction = (-1);
@ -185,6 +186,7 @@ function dfrn_poll_post(&$a) {
$sec = ((x($_POST,'sec')) ? $_POST['sec'] : ''); $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); $dfrn_version = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
$perm = ((x($_POST,'perm')) ? $_POST['perm'] : 'r');
if($ptype === 'profile-check') { if($ptype === 'profile-check') {
@ -344,6 +346,7 @@ function dfrn_poll_content(&$a) {
$destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url'] : ''); $destination_url = ((x($_GET,'destination_url')) ? $_GET['destination_url'] : '');
$sec = ((x($_GET,'sec')) ? $_GET['sec'] : ''); $sec = ((x($_GET,'sec')) ? $_GET['sec'] : '');
$dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0); $dfrn_version = ((x($_GET,'dfrn_version')) ? (float) $_GET['dfrn_version'] : 2.0);
$perm = ((x($_GET,'perm')) ? $_GET['perm'] : 'r');
$direction = (-1); $direction = (-1);
if(strpos($dfrn_id,':') == 1) { if(strpos($dfrn_id,':') == 1) {

View File

@ -423,3 +423,8 @@ function update_1045() {
function update_1046() { function update_1046() {
q("ALTER TABLE `item` ADD `attach` MEDIUMTEXT NOT NULL AFTER `tag` "); q("ALTER TABLE `item` ADD `attach` MEDIUMTEXT NOT NULL AFTER `tag` ");
} }
function update_1047() {
q("ALTER TABLE `contact` ADD `writable` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `readonly` ");
}