aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorHaakon Meland Eriksen <haakon.eriksen@far.no>2016-02-27 11:24:02 +0100
committerHaakon Meland Eriksen <haakon.eriksen@far.no>2016-02-27 11:24:02 +0100
commitcf5383fdbe273af6b3858e216b313124fd125cf6 (patch)
treea220d55b6624c76421a6173aec785958103aa92a /include
parent21f2df399d3e21b6322ece16717efe88bcc21621 (diff)
parent6126070a1d53c3ef4f59c8a0a6160610ef16563c (diff)
downloadvolse-hubzilla-cf5383fdbe273af6b3858e216b313124fd125cf6.tar.gz
volse-hubzilla-cf5383fdbe273af6b3858e216b313124fd125cf6.tar.bz2
volse-hubzilla-cf5383fdbe273af6b3858e216b313124fd125cf6.zip
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include')
-rw-r--r--include/attach.php44
-rw-r--r--include/conversation.php4
-rw-r--r--include/crypto.php15
-rw-r--r--include/datetime.php2
-rw-r--r--include/event.php11
-rw-r--r--include/features.php1
-rw-r--r--include/group.php2
-rw-r--r--include/identity.php12
-rw-r--r--include/photos.php2
-rw-r--r--include/queue_fn.php4
-rw-r--r--include/session.php4
-rw-r--r--include/text.php6
12 files changed, 55 insertions, 52 deletions
diff --git a/include/attach.php b/include/attach.php
index 8595d5d86..10ff9f13f 100644
--- a/include/attach.php
+++ b/include/attach.php
@@ -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(
diff --git a/include/conversation.php b/include/conversation.php
index e2dfccac9..39119b2bb 100644
--- a/include/conversation.php
+++ b/include/conversation.php
@@ -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,
diff --git a/include/crypto.php b/include/crypto.php
index 494a2a5b9..50ec2a3a6 100644
--- a/include/crypto.php
+++ b/include/crypto.php
@@ -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;
}
diff --git a/include/datetime.php b/include/datetime.php
index bfd806f32..ace1ad14f 100644
--- a/include/datetime.php
+++ b/include/datetime.php
@@ -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]') ;
diff --git a/include/event.php b/include/event.php
index 73033a1c3..2969f4f61 100644
--- a/include/event.php
+++ b/include/event.php
@@ -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",
diff --git a/include/features.php b/include/features.php
index 9c925bc35..1ef070b00 100644
--- a/include/features.php
+++ b/include/features.php
@@ -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')),
),
diff --git a/include/group.php b/include/group.php
index bef008afd..22f221059 100644
--- a/include/group.php
+++ b/include/group.php
@@ -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())
diff --git a/include/identity.php b/include/identity.php
index a389a613e..caf2de710 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -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(
diff --git a/include/photos.php b/include/photos.php
index 1a57ce76f..be18600de 100644
--- a/include/photos.php
+++ b/include/photos.php
@@ -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);
diff --git a/include/queue_fn.php b/include/queue_fn.php
index 3112a832b..676620e2f 100644
--- a/include/queue_fn.php
+++ b/include/queue_fn.php
@@ -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);
}
}
}
diff --git a/include/session.php b/include/session.php
index 182805980..43bba528b 100644
--- a/include/session.php
+++ b/include/session.php
@@ -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));
} \ No newline at end of file
diff --git a/include/text.php b/include/text.php
index 6b074d390..621f4cf93 100644
--- a/include/text.php
+++ b/include/text.php
@@ -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);