aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs
diff options
context:
space:
mode:
authormrjive <mrjive@mrjive.it>2018-04-12 10:12:46 +0200
committerGitHub <noreply@github.com>2018-04-12 10:12:46 +0200
commitea36ebd0df3d7612e5a524b7a287f9c57b8783b3 (patch)
tree02d1ed484823bd2c2b34aa85f153af3e1cc3c85e /Zotlabs
parenta7ff2cc5ea11afd7b832bef24866abfb0220d022 (diff)
parent3bd645033330c2db0952e57db1516274487c0712 (diff)
downloadvolse-hubzilla-ea36ebd0df3d7612e5a524b7a287f9c57b8783b3.tar.gz
volse-hubzilla-ea36ebd0df3d7612e5a524b7a287f9c57b8783b3.tar.bz2
volse-hubzilla-ea36ebd0df3d7612e5a524b7a287f9c57b8783b3.zip
Merge pull request #5 from redmatrix/dev
Dev
Diffstat (limited to 'Zotlabs')
-rw-r--r--Zotlabs/Daemon/Expire.php7
-rw-r--r--Zotlabs/Lib/Enotify.php5
-rw-r--r--Zotlabs/Lib/ThreadItem.php5
-rw-r--r--Zotlabs/Module/Acl.php2
-rw-r--r--Zotlabs/Module/Admin/Site.php3
-rw-r--r--Zotlabs/Module/Channel.php2
-rw-r--r--Zotlabs/Module/Display.php6
-rw-r--r--Zotlabs/Module/Editpost.php2
-rw-r--r--Zotlabs/Module/Item.php1
-rw-r--r--Zotlabs/Module/Like.php1
-rw-r--r--Zotlabs/Module/Photos.php10
-rw-r--r--Zotlabs/Module/Ping.php16
-rw-r--r--Zotlabs/Module/Profiles.php2
-rw-r--r--Zotlabs/Module/React.php1
-rw-r--r--Zotlabs/Module/Search.php4
-rw-r--r--Zotlabs/Module/Settings/Channel.php10
-rw-r--r--Zotlabs/Module/Settings/Features.php74
-rw-r--r--Zotlabs/Module/Settings/Oauth.php11
-rw-r--r--Zotlabs/Module/Settings/Oauth2.php160
-rw-r--r--Zotlabs/Module/Well_known.php5
-rw-r--r--Zotlabs/Storage/Browser.php2
-rw-r--r--Zotlabs/Widget/Catcloud.php46
-rw-r--r--Zotlabs/Widget/Notifications.php2
-rw-r--r--Zotlabs/Widget/Settings_menu.php10
-rw-r--r--Zotlabs/Widget/Tagcloud.php9
25 files changed, 337 insertions, 59 deletions
diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php
index 215513e87..398425861 100644
--- a/Zotlabs/Daemon/Expire.php
+++ b/Zotlabs/Daemon/Expire.php
@@ -34,7 +34,8 @@ class Expire {
logger('expire: start', LOGGER_DEBUG);
- $site_expire = get_config('system', 'default_expire_days');
+ $site_expire = intval(get_config('system', 'default_expire_days'));
+ $commented_days = intval(get_config('system','active_expire_days'));
logger('site_expire: ' . $site_expire);
@@ -64,7 +65,7 @@ class Expire {
// if the site or service class expiration is non-zero and less than person expiration, use that
logger('Expire: ' . $rr['channel_address'] . ' interval: ' . $expire_days, LOGGER_DEBUG);
- item_expire($rr['channel_id'], $expire_days);
+ item_expire($rr['channel_id'], $expire_days, $commented_days);
}
}
@@ -85,7 +86,7 @@ class Expire {
logger('Expire: sys interval: ' . $expire_days, LOGGER_DEBUG);
if ($expire_days)
- item_expire($x['channel_id'], $expire_days);
+ item_expire($x['channel_id'], $expire_days, $commented_days);
logger('Expire: sys: done', LOGGER_DEBUG);
}
diff --git a/Zotlabs/Lib/Enotify.php b/Zotlabs/Lib/Enotify.php
index 61c98c881..e05d391f3 100644
--- a/Zotlabs/Lib/Enotify.php
+++ b/Zotlabs/Lib/Enotify.php
@@ -115,6 +115,7 @@ class Enotify {
$always_show_in_notices = get_pconfig($recip['channel_id'],'system','always_show_in_notices');
+ $vnotify = get_pconfig($recip['channel_id'],'system','vnotify');
// e.g. "your post", "David's photo", etc.
$possess_desc = t('%s <!item_type!>');
@@ -142,7 +143,7 @@ class Enotify {
if(array_key_exists('item',$params) && in_array($params['item']['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) {
- if(! $always_show_in_notices) {
+ if(! $always_show_in_notices || !($vnotify & VNOTIFY_LIKE)) {
logger('notification: not a visible activity. Ignoring.');
pop_lang();
return;
@@ -249,7 +250,7 @@ class Enotify {
$itemlink = $params['link'];
if (array_key_exists('item',$params) && (! activity_match($params['item']['verb'],ACTIVITY_LIKE))) {
- if(! $always_show_in_notices) {
+ if(! $always_show_in_notices || !($vnotify & VNOTIFY_LIKE)) {
logger('notification: not a visible activity. Ignoring.');
pop_lang();
return;
diff --git a/Zotlabs/Lib/ThreadItem.php b/Zotlabs/Lib/ThreadItem.php
index d35d4732a..c2aa920b9 100644
--- a/Zotlabs/Lib/ThreadItem.php
+++ b/Zotlabs/Lib/ThreadItem.php
@@ -733,6 +733,8 @@ class ThreadItem {
$arr = array('comment_buttons' => '','id' => $this->get_id());
call_hooks('comment_buttons',$arr);
$comment_buttons = $arr['comment_buttons'];
+
+ $feature_auto_save_draft = ((feature_enabled($conv->get_profile_owner(), 'auto_save_draft')) ? "true" : "false");
$comment_box = replace_macros($template,array(
'$return_path' => '',
@@ -768,7 +770,8 @@ class ThreadItem {
'$anoncomments' => ((($conv->get_mode() === 'channel' || $conv->get_mode() === 'display') && perm_is_allowed($conv->get_profile_owner(),'','post_comments')) ? true : false),
'$anonname' => [ 'anonname', t('Your full name (required)') ],
'$anonmail' => [ 'anonmail', t('Your email address (required)') ],
- '$anonurl' => [ 'anonurl', t('Your website URL (optional)') ]
+ '$anonurl' => [ 'anonurl', t('Your website URL (optional)') ],
+ '$auto_save_draft' => $feature_auto_save_draft,
));
return $comment_box;
diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php
index ef901aef1..4c5883e88 100644
--- a/Zotlabs/Module/Acl.php
+++ b/Zotlabs/Module/Acl.php
@@ -24,7 +24,7 @@ class Acl extends \Zotlabs\Web\Controller {
function init() {
- logger('mod_acl: ' . print_r($_REQUEST,true));
+ logger('mod_acl: ' . print_r($_REQUEST,true),LOGGER_DATA);
$start = (x($_REQUEST,'start') ? $_REQUEST['start'] : 0);
$count = (x($_REQUEST,'count') ? $_REQUEST['count'] : 500);
diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php
index 95d44d754..656770ad9 100644
--- a/Zotlabs/Module/Admin/Site.php
+++ b/Zotlabs/Module/Admin/Site.php
@@ -56,6 +56,7 @@ class Site {
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
$no_community_page = !((x($_POST,'no_community_page')) ? True : False);
$default_expire_days = ((array_key_exists('default_expire_days',$_POST)) ? intval($_POST['default_expire_days']) : 0);
+ $active_expire_days = ((array_key_exists('active_expire_days',$_POST)) ? intval($_POST['active_expire_days']) : 7);
$reply_address = ((array_key_exists('reply_address',$_POST) && trim($_POST['reply_address'])) ? trim($_POST['reply_address']) : 'noreply@' . \App::get_hostname());
$from_email = ((array_key_exists('from_email',$_POST) && trim($_POST['from_email'])) ? trim($_POST['from_email']) : 'Administrator@' . \App::get_hostname());
@@ -95,6 +96,7 @@ class Site {
set_config('system', 'enable_context_help', $enable_context_help);
set_config('system', 'verify_email', $verify_email);
set_config('system', 'default_expire_days', $default_expire_days);
+ set_config('system', 'active_expire_days', $active_expire_days);
set_config('system', 'reply_address', $reply_address);
set_config('system', 'from_email', $from_email);
set_config('system', 'from_email_name' , $from_email_name);
@@ -348,6 +350,7 @@ class Site {
'$thumbnail_security' => array('thumbnail_security', t("Allow SVG thumbnails in file browser"), get_config('system','thumbnail_security',0), t("WARNING: SVG images may contain malicious code.")),
'$maxloadavg' => array('maxloadavg', t("Maximum Load Average"), ((intval(get_config('system','maxloadavg')) > 0)?get_config('system','maxloadavg'):50), t("Maximum system load before delivery and poll processes are deferred - default 50.")),
'$default_expire_days' => array('default_expire_days', t('Expiration period in days for imported (grid/network) content'), intval(get_config('system','default_expire_days')), t('0 for no expiration of imported content')),
+ '$active_expire_days' => array('active_expire_days', t('Do not expire any posts which have comments less than this many days ago'), intval(get_config('system','active_expire_days',7)), ''),
'$sellpage' => array('site_sellpage', t('Public servers: Optional landing (marketing) webpage for new registrants'), get_config('system','sellpage',''), sprintf( t('Create this page first. Default is %s/register'),z_root())),
'$first_page' => array('first_page', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Recommend: profiles, go, or settings')),
diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php
index 3d3eb2a85..6a334b59a 100644
--- a/Zotlabs/Module/Channel.php
+++ b/Zotlabs/Module/Channel.php
@@ -204,7 +204,7 @@ class Channel extends \Zotlabs\Web\Controller {
$_SESSION['loadtime'] = datetime_convert();
}
else {
- $r = q("SELECT distinct parent AS item_id from item
+ $r = q("SELECT parent AS item_id from item
left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids )
WHERE uid = %d $item_normal_update
AND item_wall = 1 $simple_update
diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php
index 30f2a7f5f..06c9479b2 100644
--- a/Zotlabs/Module/Display.php
+++ b/Zotlabs/Module/Display.php
@@ -132,7 +132,7 @@ class Display extends \Zotlabs\Web\Controller {
$y = q("select * from iconfig left join item on iconfig.iid = item.id
where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'WEBPAGE' and item.id = %d limit 1",
intval($target_item['uid']),
- intval($target_item['id'])
+ intval($target_item['parent'])
);
if($x && $y) {
goaway(z_root() . '/page/' . $x[0]['channel_address'] . '/' . $y[0]['v']);
@@ -149,7 +149,7 @@ class Display extends \Zotlabs\Web\Controller {
$y = q("select * from iconfig left join item on iconfig.iid = item.id
where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'ARTICLE' and item.id = %d limit 1",
intval($target_item['uid']),
- intval($target_item['id'])
+ intval($target_item['parent'])
);
if($x && $y) {
goaway(z_root() . '/articles/' . $x[0]['channel_address'] . '/' . $y[0]['v']);
@@ -166,7 +166,7 @@ class Display extends \Zotlabs\Web\Controller {
$y = q("select * from iconfig left join item on iconfig.iid = item.id
where item.uid = %d and iconfig.cat = 'system' and iconfig.k = 'CARD' and item.id = %d limit 1",
intval($target_item['uid']),
- intval($target_item['id'])
+ intval($target_item['parent'])
);
if($x && $y) {
goaway(z_root() . '/cards/' . $x[0]['channel_address'] . '/' . $y[0]['v']);
diff --git a/Zotlabs/Module/Editpost.php b/Zotlabs/Module/Editpost.php
index a54c42e7f..57a4cb97f 100644
--- a/Zotlabs/Module/Editpost.php
+++ b/Zotlabs/Module/Editpost.php
@@ -82,7 +82,7 @@ class Editpost extends \Zotlabs\Web\Controller {
'editor_autocomplete'=> true,
'bbco_autocomplete'=> 'bbcode',
'return_path' => $_SESSION['return_url'],
- 'button' => t('Edit'),
+ 'button' => t('Submit'),
'hide_voting' => true,
'hide_future' => true,
'hide_location' => true,
diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php
index ad72d9ccd..bba1dc02d 100644
--- a/Zotlabs/Module/Item.php
+++ b/Zotlabs/Module/Item.php
@@ -468,6 +468,7 @@ class Item extends \Zotlabs\Web\Controller {
$private = intval($acl->is_private() || $parent_item['item_private']);
$public_policy = $parent_item['public_policy'];
$owner_hash = $parent_item['owner_xchan'];
+ $webpage = $parent_item['item_type'];
}
if((! $allow_empty) && (! strlen($body))) {
diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php
index 12de86e72..4e216f08b 100644
--- a/Zotlabs/Module/Like.php
+++ b/Zotlabs/Module/Like.php
@@ -419,6 +419,7 @@ class Like extends \Zotlabs\Web\Controller {
$arr['item_origin'] = 1;
$arr['item_notshown'] = 1;
+ $arr['item_type'] = $item['item_type'];
if(intval($item['item_wall']))
$arr['item_wall'] = 1;
diff --git a/Zotlabs/Module/Photos.php b/Zotlabs/Module/Photos.php
index 81af607ec..fa22c3f26 100644
--- a/Zotlabs/Module/Photos.php
+++ b/Zotlabs/Module/Photos.php
@@ -695,8 +695,8 @@ class Photos extends \Zotlabs\Web\Controller {
'$newalbum_label' => t('Enter an album name'),
'$newalbum_placeholder' => t('or select an existing album (doubleclick)'),
'$visible' => array('visible', t('Create a status post for this upload'), 0,'', array(t('No'), t('Yes')), 'onclick="showHideBodyTextarea();"'),
- '$caption' => array('description', t('Caption (optional):')),
- '$body' => array('body', t('Description (optional):'),'', 'Description will only appear in the status post'),
+ '$caption' => array('description', t('Title (optional)')),
+ '$body' => array('body', t('Description (optional)'),'', 'Description will only appear in the status post'),
'$albums' => $albums['albums'],
'$selname' => $selname,
'$permissions' => t('Permissions'),
@@ -841,7 +841,7 @@ class Photos extends \Zotlabs\Web\Controller {
'$album_id' => $datum,
'$album_edit' => array(t('Edit Album'), $album_edit),
'$can_post' => $can_post,
- '$upload' => array(t('Upload'), z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/upload/' . $datum),
+ '$upload' => array(t('Add Photos'), z_root() . '/photos/' . \App::$data['channel']['channel_address'] . '/upload/' . $datum),
'$order' => $order,
'$upload_form' => $upload_form,
'$usage' => $usage_message
@@ -1065,7 +1065,7 @@ class Photos extends \Zotlabs\Web\Controller {
'newalbum_placeholder' => t('or select an existing one (doubleclick)'),
'nickname' => \App::$data['channel']['channel_address'],
'resource_id' => $ph[0]['resource_id'],
- 'capt_label' => t('Caption'),
+ 'capt_label' => t('Title (optional)'),
'caption' => $caption_e,
'tag_label' => t('Add a Tag'),
'permissions' => t('Permissions'),
@@ -1378,7 +1378,7 @@ class Photos extends \Zotlabs\Web\Controller {
'$title' => t('Recent Photos'),
'$album_id' => bin2hex(t('Recent Photos')),
'$can_post' => $can_post,
- '$upload' => array(t('Upload'), z_root().'/photos/'.\App::$data['channel']['channel_address'].'/upload'),
+ '$upload' => array(t('Add Photos'), z_root().'/photos/'.\App::$data['channel']['channel_address'].'/upload'),
'$photos' => $photos,
'$upload_form' => $upload_form,
'$usage' => $usage_message
diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php
index eab49d69e..9372866d7 100644
--- a/Zotlabs/Module/Ping.php
+++ b/Zotlabs/Module/Ping.php
@@ -140,7 +140,13 @@ class Ping extends \Zotlabs\Web\Controller {
db_utcnow(), db_quoteinterval('3 MINUTE')
);
- $discover_tab_on = ((get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false) ? false : true);
+
+ $sql_extra = '';
+ if(! ($vnotify & VNOTIFY_LIKE))
+ $sql_extra = ' AND verb NOT IN ("' . dbesc(ACTIVITY_LIKE) . '", "' . dbesc(ACTIVITY_DISLIKE) . '") ';
+
+ $discover_tab_on = can_view_public_stream();
+
$notify_pubs = ((local_channel()) ? ($vnotify & VNOTIFY_PUBS) && $discover_tab_on : $discover_tab_on);
if($notify_pubs) {
@@ -151,7 +157,8 @@ class Ping extends \Zotlabs\Web\Controller {
AND item_unseen = 1
AND author_xchan != '%s'
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
- $item_normal",
+ $item_normal
+ $sql_extra",
intval($sys['channel_id']),
dbesc(get_observer_hash())
);
@@ -160,6 +167,8 @@ class Ping extends \Zotlabs\Web\Controller {
$result['pubs'] = intval($pubs[0]['total']);
}
+
+
if((argc() > 1) && (argv(1) === 'pubs') && ($notify_pubs)) {
$sys = get_sys_channel();
$result = array();
@@ -170,6 +179,7 @@ class Ping extends \Zotlabs\Web\Controller {
AND author_xchan != '%s'
AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "'
$item_normal
+ $sql_extra
ORDER BY created DESC
LIMIT 300",
intval($sys['channel_id']),
@@ -334,6 +344,7 @@ class Ping extends \Zotlabs\Web\Controller {
AND item_unseen = 1
AND author_xchan != '%s'
$item_normal
+ $sql_extra
ORDER BY created DESC
LIMIT 300",
intval(local_channel()),
@@ -508,6 +519,7 @@ class Ping extends \Zotlabs\Web\Controller {
$r = q("SELECT id, item_wall FROM item
WHERE uid = %d and item_unseen = 1
$item_normal
+ $sql_extra
AND author_xchan != '%s'",
intval(local_channel()),
dbesc($ob_hash)
diff --git a/Zotlabs/Module/Profiles.php b/Zotlabs/Module/Profiles.php
index e02cb33db..202ee462a 100644
--- a/Zotlabs/Module/Profiles.php
+++ b/Zotlabs/Module/Profiles.php
@@ -732,7 +732,7 @@ class Profiles extends \Zotlabs\Web\Controller {
'$addthing' => t('Add profile things'),
'$personal' => t('Personal'),
'$location' => t('Location'),
- '$relation' => t('Relation'),
+ '$relation' => t('Relationship'),
'$miscellaneous'=> t('Miscellaneous'),
'$exportable' => feature_enabled(local_channel(),'profile_export'),
'$lbl_import' => t('Import profile from file'),
diff --git a/Zotlabs/Module/React.php b/Zotlabs/Module/React.php
index 6473317c7..fbb760786 100644
--- a/Zotlabs/Module/React.php
+++ b/Zotlabs/Module/React.php
@@ -49,6 +49,7 @@ class React extends \Zotlabs\Web\Controller {
$n['aid'] = $channel['channel_account_id'];
$n['uid'] = $channel['channel_id'];
$n['item_origin'] = true;
+ $n['item_type'] = $i[0]['item_type'];
$n['parent'] = $postid;
$n['parent_mid'] = $i[0]['mid'];
$n['mid'] = item_message_id();
diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php
index 55e0e746f..43464ad8b 100644
--- a/Zotlabs/Module/Search.php
+++ b/Zotlabs/Module/Search.php
@@ -66,6 +66,10 @@ class Search extends \Zotlabs\Web\Controller {
$search = substr($search,1);
goaway(z_root() . '/directory' . '?f=1&navsearch=1&search=' . $search);
}
+ if(strpos($search,'!') === 0) {
+ $search = substr($search,1);
+ goaway(z_root() . '/directory' . '?f=1&navsearch=1&search=' . $search);
+ }
if(strpos($search,'?') === 0) {
$search = substr($search,1);
goaway(z_root() . '/help' . '?f=1&navsearch=1&search=' . $search);
diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php
index a7dfdd790..e274c9786 100644
--- a/Zotlabs/Module/Settings/Channel.php
+++ b/Zotlabs/Module/Settings/Channel.php
@@ -208,6 +208,8 @@ class Channel {
$vnotify += intval($_POST['vnotify12']);
if(x($_POST,'vnotify13'))
$vnotify += intval($_POST['vnotify13']);
+ if(x($_POST,'vnotify14'))
+ $vnotify += intval($_POST['vnotify14']);
$always_show_in_notices = x($_POST,'always_show_in_notices') ? 1 : 0;
@@ -484,7 +486,8 @@ class Channel {
$plugin = [ 'basic' => '', 'security' => '', 'notify' => '', 'misc' => '' ];
call_hooks('channel_settings',$plugin);
- $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false;
+ $disable_discover_tab = intval(get_config('system','disable_discover_tab',1)) == 1;
+ $site_firehose = intval(get_config('system','site_firehose',0)) == 1;
$o .= replace_macros($stpl,array(
'$ptitle' => t('Channel Settings'),
@@ -575,9 +578,10 @@ class Channel {
'$vnotify10' => array('vnotify10', t('New connections'), ($vnotify & VNOTIFY_INTRO), VNOTIFY_INTRO, t('Recommended'), $yes_no),
'$vnotify11' => ((is_site_admin()) ? array('vnotify11', t('System Registrations'), ($vnotify & VNOTIFY_REGISTER), VNOTIFY_REGISTER, '', $yes_no) : array()),
'$vnotify12' => array('vnotify12', t('Unseen shared files'), ($vnotify & VNOTIFY_FILES), VNOTIFY_FILES, '', $yes_no),
- '$vnotify13' => (($disable_discover_tab) ? array() : array('vnotify13', t('Unseen public activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no)),
+ '$vnotify13' => (($disable_discover_tab && !$site_firehose) ? array() : array('vnotify13', t('Unseen public activity'), ($vnotify & VNOTIFY_PUBS), VNOTIFY_PUBS, '', $yes_no)),
+ '$vnotify14' => array('vnotify14', t('Unseen likes and dislikes'), ($vnotify & VNOTIFY_LIKE), VNOTIFY_LIKE, '', $yes_no),
'$mailhost' => [ 'mailhost', t('Email notification hub (hostname)'), get_pconfig(local_channel(),'system','email_notify_host',\App::get_hostname()), sprintf( t('If your channel is mirrored to multiple hubs, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'),\App::get_hostname()) ],
- '$always_show_in_notices' => array('always_show_in_notices', t('Also show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no),
+ '$always_show_in_notices' => array('always_show_in_notices', t('Show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no),
'$evdays' => array('evdays', t('Notify me of events this many days in advance'), $evdays, t('Must be greater than 0')),
'$basic_addon' => $plugin['basic'],
diff --git a/Zotlabs/Module/Settings/Features.php b/Zotlabs/Module/Settings/Features.php
index 5b642acc3..888032c28 100644
--- a/Zotlabs/Module/Settings/Features.php
+++ b/Zotlabs/Module/Settings/Features.php
@@ -8,43 +8,75 @@ class Features {
function post() {
check_form_security_token_redirectOnErr('/settings/features', 'settings_features');
- // Build list of features and check which are set
- // We will not create any settings for features that are above our techlevel
-
- $features = get_features();
- $all_features = array();
- foreach($features as $k => $v) {
- foreach($v as $f)
- $all_features[] = $f[0];
- }
- foreach($all_features as $k) {
- if(x($_POST,"feature_$k"))
- set_pconfig(local_channel(),'feature',$k, 1);
- else
- set_pconfig(local_channel(),'feature',$k, 0);
+ $features = get_features(false);
+
+ foreach($features as $fname => $fdata) {
+ foreach(array_slice($fdata,1) as $f) {
+ $k = $f[0];
+ if(array_key_exists("feature_$k",$_POST))
+ set_pconfig(local_channel(),'feature',$k, (string) $_POST["feature_$k"]);
+ else
+ set_pconfig(local_channel(),'feature', $k, '');
+ }
}
build_sync_packet();
return;
}
function get() {
- $arr = array();
- $features = get_features();
-
+
+ $arr = [];
+ $harr = [];
+
+ if(intval($_REQUEST['techlevel']))
+ $level = intval($_REQUEST['techlevel']);
+ else {
+ $level = get_account_techlevel();
+ }
+
+ if(! intval($level)) {
+ notice( t('Permission denied.') . EOL);
+ return;
+ }
+
+ $techlevels = \Zotlabs\Lib\Techlevels::levels();
+
+ // This page isn't accessible at techlevel 0
+
+ unset($techlevels[0]);
+
+ $def_techlevel = (($level > 0) ? $level : 1);
+ $techlock = get_config('system','techlevel_lock');
+
+ $all_features_raw = get_features(false);
+
+ foreach($all_features_raw as $fname => $fdata) {
+ foreach(array_slice($fdata,1) as $f) {
+ $harr[$f[0]] = ((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : '');
+ }
+ }
+
+ $features = get_features(true,$level);
+
foreach($features as $fname => $fdata) {
$arr[$fname] = array();
$arr[$fname][0] = $fdata[0];
foreach(array_slice($fdata,1) as $f) {
- $arr[$fname][1][] = array('feature_' .$f[0],$f[1],((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
+ $arr[$fname][1][] = array('feature_' . $f[0],$f[1],((intval(feature_enabled(local_channel(),$f[0]))) ? "1" : ''),$f[2],array(t('Off'),t('On')));
+ unset($harr[$f[0]]);
}
}
$tpl = get_markup_template("settings_features.tpl");
$o .= replace_macros($tpl, array(
'$form_security_token' => get_form_security_token("settings_features"),
- '$title' => t('Additional Features'),
- '$features' => $arr,
- '$submit' => t('Submit'),
+ '$title' => t('Additional Features'),
+ '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience and additional features consistent with your comfort level'), $techlevels ],
+ '$techlock' => $techlock,
+ '$features' => $arr,
+ '$hiddens' => $harr,
+ '$baseurl' => z_root(),
+ '$submit' => t('Submit'),
));
return $o;
diff --git a/Zotlabs/Module/Settings/Oauth.php b/Zotlabs/Module/Settings/Oauth.php
index c612c7667..d6576c6de 100644
--- a/Zotlabs/Module/Settings/Oauth.php
+++ b/Zotlabs/Module/Settings/Oauth.php
@@ -23,11 +23,12 @@ class Oauth {
check_form_security_token_redirectOnErr('/settings/oauth', 'settings_oauth');
- $name = ((x($_POST,'name')) ? $_POST['name'] : '');
- $key = ((x($_POST,'key')) ? $_POST['key'] : '');
- $secret = ((x($_POST,'secret')) ? $_POST['secret'] : '');
- $redirect = ((x($_POST,'redirect')) ? $_POST['redirect'] : '');
- $icon = ((x($_POST,'icon')) ? $_POST['icon'] : '');
+ $name = ((x($_POST,'name')) ? escape_tags($_POST['name']) : '');
+ $key = ((x($_POST,'key')) ? escape_tags($_POST['key']) : '');
+ $secret = ((x($_POST,'secret')) ? escape_tags($_POST['secret']) : '');
+ $redirect = ((x($_POST,'redirect')) ? escape_tags($_POST['redirect']) : '');
+ $icon = ((x($_POST,'icon')) ? escape_tags($_POST['icon']) : '');
+ $oauth2 = ((x($_POST,'oauth2')) ? intval($_POST['oauth2']) : 0);
$ok = true;
if($name == '') {
$ok = false;
diff --git a/Zotlabs/Module/Settings/Oauth2.php b/Zotlabs/Module/Settings/Oauth2.php
new file mode 100644
index 000000000..88bbea3b8
--- /dev/null
+++ b/Zotlabs/Module/Settings/Oauth2.php
@@ -0,0 +1,160 @@
+<?php
+
+namespace Zotlabs\Module\Settings;
+
+
+class Oauth2 {
+
+
+ function post() {
+
+ if(x($_POST,'remove')){
+ check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2');
+
+ $key = $_POST['remove'];
+ q("DELETE FROM tokens WHERE id='%s' AND uid=%d",
+ dbesc($key),
+ local_channel());
+ goaway(z_root()."/settings/oauth2/");
+ return;
+ }
+
+ if((argc() > 2) && (argv(2) === 'edit' || argv(2) === 'add') && x($_POST,'submit')) {
+
+ check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2');
+
+ $name = ((x($_POST,'name')) ? escape_tags(trim($_POST['name'])) : '');
+ $secret = ((x($_POST,'secret')) ? escape_tags(trim($_POST['secret'])) : '');
+ $redirect = ((x($_POST,'redirect')) ? escape_tags(trim($_POST['redirect'])) : '');
+ $grant = ((x($_POST,'grant')) ? escape_tags(trim($_POST['grant'])) : '');
+ $scope = ((x($_POST,'scope')) ? escape_tags(trim($_POST['scope'])) : '');
+
+ $ok = true;
+ if($name == '' || $secret == '') {
+ $ok = false;
+ notice( t('Name and Secret are required') . EOL);
+ }
+
+ if($ok) {
+ if ($_POST['submit']==t("Update")){
+ $r = q("UPDATE oauth_clients SET
+ client_id = '%s',
+ client_secret = '%s',
+ redirect_uri = '%s',
+ grant_types = '%s',
+ scope = '%s',
+ user_id = '%s'
+ WHERE client_id='%s'",
+ dbesc($name),
+ dbesc($secret),
+ dbesc($redirect),
+ dbesc($grant),
+ dbesc($scope),
+ dbesc(local_channel()),
+ dbesc($name));
+ } else {
+ $r = q("INSERT INTO oauth_clients (client_id, client_secret, redirect_uri, grant_types, scope, user_id)
+ VALUES ('%s','%s','%s','%s','%s','%s')",
+ dbesc($name),
+ dbesc($secret),
+ dbesc($redirect),
+ dbesc($grant),
+ dbesc($scope),
+ dbesc(local_channel())
+ );
+ $r = q("INSERT INTO xperm (xp_client, xp_channel, xp_perm) VALUES ('%s', %d, '%s') ",
+ dbesc($name),
+ intval(local_channel()),
+ dbesc('all')
+ );
+ }
+ }
+ goaway(z_root()."/settings/oauth2/");
+ return;
+ }
+ }
+
+ function get() {
+
+ if((argc() > 2) && (argv(2) === 'add')) {
+ $tpl = get_markup_template("settings_oauth2_edit.tpl");
+ $o .= replace_macros($tpl, array(
+ '$form_security_token' => get_form_security_token("settings_oauth2"),
+ '$title' => t('Add OAuth2 application'),
+ '$submit' => t('Submit'),
+ '$cancel' => t('Cancel'),
+ '$name' => array('name', t('Name'), '', t('Name of application')),
+ '$secret' => array('secret', t('Consumer Secret'), random_string(16), t('Automatically generated - change if desired. Max length 20')),
+ '$redirect' => array('redirect', t('Redirect'), '', t('Redirect URI - leave blank unless your application specifically requires this')),
+ '$grant' => array('grant', t('Grant Types'), '', t('leave blank unless your application sepcifically requires this')),
+ '$scope' => array('scope', t('Authorization scope'), '', t('leave blank unless your application sepcifically requires this')),
+ ));
+ return $o;
+ }
+
+ if((argc() > 3) && (argv(2) === 'edit')) {
+ $r = q("SELECT * FROM oauth_clients WHERE client_id='%s' AND user_id= '%s'",
+ dbesc(argv(3)),
+ dbesc(local_channel())
+ );
+
+ if (! $r){
+ notice(t('OAuth2 Application not found.'));
+ return;
+ }
+
+ $app = $r[0];
+
+ $tpl = get_markup_template("settings_oauth2_edit.tpl");
+ $o .= replace_macros($tpl, array(
+ '$form_security_token' => get_form_security_token("settings_oauth2"),
+ '$title' => t('Add application'),
+ '$submit' => t('Update'),
+ '$cancel' => t('Cancel'),
+ '$name' => array('name', t('Name'), $app['client_id'], t('Name of application')),
+ '$secret' => array('secret', t('Consumer Secret'), $app['client_secret'], t('Automatically generated - change if desired. Max length 20')),
+ '$redirect' => array('redirect', t('Redirect'), $app['redirect_uri'], t('Redirect URI - leave blank unless your application specifically requires this')),
+ '$grant' => array('grant', t('Grant Types'), $app['grant_types'], t('leave blank unless your application sepcifically requires this')),
+ '$scope' => array('scope', t('Authorization scope'), $app['scope'], t('leave blank unless your application sepcifically requires this')),
+ ));
+ return $o;
+ }
+
+ if((argc() > 3) && (argv(2) === 'delete')) {
+ check_form_security_token_redirectOnErr('/settings/oauth2', 'settings_oauth2', 't');
+
+ $r = q("DELETE FROM oauth_clients WHERE client_id = '%s' AND user_id = '%s'",
+ dbesc(argv(3)),
+ dbesc(local_channel())
+ );
+ goaway(z_root()."/settings/oauth2/");
+ return;
+ }
+
+
+ $r = q("SELECT oauth_clients.*, oauth_access_tokens.access_token as oauth_token, (oauth_clients.user_id = '%s') AS my
+ FROM oauth_clients
+ LEFT JOIN oauth_access_tokens ON oauth_clients.client_id=oauth_access_tokens.client_id
+ WHERE oauth_clients.user_id IN ('%s',0)",
+ dbesc(local_channel()),
+ dbesc(local_channel())
+ );
+
+ $tpl = get_markup_template("settings_oauth2.tpl");
+ $o .= replace_macros($tpl, array(
+ '$form_security_token' => get_form_security_token("settings_oauth2"),
+ '$baseurl' => z_root(),
+ '$title' => t('Connected OAuth2 Apps'),
+ '$add' => t('Add application'),
+ '$edit' => t('Edit'),
+ '$delete' => t('Delete'),
+ '$consumerkey' => t('Client key starts with'),
+ '$noname' => t('No name'),
+ '$remove' => t('Remove authorization'),
+ '$apps' => $r,
+ ));
+ return $o;
+
+ }
+
+} \ No newline at end of file
diff --git a/Zotlabs/Module/Well_known.php b/Zotlabs/Module/Well_known.php
index b57666bff..177de2323 100644
--- a/Zotlabs/Module/Well_known.php
+++ b/Zotlabs/Module/Well_known.php
@@ -26,7 +26,6 @@ class Well_known extends \Zotlabs\Web\Controller {
killme();
}
-
switch(argv(1)) {
case 'zot-info':
\App::$argc -= 1;
@@ -52,6 +51,10 @@ class Well_known extends \Zotlabs\Web\Controller {
$module->init();
break;
+ case 'dnt-policy.txt':
+ echo file_get_contents('doc/dnt-policy.txt');
+ killme();
+
default:
if(file_exists(\App::$cmd)) {
echo file_get_contents(\App::$cmd);
diff --git a/Zotlabs/Storage/Browser.php b/Zotlabs/Storage/Browser.php
index f1c95802b..508c39d22 100644
--- a/Zotlabs/Storage/Browser.php
+++ b/Zotlabs/Storage/Browser.php
@@ -274,7 +274,7 @@ class Browser extends DAV\Browser\Plugin {
'$actionspanel' => $output,
'$shared' => t('Shared'),
'$create' => t('Create'),
- '$upload' => t('Upload'),
+ '$upload' => t('Add Files'),
'$is_owner' => $is_owner,
'$parentpath' => $parentpath,
'$cpath' => bin2hex(\App::$query_string),
diff --git a/Zotlabs/Widget/Catcloud.php b/Zotlabs/Widget/Catcloud.php
new file mode 100644
index 000000000..c53f9bbf6
--- /dev/null
+++ b/Zotlabs/Widget/Catcloud.php
@@ -0,0 +1,46 @@
+<?php
+
+namespace Zotlabs\Widget;
+
+class Catcloud {
+
+ function widget($arr) {
+
+ if((! \App::$profile['profile_uid']) || (! \App::$profile['channel_hash']))
+ return '';
+
+ $limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50);
+
+ if(array_key_exists('type',$arr)) {
+ switch($arr['type']) {
+
+ case 'cards':
+
+ if(! perm_is_allowed(\App::$profile['profile_uid'], get_observer_hash(), 'view_pages'))
+ return '';
+
+ return card_catblock(\App::$profile['profile_uid'], $limit, '', \App::$profile['channel_hash']);
+
+ case 'articles':
+
+ if(! perm_is_allowed(\App::$profile['profile_uid'], get_observer_hash(), 'view_pages'))
+ return '';
+
+ return article_catblock(\App::$profile['profile_uid'], $limit, '', \App::$profile['channel_hash']);
+
+
+ default:
+ break;
+ }
+ }
+
+
+ if(! perm_is_allowed(\App::$profile['profile_uid'], get_observer_hash(), 'view_stream'))
+ return '';
+
+ return catblock(\App::$profile['profile_uid'], $limit, '', \App::$profile['channel_hash']);
+
+
+ }
+
+}
diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php
index f2619c5cf..fc78a2a39 100644
--- a/Zotlabs/Widget/Notifications.php
+++ b/Zotlabs/Widget/Notifications.php
@@ -123,7 +123,7 @@ class Notifications {
];
}
- if(get_config('system', 'disable_discover_tab') != 1) {
+ if(can_view_public_stream()) {
$notifications[] = [
'type' => 'pubs',
'icon' => 'globe',
diff --git a/Zotlabs/Widget/Settings_menu.php b/Zotlabs/Widget/Settings_menu.php
index 455fdcb9b..9574becc3 100644
--- a/Zotlabs/Widget/Settings_menu.php
+++ b/Zotlabs/Widget/Settings_menu.php
@@ -81,12 +81,20 @@ class Settings_menu {
if(feature_enabled(local_channel(),'oauth_clients')) {
$tabs[] = array(
- 'label' => t('Connected apps'),
+ 'label' => t('OAuth1 apps'),
'url' => z_root() . '/settings/oauth',
'selected' => ((argv(1) === 'oauth') ? 'active' : ''),
);
}
+ if(feature_enabled(local_channel(),'oauth2_clients')) {
+ $tabs[] = array(
+ 'label' => t('OAuth2 apps'),
+ 'url' => z_root() . '/settings/oauth2',
+ 'selected' => ((argv(1) === 'oauth2') ? 'active' : ''),
+ );
+ }
+
if(feature_enabled(local_channel(),'access_tokens')) {
$tabs[] = array(
'label' => t('Guest Access Tokens'),
diff --git a/Zotlabs/Widget/Tagcloud.php b/Zotlabs/Widget/Tagcloud.php
index cf7a4932e..f79bd59ad 100644
--- a/Zotlabs/Widget/Tagcloud.php
+++ b/Zotlabs/Widget/Tagcloud.php
@@ -2,9 +2,6 @@
namespace Zotlabs\Widget;
-// @FIXME The problem with this widget is that we don't have a search function for webpages
-// that we can send the links to. Then we should also provide an option to search webpages
-// and conversations.
class Tagcloud {
@@ -14,15 +11,15 @@ class Tagcloud {
$uid = \App::$profile_uid;
$count = ((x($args,'count')) ? intval($args['count']) : 24);
$flags = 0;
- $type = TERM_CATEGORY;
+ $type = TERM_HASHTAG;
// @FIXME there exists no $authors variable
- $r = tagadelic($uid, $count, $authors, $owner, $flags, ITEM_TYPE_WEBPAGE, $type);
+ $r = tagadelic($uid, $count, $authors, $owner, $flags, 0, $type);
// @FIXME this should use a template
if($r) {
- $o = '<div class="tagblock widget"><h3>' . t('Categories') . '</h3><div class="tags" align="center">';
+ $o = '<div class="tagblock widget"><h3>' . t('Tags') . '</h3><div class="tags" align="center">';
foreach($r as $rv) {
$o .= '<span class="tag' . $rv[2] . '">' . $rv[0] .' </span> ' . "\r\n";
}