Merge branch 'master' into pocorate

This commit is contained in:
friendica 2015-01-28 16:06:36 -08:00
commit da842da683
9 changed files with 75 additions and 21 deletions

View File

@ -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(

View File

@ -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');

View File

@ -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,13 +3010,34 @@ function tgroup_check($uid,$item) {
$body = preg_replace('/\[share(.*?)\[\/share\]/','',$body);
$pattern = '/@\!?\[zrl\=' . preg_quote($term['url'],'/') . '\]' . preg_quote($term['term'] . '+','/') . '\[\/zrl\]/';
if(! preg_match($pattern,$body,$matches)) {
logger('tgroup_check: mention was in a reshare - ignoring');
return false;
// $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(! $found) {
logger('tgroup_check: mention was in a reshare or exceeded max_tagged_forums - ignoring');
return false;
}
return true;

View File

@ -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);
@ -1537,6 +1537,9 @@ function process_delivery($sender,$arr,$deliveries,$relay,$public = false,$reque
$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'];
if($last_hop && $last_hop != $sender['hash']) {

View File

@ -33,7 +33,7 @@ function acl_init(&$a){
$sql_extra2 = "AND ( xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " OR xchan_addr LIKE " . protect_sprintf( "'%" . dbesc($search) . ((strpos($search,'@') === false) ? "%@%'" : "%'")) . ") ";
// This horrible mess is needed because position also returns 0 if nothing is found. W/ould be MUCH easier if it instead returned a very large value
// Otherwise we could just order by LEAST(POSTION($search IN xchan_name),POSITION($search IN xchan_addr)).
// Otherwise we could just order by LEAST(POSITION($search IN xchan_name),POSITION($search IN xchan_addr)).
$order_extra2 = "CASE WHEN xchan_name LIKE " . protect_sprintf( "'%" . dbesc($search) . "%'" ) ." then POSITION('".dbesc($search)."' IN xchan_name) else position('".dbesc($search)."' IN xchan_addr) end, ";
$col = ((strpos($search,'@') !== false) ? 'xchan_addr' : 'xchan_name' );
$sql_extra3 = "AND $col like " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " ";
@ -171,6 +171,7 @@ function acl_init(&$a){
);
}
elseif(($type == 'a') || ($type == 'p')) {
$r = q("SELECT abook_id as id, xchan_name as name, xchan_hash as hash, xchan_addr as nick, xchan_photo_s as micro, xchan_network as network, xchan_url as url, xchan_addr as attag , abook_their_perms FROM abook left join xchan on abook_xchan = xchan_hash
WHERE abook_channel = %d
and not (xchan_flags & %d)>0
@ -180,6 +181,7 @@ function acl_init(&$a){
intval(XCHAN_FLAGS_DELETED)
);
}
elseif($type == 'x') {
$r = navbar_complete($a);
@ -209,7 +211,7 @@ function acl_init(&$a){
foreach($r as $g){
// remove RSS feeds from ACLs - they are inaccessible
if(strpos($g['hash'],'/'))
if(strpos($g['hash'],'/') && $type != 'a')
continue;
if(($g['abook_their_perms'] & PERMS_W_TAGWALL) && $type == 'c' && (! $noforums)) {
@ -233,7 +235,7 @@ function acl_init(&$a){
"id" => $g['id'],
"xid" => $g['hash'],
"link" => $g['nick'],
"nick" => substr($g['nick'],0,strpos($g['nick'],'@')),
"nick" => (($g['nick']) ? substr($g['nick'],0,strpos($g['nick'],'@')) : t('RSS')),
"self" => (($g['abook_flags'] & ABOOK_FLAG_SELF) ? 'abook-self' : ''),
"taggable" => '',
"label" => '',
@ -249,6 +251,8 @@ function acl_init(&$a){
'items' => $items,
);
echo json_encode($o);
killme();

View File

@ -53,7 +53,7 @@ function share_init(&$a) {
"' avatar='".$r[0]['author']['xchan_photo_s'].
"' link='".$r[0]['plink'].
"' posted='".$r[0]['created'].
"' message_id='".$r[0]['mid']."']\n";
"' message_id='".$r[0]['mid']."']";
if($r[0]['title'])
$o .= '[b]'.$r[0]['title'].'[/b]'."\n";
$o .= $r[0]['body'];

View File

@ -1 +1 @@
2015-01-27.929
2015-01-28.930

View File

@ -1,6 +1,6 @@
Hallo {{$username}},
auf {{$sitename} wurde eine Rücksetzung Deines Passwortes angefordert.
auf {{$sitename}} wurde eine Rücksetzung Deines Passwortes angefordert.
Bitte klicke auf den Link unten, um diese Anforderung zu bestätigen,
oder kopiere den Link und füge ihn in die Adresszeile Deines Browsers ein.
@ -27,6 +27,4 @@ Username: {{$email}}
Viele Grüße,
der Administrator von {{$sitename}}
der Administrator von {{$sitename}}

View File

@ -1,7 +1,9 @@
<div class="section-title-wrapper">
{{if $actionspanel}}
<div class="pull-right">
{{if $is_owner}}
<a href="/sharedwithme" class="btn btn-xs btn-default"><i class="icon-cloud-download"></i>&nbsp;{{$shared}}</a>
{{/if}}
<button id="files-create-btn" class="btn btn-xs btn-primary" title="{{if $quota.limit || $quota.used}}{{$quota.desc}}{{/if}}" onclick="openClose('files-mkdir-tools'); closeMenu('files-upload-tools');"><i class="icon-folder-close-alt"></i>&nbsp;{{$create}}</button>
<button id="files-upload-btn" class="btn btn-xs btn-success" title="{{if $quota.limit || $quota.used}}{{$quota.desc}}{{/if}}" onclick="openClose('files-upload-tools'); closeMenu('files-mkdir-tools');"><i class="icon-upload"></i>&nbsp;{{$upload}}</button>
</div>