aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-01-28 16:06:36 -0800
committerfriendica <info@friendica.com>2015-01-28 16:06:36 -0800
commitda842da6839a8feeac4ef1084dce576de34fa874 (patch)
tree5535e4107e8d9762c20748735948c14c8cbb82ae /include
parentf0b900057a63a5c9efb8f35daa05b6c7e79d0adb (diff)
parent54fd8b21db2d8f3841cf590f88611a1d4f44ce48 (diff)
downloadvolse-hubzilla-da842da6839a8feeac4ef1084dce576de34fa874.tar.gz
volse-hubzilla-da842da6839a8feeac4ef1084dce576de34fa874.tar.bz2
volse-hubzilla-da842da6839a8feeac4ef1084dce576de34fa874.zip
Merge branch 'master' into pocorate
Diffstat (limited to 'include')
-rw-r--r--include/RedDAV/RedBrowser.php3
-rwxr-xr-xinclude/diaspora.php10
-rwxr-xr-xinclude/items.php54
-rw-r--r--include/zot.php7
4 files changed, 62 insertions, 12 deletions
diff --git a/include/RedDAV/RedBrowser.php b/include/RedDAV/RedBrowser.php
index e893d6ebd..8093aebc9 100644
--- a/include/RedDAV/RedBrowser.php
+++ b/include/RedDAV/RedBrowser.php
@@ -252,7 +252,8 @@ class RedBrowser extends DAV\Browser\Plugin {
'$actionspanel' => $output,
'$shared' => t('Shared'),
'$create' => t('Create'),
- 'upload' => t('Upload')
+ '$upload' => t('Upload'),
+ '$is_owner' => $is_owner
));
$html .= replace_macros(get_markup_template('cloud_directory.tpl'), array(
diff --git a/include/diaspora.php b/include/diaspora.php
index e494aac0f..767758164 100755
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -15,8 +15,14 @@ function diaspora_dispatch_public($msg) {
return;
}
- // find everybody following or allowing this author
+ $sys_disabled = true;
+
+ if(! get_config('system','disable_discover_tab')) {
+ $sys_disabled = get_config('system','disable_diaspora_discover_tab');
+ }
+ $sys = (($sys_disabled) ? null : get_sys_channel());
+ // find everybody following or allowing this author
$r = q("SELECT * from channel where channel_id in ( SELECT abook_channel from abook left join xchan on abook_xchan = xchan_hash WHERE xchan_network like '%%diaspora%%' and xchan_addr = '%s' )",
dbesc($msg['author'])
@@ -29,6 +35,8 @@ function diaspora_dispatch_public($msg) {
logger('diaspora_public: delivering to: ' . $rr['channel_name'] . ' (' . $rr['channel_address'] . ') ');
diaspora_dispatch($rr,$msg);
}
+ if($sys)
+ diaspora_dispatch($sys,$msg);
}
else
logger('diaspora_public: no subscribers');
diff --git a/include/items.php b/include/items.php
index 70802404a..756625d85 100755
--- a/include/items.php
+++ b/include/items.php
@@ -2852,12 +2852,27 @@ function tag_deliver($uid,$item_id) {
if(preg_match($pattern,$body,$matches))
$tagged = true;
- $pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'] . '+','/') . '\[\/zrl\]/';
- if(preg_match($pattern,$body,$matches))
- $plustagged = true;
+ $pattern = '/@\!?\[zrl\=(.*?)\](.*?)\+\[\/zrl\]/';
+
+ if(preg_match_all($pattern,$body,$matches,PREG_SET_ORDER)) {
+ $max_forums = get_config('system','max_tagged_forums');
+ if(! $max_forums)
+ $max_forums = 2;
+ $matched_forums = 0;
+ foreach($matches as $match) {
+ $matched_forums ++;
+ if($term['url'] === $match[1] && $term['term'] === $match[2]) {
+ if($matched_forums <= $max_forums) {
+ $plustagged = true;
+ break;
+ }
+ logger('forum ' . $term['term'] . ' exceeded max_tagged_forums - ignoring');
+ }
+ }
+ }
if(! ($tagged || $plustagged)) {
- logger('tag_deliver: mention was in a reshare - ignoring');
+ logger('tag_deliver: mention was in a reshare or exceeded max_tagged_forums - ignoring');
return;
}
@@ -2974,6 +2989,7 @@ function tgroup_check($uid,$item) {
}
}
+
if($mention) {
logger('tgroup_check: mention found for ' . $u[0]['channel_name']);
}
@@ -2982,6 +2998,7 @@ function tgroup_check($uid,$item) {
// At this point we've determined that the person receiving this post was mentioned in it.
// Now let's check if this mention was inside a reshare so we don't spam a forum
+ // note: $term has been set to the matching term
$body = $item['body'];
@@ -2993,14 +3010,35 @@ function tgroup_check($uid,$item) {
$body = preg_replace('/\[share(.*?)\[\/share\]/','',$body);
- $pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'] . '+','/') . '\[\/zrl\]/';
+
+// $pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'] . '+','/') . '\[\/zrl\]/';
+
+ $pattern = '/@\!?\[zrl\=(.*?)\](.*?)\+\[\/zrl\]/';
+
+ $found = false;
+
+ if(preg_match_all($pattern,$body,$matches,PREG_SET_ORDER)) {
+ $max_forums = get_config('system','max_tagged_forums');
+ if(! $max_forums)
+ $max_forums = 2;
+ $matched_forums = 0;
+ foreach($matches as $match) {
+ $matched_forums ++;
+ if($term['url'] === $match[1] && $term['term'] === $match[2]) {
+ if($matched_forums <= $max_forums) {
+ $found = true;
+ break;
+ }
+ logger('forum ' . $term['term'] . ' exceeded max_tagged_forums - ignoring');
+ }
+ }
+ }
- if(! preg_match($pattern,$body,$matches)) {
- logger('tgroup_check: mention was in a reshare - ignoring');
+ if(! $found) {
+ logger('tgroup_check: mention was in a reshare or exceeded max_tagged_forums - ignoring');
return false;
}
-
return true;
}
diff --git a/include/zot.php b/include/zot.php
index 2fcada429..33ac16abf 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -1485,7 +1485,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
// As a side effect we will also do a preliminary check that we have the top-level-post, otherwise
// processing it is pointless.
- $r = q("select route from item where mid = '%s' and uid = %d limit 1",
+ $r = q("select route, id from item where mid = '%s' and uid = %d limit 1",
dbesc($arr['parent_mid']),
intval($channel['channel_id'])
);
@@ -1524,7 +1524,7 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
// sent it to us originally. Ignore it if it came from another source
// (with potentially different permissions).
// only compare the last hop since it could have arrived at the last location any number of ways.
- // Always accept empty routes.
+ // Always accept empty routes and firehose items (route contains 'undefined') .
$existing_route = explode(',', $r[0]['route']);
$routes = count($existing_route);
@@ -1536,6 +1536,9 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
$last_hop = '';
$last_prior_route = '';
}
+
+ if(in_array('undefined',$existing_route) || $last_hop == 'undefined' || $sender['hash'] == 'undefined')
+ $last_hop = '';
$current_route = (($arr['route']) ? $arr['route'] . ',' : '') . $sender['hash'];