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');
define ( 'FRIENDICA_PLATFORM', 'Friendica');
define ( 'FRIENDICA_VERSION', '2.3.1281' );
define ( 'FRIENDICA_VERSION', '2.3.1282' );
define ( 'DFRN_PROTOCOL_VERSION', '2.23' );
define ( 'DB_UPDATE_VERSION', 1131 );
define ( 'DB_UPDATE_VERSION', 1132 );
define ( 'EOL', "<br />\r\n" );
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',
`readonly` 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',
`pending` tinyint(1) NOT NULL DEFAULT '1',
`rating` tinyint(1) NOT NULL DEFAULT '0',
@ -116,6 +117,7 @@ CREATE TABLE IF NOT EXISTS `contact` (
KEY `dfrn-id` (`dfrn-id`),
KEY `blocked` (`blocked`),
KEY `readonly` (`readonly`),
KEY `forum` (`forum`),
KEY `hidden` (`hidden`),
KEY `pending` (`pending`),
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_policy = '';
switch($ssl_val){
case SSL_POLICY_FULL:
$ssl_policy = 'full';
@ -1092,6 +1093,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$challenge = hex2bin((string) $res->challenge);
$dfrn_version = (float) (($res->dfrn_version) ? $res->dfrn_version : 2.0);
$rino_allowed = ((intval($res->rino) === 1) ? 1 : 0);
$page = (($owner['page-flags'] == PAGE_COMMUNITY) ? 1 : 0);
$final_dfrn_id = '';
@ -1135,6 +1137,9 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$postvars['ssl_policy'] = $ssl_policy;
if($page)
$postvars['page'] = '1';
if($rino && $rino_allowed && (! $dissolve)) {
$key = substr(random_string(),0,16);
$data = bin2hex(aes_encrypt($postvars['data'],$key));

View file

@ -207,6 +207,9 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
if($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);
/**
@ -522,6 +525,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
$source_url = ((x($_POST,'source_url')) ? hex2bin($_POST['source_url']) : '');
$aes_key = ((x($_POST,'aes_key')) ? $_POST['aes_key'] : '');
$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);
logger('dfrn_confirm: requestee contacted: ' . $node);
@ -677,6 +681,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
`blocked` = 0,
`pending` = 0,
`duplex` = %d,
`forum` = %d,
`network` = '%s' WHERE `id` = %d LIMIT 1
",
dbesc($photos[0]),
@ -687,6 +692,7 @@ function dfrn_confirm_post(&$a,$handsfree = null) {
dbesc(datetime_convert()),
dbesc(datetime_convert()),
intval($duplex),
intval($page),
dbesc(NETWORK_DFRN),
intval($dfrn_record)
);

View file

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

View file

@ -1,6 +1,6 @@
<?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`) ");
}
function update_1131() {
q("ALTER TABLE `contact` ADD `forum` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `writable` , ADD INDEX ( `forum` ) ");
}