Merge remote-tracking branch 'friendica/master'
This commit is contained in:
commit
cb05e677a9
9 changed files with 132 additions and 16 deletions
4
boot.php
4
boot.php
|
@ -9,9 +9,9 @@ require_once('include/nav.php');
|
||||||
require_once('include/cache.php');
|
require_once('include/cache.php');
|
||||||
|
|
||||||
define ( 'FRIENDIKA_PLATFORM', 'Friendica');
|
define ( 'FRIENDIKA_PLATFORM', 'Friendica');
|
||||||
define ( 'FRIENDIKA_VERSION', '2.3.1167' );
|
define ( 'FRIENDIKA_VERSION', '2.3.1170' );
|
||||||
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
define ( 'DFRN_PROTOCOL_VERSION', '2.22' );
|
||||||
define ( 'DB_UPDATE_VERSION', 1104 );
|
define ( 'DB_UPDATE_VERSION', 1105 );
|
||||||
|
|
||||||
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' );
|
||||||
|
|
|
@ -226,6 +226,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
`unseen` tinyint(1) NOT NULL DEFAULT '1',
|
`unseen` tinyint(1) NOT NULL DEFAULT '1',
|
||||||
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
`deleted` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`origin` tinyint(1) NOT NULL DEFAULT '0',
|
`origin` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
|
`forum_mode` tinyint(1) NOT NULL DEFAULT '0',
|
||||||
`last-child` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
`last-child` tinyint(1) unsigned NOT NULL DEFAULT '1',
|
||||||
PRIMARY KEY (`id`),
|
PRIMARY KEY (`id`),
|
||||||
KEY `guid` (`guid`),
|
KEY `guid` (`guid`),
|
||||||
|
@ -244,6 +245,7 @@ CREATE TABLE IF NOT EXISTS `item` (
|
||||||
KEY `starred` (`starred`),
|
KEY `starred` (`starred`),
|
||||||
KEY `deleted` (`deleted`),
|
KEY `deleted` (`deleted`),
|
||||||
KEY `origin` (`origin`),
|
KEY `origin` (`origin`),
|
||||||
|
KEY `forum_mode` (`forum_mode`),
|
||||||
KEY `last-child` (`last-child`),
|
KEY `last-child` (`last-child`),
|
||||||
KEY `unseen` (`unseen`),
|
KEY `unseen` (`unseen`),
|
||||||
KEY `wall` (`wall`),
|
KEY `wall` (`wall`),
|
||||||
|
|
|
@ -893,6 +893,8 @@ function item_store($arr,$force_parent = false) {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tgroup_deliver($arr['uid'],$current_post);
|
||||||
|
|
||||||
return $current_post;
|
return $current_post;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -909,6 +911,69 @@ function get_item_contact($item,$contacts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function tgroup_deliver($uid,$item_id) {
|
||||||
|
|
||||||
|
|
||||||
|
// setup a second delivery chain for forum/community posts if appropriate
|
||||||
|
|
||||||
|
$a = get_app();
|
||||||
|
|
||||||
|
$deliver_to_tgroup = false;
|
||||||
|
|
||||||
|
$u = q("select * from user where uid = %d and `page-flags` = %d limit 1",
|
||||||
|
intval($uid),
|
||||||
|
intval(PAGE_COMMUNITY)
|
||||||
|
);
|
||||||
|
if(! count($u))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$i = q("select * from item where id = %d and uid = %d limit 1",
|
||||||
|
intval($item_id),
|
||||||
|
intval($uid)
|
||||||
|
);
|
||||||
|
if(! count($i))
|
||||||
|
return;
|
||||||
|
|
||||||
|
$item = $i[0];
|
||||||
|
|
||||||
|
// prevent delivery looping - only proceed
|
||||||
|
// if the message originated elsewhere and is a top-level post
|
||||||
|
|
||||||
|
if(($item['wall']) || ($item['origin']) || ($item['id'] != $item['parent']))
|
||||||
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
$link = normalise_link($a->get_baseurl() . '/profile/' . $u[0]['nickname']);
|
||||||
|
|
||||||
|
$cnt = preg_match_all('/\@\[url\=(.*?)\](.*?)\[\/url\]/ism',$item['body'],$matches,PREG_SET_ORDER);
|
||||||
|
if($cnt) {
|
||||||
|
foreach($matches as $mtch) {
|
||||||
|
if(link_compare($link,$mtch[1])) {
|
||||||
|
$deliver_to_tgroup = true;
|
||||||
|
logger('tgroup_deliver: local group mention found: ' . $mtch[2]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(! $deliver_to_tgroup)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// now change this copy of the post to a forum head message and deliver to all the tgroup members
|
||||||
|
|
||||||
|
|
||||||
|
q("update item set wall = 1, origin = 1, forum_mode = 1 where id = %d limit 1",
|
||||||
|
intval($item_id)
|
||||||
|
);
|
||||||
|
|
||||||
|
proc_run('php','include/notifier.php','tgroup',$item_id);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
|
||||||
|
|
||||||
$a = get_app();
|
$a = get_app();
|
||||||
|
@ -1963,18 +2028,31 @@ function local_delivery($importer,$data) {
|
||||||
|
|
||||||
if($is_reply) {
|
if($is_reply) {
|
||||||
|
|
||||||
|
$community = false;
|
||||||
|
|
||||||
|
if($importer['page-flags'] == PAGE_COMMUNITY) {
|
||||||
|
$sql_extra = '';
|
||||||
|
$community = true;
|
||||||
|
logger('local_delivery: community reply');
|
||||||
|
}
|
||||||
|
else
|
||||||
|
$sql_extra = " and contact.self = 1 and item.wall = 1 ";
|
||||||
|
|
||||||
// was the top-level post for this reply written by somebody on this site?
|
// was the top-level post for this reply written by somebody on this site?
|
||||||
// Specifically, the recipient?
|
// Specifically, the recipient?
|
||||||
|
|
||||||
$r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`,
|
$r = q("select `item`.`id`, `item`.`uri`, `item`.`tag`,
|
||||||
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
|
`contact`.`name`, `contact`.`url`, `contact`.`thumb` from `item`
|
||||||
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
LEFT JOIN `contact` ON `contact`.`id` = `item`.`contact-id`
|
||||||
WHERE `contact`.`self` = 1 AND `item`.`wall` = 1 AND `item`.`uri` = '%s' AND `item`.`parent-uri` = '%s'
|
WHERE `item`.`uri` = '%s' AND `item`.`parent-uri` = '%s'
|
||||||
AND `item`.`uid` = %d LIMIT 1",
|
AND `item`.`uid` = %d
|
||||||
|
$sql_extra
|
||||||
|
LIMIT 1",
|
||||||
dbesc($parent_uri),
|
dbesc($parent_uri),
|
||||||
dbesc($parent_uri),
|
dbesc($parent_uri),
|
||||||
intval($importer['importer_uid'])
|
intval($importer['importer_uid'])
|
||||||
);
|
);
|
||||||
|
|
||||||
if($r && count($r)) {
|
if($r && count($r)) {
|
||||||
|
|
||||||
logger('local_delivery: received remote comment');
|
logger('local_delivery: received remote comment');
|
||||||
|
@ -1982,11 +2060,14 @@ function local_delivery($importer,$data) {
|
||||||
// remote reply to our post. Import and then notify everybody else.
|
// remote reply to our post. Import and then notify everybody else.
|
||||||
$datarray = get_atom_elements($feed,$item);
|
$datarray = get_atom_elements($feed,$item);
|
||||||
|
|
||||||
if(! link_compare($datarray['author-link'],$importer['url'])) {
|
|
||||||
logger('local_delivery: received relay claiming to be from ' . $importer['url'] . ' however comment author url is ' . $datarray['author-link'] );
|
// TODO: make this next part work against both delivery threads of a community post
|
||||||
|
|
||||||
|
// if((! link_compare($datarray['author-link'],$importer['url'])) && (! $community)) {
|
||||||
|
// logger('local_delivery: received relay claiming to be from ' . $importer['url'] . ' however comment author url is ' . $datarray['author-link'] );
|
||||||
// they won't know what to do so don't report an error. Just quietly die.
|
// they won't know what to do so don't report an error. Just quietly die.
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
// }
|
||||||
|
|
||||||
$datarray['type'] = 'remote-comment';
|
$datarray['type'] = 'remote-comment';
|
||||||
$datarray['wall'] = 1;
|
$datarray['wall'] = 1;
|
||||||
|
@ -2031,6 +2112,16 @@ function local_delivery($importer,$data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if($community) {
|
||||||
|
// $newtag = '@[url=' . $a->get_baseurl() . '/profile/' . $importer['nickname'] . ']' . $importer['username'] . '[/url]';
|
||||||
|
// if(! stristr($datarray['tag'],$newtag)) {
|
||||||
|
// if(strlen($datarray['tag']))
|
||||||
|
// $datarray['tag'] .= ',';
|
||||||
|
// $datarray['tag'] .= $newtag;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
$posted_id = item_store($datarray);
|
$posted_id = item_store($datarray);
|
||||||
$parent = 0;
|
$parent = 0;
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ function fetch_url($url,$binary = false, &$redirects = 0, $timeout = 0, $accept_
|
||||||
}
|
}
|
||||||
|
|
||||||
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
@curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
||||||
@curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
|
@curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
|
||||||
|
|
||||||
|
|
||||||
if(intval($timeout)) {
|
if(intval($timeout)) {
|
||||||
|
@ -105,7 +105,7 @@ function post_url($url,$params, $headers = null, &$redirects = 0, $timeout = 0)
|
||||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER,true);
|
||||||
curl_setopt($ch, CURLOPT_POST,1);
|
curl_setopt($ch, CURLOPT_POST,1);
|
||||||
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
|
curl_setopt($ch, CURLOPT_POSTFIELDS,$params);
|
||||||
curl_setopt($ch, CURLOPT_USERAGENT, "Friendika");
|
curl_setopt($ch, CURLOPT_USERAGENT, "Friendica");
|
||||||
|
|
||||||
if(intval($timeout)) {
|
if(intval($timeout)) {
|
||||||
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
|
||||||
|
|
|
@ -218,6 +218,11 @@ function notifier_run($argv, $argc){
|
||||||
$relay_to_owner = true;
|
$relay_to_owner = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if(($cmd === 'uplink') && (intval($parent['forum_mode'])) && (! $top_level)) {
|
||||||
|
$relay_to_owner = true;
|
||||||
|
}
|
||||||
|
|
||||||
// until the 'origin' flag has been in use for several months
|
// until the 'origin' flag has been in use for several months
|
||||||
// we will just use it as a fallback test
|
// we will just use it as a fallback test
|
||||||
// later we will be able to use it as the primary test of whether or not to relay.
|
// later we will be able to use it as the primary test of whether or not to relay.
|
||||||
|
@ -259,6 +264,13 @@ function notifier_run($argv, $argc){
|
||||||
$deny_people = expand_acl($parent['deny_cid']);
|
$deny_people = expand_acl($parent['deny_cid']);
|
||||||
$deny_groups = expand_groups(expand_acl($parent['deny_gid']));
|
$deny_groups = expand_groups(expand_acl($parent['deny_gid']));
|
||||||
|
|
||||||
|
// if our parent is a forum, uplink to the origonal author causing
|
||||||
|
// a delivery fork
|
||||||
|
|
||||||
|
if(intval($parent['forum_mode']) && (! $top_level) && ($cmd !== 'uplink')) {
|
||||||
|
proc_run('php','include/notifier','uplink',$item_id);
|
||||||
|
}
|
||||||
|
|
||||||
$conversants = array();
|
$conversants = array();
|
||||||
|
|
||||||
foreach($items as $item) {
|
foreach($items as $item) {
|
||||||
|
|
|
@ -75,8 +75,6 @@ $a->timezone = (($default_timezone) ? $default_timezone : 'UTC');
|
||||||
|
|
||||||
date_default_timezone_set($a->timezone);
|
date_default_timezone_set($a->timezone);
|
||||||
|
|
||||||
$a->init_pagehead();
|
|
||||||
|
|
||||||
session_start();
|
session_start();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -95,6 +93,12 @@ if((x($_SESSION,'language')) && ($_SESSION['language'] !== $lang)) {
|
||||||
load_translation_table($lang);
|
load_translation_table($lang);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Create the page head after setting the language
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
$a->init_pagehead();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
|
|
@ -80,7 +80,7 @@ ACPopup.prototype._search = function(){
|
||||||
that.cont.show();
|
that.cont.show();
|
||||||
$(data.items).each(function(){
|
$(data.items).each(function(){
|
||||||
html = "<img src='{0}' height='16px' width='16px'>{1} ({2})".format(this.photo, this.name, this.nick)
|
html = "<img src='{0}' height='16px' width='16px'>{1} ({2})".format(this.photo, this.name, this.nick)
|
||||||
that.add(html, this.nick + '+' + this.id + ' - ' + this.link);
|
that.add(html, this.nick.replace(' ','') + '+' + this.id + ' - ' + this.link);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
that.cont.hide();
|
that.cont.hide();
|
||||||
|
|
|
@ -865,12 +865,12 @@ function item_post(&$a) {
|
||||||
$addr = trim($recip);
|
$addr = trim($recip);
|
||||||
if(! strlen($addr))
|
if(! strlen($addr))
|
||||||
continue;
|
continue;
|
||||||
$disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendika social network.'),$a->user['username'])
|
$disclaimer = '<hr />' . sprintf( t('This message was sent to you by %s, a member of the Friendica social network.'),$a->user['username'])
|
||||||
. '<br />';
|
. '<br />';
|
||||||
$disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
|
$disclaimer .= sprintf( t('You may visit them online at %s'), $a->get_baseurl() . '/profile/' . $a->user['nickname']) . EOL;
|
||||||
$disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
|
$disclaimer .= t('Please contact the sender by replying to this post if you do not wish to receive these messages.') . EOL;
|
||||||
|
|
||||||
$subject = '[Friendika]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
|
$subject = '[Friendica]' . ' ' . sprintf( t('%s posted an update.'),$a->user['username']);
|
||||||
$headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
|
$headers = 'From: ' . $a->user['username'] . ' <' . $a->user['email'] . '>' . "\n";
|
||||||
$headers .= 'MIME-Version: 1.0' . "\n";
|
$headers .= 'MIME-Version: 1.0' . "\n";
|
||||||
$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
|
$headers .= 'Content-Type: text/html; charset=UTF-8' . "\n";
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
define( 'UPDATE_VERSION' , 1104 );
|
define( 'UPDATE_VERSION' , 1105 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
@ -895,4 +895,11 @@ function update_1103() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function update_1104() {
|
||||||
|
q("ALTER TABLE `item` ADD `forum_mode` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `origin` , ADD INDEX ( `forum_mode` ) ");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue