Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge

This commit is contained in:
zotlabs 2017-09-19 13:09:19 -07:00
commit 51e40add66
11 changed files with 96 additions and 29 deletions

View file

@ -1,3 +1,11 @@
Hubzilla 2.6.3 (2017-09-18)
- Fix anonymous comments/likes on photos - this is not yet implemented
- Fix favicon not displayed on certain pages
- Fix hubzilla logo icon for favicon and email notifications
- Fix an issue with displaying selected theme in settings/display
- [SECURITY] Restrict the input characters we accept in token verification strings to hex digits
- Remove hubzilla.nl from fallback directory servers
Hubzilla 2.6.2 (2017-08-31)
- Fix webfinger returns invalid XML (github issue #851)

View file

@ -59,6 +59,8 @@ require_once('include/bbcode.php');
*
* ZOT
* permission_create abook_id
* permission_accept abook_id
* permission_reject abook_id
* permission_update abook_id
* refresh_all channel_id
* purge_all channel_id
@ -159,7 +161,7 @@ class Notifier {
$packet_type = 'keychange';
$normal_mode = false;
}
elseif($cmd == 'permission_update' || $cmd == 'permission_create') {
elseif($cmd == 'permission_update' || $cmd == 'permission_reject' || $cmd == 'permission_accept' || $cmd == 'permission_create') {
// Get the (single) recipient
$r = q("select * from abook left join xchan on abook_xchan = xchan_hash where abook_id = %d and abook_self = 0",
intval($item_id)
@ -171,8 +173,12 @@ class Notifier {
if($channel) {
$perm_update = array('sender' => $channel, 'recipient' => $r[0], 'success' => false, 'deliveries' => '');
if($cmd == 'permission_create')
if($cmd === 'permission_create')
call_hooks('permissions_create',$perm_update);
elseif($cmd === 'permission_accept')
call_hooks('permissions_accept',$perm_update);
elseif($cmd === 'permission_reject')
call_hooks('permissions_reject',$perm_update);
else
call_hooks('permissions_update',$perm_update);

View file

@ -17,6 +17,7 @@ class ActivityStreams {
public $ldsig = null;
public $sigok = false;
public $recips = null;
public $raw_recips = null;
function __construct($string) {
@ -53,13 +54,21 @@ class ActivityStreams {
return $this->valid;
}
function set_recips($arr) {
$this->saved_recips = $arr;
}
function collect_recips($base = '',$namespace = 'https://www.w3.org/ns/activitystreams') {
$x = [];
$fields = [ 'to','cc','bto','bcc','audience'];
foreach($fields as $f) {
$y = $this->get_compound_property($f,$base,$namespace);
if($y)
if($y) {
$x = array_merge($x,$y);
if(! is_array($this->raw_recips))
$this->raw_recips = [];
$this->raw_recips[$f] = $x;
}
}
// not yet ready for prime time
// $x = $this->expand($x,$base,$namespace);

View file

@ -135,6 +135,18 @@ class NativeWiki {
$item_id = $update['item_id'];
// update acl for any existing wiki pages
q("update item set allow_cid = '%s', allow_gid = '%s', deny_cid = '%s', deny_gid = '%s', item_private = %d where resource_type = 'nwikipage' and resource_id = '%s'",
dbesc($item['allow_cid']),
dbesc($item['allow_gid']),
dbesc($item['deny_cid']),
dbesc($item['deny_gid']),
dbesc($item['item_private']),
dbesc($arr['resource_id'])
);
if($update['item_id']) {
info( t('Wiki updated successfully'));
if($update_title) {
@ -160,6 +172,12 @@ class NativeWiki {
dbesc($resource_id)
);
if($r) {
$q = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s'",
dbesc($r[0]['resource_type'])
);
if($q) {
$r = array_merge($r,$q);
}
xchan_query($r);
$sync_item = fetch_post_tags($r);
build_sync_packet($uid,array('wiki' => array(encode_item($sync_item[0],true))));

View file

@ -21,7 +21,7 @@ class NativeWikiPage {
$sql_extra = item_permissions_sql($channel_id,$observer_hash);
$r = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s' and uid = %d and item_deleted = 0
$sql_extra order by created asc",
$sql_extra order by title asc",
dbesc($resource_id),
intval($channel_id)
);
@ -74,6 +74,7 @@ class NativeWikiPage {
$arr['uid'] = $channel_id;
$arr['author_xchan'] = $observer_hash;
$arr['mimetype'] = $mimetype;
$arr['title'] = $name;
$arr['resource_type'] = 'nwikipage';
$arr['resource_id'] = $resource_id;
$arr['allow_cid'] = $w['wiki']['allow_cid'];
@ -139,8 +140,14 @@ class NativeWikiPage {
if($ic) {
foreach($ic as $c) {
set_iconfig($c['item_id'],'nwikipage','pagetitle',$pageNewName);
$ids[] = $c['item_id'];
}
$str_ids = implode(',', $ids);
q("update item set title = '%s' where id in ($str_ids)",
dbesc($pageNewName)
);
$page = [
'rawName' => $pageNewName,
'htmlName' => escape_tags($pageNewName),

View file

@ -21,7 +21,7 @@ class Acl extends \Zotlabs\Web\Controller {
function init() {
// logger('mod_acl: ' . print_r($_REQUEST,true));
logger('mod_acl: ' . print_r($_REQUEST,true));
$start = (x($_REQUEST,'start') ? $_REQUEST['start'] : 0);
$count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 500);
@ -307,7 +307,7 @@ class Acl extends \Zotlabs\Web\Controller {
$contacts[] = array(
"photo" => $g['photo'],
"name" => $g['name'],
"nick" => $g['address'],
"nick" => $g['address']
);
}
}
@ -330,7 +330,12 @@ class Acl extends \Zotlabs\Web\Controller {
continue;
$g['hash'] = urlencode($g['hash']);
if(! $g['nick']) {
$t = explode(' ',strtolower($g['name']));
$g['nick'] = $t[0] . '@';
}
if(in_array($g['hash'],$permitted) && $type == 'c' && (! $noforums)) {
$contacts[] = array(
"type" => "c",

View file

@ -1041,7 +1041,7 @@ class Photos extends \Zotlabs\Web\Controller {
$likebuttons = '';
if($can_post || $can_comment) {
if($observer && ($can_post || $can_comment)) {
$likebuttons = [
'id' => $link_item['id'],
'likethis' => t("I like this \x28toggle\x29"),
@ -1053,7 +1053,7 @@ class Photos extends \Zotlabs\Web\Controller {
$comments = '';
if(! count($r)) {
if($can_post || $can_comment) {
if($observer && ($can_post || $can_comment)) {
$commentbox = replace_macros($cmnt_tpl,array(
'$return_path' => '',
'$mode' => 'photos',
@ -1172,7 +1172,7 @@ class Photos extends \Zotlabs\Web\Controller {
}
if($can_post || $can_comment) {
if($observer && ($can_post || $can_comment)) {
$commentbox = replace_macros($cmnt_tpl,array(
'$return_path' => '',
'$jsreload' => $return_url,

View file

@ -140,11 +140,16 @@ class Wiki extends \Zotlabs\Web\Controller {
$zip = new \ZipArchive;
$r = $zip->open($zip_filepath, \ZipArchive::CREATE);
if($r === true) {
$i = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s'",
$pages = [];
$i = q("select * from item where resource_type = 'nwikipage' and resource_id = '%s' order by revision desc",
dbesc($resource_id)
);
if($i) {
foreach($i as $iv) {
if(in_array($iv['mid'],$pages))
continue;
if($iv['mimetype'] === 'text/plain') {
$content = html_entity_decode($iv['body'],ENT_COMPAT,'UTF-8');
}
@ -156,6 +161,7 @@ class Wiki extends \Zotlabs\Web\Controller {
}
$fname = get_iconfig($iv['id'],'nwikipage','pagetitle') . Zlib\NativeWikiPage::get_file_ext($iv);
$zip->addFromString($fname,$content);
$pages[] = $iv['mid'];
}

View file

@ -811,6 +811,7 @@ function feed_get_reshare(&$res,$item) {
}
$attach = $share['links'];
if($attach) {
foreach($attach as $att) {
if($att['rel'] === 'alternate') {
@ -845,6 +846,10 @@ function feed_get_reshare(&$res,$item) {
}
}
if((! $body) && ($share['alternate'])) {
$body = $share['alternate'];
}
$res['body'] = "[share author='" . urlencode($share['author']) .
"' profile='" . $share['profile'] .
"' avatar='" . $share['avatar'] .
@ -1706,7 +1711,7 @@ function compat_photos_list($s) {
$found = preg_match_all('/\[[zi]mg(.*?)\](.*?)\[/ism',$s,$matches,PREG_SET_ORDER);
if($found) {
foreach($matches as $match) {
foreach($matches as $match) {
$ret[] = [
'href' => $match[2],
'length' => 0,

View file

@ -2498,6 +2498,9 @@ function tag_deliver($uid, $item_id) {
$pattern = '/@\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\+\[\/zrl\]/';
// statusnet style group tags
$pattern2 = '/^|[^@]\!\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\+\[\/zrl\]/';
if(preg_match_all($pattern,$body,$matches,PREG_SET_ORDER)) {
$max_forums = get_config('system','max_tagged_forums');
if(! $max_forums)

View file

@ -3,23 +3,6 @@
{{/if}}
<h3>{{$header}}</h3>
<ul class="nav nav-pills flex-column">
{{if $canadd}}
<li class="nav-item"><a class="nav-link" href="#" onclick="wiki_show_new_page_form(); return false;"><i class="fa fa-plus-circle"></i>&nbsp;{{$addnew}}</a></li>
{{/if}}
{{if $canadd}}
<div id="new-page-form-wrapper" class="sub-menu" style="display:none;">
<form id="new-page-form" action="wiki/{{$channel_address}}/create/page" method="post" >
<input type="hidden" name="resource_id" value="{{$resource_id}}">
{{if $typelock}}
<input type="hidden" name="mimetype" value="{{$lockedtype}}">
{{else}}
{{$mimetype}}
{{/if}}
{{include file="field_input.tpl" field=$pageName}}
<button id="new-page-submit" class="btn btn-primary" type="submit" name="submit" >Submit</button>
</form>
</div>
{{/if}}
{{if $pages}}
{{foreach $pages as $page}}
<li class="nav-item nav-item-hack" id="{{$page.link_id}}">
@ -30,6 +13,23 @@
</li>
{{/foreach}}
{{/if}}
{{if $canadd}}
<li class="nav-item"><a class="nav-link" href="#" onclick="wiki_show_new_page_form(); return false;"><i class="fa fa-plus-circle"></i>&nbsp;{{$addnew}}</a></li>
{{/if}}
{{if $canadd}}
<div id="new-page-form-wrapper" class="sub-menu" style="display:none;">
<form id="new-page-form" action="wiki/{{$channel_address}}/create/page" method="post" >
<input type="hidden" name="resource_id" value="{{$resource_id}}">
{{if $typelock}}
<input id="id_mimetype" type="hidden" name="mimetype" value="{{$lockedtype}}">
{{else}}
{{$mimetype}}
{{/if}}
{{include file="field_input.tpl" field=$pageName}}
<button id="new-page-submit" class="btn btn-primary" type="submit" name="submit" >Submit</button>
</form>
</div>
{{/if}}
</ul>
{{if ! $refresh}}
</div>