aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2016-01-28 23:19:13 +0100
committermrjive <mrjive@mrjive.it>2016-01-28 23:19:13 +0100
commit28943af494eae225b256b9771a5699a1b05d7a2f (patch)
tree1f135da64c0935053f468281f8353e8279a18448 /include
parentc49e4f52ae83441c4a1dcf52e433dded8d767679 (diff)
parent5f1eb18da4d6380b64e83e0eeda6f1037de2fec9 (diff)
downloadvolse-hubzilla-28943af494eae225b256b9771a5699a1b05d7a2f.tar.gz
volse-hubzilla-28943af494eae225b256b9771a5699a1b05d7a2f.tar.bz2
volse-hubzilla-28943af494eae225b256b9771a5699a1b05d7a2f.zip
Merge pull request #19 from redmatrix/master
updating from original codebase
Diffstat (limited to 'include')
-rw-r--r--include/enotify.php8
-rw-r--r--include/features.php4
-rw-r--r--include/group.php10
-rw-r--r--include/identity.php4
-rw-r--r--include/import.php2
-rwxr-xr-xinclude/items.php30
-rw-r--r--include/permissions.php4
-rw-r--r--include/text.php6
-rw-r--r--include/widgets.php32
-rw-r--r--include/zot.php3
10 files changed, 71 insertions, 32 deletions
diff --git a/include/enotify.php b/include/enotify.php
index 5bb53aa0e..c4c49c8ff 100644
--- a/include/enotify.php
+++ b/include/enotify.php
@@ -273,14 +273,14 @@ function notification($params) {
$preamble = sprintf( t('%1$s, you\'ve received an new connection request from \'%2$s\' at %3$s'), $recip['channel_name'], $sender['xchan_name'], $sitename);
$epreamble = sprintf( t('%1$s, you\'ve received [zrl=%2$s]a new connection request[/zrl] from %3$s.'),
$recip['channel_name'],
- $itemlink,
+ $siteurl . '/connections/ifpending',
'[zrl=' . $sender['xchan_url'] . ']' . $sender['xchan_name'] . '[/zrl]');
$body = sprintf( t('You may visit their profile at %s'),$sender['xchan_url']);
$sitelink = t('Please visit %s to approve or reject the connection request.');
- $tsitelink = sprintf( $sitelink, $siteurl );
- $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '">' . $sitename . '</a>');
- $itemlink = $params['link'];
+ $tsitelink = sprintf( $sitelink, $siteurl . '/connections/ifpending');
+ $hsitelink = sprintf( $sitelink, '<a href="' . $siteurl . '/connections/ifpending">' . $sitename . '</a>');
+ $itemlink = $params['link'];
}
if ($params['type'] == NOTIFY_SUGGEST) {
diff --git a/include/features.php b/include/features.php
index b18a58ed4..4d8d162fa 100644
--- a/include/features.php
+++ b/include/features.php
@@ -50,7 +50,7 @@ function get_features($filtered = true) {
array('profile_export', t('Profile Import/Export'), t('Save and load profile details across sites/channels'),false,get_config('feature_lock','profile_export')),
array('webpages', t('Web Pages'), t('Provide managed web pages on your channel'),false,get_config('feature_lock','webpages')),
array('hide_rating', t('Hide Rating'), t('Hide the rating buttons on your channel and profile pages. Note: People can still rate you somewhere else.'),false,get_config('feature_lock','hide_rating')),
- array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders'),false,get_config('feature_lock','private_notes')),
+ array('private_notes', t('Private Notes'), t('Enables a tool to store notes and reminders (note: not encrypted)'),false,get_config('feature_lock','private_notes')),
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')),
@@ -76,7 +76,7 @@ function get_features($filtered = true) {
'net_module' => array(
t('Network and Stream Filtering'),
array('archives', t('Search by Date'), t('Ability to select posts by date ranges'),false,get_config('feature_lock','archives')),
- array('groups', t('Collections (Privacy Groups)'), t('Enable widget to display Network posts only from selected collections'),false,get_config('feature_lock','groups')),
+ array('groups', t('Privacy Groups'), t('Enable management and selection of privacy groups'),true,get_config('feature_lock','groups')),
array('savedsearch', t('Saved Searches'), t('Save search terms for re-use'),false,get_config('feature_lock','savedsearch')),
array('personal_tab', t('Network Personal Tab'), t('Enable tab to display only Network posts that you\'ve interacted on'),false,get_config('feature_lock','personal_tab')),
array('new_tab', t('Network New Tab'), t('Enable tab to display all new Network activity'),false,get_config('feature_lock','new_tab')),
diff --git a/include/group.php b/include/group.php
index 0875b10f9..bef008afd 100644
--- a/include/group.php
+++ b/include/group.php
@@ -229,7 +229,7 @@ function mini_group_select($uid,$group = '') {
logger('mini_group_select: ' . print_r($grps,true), LOGGER_DATA);
$o = replace_macros(get_markup_template('group_selection.tpl'), array(
- '$label' => t('Add new connections to this collection (privacy group)'),
+ '$label' => t('Add new connections to this privacy group'),
'$groups' => $grps
));
return $o;
@@ -292,10 +292,10 @@ function group_side($every="connections",$each="group",$edit = false, $group_id
$tpl = get_markup_template("group_side.tpl");
$o = replace_macros($tpl, array(
- '$title' => t('Collections'),
- '$edittext' => t('Edit collection'),
- '$createtext' => t('Add new collection'),
- '$ungrouped' => (($every === 'contacts') ? t('Channels not in any collection') : ''),
+ '$title' => t('Privacy Groups'),
+ '$edittext' => t('Edit group'),
+ '$createtext' => t('Add privacy group'),
+ '$ungrouped' => (($every === 'contacts') ? t('Channels not in any privacy group') : ''),
'$groups' => $groups,
'$add' => t('add'),
));
diff --git a/include/identity.php b/include/identity.php
index 32c4dd130..fd0b4d7f5 100644
--- a/include/identity.php
+++ b/include/identity.php
@@ -924,6 +924,9 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
$pdesc = true;
$reddress = true;
+ if($block && intval(get_config('system','block_public_blackout')))
+ return $o;
+
if((! is_array($profile)) && (! count($profile)))
return $o;
@@ -935,6 +938,7 @@ function profile_sidebar($profile, $block = 0, $show_connect = true) {
$show_connect = false;
+
$profile['picdate'] = urlencode($profile['picdate']);
call_hooks('profile_sidebar_enter', $profile);
diff --git a/include/import.php b/include/import.php
index e208c3b00..b7ec1c565 100644
--- a/include/import.php
+++ b/include/import.php
@@ -2,7 +2,7 @@
require_once('include/menu.php');
-function import_channel($channel, $account_id) {
+function import_channel($channel, $account_id, $seize) {
if(! array_key_exists('channel_system',$channel)) {
$channel['channel_system'] = (($channel['channel_pageflags'] & 0x1000) ? 1 : 0);
diff --git a/include/items.php b/include/items.php
index 6acf1c883..b38049e70 100755
--- a/include/items.php
+++ b/include/items.php
@@ -159,7 +159,7 @@ function filter_insecure($channel_id, $arr) {
$ret = array();
- if((! intval(get_pconfig($channel_id, 'system', 'filter_insecure_collections'))) || (! $arr))
+ if((! intval(get_pconfig($channel_id, 'system', 'filter_insecure_privacy_groups'))) || (! $arr))
return $arr;
$str = '';
@@ -3687,6 +3687,16 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
return;
}
+ $sys_expire = intval(get_config('system','default_expire_days'));
+ $chn_expire = intval($importer['channel_expire_days']);
+
+ $expire_days = $sys_expire;
+
+ if(($chn_expire != 0) && ($chn_expire < $sys_expire))
+ $expire_days = $chn_expire;
+
+logger('expire_days: ' . $expire_days);
+
$feed = new SimplePie();
$feed->set_raw_data($xml);
$feed->init();
@@ -3790,6 +3800,7 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
intval($importer['channel_id'])
);
+
// Update content if 'updated' changes
if($r) {
@@ -3848,6 +3859,17 @@ function consume_feed($xml, $importer, &$contact, $pass = 0) {
$datarray['owner_xchan'] = $contact['xchan_hash'];
+ if(array_key_exists('created',$datarray) && $datarray['created'] != NULL_DATE && $expire_days) {
+ $t1 = $datarray['created'];
+ $t2 = datetime_convert('UTC','UTC','now - ' . $expire_days . 'days');
+ if($t1 < $t2) {
+ logger('feed content older than expiration. Ignoring.', LOGGER_DEBUG, LOG_INFO);
+ continue;
+ }
+ }
+
+
+
$r = q("SELECT edited FROM item WHERE mid = '%s' AND uid = %d LIMIT 1",
dbesc($item_id),
intval($importer['channel_id'])
@@ -4837,7 +4859,7 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
intval($uid)
);
if(! $r) {
- $result['message'] = t('Collection not found.');
+ $result['message'] = t('Privacy group not found.');
return $result;
}
@@ -4853,14 +4875,14 @@ function items_fetch($arr,$channel = null,$observer_hash = null,$client_mode = C
}
} else {
$contact_str = ' 0 ';
- $result['message'] = t('Collection is empty.');
+ $result['message'] = t('Privacy group is empty.');
return $result;
}
$sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND (( author_xchan IN ( $contact_str ) OR owner_xchan in ( $contact_str)) or allow_gid like '" . protect_sprintf('%<' . dbesc($r[0]['hash']) . '>%') . "' ) and id = parent $item_normal ) ";
$x = group_rec_byhash($uid,$r[0]['hash']);
- $result['headline'] = sprintf( t('Collection: %s'),$x['name']);
+ $result['headline'] = sprintf( t('Privacy group: %s'),$x['name']);
}
elseif($arr['cid'] && $uid) {
diff --git a/include/permissions.php b/include/permissions.php
index a8e761f87..8071af686 100644
--- a/include/permissions.php
+++ b/include/permissions.php
@@ -641,10 +641,10 @@ function get_role_perms($role) {
$ret['directory_publish'] = true;
$ret['online'] = false;
$ret['perms_follow'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
- |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
+ |PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE|PERMS_W_TAGWALL;
$ret['perms_accept'] = PERMS_R_STREAM|PERMS_R_PROFILE|PERMS_R_ABOOK
- |PERMS_W_STREAM|PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
+ |PERMS_W_WALL|PERMS_W_COMMENT|PERMS_W_MAIL|PERMS_W_CHAT
|PERMS_R_STORAGE|PERMS_R_PAGES|PERMS_A_REPUBLISH|PERMS_W_LIKE|PERMS_W_TAGWALL;
$ret['channel_r_stream'] = PERMS_PUBLIC;
$ret['channel_r_profile'] = PERMS_PUBLIC;
diff --git a/include/text.php b/include/text.php
index 6f7297bb0..0b5ad9c72 100644
--- a/include/text.php
+++ b/include/text.php
@@ -812,7 +812,7 @@ function contact_block() {
);
if(count($r)) {
- $contacts = sprintf( tt('%d Connection','%d Connections', $total),$total);
+ $contacts = t('Connections');
$micropro = Array();
foreach($r as $rr) {
$rr['archived'] = (intval($rr['abook_archived']) ? true : false);
@@ -825,7 +825,7 @@ function contact_block() {
$o = replace_macros($tpl, array(
'$contacts' => $contacts,
'$nickname' => $a->profile['channel_address'],
- '$viewconnections' => t('View Connections'),
+ '$viewconnections' => (($total > $shown) ? sprintf(t('View all %s connections'),$total) : ''),
'$micropro' => $micropro,
));
@@ -2716,5 +2716,7 @@ function item_url_replace($channel,&$item,$old,$new) {
$item['sig'] = base64url_encode(rsa_sign($item['body'],$channel['channel_prvkey']));
$item['item_verified'] = 1;
}
+
+ // @fixme item['plink'] and item['llink']
}
diff --git a/include/widgets.php b/include/widgets.php
index 60605cb51..891e9c018 100644
--- a/include/widgets.php
+++ b/include/widgets.php
@@ -807,20 +807,28 @@ function widget_suggestedchats($arr) {
}
function widget_item($arr) {
- // FIXME there is no $a here
- $uid = $a->profile['profile_uid'];
- if((! $uid) || (! $arr['mid']))
+
+ $channel_id = 0;
+ if(array_key_exists('channel_id',$arr) && intval($arr['channel_id']))
+ $channel_id = intval($arr['channel_id']);
+ if(! $channel_id)
+ $channel_id = get_app()->profile_uid;
+ if(! $channel_id)
return '';
- if(! perm_is_allowed($uid, get_observer_hash(), 'view_pages'))
+
+ if(! $arr['mid'])
+ return '';
+
+ if(! perm_is_allowed($channel_id, get_observer_hash(), 'view_pages'))
return '';
require_once('include/security.php');
- $sql_extra = item_permissions_sql($uid);
+ $sql_extra = item_permissions_sql($channel_id);
$r = q("select * from item where mid = '%s' and uid = %d and item_type = " . intval(ITEM_TYPE_WEBPAGE) . " $sql_extra limit 1",
dbesc($arr['mid']),
- intval($uid)
+ intval($channel_id)
);
if(! $r)
@@ -1110,16 +1118,18 @@ function widget_rating($arr) {
}
+
+ $o = '<div class="widget">';
+ $o .= '<h3>' . t('Rating Tools') . '</h3>';
+
if((($remote) || (local_channel())) && (! $self)) {
- $o = '<div class="widget rateme">';
if($remote)
- $o .= '<a class="rateme" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a>';
+ $o .= '<a class="btn btn-block btn-primary btn-sm" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a>';
else
- $o .= '<div class="rateme fakelink" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div>';
- $o .= '</div>';
+ $o .= '<div class="btn btn-block btn-primary btn-sm" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div>';
}
- $o .= '<div class="widget rateme"><a class="rateme" href="ratings/' . $hash . '"><i class="icon-eye-open"></i> ' . t('View Ratings') . '</a>';
+ $o .= '<a class="btn btn-block btn-default btn-sm" href="ratings/' . $hash . '"><i class="icon-eye-open"></i> ' . t('View Ratings') . '</a>';
$o .= '</div>';
return $o;
diff --git a/include/zot.php b/include/zot.php
index 9d09aaf58..0210f3f4a 100644
--- a/include/zot.php
+++ b/include/zot.php
@@ -3186,8 +3186,9 @@ function process_channel_sync_delivery($sender, $arr, $deliveries) {
logger('process_channel_sync_delivery: total_feeds service class limit exceeded');
continue;
}
- q("insert into abook ( abook_xchan, abook_channel ) values ('%s', %d ) ",
+ q("insert into abook ( abook_xchan, abook_account, abook_channel ) values ('%s', %d, %d ) ",
dbesc($clean['abook_xchan']),
+ intval($channel['channel_account_id']),
intval($channel['channel_id'])
);
$total_friends ++;