Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Haakon Meland Eriksen 2016-02-27 11:24:02 +01:00
commit cf5383fdbe
25 changed files with 1177 additions and 1167 deletions

View file

@ -41,9 +41,10 @@ class Receiver {
if(! $this->messagetype)
$this->error = true;
$this->sender = ((array_key_exists('sender',$this->data)) ? $this->data['sender'] : null);
$this->recipients = ((array_key_exists('recipients',$this->data)) ? $this->data['recipients'] : null);
if($this->data) {
$this->sender = ((array_key_exists('sender',$this->data)) ? $this->data['sender'] : null);
$this->recipients = ((array_key_exists('recipients',$this->data)) ? $this->data['recipients'] : null);
}
if($this->sender)
$this->ValidateSender();

View file

@ -17,7 +17,6 @@ We need much more than this, but here are areas where developers can help. Pleas
[li]Integrate the "open site" list with the register page[/li]
[li]Support comments and member notes on documentation pages (to achieve an effect similar to php.net)[/li]
[li]Support comments on webpages[/li]
[li]implement oembed provider interface[/li]
[li]refactor the oembed client interface so that we can safely sandbox remote content[/li]
[li]Write more webpage layouts[/li]
[li]Write more webpage widgets[/li]

View file

@ -1313,7 +1313,7 @@ function attach_delete($channel_id, $resource, $is_photo = 0) {
intval($channel_id)
);
file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', $notify=0);
file_activity($channel_id, $object, $object['allow_cid'], $object['allow_gid'], $object['deny_cid'], $object['deny_gid'], 'update', $notify=1);
}
/**
@ -1557,6 +1557,8 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$u_arr_deny_cid = array_unique(array_merge($arr_deny_cid, expand_acl($object['deny_cid'])));
$u_arr_deny_gid = array_unique(array_merge($arr_deny_gid, expand_acl($object['deny_gid'])));
$private = (($u_arr_allow_cid[0] || $u_arr_allow_gid[0] || $u_arr_deny_cid[0] || $u_arr_deny_gid[0]) ? 1 : 0);
$u_mid = item_message_id();
$arr['aid'] = get_account_id();
@ -1566,13 +1568,12 @@ function file_activity($channel_id, $object, $allow_cid, $allow_gid, $deny_cid,
$arr['author_xchan'] = $poster['xchan_hash'];
$arr['owner_xchan'] = $poster['xchan_hash'];
$arr['title'] = '';
//updates should be visible to everybody -> perms may have changed
$arr['allow_cid'] = '';
$arr['allow_gid'] = '';
$arr['deny_cid'] = '';
$arr['deny_gid'] = '';
$arr['allow_cid'] = perms2str($u_arr_allow_cid);
$arr['allow_gid'] = perms2str($u_arr_allow_gid);
$arr['deny_cid'] = perms2str($u_arr_deny_cid);
$arr['deny_gid'] = perms2str($u_arr_deny_gid);
$arr['item_hidden'] = 1;
$arr['item_private'] = 0;
$arr['item_private'] = $private;
$arr['verb'] = ACTIVITY_UPDATE;
$arr['obj_type'] = $objtype;
$arr['object'] = $u_jsonobject;
@ -1705,7 +1706,7 @@ function recursive_activity_recipients($arr_allow_cid, $arr_allow_gid, $arr_deny
//turn allow_gid into allow_cid's
foreach($arr_allow_gid as $gid) {
$in_group = in_group($gid);
$in_group = group_get_members($gid);
$arr_allow_cid = array_unique(array_merge($arr_allow_cid, $in_group));
}
@ -1727,7 +1728,7 @@ function recursive_activity_recipients($arr_allow_cid, $arr_allow_gid, $arr_deny
* */
if($parent_arr['allow_gid']) {
foreach($parent_arr['allow_gid'][$count] as $gid) {
$in_group = in_group($gid);
$in_group = group_get_members($gid);
$parent_arr['allow_cid'][$count] = array_unique(array_merge($parent_arr['allow_cid'][$count], $in_group));
}
}
@ -1808,31 +1809,6 @@ function recursive_activity_recipients($arr_allow_cid, $arr_allow_gid, $arr_deny
return $ret;
}
/**
* @brief Returns members of a group.
*
* @param int $group_id id of the group to look up
*/
function in_group($group_id) {
$group_members = array();
/** @TODO make these two queries one with a join. */
$x = q("SELECT id FROM groups WHERE hash = '%s'",
dbesc($group_id)
);
$r = q("SELECT xchan FROM group_member WHERE gid = %d",
intval($x[0]['id'])
);
foreach($r as $ig) {
$group_members[] = $ig['xchan'];
}
return $group_members;
}
function filepath_macro($s) {
return str_replace(

View file

@ -1599,7 +1599,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
$uid = (($a->profile['profile_uid']) ? $a->profile['profile_uid'] : local_channel());
if($uid == local_channel()) {
$cal_link = '/events';
$cal_link = '';
}
else {
$cal_link = '/cal/' . $nickname;
@ -1653,7 +1653,7 @@ function profile_tabs($a, $is_owner = false, $nickname = null){
);
}
if($p['view_stream']) {
if($p['view_stream'] && $cal_link) {
$tabs[] = array(
'label' => t('Events'),
'url' => $a->get_baseurl() . $cal_link,

View file

@ -21,6 +21,21 @@ function rsa_verify($data,$sig,$key,$alg = 'sha256') {
if(intval(OPENSSL_ALGO_SHA256) && $alg === 'sha256')
$alg = OPENSSL_ALGO_SHA256;
$verify = openssl_verify($data,$sig,$key,$alg);
if(! $verify) {
logger('openssl_verify: ' . openssl_error_string(),LOGGER_NORMAL,LOG_ERR);
logger('openssl_verify: key: ' . $key, LOGGER_DEBUG, LOG_ERR);
// provide a backtrace so that we can debug key issues
if(version_compare(PHP_VERSION, '5.4.0') >= 0) {
$stack = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
if($stack) {
foreach($stack as $s) {
logger('stack: ' . basename($s['file']) . ':' . $s['line'] . ':' . $s['function'] . '()',LOGGER_DEBUG,LOG_ERR);
}
}
}
}
return $verify;
}

View file

@ -549,7 +549,7 @@ function update_birthdays() {
$ev['event_xchan'] = $rr['xchan_hash'];
$ev['start'] = datetime_convert('UTC', 'UTC', $rr['abook_dob']);
$ev['finish'] = datetime_convert('UTC', 'UTC', $rr['abook_dob'] . ' + 1 day ');
$ev['adjust'] = 1;
$ev['adjust'] = intval(feature_enabled($rr['abook_channel'],'smart_birthdays'));
$ev['summary'] = sprintf( t('%1$s\'s birthday'), $rr['xchan_name']);
$ev['description'] = sprintf( t('Happy Birthday %1$s'),
'[zrl=' . $rr['xchan_url'] . ']' . $rr['xchan_name'] . '[/zrl]') ;

View file

@ -440,6 +440,17 @@ function event_addtocal($item_id, $uid) {
$ev['event_hash'] = $item['resource_id'];
}
if($ev->private)
$ev['allow_cid'] = '<' . $channel['channel_hash'] . '>';
else {
$acl = new Zotlabs\Access\AccessList($channel);
$x = $acl->get();
$ev['allow_cid'] = $x['allow_cid'];
$ev['allow_gid'] = $x['allow_gid'];
$ev['deny_cid'] = $x['deny_cid'];
$ev['deny_gid'] = $x['deny_gid'];
}
$event = event_store_event($ev);
if($event) {
$r = q("update item set resource_id = '%s', resource_type = 'event' where id = %d and uid = %d",

View file

@ -57,6 +57,7 @@ function get_features($filtered = true) {
array('nav_channel_select', t('Navigation Channel Select'), t('Change channels directly from within the navigation dropdown menu'),false,get_config('feature_lock','nav_channel_select')),
array('photo_location', t('Photo Location'), t('If location data is available on uploaded photos, link this to a map.'),false,get_config('feature_lock','photo_location')),
array('smart_birthdays', t('Smart Birthdays'), t('Make birthday events timezone aware in case your friends are scattered across the planet.'),true,get_config('feature_lock','smart_birthdays')),
array('expert', t('Expert Mode'), t('Enable Expert Mode to provide advanced configuration options'),false,get_config('feature_lock','expert')),
array('premium_channel', t('Premium Channel'), t('Allows you to set restrictions and terms on those that connect with your channel'),false,get_config('feature_lock','premium_channel')),
),

View file

@ -200,7 +200,7 @@ function group_get_members($gid) {
if(intval($gid)) {
$r = q("SELECT * FROM `group_member`
LEFT JOIN abook ON abook_xchan = `group_member`.`xchan` left join xchan on xchan_hash = abook_xchan
WHERE `gid` = %d AND abook_channel = %d and `group_member`.`uid` = %d and xchan_deleted = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ",
WHERE `gid` = %d AND abook_channel = %d and `group_member`.`uid` = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 ORDER BY xchan_name ASC ",
intval($gid),
intval(local_channel()),
intval(local_channel())

View file

@ -1237,10 +1237,6 @@ function advanced_profile(&$a) {
if(! perm_is_allowed($a->profile['profile_uid'],get_observer_hash(),'view_profile'))
return '';
$o = '';
$o .= '<h2>' . t('Profile') . '</h2>';
if($a->profile['name']) {
$tpl = get_markup_template('profile_advanced.tpl');
@ -1351,6 +1347,10 @@ function advanced_profile(&$a) {
$profile['extra_fields'] = $a->profile['extra_fields'];
}
$is_owner = (($a->profile['profile_uid'] == local_channel()) ? true : false);
$edit = (($is_owner) ? array('link' => $a->get_baseurl() . '/profiles/' . $a->profile['profile_uid'], 'label' => t('Edit')) : '');
$things = get_things($a->profile['profile_guid'],$a->profile['profile_uid']);
// logger('mod_profile: things: ' . print_r($things,true), LOGGER_DATA);
@ -1360,6 +1360,7 @@ function advanced_profile(&$a) {
'$canlike' => (($profile['canlike'])? true : false),
'$likethis' => t('Like this thing'),
'$profile' => $profile,
'$edit' => $edit,
'$things' => $things
));
}
@ -1831,8 +1832,7 @@ function get_zcard($channel,$observer_hash = '',$args = array()) {
$cover['href'] = z_root() . '/photo/' . $r[0]['resource_id'] . '-' . $r[0]['scale'];
}
else {
// @fixme remove this when we have a fallback cover photo and use that instead.
return;
$cover = $pphoto;
}
$o .= replace_macros(get_markup_template('zcard.tpl'),array(

View file

@ -296,7 +296,7 @@ function photo_upload($channel, $observer, $args) {
$photo_link = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/image/' . $photo_hash . ']' . t('a new photo') . '[/zrl]';
$album_link = '[zrl=' . z_root() . '/photos/album/' . bin2hex($album) . ']' . $album . '[/zrl]';
$album_link = '[zrl=' . z_root() . '/photos/' . $channel['channel_address'] . '/album/' . bin2hex($album) . ']' . $album . '[/zrl]';
$activity_format = sprintf(t('%1$s posted %2$s to %3$s','photo_upload'), $author_link, $photo_link, $album_link);

View file

@ -126,7 +126,7 @@ function queue_deliver($outq, $immediate = false) {
remove_queue_item($outq['outq_hash']);
// server is responding - see if anything else is going to this destination and is piled up
// and try to send some more. We're relying on the fact that delivery_loop() results in an
// and try to send some more. We're relying on the fact that do_delivery() results in an
// immediate delivery otherwise we could get into a queue loop.
if(! $immediate) {
@ -141,7 +141,7 @@ function queue_deliver($outq, $immediate = false) {
}
}
if($piled_up) {
delivery_loop($piled_up);
do_delivery($piled_up);
}
}
}

View file

@ -124,12 +124,12 @@ session_set_save_handler(
// Force cookies to be secure (https only) if this site is SSL enabled. Must be done before session_start().
if(intval($a->config['system']['ssl_cookie_protection'])) {
if(intval(get_app()->config['system']['ssl_cookie_protection'])) {
$arr = session_get_cookie_params();
session_set_cookie_params(
((isset($arr['lifetime'])) ? $arr['lifetime'] : 0),
((isset($arr['path'])) ? $arr['path'] : '/'),
((isset($arr['domain'])) ? $arr['domain'] : $a->get_hostname()),
((isset($arr['domain'])) ? $arr['domain'] : get_app()->get_hostname()),
((isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on') ? true : false),
((isset($arr['httponly'])) ? $arr['httponly'] : true));
}

View file

@ -1444,7 +1444,7 @@ function prepare_body(&$item,$attach = false) {
call_hooks('prepare_body_init', $item);
$s = '';
$photo = '';
$is_photo = ((($item['verb'] === ACTIVITY_POST) && ($item['obj_type'] === ACTIVITY_OBJ_PHOTO)) ? true : false);
@ -1454,7 +1454,7 @@ function prepare_body(&$item,$attach = false) {
// if original photo width is <= 640px prepend it to item body
if($object['link'][0]['width'] && $object['link'][0]['width'] <= 640) {
$s = '<div class="inline-photo-item-wrapper"><a href="' . zid(rawurldecode($object['id'])) . '" target="_blank"><img class="inline-photo-item" style="max-width:' . $object['link'][0]['width'] . 'px; width:100%; height:auto;" src="' . zid(rawurldecode($object['link'][0]['href'])) . '"></a></div>' . $s;
$s .= '<div class="inline-photo-item-wrapper"><a href="' . zid(rawurldecode($object['id'])) . '" target="_blank"><img class="inline-photo-item" style="max-width:' . $object['link'][0]['width'] . 'px; width:100%; height:auto;" src="' . zid(rawurldecode($object['link'][0]['href'])) . '"></a></div>' . $s;
}
// if original photo width is > 640px make it a cover photo
@ -1464,7 +1464,7 @@ function prepare_body(&$item,$attach = false) {
}
}
$s = prepare_text($item['body'],$item['mimetype'], false);
$s .= prepare_text($item['body'],$item['mimetype'], false);
$event = (($item['obj_type'] === ACTIVITY_OBJ_EVENT) ? format_event($item['object']) : false);

View file

@ -80,12 +80,14 @@ function cal_content(&$a) {
$o = '';
$tabs = profile_tabs($a, True, $channel['channel_address']);
$mode = 'view';
$y = 0;
$m = 0;
$ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : '');
logger('args: ' . print_r($a->argv,true));
// logger('args: ' . print_r($a->argv,true));
if(argc() > 3 && intval(argv(2)) && intval(argv(3))) {
$mode = 'view';
@ -333,6 +335,7 @@ logger('args: ' . print_r($a->argv,true));
'$today' => t('Today'),
'$form' => $form,
'$expandform' => ((x($_GET,'expandform')) ? true : false),
'$tabs' => $tabs
));
if (x($_GET,'id')){ echo $o; killme(); }

View file

@ -299,7 +299,7 @@ function events_content(&$a) {
$ignored = ((x($_REQUEST,'ignored')) ? " and ignored = " . intval($_REQUEST['ignored']) . " " : '');
logger('args: ' . print_r($a->argv,true));
// logger('args: ' . print_r($a->argv,true));

View file

@ -117,7 +117,7 @@ function group_content(&$a) {
check_form_security_token_ForbiddenOnErr('group_member_change', 't');
$r = q("SELECT abook_xchan from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d and xchan_deleted = 0 and abook_blocked = 0 and abook_pending = 0 limit 1",
$r = q("SELECT abook_xchan from abook left join xchan on abook_xchan = xchan_hash where abook_xchan = '%s' and abook_channel = %d and xchan_deleted = 0 and abook_self = 0 and abook_blocked = 0 and abook_pending = 0 limit 1",
dbesc(base64url_decode(argv(2))),
intval(local_channel())
);
@ -208,7 +208,7 @@ function group_content(&$a) {
group_rmv_member(local_channel(),$group['name'],$member['xchan_hash']);
}
$r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 order by xchan_name asc",
$r = q("SELECT abook.*, xchan.* FROM `abook` left join xchan on abook_xchan = xchan_hash WHERE `abook_channel` = %d AND abook_self = 0 and abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 order by xchan_name asc",
intval(local_channel())
);

View file

@ -107,13 +107,13 @@ function like_content(&$a) {
// to them.
$allow_cid = $allow_gid = $deny_cid = $deny_gid = '';
foreach($d as $dd) {
$allow_gid .= '<' . $dd['abook_xchan'] . '>';
$allow_cid .= '<' . $dd['abook_xchan'] . '>';
}
}
$post_type = t('channel');
$objtype = ACTIVITY_OBJ_PROFILE;
$profile = $r[0];
}
elseif($obj_type == 'thing') {
@ -462,6 +462,13 @@ function like_content(&$a) {
if($obj_type === 'thing' && $r[0]['imgurl']) {
$arr['body'] .= "\n\n[zmg=80x80]" . $r[0]['imgurl'] . '[/zmg]';
}
if($obj_type === 'profile') {
if($public) {
$arr['body'] .= "\n\n" . '[embed]' . z_root() . '/profile/' . $ch[0]['channel_address'] . '[/embed]';
}
else
$arr['body'] .= "\n\n[zmg=80x80]" . $profile['thumb'] . '[/zmg]';
}
$arr['verb'] = $activity;

View file

@ -39,4 +39,4 @@ function update_display_content(&$a) {
// logger('update_display: ' . $text);
killme();
}
}

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
2016-02-24.1317H
2016-02-26.1319H

View file

@ -1,3 +1,4 @@
{{$tabs}}
<div class="generic-content-wrapper">
<div class="section-title-wrapper">
<div class="pull-right">

View file

@ -1,4 +1,3 @@
<div class="wall-item-delete-wrapper" id="wall-item-delete-wrapper-{{$id}}" >
<a href="item/drop/{{$id}}" onclick="return confirmDelete();" title="{{$delete}}" ><i class="icon-trash drop-icons"></i></a>
<a class="btn btn-default btn-sm" href="#" onclick="dropItem('item/drop/{{$id}}', '#wall-item-outside-wrapper-{{$id}}'); return false;" title="{{$delete}}" ><i class="icon-trash"></i></a>
</div>
<div class="wall-item-delete-end"></div>

View file

@ -1,27 +1,34 @@
<div class="wall-item-outside-wrapper {{$indent}}" id="wall-item-outside-wrapper-{{$id}}" >
<div class="wall-item-content-wrapper {{$indent}}" id="wall-item-content-wrapper-{{$id}}" style="clear:both;">
<div class="wall-item-info" id="wall-item-info-{{$item.id}}" >
<div class="wall-item-photo-wrapper" id="wall-item-photo-wrapper-{{$id}}" >
<a href="{{$profile_url}}" title="View {{$name}}'s profile" class="wall-item-photo-link" id="wall-item-photo-link-{{$id}}">
<img src="{{$thumb}}" class="wall-item-photo" id="wall-item-photo-{{$id}}" style="height: 80px; width: 80px;" alt="{{$name}}" /></a>
<div class="wall-item-outside-wrapper{{if $indent}} {{$indent}}{{/if}}" id="wall-item-outside-wrapper-{{$id}}" >
<div class="wall-item-content-wrapper{{if $indent}} {{$indent}}{{/if}}" id="wall-item-content-wrapper-{{$id}}" style="clear:both;">
<div class="wall-item-head">
<div class="wall-item-info" id="wall-item-info-{{$id}}" >
<div class="wall-item-photo-wrapper" id="wall-item-photo-wrapper-{{$id}}" >
<a href="{{$profile_url}}" title="View {{$name}}'s profile" class="wall-item-photo-link" id="wall-item-photo-link-{{$id}}">
<img src="{{$thumb}}" class="wall-item-photo" id="wall-item-photo-{{$id}}" style="height: 80px; width: 80px;" alt="{{$name}}" /></a>
</div>
</div>
</div>
<div class="wall-item-wrapper" id="wall-item-wrapper-{{$id}}" >
<div class="wall-item-author">
<a href="{{$profile_url}}" title="View {{$name}}'s profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-name-{{$id}}" >{{$name}}</span></a>
<div class="wall-item-wrapper" id="wall-item-wrapper-{{$id}}" >
<div class="wall-item-author">
<a href="{{$profile_url}}" title="View {{$name}}'s profile" class="wall-item-name-link"><span class="wall-item-name" id="wall-item-name-{{$id}}" >{{$name}}</span></a>
</div>
<div class="wall-item-ago" id="wall-item-ago-{{$id}}">{{$ago}}</div>
</div>
<div class="wall-item-ago" id="wall-item-ago-{{$id}}">{{$ago}}</div>
</div>
<div class="wall-item-content" id="wall-item-content-{{$id}}" >
<div class="wall-item-title" id="wall-item-title-{{$id}}">{{$title}}</div>
<div class="wall-item-body" id="wall-item-body-{{$id}}" >{{$body}}</div>
</div>
{{$drop}}
<div class="wall-item-wrapper-end"></div>
{{if $drop}}
<div class="wall-item-tools" id="wall-item-tools-{{$id}}" >
<div class="wall-item-tools-right pull-right">
{{$drop}}
</div>
<div class="clear"></div>
</div>
{{/if}}
<div class="clear"></div>
{{$comment}}
<div class="clear{{if $indent}} {{$indent}}{{/if}}"></div>
</div>
</div>

View file

@ -12,6 +12,9 @@
<i class="icon-thumbs-up-alt" title="{{$profile.likethis}}"></i>
</button>
{{/if}}
{{if $edit}}
<a href="{{$edit.link}}" class="btn btn-primary btn-xs"><i class="icon-pencil"></i>&nbsp;{{$edit.label}}</a>
{{/if}}
</div>
<h2>{{$title}}</h2>
<div class="clear"></div>