track whether contact is a community page or not

This commit is contained in:
friendica 2012-03-15 16:38:26 -07:00
parent f96aff5518
commit 7684f63ecd
6 changed files with 29 additions and 7 deletions

View File

@ -9,9 +9,9 @@ require_once('include/nav.php');
require_once('include/cache.php'); require_once('include/cache.php');
define ( 'FRIENDICA_PLATFORM', 'Friendica'); define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1281' ); define ( 'FRIENDICA_VERSION', '2.3.1282' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' ); define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1131 ); define ( 'DB_UPDATE_VERSION', 1132 );
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

@ -92,6 +92,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
`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', `writable` tinyint(1) NOT NULL DEFAULT '0',
`forum` tinyint(1) NOT NULL DEFAULT '0',
`hidden` tinyint(1) NOT NULL DEFAULT '0', `hidden` 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',
@ -116,6 +117,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
KEY `dfrn-id` (`dfrn-id`), KEY `dfrn-id` (`dfrn-id`),
KEY `blocked` (`blocked`), KEY `blocked` (`blocked`),
KEY `readonly` (`readonly`), KEY `readonly` (`readonly`),
KEY `forum` (`forum`),
KEY `hidden` (`hidden`), KEY `hidden` (`hidden`),
KEY `pending` (`pending`), KEY `pending` (`pending`),
KEY `closeness` (`closeness`) KEY `closeness` (`closeness`)

View File

@ -1048,6 +1048,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$ssl_val = intval(get_config('system','ssl_policy')); $ssl_val = intval(get_config('system','ssl_policy'));
$ssl_policy = ''; $ssl_policy = '';
switch($ssl_val){ switch($ssl_val){
case SSL_POLICY_FULL: case SSL_POLICY_FULL:
$ssl_policy = 'full'; $ssl_policy = 'full';
@ -1092,6 +1093,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$challenge = hex2bin((string) $res->challenge); $challenge = hex2bin((string) $res->challenge);
$dfrn_version = (float) (($res->dfrn_version) ? $res->dfrn_version : 2.0); $dfrn_version = (float) (($res->dfrn_version) ? $res->dfrn_version : 2.0);
$rino_allowed = ((intval($res->rino) === 1) ? 1 : 0); $rino_allowed = ((intval($res->rino) === 1) ? 1 : 0);
$page = (($owner['page-flags'] == PAGE_COMMUNITY) ? 1 : 0);
$final_dfrn_id = ''; $final_dfrn_id = '';
@ -1135,6 +1137,9 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$postvars['ssl_policy'] = $ssl_policy; $postvars['ssl_policy'] = $ssl_policy;
if($page)
$postvars['page'] = '1';
if($rino && $rino_allowed && (! $dissolve)) { if($rino && $rino_allowed && (! $dissolve)) {
$key = substr(random_string(),0,16); $key = substr(random_string(),0,16);
$data = bin2hex(aes_encrypt($postvars['data'],$key)); $data = bin2hex(aes_encrypt($postvars['data'],$key));

View File

@ -207,6 +207,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if($duplex == 1) if($duplex == 1)
$params['duplex'] = 1; $params['duplex'] = 1;
if($user['page-flags'] == PAGE_COMMUNITY)
$params['page'] = 1;
logger('dfrn_confirm: Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params,true), LOGGER_DATA); logger('dfrn_confirm: Confirm: posting data to ' . $dfrn_confirm . ': ' . print_r($params,true), LOGGER_DATA);
/** /**
@ -522,6 +525,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$source_url = ((x($_POST,'source_url')) ? hex2bin($_POST['source_url']) : ''); $source_url = ((x($_POST,'source_url')) ? hex2bin($_POST['source_url']) : '');
$aes_key = ((x($_POST,'aes_key')) ? $_POST['aes_key'] : ''); $aes_key = ((x($_POST,'aes_key')) ? $_POST['aes_key'] : '');
$duplex = ((x($_POST,'duplex')) ? intval($_POST['duplex']) : 0 ); $duplex = ((x($_POST,'duplex')) ? intval($_POST['duplex']) : 0 );
$page = ((x($_POST,'page')) ? intval($_POST['page']) : 0 );
$version_id = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0); $version_id = ((x($_POST,'dfrn_version')) ? (float) $_POST['dfrn_version'] : 2.0);
logger('dfrn_confirm: requestee contacted: ' . $node); logger('dfrn_confirm: requestee contacted: ' . $node);
@ -677,6 +681,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
`blocked` = 0, `blocked` = 0,
`pending` = 0, `pending` = 0,
`duplex` = %d, `duplex` = %d,
`forum` = %d,
`network` = '%s' WHERE `id` = %d LIMIT 1 `network` = '%s' WHERE `id` = %d LIMIT 1
", ",
dbesc($photos[0]), dbesc($photos[0]),
@ -687,6 +692,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
dbesc(datetime_convert()), dbesc(datetime_convert()),
dbesc(datetime_convert()), dbesc(datetime_convert()),
intval($duplex), intval($duplex),
intval($page),
dbesc(NETWORK_DFRN), dbesc(NETWORK_DFRN),
intval($dfrn_record) intval($dfrn_record)
); );

View File

@ -15,6 +15,7 @@ function dfrn_notify_post(&$a) {
$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'); $perm = ((x($_POST,'perm')) ? notags(trim($_POST['perm'])) : 'r');
$ssl_policy = ((x($_POST,'ssl_policy')) ? notags(trim($_POST['ssl_policy'])): 'none'); $ssl_policy = ((x($_POST,'ssl_policy')) ? notags(trim($_POST['ssl_policy'])): 'none');
$page = ((x($_POST,'page')) ? intval($_POST['page']) : 0);
$writable = (-1); $writable = (-1);
if($dfrn_version >= 2.21) { if($dfrn_version >= 2.21) {
@ -87,12 +88,15 @@ function dfrn_notify_post(&$a) {
$importer = $r[0]; $importer = $r[0];
if(($writable != (-1)) && ($writable != $importer['writable'])) { if((($writable != (-1)) && ($writable != $importer['writable'])) || ($importer['forum'] != $page)) {
q("UPDATE `contact` SET `writable` = %d WHERE `id` = %d LIMIT 1", q("UPDATE `contact` SET `writable` = %d, forum = %d WHERE `id` = %d LIMIT 1",
intval($writable), intval(($writable == (-1)) ? $importer['writable'] : $writable),
intval($page),
intval($importer['id']) intval($importer['id'])
); );
if($writable != (-1))
$importer['writable'] = $writable; $importer['writable'] = $writable;
$importer['forum'] = $page;
} }
// if contact's ssl policy changed, update our links // if contact's ssl policy changed, update our links

View File

@ -1,6 +1,6 @@
<?php <?php
define( 'UPDATE_VERSION' , 1131 ); define( 'UPDATE_VERSION' , 1132 );
/** /**
* *
@ -1122,3 +1122,8 @@ function update_1130() {
q("ALTER TABLE `item` ADD `file` MEDIUMTEXT NOT NULL AFTER `inform`, ADD FULLTEXT KEY (`file`) "); q("ALTER TABLE `item` ADD `file` MEDIUMTEXT NOT NULL AFTER `inform`, ADD FULLTEXT KEY (`file`) ");
} }
function update_1131() {
q("ALTER TABLE `contact` ADD `forum` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `writable` , ADD INDEX ( `forum` ) ");
}