diff options
-rw-r--r-- | include/RedDAV/RedBrowser.php | 3 | ||||
-rwxr-xr-x | include/diaspora.php | 10 | ||||
-rwxr-xr-x | include/items.php | 54 | ||||
-rw-r--r-- | include/zot.php | 7 | ||||
-rw-r--r-- | mod/acl.php | 10 | ||||
-rw-r--r-- | mod/share.php | 2 | ||||
-rw-r--r-- | version.inc | 2 | ||||
-rw-r--r-- | view/de/lostpass_eml.tpl | 6 | ||||
-rw-r--r-- | view/tpl/cloud_header.tpl | 2 |
9 files changed, 75 insertions, 21 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']; diff --git a/mod/acl.php b/mod/acl.php index d406942c3..8eff93a9a 100644 --- a/mod/acl.php +++ b/mod/acl.php @@ -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" => '', @@ -248,6 +250,8 @@ function acl_init(&$a){ 'count' => $count, 'items' => $items, ); + + echo json_encode($o); diff --git a/mod/share.php b/mod/share.php index 78a25ee10..d70336ed1 100644 --- a/mod/share.php +++ b/mod/share.php @@ -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']; diff --git a/version.inc b/version.inc index f140c0f66..8b85b7799 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2015-01-27.929 +2015-01-28.930 diff --git a/view/de/lostpass_eml.tpl b/view/de/lostpass_eml.tpl index 2175d2e5d..02a71b77a 100644 --- a/view/de/lostpass_eml.tpl +++ b/view/de/lostpass_eml.tpl @@ -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}} - -
\ No newline at end of file +der Administrator von {{$sitename}} diff --git a/view/tpl/cloud_header.tpl b/view/tpl/cloud_header.tpl index 403323085..c75815d07 100644 --- a/view/tpl/cloud_header.tpl +++ b/view/tpl/cloud_header.tpl @@ -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> {{$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> {{$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> {{$upload}}</button> </div> |