From 26b92c85641f0c4c4bda683456106c4ad21caa86 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 14 Dec 2017 22:41:11 +0100 Subject: fix another PHP7.2 warningg --- Zotlabs/Module/Item.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 37a3a3a85..6365230f8 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -156,7 +156,7 @@ class Item extends \Zotlabs\Web\Controller { if(! x($_REQUEST,'type')) $_REQUEST['type'] = 'net-comment'; - if($obj_type == ACTIVITY_OBJ_POST) + if($obj_type == ACTIVITY_OBJ_NOTE) $obj_type = ACTIVITY_OBJ_COMMENT; if($parent) { -- cgit v1.2.3 From 5c5fc0a62f892f20c2a5a21acf2932ef6a327ad7 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 15 Dec 2017 08:51:05 +0100 Subject: only use effective uid if we deal with sys channel content --- Zotlabs/Module/Hq.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index 073b67b92..1e46a6353 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -98,6 +98,8 @@ class Hq extends \Zotlabs\Web\Controller { $sys = get_sys_channel(); $sql_extra = item_permissions_sql($sys['channel_id']); + $sys_item = false; + } if(! $update) { @@ -215,6 +217,8 @@ class Hq extends \Zotlabs\Web\Controller { } if(!$r) { + $sys_item = true; + $r = q("SELECT item.id AS item_id FROM item LEFT JOIN abook ON item.author_xchan = abook.abook_xchan WHERE mid = '%s' AND item.uid = %d $item_normal @@ -243,6 +247,8 @@ class Hq extends \Zotlabs\Web\Controller { } if(!$r) { + $sys_item = true; + $r = q("SELECT item.parent AS item_id FROM item LEFT JOIN abook ON item.author_xchan = abook.abook_xchan WHERE mid = '%s' AND item.uid = %d $item_normal_update $simple_update @@ -268,7 +274,7 @@ class Hq extends \Zotlabs\Web\Controller { dbesc($parents_str) ); - xchan_query($items,true,local_channel()); + xchan_query($items,true,(($sys_item) ? local_channel() : 0)); $items = fetch_post_tags($items,true); $items = conv_sort($items,'created'); } -- cgit v1.2.3 From fe960d7c28e89240902293ba064d452b92d7d27a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 18 Dec 2017 12:46:37 +0100 Subject: notifications: only handle item otype notify_ids --- Zotlabs/Module/Ping.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index c1bce0d51..a3f6cdfec 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -279,8 +279,8 @@ class Ping extends \Zotlabs\Web\Controller { 'photo' => $tt['photo'], 'when' => relative_date($tt['created']), 'hclass' => (($tt['seen']) ? 'notify-seen' : 'notify-unseen'), - 'b64mid' => $b64mid, - 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : ''), + 'b64mid' => (($tt['otype'] == 'item') ? $b64mid : 'undefined'), + 'notify_id' => (($tt['otype'] == 'item') ? $tt['id'] : 'undefined'), 'message' => $message ); } -- cgit v1.2.3 From 38646fe0e1302b3be932a4d59e9431c7afe5c847 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 28 Dec 2017 14:06:30 -0800 Subject: Make affinity widget settings work. It's entirely possible they never did work correctly. I'm not comfortable over-riding the network_page_default config in this way but this is the way I've always set the affinity and it has worked just fine for me for several years and there haven't been any other requests to extend the network page default options. --- Zotlabs/Module/Settings/Featured.php | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php index ebe2996d3..6a8d10b2d 100644 --- a/Zotlabs/Module/Settings/Featured.php +++ b/Zotlabs/Module/Settings/Featured.php @@ -11,15 +11,21 @@ class Featured { call_hooks('feature_settings_post', $_POST); if($_POST['affinity_slider-submit']) { - if(intval($_POST['affinity_cmax'])) { - set_pconfig(local_channel(),'affinity','cmax',intval($_POST['affinity_cmax'])); + $cmax = intval($_POST['affinity_cmax']); + if($cmax < 0 || $cmax > 99) + $cmax = 99; + $cmin = intval($_POST['affinity_cmin']); + if($cmin < 0 || $cmin > 99) + $cmin = 0; + if($cmin !== 0 || $cmax !== 99) { + set_pconfig(local_channel(),'system','network_page_default','cmin=' . $cmin . '&cmax=' . $cmax); } - if(intval($_POST['affinity_cmin'])) { - set_pconfig(local_channel(),'affinity','cmin',intval($_POST['affinity_cmin'])); - } - if(intval($_POST['affinity_cmax']) || intval($_POST['affinity_cmin'])) { - info( t('Affinity Slider settings updated.') . EOL); + else { + set_pconfig(local_channel(),'system','network_page_default',''); } + + info( t('Affinity Slider settings updated.') . EOL); + } build_sync_packet(); -- cgit v1.2.3 From 5cfb63da50f21f0f9591599cde476b575cb1266e Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 28 Dec 2017 15:12:20 -0800 Subject: a different (hopefully better) implementation of affinity presets, but not for 3.0 because strings have changed. --- Zotlabs/Module/Network.php | 6 ++++-- Zotlabs/Module/Settings/Featured.php | 12 ++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 4deb7c9e8..d54220e75 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -106,6 +106,8 @@ class Network extends \Zotlabs\Web\Controller { $o = ''; + $default_cmin = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0); + $default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99); // if no tabs are selected, defaults to comments @@ -115,8 +117,8 @@ class Network extends \Zotlabs\Web\Controller { $liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0); $conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0); $spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0); - $cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : 0); - $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : 99); + $cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : $default_cmin); + $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : $default_cmax); $file = ((x($_GET,'file')) ? $_GET['file'] : ''); $xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : ''); $net = ((x($_GET,'net')) ? $_GET['net'] : ''); diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php index 6a8d10b2d..9c5a7b16c 100644 --- a/Zotlabs/Module/Settings/Featured.php +++ b/Zotlabs/Module/Settings/Featured.php @@ -17,12 +17,8 @@ class Featured { $cmin = intval($_POST['affinity_cmin']); if($cmin < 0 || $cmin > 99) $cmin = 0; - if($cmin !== 0 || $cmax !== 99) { - set_pconfig(local_channel(),'system','network_page_default','cmin=' . $cmin . '&cmax=' . $cmax); - } - else { - set_pconfig(local_channel(),'system','network_page_default',''); - } + set_pconfig(local_channel(),'affinity','cmin',$cmin); + set_pconfig(local_channel(),'affinity','cmax',$cmax); info( t('Affinity Slider settings updated.') . EOL); @@ -46,12 +42,12 @@ class Featured { $cmax = intval(get_pconfig(local_channel(),'affinity','cmax')); $cmax = (($cmax) ? $cmax : 99); $setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array( - '$field' => array('affinity_cmax', t('Default maximum affinity level'), $cmax, '') + '$field' => array('affinity_cmax', t('Default maximum affinity level'), $cmax, t('0-99 default 99')) )); $cmin = intval(get_pconfig(local_channel(),'affinity','cmin')); $cmin = (($cmin) ? $cmin : 0); $setting_fields .= replace_macros(get_markup_template('field_input.tpl'), array( - '$field' => array('affinity_cmin', t('Default minimum affinity level'), $cmin, '') + '$field' => array('affinity_cmin', t('Default minimum affinity level'), $cmin, t('0-99 - default 0')) )); $settings_addons .= replace_macros(get_markup_template('generic_addon_settings.tpl'), array( -- cgit v1.2.3 From 1fcf59ff94200a542bfc99c592a924236de1d3c7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 28 Dec 2017 15:16:50 -0800 Subject: cleanup --- Zotlabs/Module/Network.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index d54220e75..0da2a5676 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -35,9 +35,12 @@ class Network extends \Zotlabs\Web\Controller { return login(false); } - if($load) + $o = ''; + + if($load) { $_SESSION['loadtime'] = datetime_convert(); - + } + $arr = array('query' => \App::$query_string); call_hooks('network_content_init', $arr); @@ -104,7 +107,6 @@ class Network extends \Zotlabs\Web\Controller { $def_acl = array('allow_gid' => '<' . $r[0]['hash'] . '>'); } - $o = ''; $default_cmin = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0); $default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99); -- cgit v1.2.3 From e095cb8113c1ba6aec16a3bb500a447480218c19 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 30 Dec 2017 15:35:18 -0800 Subject: possibly fix hubzilla #673 (prev/next buttons on connedit can show deleted connections). We cannot actually determine that a connection has been deleted (this is typically accomplished by removing the abook record), but we can determine if the corresponding xchan has been deleted. --- Zotlabs/Module/Connedit.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 23c5282e3..e0511b0d3 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -567,7 +567,7 @@ class Connedit extends \Zotlabs\Web\Controller { $contact_id = \App::$poi['abook_id']; $contact = \App::$poi; - $cn = q("SELECT abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 order by xchan_name", + $cn = q("SELECT abook_id, xchan_name from abook left join xchan on abook_xchan = xchan_hash where abook_channel = %d and abook_self = 0 and xchan_deleted = 0 order by xchan_name", intval(local_channel()) ); -- cgit v1.2.3 From 3fadedcc54e9f937dbc461da7e99a851c044b6bf Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 30 Dec 2017 22:48:06 -0800 Subject: test of new affinity preset code (post 3.0) --- Zotlabs/Module/Network.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 0da2a5676..551303984 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -110,6 +110,7 @@ class Network extends \Zotlabs\Web\Controller { $default_cmin = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmin',0) : 0); $default_cmax = ((feature_enabled(local_channel(),'affinity')) ? get_pconfig(local_channel(),'affinity','cmax',99) : 99); + // if no tabs are selected, defaults to comments @@ -119,8 +120,8 @@ class Network extends \Zotlabs\Web\Controller { $liked = ((x($_GET,'liked')) ? intval($_GET['liked']) : 0); $conv = ((x($_GET,'conv')) ? intval($_GET['conv']) : 0); $spam = ((x($_GET,'spam')) ? intval($_GET['spam']) : 0); - $cmin = ((x($_GET,'cmin')) ? intval($_GET['cmin']) : $default_cmin); - $cmax = ((x($_GET,'cmax')) ? intval($_GET['cmax']) : $default_cmax); + $cmin = ((array_key_exists('cmin',$_GET)) ? intval($_GET['cmin']) : $default_cmin); + $cmax = ((array_key_exists('cmax',$_GET)) ? intval($_GET['cmax']) : $default_cmax); $file = ((x($_GET,'file')) ? $_GET['file'] : ''); $xchan = ((x($_GET,'xchan')) ? $_GET['xchan'] : ''); $net = ((x($_GET,'net')) ? $_GET['net'] : ''); @@ -408,7 +409,6 @@ class Network extends \Zotlabs\Web\Controller { if($cmax == 99) $sql_nets .= " OR abook.abook_closeness IS NULL ) "; - } $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : ''); @@ -477,7 +477,6 @@ class Network extends \Zotlabs\Web\Controller { if($load) { // Fetch a page full of parent items for this page - $r = q("SELECT distinct item.id AS item_id, $ordering FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) $net_query @@ -488,7 +487,6 @@ class Network extends \Zotlabs\Web\Controller { $net_query2 ORDER BY $ordering DESC $pager_sql " ); - } else { -- cgit v1.2.3 From ce38350e003cc7c8925f2fe3054bc7fb277e29a0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 31 Dec 2017 14:45:42 -0800 Subject: this should finish up hubzilla issue #113 --- Zotlabs/Module/Profile_photo.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 411518c61..45a606d5f 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -179,7 +179,10 @@ class Profile_photo extends \Zotlabs\Web\Controller { ); } - profiles_build_sync(local_channel()); + // set $send to false in profiles_build_sync() to return the data + // so that we only send one sync packet. + + $sync_profiles = profiles_build_sync(local_channel(),false); // We'll set the updated profile-photo timestamp even if it isn't the default profile, // so that browsers will do a cache update unconditionally @@ -201,7 +204,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { $sync = attach_export_data($channel,$base_image['resource_id']); if($sync) - build_sync_packet($channel['channel_id'],array('file' => array($sync))); + build_sync_packet($channel['channel_id'],array('file' => array($sync), 'profile' => $sync_profiles)); // Similarly, tell the nav bar to bypass the cache and update the avatar image. -- cgit v1.2.3 From ada578e7e3fc86970be6d1f242f785dae14f5e30 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 2 Jan 2018 14:04:43 -0800 Subject: issues with feed parameters --- Zotlabs/Module/Feed.php | 9 ++++++--- Zotlabs/Module/Ofeed.php | 9 ++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Feed.php b/Zotlabs/Module/Feed.php index 06637b6d2..36869abbe 100644 --- a/Zotlabs/Module/Feed.php +++ b/Zotlabs/Module/Feed.php @@ -16,12 +16,15 @@ class Feed extends \Zotlabs\Web\Controller { $params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml'); $params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0); $params['top'] = ((x($_REQUEST,'top')) ? intval($_REQUEST['top']) : 0); - $params['start'] = ((x($params,'start')) ? intval($params['start']) : 0); - $params['records'] = ((x($params,'records')) ? intval($params['records']) : 40); - $params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc'); + $params['start'] = ((x($_REQUEST,'start')) ? intval($_REQUEST['start']) : 0); + $params['records'] = ((x($_REQUEST,'records')) ? intval($_REQUEST['records']) : 40); + $params['direction'] = ((x($_REQUEST,'direction')) ? dbesc($_REQUEST['direction']) : 'desc'); $params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : ''); $params['compat'] = ((x($_REQUEST,'compat')) ? intval($_REQUEST['compat']) : 0); + if(! in_array($params['direction'],['asc','desc'])) { + $params['direction'] = 'desc'; + } if(argc() > 1) { diff --git a/Zotlabs/Module/Ofeed.php b/Zotlabs/Module/Ofeed.php index 58488d4af..d18a43ae5 100644 --- a/Zotlabs/Module/Ofeed.php +++ b/Zotlabs/Module/Ofeed.php @@ -17,12 +17,15 @@ class Ofeed extends \Zotlabs\Web\Controller { $params['type'] = ((stristr(argv(0),'json')) ? 'json' : 'xml'); $params['pages'] = ((x($_REQUEST,'pages')) ? intval($_REQUEST['pages']) : 0); $params['top'] = ((x($_REQUEST,'top')) ? intval($_REQUEST['top']) : 0); - $params['start'] = ((x($params,'start')) ? intval($params['start']) : 0); - $params['records'] = ((x($params,'records')) ? intval($params['records']) : 10); - $params['direction'] = ((x($params,'direction')) ? dbesc($params['direction']) : 'desc'); + $params['start'] = ((x($_REQUEST,'start')) ? intval($_REQUEST['start']) : 0); + $params['records'] = ((x($_REQUEST,'records')) ? intval($_REQUEST['records']) : 10); + $params['direction'] = ((x($_REQUEST,'direction')) ? dbesc($_REQUEST['direction']) : 'desc'); $params['cat'] = ((x($_REQUEST,'cat')) ? escape_tags($_REQUEST['cat']) : ''); $params['compat'] = ((x($_REQUEST,'compat')) ? intval($_REQUEST['compat']) : 1); + if(! in_array($params['direction'],['asc','desc'])) { + $params['direction'] = 'desc'; + } if(argc() > 1) { -- cgit v1.2.3 From aa63c23839990045e8e4a1a283b91a1cd21e1e9c Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sat, 23 Dec 2017 14:42:23 +0100 Subject: :bulb: Add source documentation from recent conversations. There have been some conversations in the last weeks which explained several parts of the code, so add it to the source code documentation. Also some other small source code documentation improvements. --- Zotlabs/Module/Acl.php | 43 ++++++++++++++++++++++--------------------- 1 file changed, 22 insertions(+), 21 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index ad1c8b8cd..fae7e2e44 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -1,36 +1,39 @@ standard ACL request // 'g' => Groups only ACL request // 'f' => forums only ACL request @@ -382,15 +385,13 @@ class Acl extends \Zotlabs\Web\Controller { 'count' => $count, 'items' => $items, ); - - - + echo json_encode($o); - + killme(); } - - + + function navbar_complete(&$a) { // logger('navbar_complete'); @@ -447,5 +448,5 @@ class Acl extends \Zotlabs\Web\Controller { } return array(); } - + } -- cgit v1.2.3 From 0600817ef75d19d1ec91ba822f8a6938d442824e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 8 Jan 2018 11:11:17 +0100 Subject: fix regression in app categories --- Zotlabs/Module/Apps.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Apps.php b/Zotlabs/Module/Apps.php index 2f61f2932..c672ea467 100644 --- a/Zotlabs/Module/Apps.php +++ b/Zotlabs/Module/Apps.php @@ -22,7 +22,8 @@ class Apps extends \Zotlabs\Web\Controller { if(local_channel()) { Zlib\Apps::import_system_apps(); $syslist = array(); - $list = Zlib\Apps::app_list(local_channel(), (($mode == 'edit') ? true : false), $_GET['cat']); + $cat = ((array_key_exists('cat',$_GET) && $_GET['cat']) ? [ escape_tags($_GET['cat']) ] : ''); + $list = Zlib\Apps::app_list(local_channel(), (($mode == 'edit') ? true : false), $cat); if($list) { foreach($list as $x) { $syslist[] = Zlib\Apps::app_encode($x); @@ -43,7 +44,7 @@ class Apps extends \Zotlabs\Web\Controller { return replace_macros(get_markup_template('myapps.tpl'), array( '$sitename' => get_config('system','sitename'), - '$cat' => ((array_key_exists('cat',$_GET) && $_GET['cat']) ? escape_tags($_GET['cat']) : ''), + '$cat' => $cat, '$title' => t('Apps'), '$apps' => $apps, '$authed' => ((local_channel()) ? true : false), -- cgit v1.2.3 From 62f0266f467a03ce313edd8dc582c5c194cd5396 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 8 Jan 2018 14:45:21 -0800 Subject: scrutinizer issues: none worthy of including in 3.0, there will likely be a few hundred more before all is said and done. --- Zotlabs/Module/Api.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Api.php b/Zotlabs/Module/Api.php index a2a1aac1d..aa0fca54d 100644 --- a/Zotlabs/Module/Api.php +++ b/Zotlabs/Module/Api.php @@ -39,10 +39,12 @@ class Api extends \Zotlabs\Web\Controller { // get consumer/client from request token try { - $request = OAuth1Request::from_request(); + $request = \OAuth1Request::from_request(); } catch(\Exception $e) { - echo "
"; var_dump($e); killme();
+				logger('OAuth exception: ' . print_r($e,true));
+				// echo "
"; var_dump($e); 
+				killme();
 			}
 			
 			
@@ -52,7 +54,7 @@ class Api extends \Zotlabs\Web\Controller {
 				if (is_null($app)) 
 					return "Invalid request. Unknown token.";
 
-				$consumer = new OAuth1Consumer($app['client_id'], $app['pw'], $app['redirect_uri']);
+				$consumer = new \OAuth1Consumer($app['client_id'], $app['pw'], $app['redirect_uri']);
 	
 				$verifier = md5($app['secret'] . local_channel());
 				set_config('oauth', $verifier, local_channel());
@@ -63,7 +65,7 @@ class Api extends \Zotlabs\Web\Controller {
 					$glue = '?';
 					if(strstr($consumer->callback_url,$glue))
 						$glue = '?';
-					goaway($consumer->callback_url . $glue . "oauth_token=" . OAuth1Util::urlencode_rfc3986($params['oauth_token']) . "&oauth_verifier=" . OAuth1Util::urlencode_rfc3986($verifier));
+					goaway($consumer->callback_url . $glue . "oauth_token=" . \OAuth1Util::urlencode_rfc3986($params['oauth_token']) . "&oauth_verifier=" . \OAuth1Util::urlencode_rfc3986($verifier));
 					killme();
 				}
 							
-- 
cgit v1.2.3


From c09bab466a989a606fd1940a667eb95b90fabe09 Mon Sep 17 00:00:00 2001
From: zotlabs 
Date: Wed, 10 Jan 2018 15:32:04 -0800
Subject: hubzilla issue #945 continued: We previously blocked directory
 keywords when searching the local directory as it produced errant results and
 included results from the entire directory space (an issue that was resolved
 satisfactorily by that fix sometime in the past). As a result of issue #945
 this was reworked so that we should return correct results for keywords when
 searching either the local directory or a standalone directory.

---
 Zotlabs/Module/Dirsearch.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

(limited to 'Zotlabs/Module')

diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php
index e6cf5449a..53ec1a850 100644
--- a/Zotlabs/Module/Dirsearch.php
+++ b/Zotlabs/Module/Dirsearch.php
@@ -313,7 +313,7 @@ class Dirsearch extends \Zotlabs\Web\Controller {
 	
 			$ret['results'] = $entries;
 			if($kw) {
-				$k = dir_tagadelic($kw);
+				$k = dir_tagadelic($kw, $hub);
 				if($k) {
 					$ret['keywords'] = array();
 					foreach($k as $kv) {
-- 
cgit v1.2.3


From 25a63dc413cd51ce12deb1a87b0609e7829b0154 Mon Sep 17 00:00:00 2001
From: Mario Vavti 
Date: Thu, 11 Jan 2018 10:58:46 +0100
Subject: continue working on hq

---
 Zotlabs/Module/Hq.php | 33 ++++++++++++++-------------------
 1 file changed, 14 insertions(+), 19 deletions(-)

(limited to 'Zotlabs/Module')

diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php
index 1e46a6353..ec3858471 100644
--- a/Zotlabs/Module/Hq.php
+++ b/Zotlabs/Module/Hq.php
@@ -51,8 +51,8 @@ class Hq extends \Zotlabs\Web\Controller {
 
 		if(! $item_hash) {
 			$r = q("SELECT mid FROM item
-				WHERE uid = %d 
-				AND mid = parent_mid
+				WHERE uid = %d $item_normal
+				AND item_unseen = 1 
 				ORDER BY created DESC LIMIT 1",
 				intval(local_channel())
 			);
@@ -135,13 +135,11 @@ class Hq extends \Zotlabs\Web\Controller {
 			$o = replace_macros(get_markup_template("hq.tpl"),
 				[
 					'$no_messages' => (($target_item) ? false : true),
-					'$no_messages_label' => t('Welcome to hubzilla!')
+					'$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen activity...') ],
+					'$editor' => status_editor($a,$x)
 				]
 			);
-	
-			$o = '
'; - $o .= status_editor($a,$x); - $o .= '
'; + } if(! $update && ! $load) { @@ -266,23 +264,20 @@ class Hq extends \Zotlabs\Web\Controller { } if($r) { - $parents_str = ids_to_querystr($r,'item_id'); - if($parents_str) { - $items = q("SELECT item.*, item.id AS item_id - FROM item - WHERE parent IN ( %s ) $item_normal ", - dbesc($parents_str) - ); + $items = q("SELECT item.*, item.id AS item_id + FROM item + WHERE parent = '%s' $item_normal ", + dbesc($r[0]['item_id']) + ); - xchan_query($items,true,(($sys_item) ? local_channel() : 0)); - $items = fetch_post_tags($items,true); - $items = conv_sort($items,'created'); - } + xchan_query($items,true,(($sys_item) ? local_channel() : 0)); + $items = fetch_post_tags($items,true); + $items = conv_sort($items,'created'); } else { $items = []; } - + $o .= conversation($items, 'hq', $update, 'client'); if($updateable) { -- cgit v1.2.3 From 468e976a88fe3027dde1a56b116e495f7edd7d1a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 11 Jan 2018 12:13:57 -0800 Subject: OpenWebAuth: can fail after site re-installs; this may need to be pushed forward to master --- Zotlabs/Module/Owa.php | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index d58fd7a41..9a39fe4c0 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -31,19 +31,21 @@ class Owa extends \Zotlabs\Web\Controller { if($keyId) { $r = q("select * from hubloc left join xchan on hubloc_hash = xchan_hash - where hubloc_addr = '%s' limit 1", + where hubloc_addr = '%s' ", dbesc(str_replace('acct:','',$keyId)) ); if($r) { - $hubloc = $r[0]; - $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']); - if($verified && $verified['header_signed'] && $verified['header_valid']) { - $ret['success'] = true; - $token = random_string(32); - \Zotlabs\Zot\Verify::create('owt',0,$token,$r[0]['hubloc_addr']); - $result = ''; - openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']); - $ret['encrypted_token'] = base64url_encode($result); + foreach($r as $hubloc) { + $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']); + if($verified && $verified['header_signed'] && $verified['header_valid']) { + $ret['success'] = true; + $token = random_string(32); + \Zotlabs\Zot\Verify::create('owt',0,$token,$r[0]['hubloc_addr']); + $result = ''; + openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']); + $ret['encrypted_token'] = base64url_encode($result); + break; + } } } } -- cgit v1.2.3 From 6a8c5832201262f62a630890935553d51cff6d90 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 11 Jan 2018 14:29:00 -0800 Subject: expose settings for site sellpage and site location --- Zotlabs/Module/Admin/Site.php | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index a9db1ad55..50756c654 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -35,6 +35,8 @@ class Site { $abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0); $register_text = ((x($_POST,'register_text')) ? notags(trim($_POST['register_text'])) : ''); + $site_sellpage = ((x($_POST,'site_sellpage')) ? notags(trim($_POST['site_sellpage'])) : ''); + $site_location = ((x($_POST,'site_location')) ? notags(trim($_POST['site_location'])) : ''); $frontpage = ((x($_POST,'frontpage')) ? notags(trim($_POST['frontpage'])) : ''); $mirror_frontpage = ((x($_POST,'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0); $directory_server = ((x($_POST,'directory_server')) ? trim($_POST['directory_server']) : ''); @@ -76,6 +78,8 @@ class Site { set_config('system', 'poll_interval', $poll_interval); set_config('system', 'maxloadavg', $maxloadavg); set_config('system', 'frontpage', $frontpage); + set_config('system', 'sellpage', $site_sellpage); + set_config('system', 'site_location', $site_location); set_config('system', 'mirror_frontpage', $mirror_frontpage); set_config('system', 'sitename', $sitename); set_config('system', 'login_on_homepage', $login_on_homepage); @@ -328,6 +332,12 @@ 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')), + + '$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())), + + '$location' => array('site_location', t('Optional: site location'), get_config('system','site_location',''), t('Region or country')), + + '$form_security_token' => get_form_security_token("admin_site"), )); } -- cgit v1.2.3 From db08e2cea0703818b7f3515271d7603c78d1e648 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 12 Jan 2018 15:54:27 +0100 Subject: mod hq: stick to show latest unseen toplevel post on load --- Zotlabs/Module/Hq.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index ec3858471..aa8293d5c 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -52,7 +52,7 @@ class Hq extends \Zotlabs\Web\Controller { if(! $item_hash) { $r = q("SELECT mid FROM item WHERE uid = %d $item_normal - AND item_unseen = 1 + AND mid = parent_ mid AND item_unseen = 1 ORDER BY created DESC LIMIT 1", intval(local_channel()) ); @@ -135,7 +135,7 @@ class Hq extends \Zotlabs\Web\Controller { $o = replace_macros(get_markup_template("hq.tpl"), [ '$no_messages' => (($target_item) ? false : true), - '$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen activity...') ], + '$no_messages_label' => [ t('Welcome to Hubzilla!'), t('You have got no unseen posts...') ], '$editor' => status_editor($a,$x) ] ); -- cgit v1.2.3 From f2ec84fb138e056b2a49f0fcdf8fc0af05689a91 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 12 Jan 2018 16:03:41 +0100 Subject: typo --- Zotlabs/Module/Hq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index aa8293d5c..c169644db 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -52,7 +52,7 @@ class Hq extends \Zotlabs\Web\Controller { if(! $item_hash) { $r = q("SELECT mid FROM item WHERE uid = %d $item_normal - AND mid = parent_ mid AND item_unseen = 1 + AND mid = parent_mid AND item_unseen = 1 ORDER BY created DESC LIMIT 1", intval(local_channel()) ); -- cgit v1.2.3 From 2c5b6cf8dca239ab4ae85825e4593f8dba56cf74 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 12 Jan 2018 22:03:06 +0100 Subject: update to bootstrap 4 beta3 --- Zotlabs/Module/Hq.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index c169644db..a9c3bb8e2 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -51,8 +51,8 @@ class Hq extends \Zotlabs\Web\Controller { if(! $item_hash) { $r = q("SELECT mid FROM item - WHERE uid = %d $item_normal - AND mid = parent_mid AND item_unseen = 1 + WHERE uid = %d + AND mid = parent_mid ORDER BY created DESC LIMIT 1", intval(local_channel()) ); -- cgit v1.2.3 From 8892568652c2fc56e39611660d9bec4770c4354b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 13 Jan 2018 12:24:55 -0800 Subject: improve owa logging --- Zotlabs/Module/Owa.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 9a39fe4c0..8764a33ee 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -38,14 +38,18 @@ class Owa extends \Zotlabs\Web\Controller { foreach($r as $hubloc) { $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']); if($verified && $verified['header_signed'] && $verified['header_valid']) { + logger('OWA success: ' . $hubloc['hubloc_addr'],LOGGER_DATA); $ret['success'] = true; $token = random_string(32); - \Zotlabs\Zot\Verify::create('owt',0,$token,$r[0]['hubloc_addr']); + \Zotlabs\Zot\Verify::create('owt',0,$token,$hubloc['hubloc_addr']); $result = ''; openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']); $ret['encrypted_token'] = base64url_encode($result); break; } + else { + logger('OWA fail: ' . $hubloc['hubloc_id'] . ' ' . $hubloc['hubloc_addr']); + } } } } -- cgit v1.2.3 From 08bea83c032675e93c789070e681aab212c1d2a4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 13 Jan 2018 13:45:33 -0800 Subject: unexpected openssl result --- Zotlabs/Module/Owa.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 8764a33ee..537489687 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -38,6 +38,7 @@ class Owa extends \Zotlabs\Web\Controller { foreach($r as $hubloc) { $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']); if($verified && $verified['header_signed'] && $verified['header_valid']) { + logger('OWA header: ' . print_r($verified,true)); logger('OWA success: ' . $hubloc['hubloc_addr'],LOGGER_DATA); $ret['success'] = true; $token = random_string(32); -- cgit v1.2.3 From eb3e43feec4e2de439de5398fcf498c0de5afbd4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 13 Jan 2018 14:08:15 -0800 Subject: cleanup of last fix --- Zotlabs/Module/Owa.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 537489687..23ee14f39 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -38,7 +38,7 @@ class Owa extends \Zotlabs\Web\Controller { foreach($r as $hubloc) { $verified = \Zotlabs\Web\HTTPSig::verify('',$hubloc['xchan_pubkey']); if($verified && $verified['header_signed'] && $verified['header_valid']) { - logger('OWA header: ' . print_r($verified,true)); + logger('OWA header: ' . print_r($verified,true),LOGGER_DATA); logger('OWA success: ' . $hubloc['hubloc_addr'],LOGGER_DATA); $ret['success'] = true; $token = random_string(32); -- cgit v1.2.3 From ef11b3eb2bea74f0714402256e677fe7835c43ab Mon Sep 17 00:00:00 2001 From: Andrew Manning Date: Sun, 14 Jan 2018 15:02:43 -0500 Subject: Added minimum registration age to /admin/site settings page --- Zotlabs/Module/Admin/Site.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 50756c654..60cb39277 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -29,7 +29,7 @@ class Site { $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0); $register_policy = ((x($_POST,'register_policy')) ? intval(trim($_POST['register_policy'])) : 0); - + $minimum_age = ((x($_POST,'minimum_age')) ? intval(trim($_POST['minimum_age'])) : 13); $access_policy = ((x($_POST,'access_policy')) ? intval(trim($_POST['access_policy'])) : 0); $invite_only = ((x($_POST,'invite_only')) ? True : False); $abandon_days = ((x($_POST,'abandon_days')) ? intval(trim($_POST['abandon_days'])) : 0); @@ -127,6 +127,7 @@ class Site { set_config('system','maximagesize', $maximagesize); set_config('system','register_policy', $register_policy); + set_config('system','minimum_age', $minimum_age); set_config('system','invitation_only', $invite_only); set_config('system','access_policy', $access_policy); set_config('system','account_abandon_days', $abandon_days); @@ -303,6 +304,7 @@ class Site { '$maximagesize' => array('maximagesize', t("Maximum image size"), intval(get_config('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")), '$register_policy' => array('register_policy', t("Does this site allow new member registration?"), get_config('system','register_policy'), "", $register_choices), '$invite_only' => array('invite_only', t("Invitation only"), get_config('system','invitation_only'), t("Only allow new member registrations with an invitation code. Above register policy must be set to Yes.")), + '$minimum_age' => array('minimum_age', t("Minimum age"), (x(get_config('system','minimum_age'))?get_config('system','minimum_age'):13), t("Minimum age (in years) for who may register on this site.")), '$access_policy' => array('access_policy', t("Which best describes the types of account offered by this hub?"), get_config('system','access_policy'), "This is displayed on the public server site list.", $access_choices), '$register_text' => array('register_text', t("Register text"), htmlspecialchars(get_config('system','register_text'), ENT_QUOTES, 'UTF-8'), t("Will be displayed prominently on the registration page.")), '$frontpage' => array('frontpage', t("Site homepage to show visitors (default: login box)"), get_config('system','frontpage'), t("example: 'public' to show public stream, 'page/sys/home' to show a system webpage called 'home' or 'include:home.html' to include a file.")), -- cgit v1.2.3 From 91db66b32d2c469a6d0292712666614b48b4c62e Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 14 Jan 2018 18:22:58 -0800 Subject: move markdown-in-posts/comments feature to plugin --- Zotlabs/Module/Item.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 6365230f8..ad829137a 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -504,7 +504,12 @@ class Item extends \Zotlabs\Web\Controller { $body = z_input_filter($body,$mimetype,$execflag); } - // Verify ability to use html or php!!! + + $arr = [ 'profile_uid' => $profile_uid, 'content' => $body, 'mimetype' => $mimetype ]; + call_hooks('post_content',$arr); + $body = $arr['content']; + $mimetype = $arr['mimetype']; + $gacl = $acl->get(); $str_contact_allow = $gacl['allow_cid']; @@ -516,13 +521,6 @@ class Item extends \Zotlabs\Web\Controller { require_once('include/text.php'); - if($uid && $uid == $profile_uid && feature_enabled($uid,'markdown')) { - require_once('include/markdown.php'); - $body = preg_replace_callback('/\[share(.*?)\]/ism','\share_shield',$body); - $body = markdown_to_bb($body,true,['preserve_lf' => true]); - $body = preg_replace_callback('/\[share(.*?)\]/ism','\share_unshield',$body); - - } // BBCODE alert: the following functions assume bbcode input // and will require alternatives for alternative content-types (text/html, text/markdown, text/plain, etc.) -- cgit v1.2.3 From 746ea5a3691a67ceb176352e8b6fcfe0f2dc99d6 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Mon, 15 Jan 2018 11:34:42 +0100 Subject: fix some regressions with permission roles --- Zotlabs/Module/Connedit.php | 2 +- Zotlabs/Module/Defperms.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index e0511b0d3..8288886cd 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -866,7 +866,7 @@ class Connedit extends \Zotlabs\Web\Controller { $o .= replace_macros($tpl, [ '$header' => (($self) ? t('Connection Default Permissions') : sprintf( t('Connection: %s'),$contact['xchan_name'])), '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('Connection requests will be approved without your interaction'), $yes_no), - '$permcat' => [ 'permcat', t('Permission role'), '', '',$permcats ], + '$permcat' => [ 'permcat', t('Permission role'), '', '',$permcats ], '$permcat_new' => t('Add permission role'), '$permcat_enable' => feature_enabled(local_channel(),'permcats'), '$addr' => $contact['xchan_addr'], diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php index 9214331e4..422333a50 100644 --- a/Zotlabs/Module/Defperms.php +++ b/Zotlabs/Module/Defperms.php @@ -237,7 +237,7 @@ class Defperms extends \Zotlabs\Web\Controller { $o .= replace_macros($tpl, [ '$header' => t('Connection Default Permissions'), '$autoperms' => array('autoperms',t('Apply these permissions automatically'), ((get_pconfig(local_channel(),'system','autoperms')) ? 1 : 0), t('If enabled, connection requests will be approved without your interaction'), $yes_no), - '$permcat' => [ 'permcat', t('Permission role'), '', '',$permcats ], + '$permcat' => [ 'permcat', t('Permission role'), '', '',$permcats ], '$permcat_new' => t('Add permission role'), '$permcat_enable' => feature_enabled(local_channel(),'permcats'), '$section' => $section, -- cgit v1.2.3 From 03f692f24fe543c740e5443223d8084b9ca0c4de Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 15 Jan 2018 21:46:27 -0800 Subject: surface the article feature --- Zotlabs/Module/Articles.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Articles.php b/Zotlabs/Module/Articles.php index 25daca81d..e2e0fed5d 100644 --- a/Zotlabs/Module/Articles.php +++ b/Zotlabs/Module/Articles.php @@ -35,7 +35,7 @@ class Articles extends \Zotlabs\Web\Controller { return; } - nav_set_selected(t('Cards')); + nav_set_selected(t('Articles')); head_add_link([ 'rel' => 'alternate', @@ -102,6 +102,7 @@ class Articles extends \Zotlabs\Web\Controller { 'permissions' => $channel_acl, 'showacl' => (($is_owner) ? true : false), 'visitor' => true, + 'body' => '[summary][/summary]', 'hide_location' => false, 'hide_voting' => false, 'profile_uid' => intval($owner), -- cgit v1.2.3 From f1afb0ddfec8ed90332e5f6b2f0c74e338727094 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 17 Jan 2018 20:10:49 -0800 Subject: simplify dir_tagadelic dramatically --- Zotlabs/Module/Dirsearch.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Dirsearch.php b/Zotlabs/Module/Dirsearch.php index 53ec1a850..08f1f7a13 100644 --- a/Zotlabs/Module/Dirsearch.php +++ b/Zotlabs/Module/Dirsearch.php @@ -97,7 +97,10 @@ class Dirsearch extends \Zotlabs\Web\Controller { else $sync = false; - + if(($dirmode == DIRECTORY_MODE_STANDALONE) && (! $hub)) { + $hub = \App::get_hostname(); + } + if($hub) $hub_query = " and xchan_hash in (select hubloc_hash from hubloc where hubloc_host = '" . protect_sprintf(dbesc($hub)) . "') "; else -- cgit v1.2.3 From eb86ffefbfb38cf76316940a6aa164530f9b9348 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 17 Jan 2018 21:30:19 -0800 Subject: provide local pubstream option (content from this site only). --- Zotlabs/Module/Admin/Site.php | 4 ++++ Zotlabs/Module/Pubstream.php | 15 +++++++++++---- 2 files changed, 15 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 60cb39277..e04625c22 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -43,6 +43,7 @@ class Site { $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : ''); $force_publish = ((x($_POST,'publish_all')) ? True : False); $disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True); + $site_firehose = ((x($_POST,'site_firehose')) ? True : False); $login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False); $enable_context_help = ((x($_POST,'enable_context_help')) ? True : False); $global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : ''); @@ -135,6 +136,7 @@ class Site { set_config('system','allowed_sites', $allowed_sites); set_config('system','publish_all', $force_publish); set_config('system','disable_discover_tab', $disable_discover_tab); + set_config('system','site_firehose', $site_firehose); set_config('system','force_queue_threshold', $force_queue); if ($global_directory == '') { del_config('system', 'directory_submit_url'); @@ -314,6 +316,8 @@ class Site { '$verify_email' => array('verify_email', t("Verify Email Addresses"), get_config('system','verify_email'), t("Check to verify email addresses used in account registration (recommended).")), '$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")), '$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')), + '$site_firehose' => array('site_firehose', t('Site only Public Streams'), get_config('system','site_firehose'), t('Allow access to public content originating only from this site if Imported Public Streams are disabled.')), + '$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")), '$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")), diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index c469a0eca..2c25e2ce0 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -17,9 +17,16 @@ class Pubstream extends \Zotlabs\Web\Controller { return login(); } - $disable_discover_tab = get_config('system','disable_discover_tab') || get_config('system','disable_discover_tab') === false; - if($disable_discover_tab) - return; + $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); + $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); + + if(! ($site_firehose || $net_firehose)) { + return ''; + } + + if($net_firehose) { + $site_firehose = false; + } $mid = ((x($_REQUEST,'mid')) ? $_REQUEST['mid'] : ''); @@ -142,7 +149,7 @@ class Pubstream extends \Zotlabs\Web\Controller { require_once('include/channel.php'); require_once('include/security.php'); - if(get_config('system','site_firehose')) { + if($site_firehose) { $uids = " and item.uid in ( " . stream_perms_api_uids(PERMS_PUBLIC) . " ) and item_private = 0 and item_wall = 1 "; } else { -- cgit v1.2.3 From 23a20ba6a549aacd637606857147a4949f5637fe Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 18 Jan 2018 11:30:33 +0100 Subject: raise the queue threshold default from 300 to 3000 --- Zotlabs/Module/Admin/Site.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 60cb39277..86558e93c 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -66,7 +66,7 @@ class Site { $techlevel_lock = ((x($_POST,'techlock')) ? intval($_POST['techlock']) : 0); $imagick_path = ((x($_POST,'imagick_path')) ? trim($_POST['imagick_path']) : ''); $thumbnail_security = ((x($_POST,'thumbnail_security')) ? intval($_POST['thumbnail_security']) : 0); - $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 300); + $force_queue = ((intval($_POST['force_queue']) > 0) ? intval($_POST['force_queue']) : 3000); $techlevel = null; if(array_key_exists('techlevel', $_POST)) @@ -328,7 +328,7 @@ class Site { '$timeout' => array('timeout', t("Network timeout"), (x(get_config('system','curl_timeout'))?get_config('system','curl_timeout'):60), t("Value is in seconds. Set to 0 for unlimited (not recommended).")), '$delivery_interval' => array('delivery_interval', t("Delivery interval"), (x(get_config('system','delivery_interval'))?get_config('system','delivery_interval'):2), t("Delay background delivery processes by this many seconds to reduce system load. Recommend: 4-5 for shared hosts, 2-3 for virtual private servers. 0-1 for large dedicated servers.")), '$delivery_batch_count' => array('delivery_batch_count', t('Deliveries per process'),(x(get_config('system','delivery_batch_count'))?get_config('system','delivery_batch_count'):1), t("Number of deliveries to attempt in a single operating system process. Adjust if necessary to tune system performance. Recommend: 1-5.")), - '$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',300), t("Always defer immediate delivery if queue contains more than this number of entries.")), + '$force_queue' => array('force_queue', t("Queue Threshold"), get_config('system','force_queue_threshold',3000), t("Always defer immediate delivery if queue contains more than this number of entries.")), '$poll_interval' => array('poll_interval', t("Poll interval"), (x(get_config('system','poll_interval'))?get_config('system','poll_interval'):2), t("Delay background polling processes by this many seconds to reduce system load. If 0, use delivery interval.")), '$imagick_path' => array('imagick_path', t("Path to ImageMagick convert program"), get_config('system','imagick_convert_path'), t("If set, use this program to generate photo thumbnails for huge images ( > 4000 pixels in either dimension), otherwise memory exhaustion may occur. Example: /usr/bin/convert")), '$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.")), -- cgit v1.2.3 From a4588af0f8ef56734ad0a974838f9efeff342eff Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 21 Jan 2018 17:06:38 -0800 Subject: mod_search: fix the group by mess --- Zotlabs/Module/Search.php | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index a572a5a42..504c0353f 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -165,40 +165,41 @@ class Search extends \Zotlabs\Web\Controller { if($load) { $r = null; - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $prefix = 'distinct on (created, mid)'; - $suffix = 'ORDER BY created DESC, mid'; - } else { - $prefix = 'distinct'; - $suffix = 'group by mid ORDER BY created DESC'; - } if(local_channel()) { - $r = q("SELECT $prefix mid, item.id as item_id, item.* from item + $r = q("SELECT mid, MAX(id) as item_id from item WHERE ((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND item.deny_gid = '' AND item_private = 0 ) OR ( item.uid = %d )) OR item.owner_xchan = '%s' ) $item_normal $sql_extra - $suffix $pager_sql ", + group by mid order by created desc $pager_sql ", intval(local_channel()), dbesc($sys['xchan_hash']) ); } if($r === null) { - $r = q("SELECT $prefix mid, item.id as item_id, item.* from item + $r = q("SELECT mid, MAX(id) as item_id from item WHERE (((( item.allow_cid = '' AND item.allow_gid = '' AND item.deny_cid = '' AND item.deny_gid = '' AND item_private = 0 ) and owner_xchan in ( " . stream_perms_xchans(($observer) ? (PERMS_NETWORK|PERMS_PUBLIC) : PERMS_PUBLIC) . " )) $pub_sql ) OR owner_xchan = '%s') $item_normal $sql_extra - $suffix $pager_sql", + group by mid order by created desc $pager_sql", dbesc($sys['xchan_hash']) ); } + if($r) { + $str = ids_to_querystr($r,'item_id'); + $r = q("select *, id as item_id from item where id in ( " . $str . ") "); + } } else { $r = array(); } + + + + } if($r) { -- cgit v1.2.3 From c994f26dbd8151bd1e937dbb13d3ae416740fdd9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 21 Jan 2018 18:11:04 -0800 Subject: preserve reverse date sort in mod_search after changes --- Zotlabs/Module/Search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 504c0353f..4d35b59f3 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -190,7 +190,7 @@ class Search extends \Zotlabs\Web\Controller { } if($r) { $str = ids_to_querystr($r,'item_id'); - $r = q("select *, id as item_id from item where id in ( " . $str . ") "); + $r = q("select *, id as item_id from item where id in ( " . $str . ") order by created desc "); } } else { -- cgit v1.2.3 From 5967360991cb3766a6517759369b6d6fd8563c61 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 22 Jan 2018 16:49:45 -0800 Subject: hubzilla issue #920 - unable to delete permission groups with space in name --- Zotlabs/Module/Settings/Permcats.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Settings/Permcats.php b/Zotlabs/Module/Settings/Permcats.php index 336f69653..535399083 100644 --- a/Zotlabs/Module/Settings/Permcats.php +++ b/Zotlabs/Module/Settings/Permcats.php @@ -49,7 +49,7 @@ class Permcats { if(argc() > 2) - $name = argv(2); + $name = hex2bin(argv(2)); if(argc() > 3 && argv(3) === 'drop') { \Zotlabs\Lib\Permcat::delete(local_channel(),$name); @@ -70,7 +70,7 @@ class Permcats { if(($pc['name']) && ($name) && ($pc['name'] == $name)) $existing = $pc['perms']; if(! $pc['system']) - $permcats[$pc['name']] = $pc['localname']; + $permcats[bin2hex($pc['name'])] = $pc['localname']; } } -- cgit v1.2.3 From 4cfd7b65fba13b86450730aabdd7f37ea8e2afa9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 22 Jan 2018 20:07:08 -0800 Subject: siteinfo embellishments --- Zotlabs/Module/Siteinfo.php | 1 - 1 file changed, 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Siteinfo.php b/Zotlabs/Module/Siteinfo.php index fafd51f65..92ee78cc6 100644 --- a/Zotlabs/Module/Siteinfo.php +++ b/Zotlabs/Module/Siteinfo.php @@ -5,7 +5,6 @@ namespace Zotlabs\Module; class Siteinfo extends \Zotlabs\Web\Controller { function init() { -logger(print_r($_REQUEST,true)); if (argv(1) === 'json' || $_REQUEST['module_format'] === 'json') { $data = get_site_info(); json_return_and_die($data); -- cgit v1.2.3 From 4b7947d98c0625cfc53b481e2240a275e48c0d19 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 23 Jan 2018 16:36:56 -0800 Subject: replace image cropping library --- Zotlabs/Module/Cover_photo.php | 12 ++++++------ Zotlabs/Module/Profile_photo.php | 21 +++++++++++++-------- 2 files changed, 19 insertions(+), 14 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index 47bce6c2b..cfb513365 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -64,12 +64,12 @@ class Cover_photo extends \Zotlabs\Web\Controller { $image_id = substr($image_id,0,-2); } - - $srcX = $_POST['xstart']; - $srcY = $_POST['ystart']; - $srcW = $_POST['xfinal'] - $srcX; - $srcH = $_POST['yfinal'] - $srcY; - + + + $srcX = intval($_POST['xstart']); + $srcY = intval($_POST['ystart']); + $srcW = intval($_POST['xfinal']) - $srcX; + $srcH = intval($_POST['yfinal']) - $srcY; $r = q("select gender from profile where uid = %d and is_default = 1 limit 1", intval(local_channel()) diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 45a606d5f..3aa6aee79 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -1,10 +1,11 @@ Date: Tue, 23 Jan 2018 16:44:11 -0800 Subject: add units to css --- Zotlabs/Module/Profile_photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 3aa6aee79..222b92721 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -56,7 +56,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { if((array_key_exists('cropfinal',$_POST)) && (intval($_POST['cropfinal']) == 1)) { - logger('crop: ' . print_r($_POST,true)); + // logger('crop: ' . print_r($_POST,true)); -- cgit v1.2.3 From 304085606fac6ae4fd2d3e29ed44afb4b4e1bc28 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 23 Jan 2018 20:03:17 -0800 Subject: some code cleanup and simplification in mod_like --- Zotlabs/Module/Like.php | 81 +++++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 40 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Like.php b/Zotlabs/Module/Like.php index b07824363..6d9fde17c 100644 --- a/Zotlabs/Module/Like.php +++ b/Zotlabs/Module/Like.php @@ -9,9 +9,41 @@ require_once('include/items.php'); class Like extends \Zotlabs\Web\Controller { - function get() { + + + private function reaction_to_activity($reaction) { + + $acts = [ + 'like' => ACTIVITY_LIKE , + 'dislike' => ACTIVITY_DISLIKE , + 'agree' => ACTIVITY_AGREE , + 'disagree' => ACTIVITY_DISAGREE , + 'abstain' => ACTIVITY_ABSTAIN , + 'attendyes' => ACTIVITY_ATTEND , + 'attendno' => ACTIVITY_ATTENDNO , + 'attendmaybe' => ACTIVITY_ATTENDMAYBE + ]; + + // unlike (etc.) reactions are an undo of positive reactions, rather than a negative action. + // The activity is the same in undo actions and will have the same activity mapping + + if(substr($reaction,0,2) === 'un') { + $reaction = substr($reaction,2); + } + + if(array_key_exists($reaction,$acts)) { + return $acts[$reaction]; + } + + return EMPTY_STR; + + } + + + + public function get() { - $o = ''; + $o = EMPTY_STR; $sys_channel = get_sys_channel(); $sys_channel_id = (($sys_channel) ? $sys_channel['channel_id'] : 0); @@ -35,48 +67,17 @@ class Like extends \Zotlabs\Web\Controller { if(! $verb) $verb = 'like'; - switch($verb) { - case 'like': - case 'unlike': - $activity = ACTIVITY_LIKE; - break; - case 'dislike': - case 'undislike': - $activity = ACTIVITY_DISLIKE; - break; - case 'agree': - case 'unagree': - $activity = ACTIVITY_AGREE; - break; - case 'disagree': - case 'undisagree': - $activity = ACTIVITY_DISAGREE; - break; - case 'abstain': - case 'unabstain': - $activity = ACTIVITY_ABSTAIN; - break; - case 'attendyes': - case 'unattendyes': - $activity = ACTIVITY_ATTEND; - break; - case 'attendno': - case 'unattendno': - $activity = ACTIVITY_ATTENDNO; - break; - case 'attendmaybe': - case 'unattendmaybe': - $activity = ACTIVITY_ATTENDMAYBE; - break; - default: - return; - break; + $activity = $this->reaction_to_activity($verb); + + if(! $activity) { + return EMPTY_STR; } + $extended_like = false; $object = $target = null; - $post_type = ''; - $objtype = ''; + $post_type = EMPTY_STR; + $objtype = EMPTY_STR; if(argc() == 3) { -- cgit v1.2.3 From e3a6b0012e95aae8e0572a53ea96ddc915d6eb03 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 24 Jan 2018 11:16:51 +0100 Subject: implement caching of notifications in browser session storage --- Zotlabs/Module/Logout.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Logout.php b/Zotlabs/Module/Logout.php index 6aa11d110..f06e7278b 100644 --- a/Zotlabs/Module/Logout.php +++ b/Zotlabs/Module/Logout.php @@ -9,4 +9,4 @@ class Logout extends \Zotlabs\Web\Controller { goaway(z_root()); } -} \ No newline at end of file +} -- cgit v1.2.3 From 660079bd2a4a6dcb54390a4c2f22bbc7a0633fd4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 26 Jan 2018 12:16:47 -0800 Subject: Issue with configurable site age limit, vagueness when informing about email validation policy; added email validation resend ability and the option to input a verification code at a webpage though both require additional work to provide these abilities. --- Zotlabs/Module/Register.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index deaee31bf..1cb3bab91 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -217,6 +217,9 @@ class Register extends \Zotlabs\Web\Controller { $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : ""); $perm_roles = \Zotlabs\Access\PermissionRoles::roles(); + + // A new account will not have a techlevel, but accounts can also be created by the administrator. + if((get_account_techlevel() < 4) && $privacy_role !== 'custom') unset($perm_roles[t('Other')]); @@ -231,15 +234,17 @@ class Register extends \Zotlabs\Web\Controller { // Configurable whether to restrict age or not - default is based on international legal requirements // This can be relaxed if you are on a restricted server that does not share with public servers - if(get_config('system','no_age_restriction')) + if(get_config('system','no_age_restriction')) { $label_tos = sprintf( t('I accept the %s for this website'), $toslink); - else + } + else { $age = get_config('system','minimum_age'); if(!$age) { $age = 13; } $label_tos = sprintf( t('I am over %s years of age and accept the %s for this website'), $age, $toslink); - + } + $enable_tos = 1 - intval(get_config('system','no_termsofservice')); $email = array('email', t('Your email address'), ((x($_REQUEST,'email')) ? strip_tags(trim($_REQUEST['email'])) : "")); @@ -255,6 +260,7 @@ class Register extends \Zotlabs\Web\Controller { $auto_create = (get_config('system','auto_channel_create') ? true : false); $default_role = get_config('system','default_permissions_role'); + $email_verify = get_config('system','verify_email'); require_once('include/bbcode.php'); @@ -278,7 +284,7 @@ class Register extends \Zotlabs\Web\Controller { '$pass1' => $password, '$pass2' => $password2, '$submit' => t('Register'), - '$verify_note' => t('This site may require email verification after submitting this form. If you are returned to a login page, please check your email for instructions.') + '$verify_note' => (($email_verify) ? t('This site requires email verification. After completing this form, please check your email for further instructions.') : ''), )); return $o; -- cgit v1.2.3 From bd0f63980ba0d0e606f2dd7a65313f7e150d330a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 27 Jan 2018 12:51:48 -0800 Subject: Usability improvements to registration/verification workflow. This requires additional testing. --- Zotlabs/Module/Email_resend.php | 48 +++++++++++++++++++++++++++++++++++++ Zotlabs/Module/Email_validation.php | 38 +++++++++++++++++++++++++++++ Zotlabs/Module/Register.php | 6 +++-- 3 files changed, 90 insertions(+), 2 deletions(-) create mode 100644 Zotlabs/Module/Email_resend.php create mode 100644 Zotlabs/Module/Email_validation.php (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Email_resend.php b/Zotlabs/Module/Email_resend.php new file mode 100644 index 000000000..367593b55 --- /dev/null +++ b/Zotlabs/Module/Email_resend.php @@ -0,0 +1,48 @@ + 1) { + $result = false; + $email = hex2bin(argv(1)); + + if($email) { + $result = verify_email_address( [ 'resend' => true, 'email' => $email ] ); + } + + if($result) { + notice(t('Email verification resent')); + } + else { + notice(t('Unable to resend email verification message.')); + } + + return; + + } + + // @todo - one can provide a form here to resend the mail + // after directing to here if a succesful login was attempted from an unverified address. + + + } + +} \ No newline at end of file diff --git a/Zotlabs/Module/Email_validation.php b/Zotlabs/Module/Email_validation.php new file mode 100644 index 000000000..4cc016847 --- /dev/null +++ b/Zotlabs/Module/Email_validation.php @@ -0,0 +1,38 @@ + 1) { + $email = hex2bin(argv(1)); + } + + $o = replace_macros(get_markup_template('email_validation.tpl'), [ + '$title' => t('Email Verification Required'), + '$desc' => sprintf( t('A verification token was sent to your email address [%s]. Enter that token here to complete the account verification step. Please allow a few minutes for delivery, and check your spam folder if you do not see the message.'),$email), + '$resend' => t('Resend Email'), + '$email' => bin2hex($email), + '$submit' => t('Submit'), + '$token' => [ 'token', t('Validation token'),'','' ], + ]); + + return $o; + + } + +} \ No newline at end of file diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index 1cb3bab91..c7fa1cee8 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -150,9 +150,11 @@ class Register extends \Zotlabs\Web\Controller { } if($email_verify) { - goaway(z_root()); + goaway(z_root() . '/email_validation/' . bin2hex($result['email'])); } - + + // fall through and authenticate if no approvals or verifications were required. + authenticate_success($result['account'],null,true,false,true); $new_channel = false; -- cgit v1.2.3 From 2e4e56f7cc696b2c52014f0050294826caa74d7d Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 27 Jan 2018 22:23:47 +0100 Subject: if startpage is /hq redirect all notifications links to /hq and minor notifications and hq fixes --- Zotlabs/Module/Hq.php | 2 ++ 1 file changed, 2 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index a9c3bb8e2..c305fdb3b 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -29,6 +29,8 @@ class Hq extends \Zotlabs\Web\Controller { ); } + killme(); + } function get($update = 0, $load = false) { -- cgit v1.2.3 From d99a51e5b7748115bab218db31b9675fb31b1de8 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 27 Jan 2018 13:41:37 -0800 Subject: typo --- Zotlabs/Module/Email_resend.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Email_resend.php b/Zotlabs/Module/Email_resend.php index 367593b55..8c0fbad2f 100644 --- a/Zotlabs/Module/Email_resend.php +++ b/Zotlabs/Module/Email_resend.php @@ -11,7 +11,7 @@ class Email_resend extends \Zotlabs\Web\Controller { if($_POST['token']) { if(! account_approve(trim($_POST['token']))) { - notice('Token verification failed.') + notice('Token verification failed.'); } } -- cgit v1.2.3 From 69099a2732b749b4e370e16523152068e15cbd6f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 27 Jan 2018 14:16:52 -0800 Subject: registration testing --- Zotlabs/Module/Email_resend.php | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Email_resend.php b/Zotlabs/Module/Email_resend.php index 8c0fbad2f..921d2819a 100644 --- a/Zotlabs/Module/Email_resend.php +++ b/Zotlabs/Module/Email_resend.php @@ -7,8 +7,6 @@ class Email_resend extends \Zotlabs\Web\Controller { function post() { - - if($_POST['token']) { if(! account_approve(trim($_POST['token']))) { notice('Token verification failed.'); @@ -35,7 +33,7 @@ class Email_resend extends \Zotlabs\Web\Controller { notice(t('Unable to resend email verification message.')); } - return; + goaway(z_root() . '/email_validation/' . bin2hex($email)); } -- cgit v1.2.3 From 6c4054c20bf2e9c843b065318dd252233513f201 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 27 Jan 2018 23:55:44 +0100 Subject: fix syntax error --- Zotlabs/Module/Email_resend.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Email_resend.php b/Zotlabs/Module/Email_resend.php index 367593b55..57a82ebda 100644 --- a/Zotlabs/Module/Email_resend.php +++ b/Zotlabs/Module/Email_resend.php @@ -11,7 +11,7 @@ class Email_resend extends \Zotlabs\Web\Controller { if($_POST['token']) { if(! account_approve(trim($_POST['token']))) { - notice('Token verification failed.') + notice(t('Token verification failed.')); } } @@ -45,4 +45,4 @@ class Email_resend extends \Zotlabs\Web\Controller { } -} \ No newline at end of file +} -- cgit v1.2.3 From 21f464a5577e84b808fd56efdc49117a64c8dc30 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 27 Jan 2018 15:20:43 -0800 Subject: Guranteed somebody will paste the verification link and not the token, especially before all the translations are completed. But even then... --- Zotlabs/Module/Email_validation.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Email_validation.php b/Zotlabs/Module/Email_validation.php index 4cc016847..162501140 100644 --- a/Zotlabs/Module/Email_validation.php +++ b/Zotlabs/Module/Email_validation.php @@ -8,7 +8,7 @@ class Email_validation extends \Zotlabs\Web\Controller { function post() { if($_POST['token']) { - if(! account_approve(trim($_POST['token']))) { + if(! account_approve(trim(basename($_POST['token'])))) { notice('Token verification failed.'); } } -- cgit v1.2.3 From a86b260f736cd7298d5d160c658bb9405ad3f69f Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 28 Jan 2018 12:09:47 +0100 Subject: query optimisations for notifications - use a specific index only --- Zotlabs/Module/Hq.php | 6 ++++-- Zotlabs/Module/Ping.php | 8 ++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index c305fdb3b..c46695b65 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -51,9 +51,11 @@ class Hq extends \Zotlabs\Web\Controller { $item_normal = item_normal(); $item_normal_update = item_normal_update(); + $use_index = db_use_index('created'); + if(! $item_hash) { - $r = q("SELECT mid FROM item - WHERE uid = %d + $r = q("SELECT mid FROM item $use_index + WHERE uid = %d $item_normal AND mid = parent_mid ORDER BY created DESC LIMIT 1", intval(local_channel()) diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index a3f6cdfec..f8399d871 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -320,7 +320,9 @@ class Ping extends \Zotlabs\Web\Controller { if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) { $result = array(); - $r = q("SELECT * FROM item + $use_index = db_use_index('uid_item_unseen'); + + $r = q("SELECT * FROM item $use_index WHERE item_unseen = 1 and uid = %d $item_normal AND author_xchan != '%s' ORDER BY created DESC limit 300", @@ -492,8 +494,10 @@ class Ping extends \Zotlabs\Web\Controller { $t3 = dba_timer(); if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { + + $use_index = db_use_index('uid_item_unseen'); - $r = q("SELECT id, item_wall FROM item + $r = q("SELECT id, item_wall FROM item $use_index WHERE item_unseen = 1 and uid = %d $item_normal AND author_xchan != '%s'", -- cgit v1.2.3 From 82f19e6278fd79c03dfbcd4007bf4321466485a6 Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sun, 28 Jan 2018 21:38:25 +0100 Subject: Fix a PHP7.2 warning when a channel has no cards. --- Zotlabs/Module/Cards.php | 79 +++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 38 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index 22c5d673c..8eff6c80d 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -9,18 +9,22 @@ require_once('include/acl_selectors.php'); class Cards extends \Zotlabs\Web\Controller { function init() { - + if(argc() > 1) $which = argv(1); else return; - + profile_load($which); - + } - + + /** + * {@inheritDoc} + * @see \Zotlabs\Web\Controller::get() + */ function get($update = 0, $load = false) { - + if(observer_prohibited(true)) { return login(); } @@ -31,13 +35,13 @@ class Cards extends \Zotlabs\Web\Controller { return; } - if(! feature_enabled(\App::$profile_uid,'cards')) { + if(! feature_enabled(\App::$profile_uid, 'cards')) { return; } nav_set_selected(t('Cards')); - head_add_link([ + head_add_link([ 'rel' => 'alternate', 'type' => 'application/json+oembed', 'href' => z_root() . '/oep?f=&url=' . urlencode(z_root() . '/' . \App::$query_string), @@ -46,48 +50,48 @@ class Cards extends \Zotlabs\Web\Controller { $category = (($_REQUEST['cat']) ? escape_tags(trim($_REQUEST['cat'])) : ''); - + if($category) { - $sql_extra2 .= protect_sprintf(term_item_parent_query(\App::$profile['profile_uid'],'item', $category, TERM_CATEGORY)); + $sql_extra2 .= protect_sprintf(term_item_parent_query(\App::$profile['profile_uid'], 'item', $category, TERM_CATEGORY)); } $which = argv(1); - + $selected_card = ((argc() > 2) ? argv(2) : ''); $_SESSION['return_url'] = \App::$query_string; - + $uid = local_channel(); $owner = \App::$profile_uid; $observer = \App::get_observer(); - + $ob_hash = (($observer) ? $observer['xchan_hash'] : ''); - - if(! perm_is_allowed($owner,$ob_hash,'view_pages')) { + + if(! perm_is_allowed($owner, $ob_hash, 'view_pages')) { notice( t('Permission denied.') . EOL); return; } - + $is_owner = ($uid && $uid == $owner); - + $channel = channelx_by_n($owner); if($channel) { - $channel_acl = array( + $channel_acl = [ 'allow_cid' => $channel['channel_allow_cid'], 'allow_gid' => $channel['channel_allow_gid'], 'deny_cid' => $channel['channel_deny_cid'], 'deny_gid' => $channel['channel_deny_gid'] - ); + ]; } else { $channel_acl = [ 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ]; } - - if(perm_is_allowed($owner,$ob_hash,'write_pages')) { + + if(perm_is_allowed($owner, $ob_hash, 'write_pages')) { $x = [ 'webpage' => ITEM_TYPE_CARD, @@ -95,9 +99,9 @@ class Cards extends \Zotlabs\Web\Controller { 'content_label' => t('Add Card'), 'button' => t('Create'), 'nickname' => $channel['channel_address'], - 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] + 'lockstate' => (($channel['channel_allow_cid'] || $channel['channel_allow_gid'] || $channel['channel_deny_cid'] || $channel['channel_deny_gid']) ? 'lock' : 'unlock'), - 'acl' => (($is_owner) ? populate_acl($channel_acl, false, + 'acl' => (($is_owner) ? populate_acl($channel_acl, false, \Zotlabs\Lib\PermissionDescription::fromGlobalPermission('view_pages')) : ''), 'permissions' => $channel_acl, 'showacl' => (($is_owner) ? true : false), @@ -110,7 +114,7 @@ class Cards extends \Zotlabs\Web\Controller { 'layoutselect' => false, 'expanded' => false, 'novoting' => false, - 'catsenabled' => feature_enabled($owner,'categories'), + 'catsenabled' => feature_enabled($owner, 'categories'), 'bbco_autocomplete' => 'bbcode', 'bbcode' => true ]; @@ -119,14 +123,14 @@ class Cards extends \Zotlabs\Web\Controller { $x['title'] = $_REQUEST['title']; if($_REQUEST['body']) $x['body'] = $_REQUEST['body']; - $editor = status_editor($a,$x); + $editor = status_editor($a, $x); } else { $editor = ''; } - - + + $sql_extra = item_permissions_sql($owner); if($selected_card) { @@ -137,9 +141,9 @@ class Cards extends \Zotlabs\Web\Controller { $sql_extra .= "and item.id = " . intval($r[0]['iid']) . " "; } } - - $r = q("select * from item - where item.uid = %d and item_type = %d + + $r = q("select * from item + where item.uid = %d and item_type = %d $sql_extra order by item.created desc", intval($owner), intval(ITEM_TYPE_CARD) @@ -149,9 +153,10 @@ class Cards extends \Zotlabs\Web\Controller { and item.item_unpublished = 0 and item.item_delayed = 0 and item.item_pending_remove = 0 and item.item_blocked = 0 "; + $items_result = []; if($r) { - $parents_str = ids_to_querystr($r,'id'); + $parents_str = ids_to_querystr($r, 'id'); $items = q("SELECT item.*, item.id AS item_id FROM item @@ -164,24 +169,22 @@ class Cards extends \Zotlabs\Web\Controller { if($items) { xchan_query($items); $items = fetch_post_tags($items, true); - $items = conv_sort($items,'updated'); + $items_result = conv_sort($items, 'updated'); } - else - $items = []; } $mode = 'cards'; - - $content = conversation($items,$mode,false,'traditional'); + + $content = conversation($items_result, $mode, false, 'traditional'); $o = replace_macros(get_markup_template('cards.tpl'), [ '$title' => t('Cards'), '$editor' => $editor, '$content' => $content, - '$pager' => alt_pager($a,count($items)) + '$pager' => alt_pager($a, count($items_result)) ]); - return $o; - } + return $o; + } } -- cgit v1.2.3 From c3e365ef4718e4c9d06eb962cb3deeb9fb39a2d9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 28 Jan 2018 15:56:31 -0800 Subject: Surface the ability to change the landing page after channel creation and create a 'go' module to present several possible things to do at this point. Change the default from 'settings' to 'profiles' so that the focus is more on you rather than the software configuration. --- Zotlabs/Module/Admin/Site.php | 3 ++ Zotlabs/Module/Go.php | 66 ++++++++++++++++++++++++++++++++++++++++++ Zotlabs/Module/New_channel.php | 4 +-- 3 files changed, 70 insertions(+), 3 deletions(-) create mode 100644 Zotlabs/Module/Go.php (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 037f49277..52b36e03e 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -38,6 +38,7 @@ class Site { $site_sellpage = ((x($_POST,'site_sellpage')) ? notags(trim($_POST['site_sellpage'])) : ''); $site_location = ((x($_POST,'site_location')) ? notags(trim($_POST['site_location'])) : ''); $frontpage = ((x($_POST,'frontpage')) ? notags(trim($_POST['frontpage'])) : ''); + $firstpage = ((x(trim($_POST,'firstpage'))) ? notags(trim($_POST['firstpage'])) : 'profiles'); $mirror_frontpage = ((x($_POST,'mirror_frontpage')) ? intval(trim($_POST['mirror_frontpage'])) : 0); $directory_server = ((x($_POST,'directory_server')) ? trim($_POST['directory_server']) : ''); $allowed_sites = ((x($_POST,'allowed_sites')) ? notags(trim($_POST['allowed_sites'])) : ''); @@ -80,6 +81,7 @@ class Site { set_config('system', 'maxloadavg', $maxloadavg); set_config('system', 'frontpage', $frontpage); set_config('system', 'sellpage', $site_sellpage); + set_config('system', 'workflow_channel_next', $firstpage); set_config('system', 'site_location', $site_location); set_config('system', 'mirror_frontpage', $mirror_frontpage); set_config('system', 'sitename', $sitename); @@ -340,6 +342,7 @@ class Site { '$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')), '$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())), + '$firstpage' => array('firstpage', t('Page to display after creating a new channel'), get_config('system','workflow_channel_next','profiles'), t('Recommend: profiles, go, or settings')), '$location' => array('site_location', t('Optional: site location'), get_config('system','site_location',''), t('Region or country')), diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php new file mode 100644 index 000000000..2c2dcf460 --- /dev/null +++ b/Zotlabs/Module/Go.php @@ -0,0 +1,66 @@ + t('Upload a profile photo'), + 'profiles' => t('Edit your default profile'), + 'suggest' => t('View friend suggestions'), + 'directory' => t('View the directory to find other interesting channels'), + 'settings' => t('View/edit your channel settings'), + 'help' => t('View the site or project documentation'), + 'channel/' . $channel['channel_address'] => t('Visit your channel homepage'), + 'connections' => t('View your connections and/or add somebody whose address you already know'), + 'network' => t('View your personal stream (this may be empty until you add some connections)'), + + ]; + + $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); + $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); + + if($site_firehose || $net_firehose) { + $options['pubstream'] = t('View the public stream. Warning: this content is not moderated'); + } + + $o = replace_macros(get_markup_template('go.tpl'), [ + '$title' => $title, + '$m' => $m, + '$m1' => $m1, + '$options' => $options + + ]); + + return $o; + + } + +} \ No newline at end of file diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php index 2b73fa191..9f2fea802 100644 --- a/Zotlabs/Module/New_channel.php +++ b/Zotlabs/Module/New_channel.php @@ -89,9 +89,7 @@ class New_channel extends \Zotlabs\Web\Controller { change_channel($result['channel']['channel_id']); - if(! strlen($next_page = get_config('system','workflow_channel_next'))) - $next_page = 'settings'; - + $next_page = get_config('system', 'workflow_channel_next', 'profiles'); goaway(z_root() . '/' . $next_page); } -- cgit v1.2.3 From 56d1614ea6ddfd72df1241a7f2cbe927e38e2a8b Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 28 Jan 2018 20:35:05 -0800 Subject: provide a default video image if nothing else is available. Allow sites to change it. --- Zotlabs/Module/Linkinfo.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Linkinfo.php b/Zotlabs/Module/Linkinfo.php index 78c34583e..3392e4114 100644 --- a/Zotlabs/Module/Linkinfo.php +++ b/Zotlabs/Module/Linkinfo.php @@ -120,9 +120,9 @@ class Linkinfo extends \Zotlabs\Web\Controller { $siteinfo = self::parseurl_getsiteinfo($url); - // If this is a Red site, use zrl rather than url so they get zids sent to them by default + // If the site uses this platform, use zrl rather than url so they get zids sent to them by default - if( x($siteinfo,'generator') && (strpos($siteinfo['generator'], \Zotlabs\Lib\System::get_platform_name() . ' ') === 0)) + if(is_matrix_url($url)) $template = str_replace('url','zrl',$template); if($siteinfo["title"] == "") { -- cgit v1.2.3 From e4eff6a32bd6b9907c5c1a4454e5861f3712d380 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 29 Jan 2018 02:41:45 -0800 Subject: fix workflow for form based email validation when auto_channel_create is in effect. Eventually we will need to rework the workflow logic because it is getting a bit tangled. --- Zotlabs/Module/Email_validation.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Email_validation.php b/Zotlabs/Module/Email_validation.php index 162501140..b8bb720cd 100644 --- a/Zotlabs/Module/Email_validation.php +++ b/Zotlabs/Module/Email_validation.php @@ -8,9 +8,18 @@ class Email_validation extends \Zotlabs\Web\Controller { function post() { if($_POST['token']) { + // This will redirect internally on success unless the channel is auto_created if(! account_approve(trim(basename($_POST['token'])))) { notice('Token verification failed.'); } + else { + if(get_config('system','auto_channel_create')) { + $next_page = get_config('system', 'workflow_channel_next', 'profiles'); + } + if($next_page) { + goaway(z_root() . '/' . $next_page); + } + } } } -- cgit v1.2.3 From 8d479aa1c74169e5b39d6409582c87e59a82d692 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 29 Jan 2018 16:58:55 -0800 Subject: redirect to the email_validation page if login was attempted after account creation but prior to successful verification. This presents the link to resend the verification email and/or allows you to enter it. --- Zotlabs/Module/Item.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index ad829137a..db2d64d70 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -753,6 +753,7 @@ class Item extends \Zotlabs\Web\Controller { if ((! $plink) && ($item_thread_top)) { $plink = z_root() . '/channel/' . $channel['channel_address'] . '/?f=&mid=' . $mid; + $plink = substr($plink,0,190); } $datarray['aid'] = $channel['channel_account_id']; -- cgit v1.2.3 From 668f56807ad8bde45a2ed679eb3c97c632b6fb2f Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 29 Jan 2018 17:43:11 -0800 Subject: unable to delete accounts using tickboxes on admin/accounts - make all the action names consistent --- Zotlabs/Module/Admin/Accounts.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php index 2043550fc..8925ffff1 100644 --- a/Zotlabs/Module/Admin/Accounts.php +++ b/Zotlabs/Module/Admin/Accounts.php @@ -16,6 +16,9 @@ class Accounts { */ function post() { + +logger('post: ' . print_r($_POST,true)); + $pending = ( x($_POST, 'pending') ? $_POST['pending'] : array() ); $users = ( x($_POST, 'user') ? $_POST['user'] : array() ); $blocked = ( x($_POST, 'blocked') ? $_POST['blocked'] : array() ); @@ -24,7 +27,7 @@ class Accounts { // change to switch structure? // account block/unblock button was submitted - if (x($_POST, 'page_users_block')) { + if (x($_POST, 'page_accounts_block')) { for ($i = 0; $i < count($users); $i++) { // if account is blocked remove blocked bit-flag, otherwise add blocked bit-flag $op = ($blocked[$i]) ? '& ~' : '| '; @@ -43,13 +46,13 @@ class Accounts { notice( sprintf( tt("%s account deleted", "%s accounts deleted", count($users)), count($users)) ); } // registration approved button was submitted - if (x($_POST, 'page_users_approve')) { + if (x($_POST, 'page_accounts_approve')) { foreach ($pending as $hash) { account_allow($hash); } } // registration deny button was submitted - if (x($_POST, 'page_users_deny')) { + if (x($_POST, 'page_accounts_deny')) { foreach ($pending as $hash) { account_deny($hash); } -- cgit v1.2.3 From 0e2c539d93e36db0b095e1dcd5080ce2b5fec1d7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 29 Jan 2018 19:57:43 -0800 Subject: remove logging --- Zotlabs/Module/Admin/Accounts.php | 2 -- 1 file changed, 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Accounts.php b/Zotlabs/Module/Admin/Accounts.php index 8925ffff1..2e417edd1 100644 --- a/Zotlabs/Module/Admin/Accounts.php +++ b/Zotlabs/Module/Admin/Accounts.php @@ -17,8 +17,6 @@ class Accounts { function post() { -logger('post: ' . print_r($_POST,true)); - $pending = ( x($_POST, 'pending') ? $_POST['pending'] : array() ); $users = ( x($_POST, 'user') ? $_POST['user'] : array() ); $blocked = ( x($_POST, 'blocked') ? $_POST['blocked'] : array() ); -- cgit v1.2.3 From c92bb6176a79ef575c9a9b5dec8fde7034c6421c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 1 Feb 2018 15:09:51 -0800 Subject: more separation of complex code into separate functions --- Zotlabs/Module/Connedit.php | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index 8288886cd..e23a751d9 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -826,27 +826,10 @@ class Connedit extends \Zotlabs\Web\Controller { } } - $locstr = ''; - - $locs = q("select hubloc_addr as location from hubloc left join site on hubloc_url = site_url where hubloc_hash = '%s' - and hubloc_deleted = 0 and site_dead = 0", - dbesc($contact['xchan_hash']) - ); - - if($locs) { - foreach($locs as $l) { - if(!($l['location'])) - continue; - if(strpos($locstr,$l['location']) !== false) - continue; - if(strlen($locstr)) - $locstr .= ', '; - $locstr .= $l['location']; - } - } - else + $locstr = locations_by_netid($contact['xchan_hash']); + if(! $locstr) $locstr = $contact['xchan_url']; - + $clone_warn = ''; $clonable = (in_array($contact['xchan_network'],['zot','rss']) ? true : false); if(! $clonable) { -- cgit v1.2.3 From dd35cad62a6574143940f4879083d9e80f5a4e88 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 1 Feb 2018 19:52:40 -0800 Subject: some feed cleanup --- Zotlabs/Module/Display.php | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 6d895feb5..11dd0d174 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -343,14 +343,15 @@ class Display extends \Zotlabs\Web\Controller { case 'atom': $atom = replace_macros(get_markup_template('atom_feed.tpl'), array( - '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()), - '$red' => xmlify(\Zotlabs\Lib\System::get_platform_name()), - '$feed_id' => xmlify(\App::$cmd), - '$feed_title' => xmlify(t('Article')), - '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)), - '$author' => '', - '$owner' => '', - '$profile_page' => xmlify(z_root() . '/display/' . $target_item['mid']), + '$version' => xmlify(\Zotlabs\Lib\System::get_project_version()), + '$generator' => xmlify(\Zotlabs\Lib\System::get_platform_name()), + '$generator_uri' => 'https://hubzilla.org', + '$feed_id' => xmlify(\App::$cmd), + '$feed_title' => xmlify(t('Article')), + '$feed_updated' => xmlify(datetime_convert('UTC', 'UTC', 'now', ATOM_TIME)), + '$author' => '', + '$owner' => '', + '$profile_page' => xmlify(z_root() . '/display/' . $target_item['mid']), )); $x = [ 'xml' => $atom, 'channel' => $channel, 'observer_hash' => $observer_hash, 'params' => $params ]; -- cgit v1.2.3 From 3cc756f3029e5f3b02008dac94a90e168d398c9a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 4 Feb 2018 20:42:40 +0100 Subject: remove some never used indices which prevented our item queries to find the right query execution plan in mysql and adjust some queries to optimze the result --- Zotlabs/Module/Channel.php | 6 +++--- Zotlabs/Module/Hq.php | 4 +--- Zotlabs/Module/Network.php | 36 +++++++++++++++++++++++------------- Zotlabs/Module/Ping.php | 19 ++++++++----------- Zotlabs/Module/Pubstream.php | 4 ++-- 5 files changed, 37 insertions(+), 32 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 7c4c900a1..b7e18f954 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -239,7 +239,7 @@ class Channel extends \Zotlabs\Web\Controller { if($load || ($checkjs->disabled())) { if($mid) { - $r = q("SELECT distinct parent AS item_id from item where mid like '%s' and uid = %d $item_normal + $r = q("SELECT parent AS item_id from item where mid like '%s' and uid = %d $item_normal AND item_wall = 1 $sql_extra limit 1", dbesc($mid . '%'), intval(\App::$profile['profile_uid']) @@ -249,13 +249,13 @@ class Channel extends \Zotlabs\Web\Controller { } } else { - $r = q("SELECT distinct id AS item_id, created FROM item + $r = q("SELECT id AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan WHERE uid = %d $item_normal AND item_wall = 1 and item_thread_top = 1 AND (abook_blocked = 0 or abook.abook_flags is null) $sql_extra $sql_extra2 - ORDER BY created DESC $pager_sql ", + ORDER BY created DESC, id $pager_sql ", intval(\App::$profile['profile_uid']) ); } diff --git a/Zotlabs/Module/Hq.php b/Zotlabs/Module/Hq.php index c46695b65..baeba82e8 100644 --- a/Zotlabs/Module/Hq.php +++ b/Zotlabs/Module/Hq.php @@ -51,10 +51,8 @@ class Hq extends \Zotlabs\Web\Controller { $item_normal = item_normal(); $item_normal_update = item_normal_update(); - $use_index = db_use_index('created'); - if(! $item_hash) { - $r = q("SELECT mid FROM item $use_index + $r = q("SELECT mid FROM item WHERE uid = %d $item_normal AND mid = parent_mid ORDER BY created DESC LIMIT 1", diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 551303984..70e0048fb 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -209,8 +209,11 @@ class Network extends \Zotlabs\Web\Controller { : ''); $sql_nets = ''; + + $distinct = ''; + $item_thread_top = ' AND item_thread_top = 1 '; - $sql_extra = " AND item.parent IN ( SELECT parent FROM item WHERE item_thread_top = 1 $sql_options ) "; + $sql_extra = $sql_options; if($group) { $contact_str = ''; @@ -226,7 +229,8 @@ class Network extends \Zotlabs\Web\Controller { $contact_str = ' 0 '; info( t('Privacy group is empty')); } - + $distinct = ' distinct '; + $item_thread_top = ''; $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($group_hash) . '>%') . "' ) and id = parent $item_normal ) "; $x = group_rec_byhash(local_channel(), $group_hash); @@ -250,6 +254,8 @@ class Network extends \Zotlabs\Web\Controller { intval(local_channel()) ); if($r) { + $distinct = ' distinct '; + $item_thread_top = ''; $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($r[0]['abook_xchan']) . "' or owner_xchan = '" . dbesc($r[0]['abook_xchan']) . "' ) $item_normal ) "; $title = replace_macros(get_markup_template("section_title.tpl"),array( '$title' => '' . urlencode($r[0]['xchan_name']) . ' ' . $r[0]['xchan_name'] . '' @@ -264,13 +270,15 @@ class Network extends \Zotlabs\Web\Controller { } } elseif($xchan) { - $r = q("select * from xchan where xchan_hash = '%s'", - dbesc($xchan) - ); - if($r) { - $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) "; - $title = replace_macros(get_markup_template("section_title.tpl"),array( - '$title' => '' . urlencode($r[0]['xchan_name']) . ' ' . $r[0]['xchan_name'] . '' + $r = q("select * from xchan where xchan_hash = '%s'", + dbesc($xchan) + ); + if($r) { + $distinct = ' distinct '; + $item_thread_top = ''; + $sql_extra = " AND item.parent IN ( SELECT DISTINCT parent FROM item WHERE true $sql_options AND uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($xchan) . "' or owner_xchan = '" . dbesc($xchan) . "' ) $item_normal ) "; + $title = replace_macros(get_markup_template("section_title.tpl"),array( + '$title' => '' . urlencode($r[0]['xchan_name']) . ' ' . $r[0]['xchan_name'] . '' )); $o = $tabs; $o .= $title; @@ -373,6 +381,8 @@ class Network extends \Zotlabs\Web\Controller { } if($conv) { + $distinct = ' distinct '; + $item_thread_top = ''; $sql_extra .= sprintf(" AND parent IN (SELECT distinct(parent) from item where ( author_xchan like '%s' or item_mentionsme = 1 )) ", dbesc(protect_sprintf($channel['channel_hash'])) ); @@ -448,7 +458,7 @@ class Network extends \Zotlabs\Web\Controller { if($nouveau && $load) { // "New Item View" - show all items unthreaded in reverse created date order - $items = q("SELECT item.*, item.id AS item_id, received FROM item + $items = q("SELECT item.*, item.id AS item_id, received FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) $net_query WHERE true $uids $item_normal @@ -477,11 +487,11 @@ class Network extends \Zotlabs\Web\Controller { if($load) { // Fetch a page full of parent items for this page - $r = q("SELECT distinct item.id AS item_id, $ordering FROM item + $r = q("SELECT $distinct item.parent AS item_id FROM item left join abook on ( item.owner_xchan = abook.abook_xchan $abook_uids ) $net_query - WHERE true $uids $item_normal - AND item.parent = item.id + WHERE true $uids $item_thread_top $item_normal + AND item.mid = item.parent_mid and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets $net_query2 diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index f8399d871..2e86804ac 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -149,13 +149,11 @@ class Ping extends \Zotlabs\Web\Controller { $pubs = q("SELECT count(id) as total from item WHERE uid = %d AND author_xchan != '%s' - AND obj_type != '%s' AND item_unseen = 1 AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "' $item_normal", intval($sys['channel_id']), - dbesc(get_observer_hash()), - dbesc(ACTIVITY_OBJ_FILE) + dbesc(get_observer_hash()) ); if($pubs) @@ -320,12 +318,13 @@ class Ping extends \Zotlabs\Web\Controller { if(argc() > 1 && (argv(1) === 'network' || argv(1) === 'home')) { $result = array(); - $use_index = db_use_index('uid_item_unseen'); - - $r = q("SELECT * FROM item $use_index - WHERE item_unseen = 1 and uid = %d $item_normal + $r = q("SELECT * FROM item + WHERE uid = %d AND author_xchan != '%s' - ORDER BY created DESC limit 300", + AND item_unseen = 1 + $item_normal + ORDER BY created DESC, id + LIMIT 300", intval(local_channel()), dbesc($ob_hash) ); @@ -495,9 +494,7 @@ class Ping extends \Zotlabs\Web\Controller { if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { - $use_index = db_use_index('uid_item_unseen'); - - $r = q("SELECT id, item_wall FROM item $use_index + $r = q("SELECT id, item_wall FROM item WHERE item_unseen = 1 and uid = %d $item_normal AND author_xchan != '%s'", diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 2c25e2ce0..16a5fdbba 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -196,10 +196,10 @@ class Pubstream extends \Zotlabs\Web\Controller { } else { // Fetch a page full of parent items for this page - $r = q("SELECT distinct item.id AS item_id, $ordering FROM item + $r = q("SELECT item.id AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan $net_query - WHERE true $uids $item_normal + WHERE item_thread_top = 1 $uids $item_normal AND item.parent = item.id and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets $net_query2 -- cgit v1.2.3 From 9d55a254dcd39e2a77a1c24625adba69d16acb7a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 4 Feb 2018 22:37:30 +0100 Subject: this will fix the cards query and keep the rest intact --- Zotlabs/Module/Cards.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cards.php b/Zotlabs/Module/Cards.php index 8eff6c80d..f87988183 100644 --- a/Zotlabs/Module/Cards.php +++ b/Zotlabs/Module/Cards.php @@ -143,7 +143,7 @@ class Cards extends \Zotlabs\Web\Controller { } $r = q("select * from item - where item.uid = %d and item_type = %d + where uid = %d and item_type = %d $sql_extra order by item.created desc", intval($owner), intval(ITEM_TYPE_CARD) -- cgit v1.2.3 From f15fd93f905520fa7f58e7365c838edd382b227c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 4 Feb 2018 17:01:59 -0800 Subject: implode can take its arguments in either order, but let's try to be consistent --- Zotlabs/Module/Admin/Security.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Security.php b/Zotlabs/Module/Admin/Security.php index a1e4bf537..49e1ccf42 100644 --- a/Zotlabs/Module/Admin/Security.php +++ b/Zotlabs/Module/Admin/Security.php @@ -52,24 +52,24 @@ class Security { function get() { $whitesites = get_config('system','whitelisted_sites'); - $whitesites_str = ((is_array($whitesites)) ? implode($whitesites,"\n") : ''); + $whitesites_str = ((is_array($whitesites)) ? implode("\n",$whitesites) : ''); $blacksites = get_config('system','blacklisted_sites'); - $blacksites_str = ((is_array($blacksites)) ? implode($blacksites,"\n") : ''); + $blacksites_str = ((is_array($blacksites)) ? implode("\n",$blacksites) : ''); $whitechannels = get_config('system','whitelisted_channels'); - $whitechannels_str = ((is_array($whitechannels)) ? implode($whitechannels,"\n") : ''); + $whitechannels_str = ((is_array($whitechannels)) ? implode("\n",$whitechannels) : ''); $blackchannels = get_config('system','blacklisted_channels'); - $blackchannels_str = ((is_array($blackchannels)) ? implode($blackchannels,"\n") : ''); + $blackchannels_str = ((is_array($blackchannels)) ? implode("\n",$blackchannels) : ''); $whiteembeds = get_config('system','embed_allow'); - $whiteembeds_str = ((is_array($whiteembeds)) ? implode($whiteembeds,"\n") : ''); + $whiteembeds_str = ((is_array($whiteembeds)) ? implode("\n",$whiteembeds) : ''); $blackembeds = get_config('system','embed_deny'); - $blackembeds_str = ((is_array($blackembeds)) ? implode($blackembeds,"\n") : ''); + $blackembeds_str = ((is_array($blackembeds)) ? implode("\n",$blackembeds) : ''); $embed_coop = intval(get_config('system','embed_coop')); -- cgit v1.2.3 From cadd958339323f5fcf4c2b438f7a5e311e477d52 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 5 Feb 2018 18:06:25 -0800 Subject: remove mobile_detect (outdated and unmaintainable) --- Zotlabs/Module/Connections.php | 2 +- Zotlabs/Module/Connedit.php | 1 - Zotlabs/Module/Settings/Display.php | 26 ++++---------------------- 3 files changed, 5 insertions(+), 24 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php index f42ff9b84..255731c9c 100644 --- a/Zotlabs/Module/Connections.php +++ b/Zotlabs/Module/Connections.php @@ -232,7 +232,7 @@ class Connections extends \Zotlabs\Web\Controller { if($rr['xchan_url']) { if(($rr['vcard']) && is_array($rr['vcard']['tels']) && $rr['vcard']['tels'][0]['nr']) - $phone = ((\App::$is_mobile || \App::$is_tablet) ? $rr['vcard']['tels'][0]['nr'] : ''); + $phone = $rr['vcard']['tels'][0]['nr']; else $phone = ''; diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index e23a751d9..f359175c1 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -895,7 +895,6 @@ class Connedit extends \Zotlabs\Web\Controller { '$permnote_self' => t('Some permissions may be inherited from your channel\'s privacy settings, which have higher priority than individual settings. You can change those settings here but they wont have any impact unless the inherited setting changes.'), '$lastupdtext' => t('Last update:'), '$last_update' => relative_date($contact['abook_connected']), - '$is_mobile' => ((\App::$is_mobile || \App::$is_tablet) ? true : false), '$profile_select' => contact_profile_assign($contact['abook_profile']), '$multiprofs' => $multiprofs, '$contact_id' => $contact['abook_id'], diff --git a/Zotlabs/Module/Settings/Display.php b/Zotlabs/Module/Settings/Display.php index e1ea0e3e5..340b3c0bb 100644 --- a/Zotlabs/Module/Settings/Display.php +++ b/Zotlabs/Module/Settings/Display.php @@ -21,7 +21,7 @@ class Display { if(! $theme) $theme = 'redbasic'; - $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : ''); + $preload_images = ((x($_POST,'preload_images')) ? intval($_POST['preload_images']) : 0); $channel_menu = ((x($_POST,'channel_menu')) ? intval($_POST['channel_menu']) : 0); $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0); @@ -47,11 +47,6 @@ class Display { if($itemspage > 100) $itemspage = 100; - if ($mobile_theme == "---") - del_pconfig(local_channel(),'system','mobile_theme'); - else { - set_pconfig(local_channel(),'system','mobile_theme',$mobile_theme); - } set_pconfig(local_channel(),'system','preload_images',$preload_images); set_pconfig(local_channel(),'system','user_scalable',$user_scalable); @@ -114,10 +109,6 @@ class Display { $theme = (($existing_theme) ? $existing_theme : $default_theme); - $default_mobile_theme = get_config('system','mobile_theme'); - if(! $mobile_default_theme) - $mobile_default_theme = 'none'; - $allowed_themes_str = get_config('system','allowed_themes'); $allowed_themes_raw = explode(',',$allowed_themes_str); $allowed_themes = array(); @@ -135,26 +126,19 @@ class Display { $info = get_theme_info($th); $compatible = check_plugin_versions($info); - if(!$compatible) { - $mobile_themes[$f] = $themes[$f] = sprintf(t('%s - (Incompatible)'), $f); + if(! $compatible) { + $themes[$f] = sprintf(t('%s - (Incompatible)'), $f); continue; } $is_experimental = file_exists('view/theme/' . $th . '/experimental'); $unsupported = file_exists('view/theme/' . $th . '/unsupported'); - $is_mobile = file_exists('view/theme/' . $th . '/mobile'); $is_library = file_exists('view/theme/'. $th . '/library'); - $mobile_themes['---'] = t("No special theme for mobile devices"); if (!$is_experimental or ($is_experimental && (get_config('experimentals','exp_themes')==1 or get_config('experimentals','exp_themes')===false))){ $theme_name = (($is_experimental) ? sprintf(t('%s - (Experimental)'), $f) : $f); if (! $is_library) { - if($is_mobile) { - $mobile_themes[$f] = $themes[$f] = $theme_name . ' (' . t('mobile') . ')'; - } - else { - $mobile_themes[$f] = $themes[$f] = $theme_name; - } + $themes[$f] = $theme_name; } } } @@ -166,7 +150,6 @@ class Display { $theme_selected = explode(':', $theme_selected)[0]; } - $mobile_theme_selected = (!x($_SESSION,'mobile_theme')? $default_mobile_theme : $_SESSION['mobile_theme']); $preload_images = get_pconfig(local_channel(),'system','preload_images'); $preload_images = (($preload_images===false)? '0': $preload_images); // default if not set: 0 @@ -213,7 +196,6 @@ class Display { '$theme' => (($themes) ? array('theme', t('Display Theme:'), $theme_selected, '', $themes, 'preview') : false), '$schema' => array('schema', t('Select scheme'), $existing_schema, '' , $schemas), - '$mobile_theme' => (($mobile_themes) ? array('mobile_theme', t('Mobile Theme:'), $mobile_theme_selected, '', $mobile_themes, '') : false), '$preload_images' => array('preload_images', t("Preload images before rendering the page"), $preload_images, t("The subjective page load time will be longer but the page will be ready when displayed"), $yes_no), '$user_scalable' => array('user_scalable', t("Enable user zoom on mobile devices"), $user_scalable, '', $yes_no), '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), -- cgit v1.2.3 From 661c20e452255754bbccadc3b29dc3c598c07ed0 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 8 Feb 2018 09:47:49 +0100 Subject: more db and queries finetuning --- Zotlabs/Module/Ping.php | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 2e86804ac..96ade22c0 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -148,8 +148,8 @@ class Ping extends \Zotlabs\Web\Controller { $pubs = q("SELECT count(id) as total from item WHERE uid = %d - AND author_xchan != '%s' AND item_unseen = 1 + AND author_xchan != '%s' AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "' $item_normal", intval($sys['channel_id']), @@ -166,8 +166,8 @@ class Ping extends \Zotlabs\Web\Controller { $r = q("SELECT * FROM item WHERE uid = %d - AND author_xchan != '%s' AND item_unseen = 1 + AND author_xchan != '%s' AND created > '" . datetime_convert('UTC','UTC',$_SESSION['static_loadtime']) . "' $item_normal ORDER BY created DESC @@ -208,22 +208,22 @@ class Ping extends \Zotlabs\Web\Controller { if(x($_REQUEST, 'markRead') && local_channel()) { switch($_REQUEST['markRead']) { case 'network': - $r = q("update item set item_unseen = 0 where item_unseen = 1 and uid = %d", + $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1", intval(local_channel()) ); break; case 'home': - $r = q("update item set item_unseen = 0 where item_unseen = 1 and item_wall = 1 and uid = %d", + $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND item_unseen = 1 AND item_wall = 1", intval(local_channel()) ); break; case 'mail': - $r = q("update mail set mail_seen = 1 where mail_seen = 0 and channel_id = %d ", + $r = q("UPDATE mail SET mail_seen = 1 WHERE channel_id = %d AND mail_seen = 0", intval(local_channel()) ); break; case 'all_events': - $r = q("update event set dismissed = 1 where dismissed = 0 and uid = %d AND dtstart < '%s' AND dtstart > '%s' ", + $r = q("UPDATE event SET dismissed = 1 WHERE uid = %d AND dismissed = 0 AND dtstart < '%s' AND dtstart > '%s' ", intval(local_channel()), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now + ' . intval($evdays) . ' days')), dbesc(datetime_convert('UTC', date_default_timezone_get(), 'now - 1 days')) @@ -243,9 +243,9 @@ class Ping extends \Zotlabs\Web\Controller { } if(x($_REQUEST, 'markItemRead') && local_channel()) { - $r = q("update item set item_unseen = 0 where parent = %d and uid = %d", - intval($_REQUEST['markItemRead']), - intval(local_channel()) + $r = q("UPDATE item SET item_unseen = 0 WHERE uid = %d AND parent = %d", + intval(local_channel()), + intval($_REQUEST['markItemRead']) ); } @@ -254,7 +254,7 @@ class Ping extends \Zotlabs\Web\Controller { * dropdown menu. */ if(argc() > 1 && argv(1) === 'notify') { - $t = q("select * from notify where uid = %d and seen = 0 order by created desc", + $t = q("SELECT * FROM notify WHERE uid = %d AND seen = 0 ORDER BY CREATED DESC", intval(local_channel()) ); @@ -320,10 +320,10 @@ class Ping extends \Zotlabs\Web\Controller { $r = q("SELECT * FROM item WHERE uid = %d - AND author_xchan != '%s' AND item_unseen = 1 + AND author_xchan != '%s' $item_normal - ORDER BY created DESC, id + ORDER BY created DESC LIMIT 300", intval(local_channel()), dbesc($ob_hash) @@ -495,7 +495,7 @@ class Ping extends \Zotlabs\Web\Controller { if($vnotify & (VNOTIFY_NETWORK|VNOTIFY_CHANNEL)) { $r = q("SELECT id, item_wall FROM item - WHERE item_unseen = 1 and uid = %d + WHERE uid = %d and item_unseen = 1 $item_normal AND author_xchan != '%s'", intval(local_channel()), -- cgit v1.2.3 From 5f229d81e9aaac0e0d82091d2d9089f5fb34bfe8 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 9 Feb 2018 14:06:59 +0100 Subject: use distinct in channel item query and minor notification cache improvement --- Zotlabs/Module/Channel.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index b7e18f954..dddca16b4 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -249,13 +249,13 @@ class Channel extends \Zotlabs\Web\Controller { } } else { - $r = q("SELECT id AS item_id FROM item + $r = q("SELECT DISTINCT item.parent AS item_id FROM item left join abook on item.author_xchan = abook.abook_xchan - WHERE uid = %d $item_normal - AND item_wall = 1 and item_thread_top = 1 - AND (abook_blocked = 0 or abook.abook_flags is null) + WHERE true and uid = %d $item_normal + AND (abook.abook_blocked = 0 or abook.abook_flags is null) + AND item.item_wall = 1 AND item.item_thread_top AND item.mid = item.parent_mid $sql_extra $sql_extra2 - ORDER BY created DESC, id $pager_sql ", + ORDER BY created DESC $pager_sql ", intval(\App::$profile['profile_uid']) ); } -- cgit v1.2.3 From 6cc32943954124739023751eb377d398a54772d9 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Fri, 9 Feb 2018 20:36:14 +0100 Subject: finally fix channel query --- Zotlabs/Module/Channel.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index dddca16b4..3dab85410 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, created from item + $r = q("SELECT distinct 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 @@ -249,11 +249,11 @@ class Channel extends \Zotlabs\Web\Controller { } } else { - $r = q("SELECT DISTINCT item.parent AS item_id FROM item - left join abook on item.author_xchan = abook.abook_xchan + $r = q("SELECT item.parent AS item_id FROM item + left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) WHERE true and uid = %d $item_normal AND (abook.abook_blocked = 0 or abook.abook_flags is null) - AND item.item_wall = 1 AND item.item_thread_top AND item.mid = item.parent_mid + AND item.item_wall = 1 AND item.item_thread_top = 1 $sql_extra $sql_extra2 ORDER BY created DESC $pager_sql ", intval(\App::$profile['profile_uid']) -- cgit v1.2.3 From 5a9ea29614b8620c10d84f67a1a7c93fe537a037 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 9 Feb 2018 14:08:29 -0800 Subject: hubzilla issue #975 (searching for title as well as body could present a performance issue, so perhaps the tradeoffs should be debated) --- Zotlabs/Module/Search.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Search.php b/Zotlabs/Module/Search.php index 4d35b59f3..55e0e746f 100644 --- a/Zotlabs/Module/Search.php +++ b/Zotlabs/Module/Search.php @@ -90,7 +90,7 @@ class Search extends \Zotlabs\Web\Controller { } else { $regstr = db_getfunc('REGEXP'); - $sql_extra = sprintf(" AND item.body $regstr '%s' ", dbesc(protect_sprintf(preg_quote($search)))); + $sql_extra = sprintf(" AND (item.title $regstr '%s' OR item.body $regstr '%s') ", dbesc(protect_sprintf(preg_quote($search))), dbesc(protect_sprintf(preg_quote($search)))); } // Here is the way permissions work in the search module... -- cgit v1.2.3 From 07d33a11830e52499842b99ded964b0a934116d7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Feb 2018 15:34:34 -0800 Subject: use new forum tag style in forum search postings --- Zotlabs/Module/Network.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Network.php b/Zotlabs/Module/Network.php index 70e0048fb..6e961dc36 100644 --- a/Zotlabs/Module/Network.php +++ b/Zotlabs/Module/Network.php @@ -144,7 +144,7 @@ class Network extends \Zotlabs\Web\Controller { // NOTREACHED } if($_GET['pf'] === '1') - $deftag = '@' . t('forum') . '+' . intval($cid) . '+'; + $deftag = '!' . t('forum') . '+' . intval($cid); else $def_acl = [ 'allow_cid' => '<' . $r[0]['abook_xchan'] . '>', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ]; } -- cgit v1.2.3 From 63107f5b2f5031a7cc971063b9344592cc2257e3 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 11 Feb 2018 18:17:17 -0800 Subject: second part of hubzilla issue #972 --- Zotlabs/Module/Settings/Channel.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Settings/Channel.php b/Zotlabs/Module/Settings/Channel.php index 5e9e88a6d..fb8284d2e 100644 --- a/Zotlabs/Module/Settings/Channel.php +++ b/Zotlabs/Module/Settings/Channel.php @@ -331,22 +331,21 @@ class Channel { ); $limits = \Zotlabs\Access\PermissionLimits::Get(local_channel()); + $anon_comments = get_config('system','anonymous_comments',true); foreach($global_perms as $k => $perm) { $options = array(); + $can_be_public = ((strstr($k,'view') || ($k === 'post_comments' && $anon_comments)) ? true : false); foreach($perm_opts as $opt) { - if(((! strstr($k,'view')) && $k !== 'post_comments') && $opt[1] == PERMS_PUBLIC) + if($opt[1] == PERMS_PUBLIC && (! $can_be_public)) continue; $options[$opt[1]] = $opt[0]; } $permiss[] = array($k,$perm,$limits[$k],'',$options); } - - + // logger('permiss: ' . print_r($permiss,true)); - - $username = $channel['channel_name']; $nickname = $channel['channel_address']; $timezone = $channel['channel_timezone']; -- cgit v1.2.3 From fd81a4bdc4f1c80d9dd73358452f50bc6422afef Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 12 Feb 2018 21:43:04 -0800 Subject: initial share refactor --- Zotlabs/Module/Item.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index db2d64d70..73730bc99 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -39,6 +39,7 @@ class Item extends \Zotlabs\Web\Controller { $uid = local_channel(); $channel = null; $observer = null; + $datarray = []; /** @@ -619,6 +620,21 @@ class Item extends \Zotlabs\Web\Controller { $i++; } } + + + if(preg_match_all('/(\[share=(.*?)\](.*?)\[\/share\])/',$body,$match)) { + // process share by id + + $verb = ACTIVITY_SHARE; + $i = 0; + foreach($match[2] as $mtch) { +// $obj = get_share_activity($mtch); + $datarray['obj'] = $obj['obj']; + $datarray['obj_type'] = $obj['obj']['type']; + $body = str_replace($match[1][$i],$obj['body'],$body); + $i++; + } + } } @@ -720,7 +736,6 @@ class Item extends \Zotlabs\Web\Controller { if(!$thr_parent) $thr_parent = $mid; - $datarray = array(); $item_thread_top = ((! $parent) ? 1 : 0); -- cgit v1.2.3 From d826515ba8d2d1d78abed6701df3c2c3550e87df Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Tue, 13 Feb 2018 11:01:58 +0100 Subject: since we only save the parent mid in notify we must look for thr_parent when dealing with likes --- Zotlabs/Module/Ping.php | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Ping.php b/Zotlabs/Module/Ping.php index 96ade22c0..eab49d69e 100644 --- a/Zotlabs/Module/Ping.php +++ b/Zotlabs/Module/Ping.php @@ -268,7 +268,18 @@ class Ping extends \Zotlabs\Web\Controller { $mid = basename($tt['link']); - $b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid)); + if(in_array($tt['verb'], [ACTIVITY_LIKE, ACTIVITY_DISLIKE])) { + // we need the thread parent + $r = q("select thr_parent from item where mid = '%s' and uid = %d limit 1", + dbesc($mid), + intval(local_channel()) + ); + + $b64mid = ((strpos($r[0]['thr_parent'], 'b64.' === 0)) ? $r[0]['thr_parent'] : 'b64.' . base64url_encode($r[0]['thr_parent'])); + } + else { + $b64mid = ((strpos($mid, 'b64.' === 0)) ? $mid : 'b64.' . base64url_encode($mid)); + } $notifs[] = array( 'notify_link' => z_root() . '/notify/view/' . $tt['id'], -- cgit v1.2.3 From 6ca3442ba381a3c5b98cd04f4f9e87e48c55b072 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 13 Feb 2018 12:13:37 -0800 Subject: defperms: bad query --- Zotlabs/Module/Defperms.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Defperms.php b/Zotlabs/Module/Defperms.php index 422333a50..97d9cfd1d 100644 --- a/Zotlabs/Module/Defperms.php +++ b/Zotlabs/Module/Defperms.php @@ -22,7 +22,7 @@ class Defperms extends \Zotlabs\Web\Controller { $r = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash - WHERE abook_self = 1 and abook_id = %d LIMIT 1", + WHERE abook_self = 1 and abook_channel = %d LIMIT 1", intval(local_channel()) ); if($r) { -- cgit v1.2.3 From 64809dd2777ae0064addaff765450cf3f05c3bc4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 13 Feb 2018 20:07:57 -0800 Subject: turn shares into activities - make certain to pull addons or JSON-LD will chuck a wobbly --- Zotlabs/Module/Item.php | 8 ++++---- Zotlabs/Module/Share.php | 4 ++++ 2 files changed, 8 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 73730bc99..3f857030b 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -628,10 +628,10 @@ class Item extends \Zotlabs\Web\Controller { $verb = ACTIVITY_SHARE; $i = 0; foreach($match[2] as $mtch) { -// $obj = get_share_activity($mtch); - $datarray['obj'] = $obj['obj']; - $datarray['obj_type'] = $obj['obj']['type']; - $body = str_replace($match[1][$i],$obj['body'],$body); + $reshare = new \Zotlabs\Lib\Share($mtch); + $datarray['obj'] = $reshare->obj(); + $datarray['obj_type'] = $datarray['obj']['type']; + $body = str_replace($match[1][$i],$reshare->bbcode(),$body); $i++; } } diff --git a/Zotlabs/Module/Share.php b/Zotlabs/Module/Share.php index 5c4811c59..7f4d8b1eb 100644 --- a/Zotlabs/Module/Share.php +++ b/Zotlabs/Module/Share.php @@ -14,6 +14,10 @@ class Share extends \Zotlabs\Web\Controller { if(! $post_id) killme(); + + echo '[share=' . $post_id . '][/share]'; + killme(); + if(! (local_channel() || remote_channel())) killme(); -- cgit v1.2.3 From 465d89129caaaa0240229f8d6f81d68f26eb60b0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 14 Feb 2018 15:32:33 -0800 Subject: provide option to block the public stream unless authenticated, since there could be legal issues with unmoderated content --- Zotlabs/Module/Admin/Site.php | 4 +++- Zotlabs/Module/Pubstream.php | 7 +++---- 2 files changed, 6 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 52b36e03e..ca181d5f8 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -45,6 +45,7 @@ class Site { $force_publish = ((x($_POST,'publish_all')) ? True : False); $disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True); $site_firehose = ((x($_POST,'site_firehose')) ? True : False); + $open_pubstream = ((x($_POST,'open_pubstream')) ? True : False); $login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False); $enable_context_help = ((x($_POST,'enable_context_help')) ? True : False); $global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : ''); @@ -139,6 +140,7 @@ class Site { set_config('system','publish_all', $force_publish); set_config('system','disable_discover_tab', $disable_discover_tab); set_config('system','site_firehose', $site_firehose); + set_config('system','open_pubstream', $open_pubstream); set_config('system','force_queue_threshold', $force_queue); if ($global_directory == '') { del_config('system', 'directory_submit_url'); @@ -319,7 +321,7 @@ class Site { '$force_publish' => array('publish_all', t("Force publish"), get_config('system','publish_all'), t("Check to force all profiles on this site to be listed in the site directory.")), '$disable_discover_tab' => array('disable_discover_tab', t('Import Public Streams'), $discover_tab, t('Import and allow access to public content pulled from other sites. Warning: this content is unmoderated.')), '$site_firehose' => array('site_firehose', t('Site only Public Streams'), get_config('system','site_firehose'), t('Allow access to public content originating only from this site if Imported Public Streams are disabled.')), - + '$open_pubstream' => array('open_pubstream', t('Allow anybody on the internet to access the Public streams'), get_config('system','open_pubstream',1), t('Disable to require authentication before viewing. Warning: this content is unmoderated.')), '$login_on_homepage' => array('login_on_homepage', t("Login on Homepage"),((intval($homelogin) || $homelogin === false) ? 1 : '') , t("Present a login box to visitors on the home page if no other content has been configured.")), '$enable_context_help' => array('enable_context_help', t("Enable context help"),((intval($enable_context_help) === 1 || $enable_context_help === false) ? 1 : 0) , t("Display contextual help for the current page when the help button is pressed.")), diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index 16a5fdbba..afe53eca7 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -12,11 +12,10 @@ class Pubstream extends \Zotlabs\Web\Controller { if($load) $_SESSION['loadtime'] = datetime_convert(); - - if(observer_prohibited(true)) { - return login(); + if((observer_prohibited(true)) || (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) { + return login(); } - + $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); -- cgit v1.2.3 From 9e251a1abcc50af0f678a17d3a688f4ba9e4a4fc Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 15 Feb 2018 19:24:15 +0100 Subject: some more DB tuning. --- Zotlabs/Module/Channel.php | 4 ++-- Zotlabs/Module/Pubstream.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 3dab85410..231146999 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -251,9 +251,9 @@ class Channel extends \Zotlabs\Web\Controller { else { $r = q("SELECT item.parent AS item_id FROM item left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) - WHERE true and uid = %d $item_normal + WHERE true and item.uid = %d AND item.item_thread_top = 1 $item_normal AND (abook.abook_blocked = 0 or abook.abook_flags is null) - AND item.item_wall = 1 AND item.item_thread_top = 1 + AND item.item_wall = 1 $sql_extra $sql_extra2 ORDER BY created DESC $pager_sql ", intval(\App::$profile['profile_uid']) diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index afe53eca7..af7bc7658 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -166,7 +166,8 @@ class Pubstream extends \Zotlabs\Web\Controller { $net_query = (($net) ? " left join xchan on xchan_hash = author_xchan " : ''); $net_query2 = (($net) ? " and xchan_network = '" . protect_sprintf(dbesc($net)) . "' " : ''); - + + $abook_uids = " and abook.abook_channel = " . intval(\App::$profile['profile_uid']) . " "; $simple_update = (($_SESSION['loadtime']) ? " AND item.changed > '" . datetime_convert('UTC','UTC',$_SESSION['loadtime']) . "' " : ''); @@ -185,7 +186,7 @@ class Pubstream extends \Zotlabs\Web\Controller { if($load) { if($mid) { $r = q("SELECT parent AS item_id FROM item - left join abook on item.author_xchan = abook.abook_xchan + left join abook on item.author_xchan = abook.abook_xchan $net_query WHERE mid like '%s' $uids $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) @@ -196,10 +197,9 @@ class Pubstream extends \Zotlabs\Web\Controller { else { // Fetch a page full of parent items for this page $r = q("SELECT item.id AS item_id FROM item - left join abook on item.author_xchan = abook.abook_xchan + left join abook on ( item.author_xchan = abook.abook_xchan $abook_uids ) $net_query - WHERE item_thread_top = 1 $uids $item_normal - AND item.parent = item.id + WHERE true $uids and item.item_thread_top = 1 $item_normal and (abook.abook_blocked = 0 or abook.abook_flags is null) $sql_extra3 $sql_extra $sql_nets $net_query2 ORDER BY $ordering DESC $pager_sql " -- cgit v1.2.3 From 27cd26ec1e26b6c389a623395687af5052f0b5a1 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 15 Feb 2018 18:47:56 -0800 Subject: extend the oauth2 storage driver so that we can use our own channel table --- Zotlabs/Module/Authorize.php | 55 +++++++++++++++++++++----------------------- Zotlabs/Module/Token.php | 46 +++++++++++++++++------------------- 2 files changed, 47 insertions(+), 54 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Authorize.php b/Zotlabs/Module/Authorize.php index 06f66c456..7676b0855 100644 --- a/Zotlabs/Module/Authorize.php +++ b/Zotlabs/Module/Authorize.php @@ -6,41 +6,38 @@ namespace Zotlabs\Module; class Authorize extends \Zotlabs\Web\Controller { - function get() { + function init() { - // workaround for HTTP-auth in CGI mode - if (x($_SERVER, 'REDIRECT_REMOTE_USER')) { - $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ; - if(strlen($userpass)) { - list($name, $password) = explode(':', $userpass); - $_SERVER['PHP_AUTH_USER'] = $name; - $_SERVER['PHP_AUTH_PW'] = $password; - } + // workaround for HTTP-auth in CGI mode + if (x($_SERVER, 'REDIRECT_REMOTE_USER')) { + $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ; + if(strlen($userpass)) { + list($name, $password) = explode(':', $userpass); + $_SERVER['PHP_AUTH_USER'] = $name; + $_SERVER['PHP_AUTH_PW'] = $password; } - - if (x($_SERVER, 'HTTP_AUTHORIZATION')) { - $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ; - if(strlen($userpass)) { - list($name, $password) = explode(':', $userpass); - $_SERVER['PHP_AUTH_USER'] = $name; - $_SERVER['PHP_AUTH_PW'] = $password; - } + } + + if (x($_SERVER, 'HTTP_AUTHORIZATION')) { + $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ; + if(strlen($userpass)) { + list($name, $password) = explode(':', $userpass); + $_SERVER['PHP_AUTH_USER'] = $name; + $_SERVER['PHP_AUTH_PW'] = $password; } + } + $s = new \Zotlabs\Identity\OAuth2Server(); + $request = \OAuth2\Request::createFromGlobals(); + $response = new \OAuth2\Response(); - - require_once('include/oauth2.php'); - - $request = \OAuth2\Request::createFromGlobals(); - $response = new \OAuth2\Response(); - - // validate the authorize request - if (! $oauth2_server->validateAuthorizeRequest($request, $response)) { - $response->send(); - killme(); - } + // validate the authorize request + if (! $s->server->validateAuthorizeRequest($request, $response)) { + $response->send(); + killme(); + } // display an authorization form if (empty($_POST)) { @@ -55,7 +52,7 @@ class Authorize extends \Zotlabs\Web\Controller { // print the authorization code if the user has authorized your client $is_authorized = ($_POST['authorized'] === 'yes'); - $oauth2_server->handleAuthorizeRequest($request, $response, $is_authorized); + $s->server->handleAuthorizeRequest($request, $response, $is_authorized, local_channel()); if ($is_authorized) { // this is only here so that you get to see your code in the cURL request. Otherwise, // we'd redirect back to the client diff --git a/Zotlabs/Module/Token.php b/Zotlabs/Module/Token.php index e0d9d74d7..5cde58895 100644 --- a/Zotlabs/Module/Token.php +++ b/Zotlabs/Module/Token.php @@ -5,36 +5,32 @@ namespace Zotlabs\Module; class Token extends \Zotlabs\Web\Controller { - - function get() { - - - // workaround for HTTP-auth in CGI mode - if (x($_SERVER, 'REDIRECT_REMOTE_USER')) { - $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ; - if(strlen($userpass)) { - list($name, $password) = explode(':', $userpass); - $_SERVER['PHP_AUTH_USER'] = $name; - $_SERVER['PHP_AUTH_PW'] = $password; - } + function init() { + + // workaround for HTTP-auth in CGI mode + if (x($_SERVER, 'REDIRECT_REMOTE_USER')) { + $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ; + if(strlen($userpass)) { + list($name, $password) = explode(':', $userpass); + $_SERVER['PHP_AUTH_USER'] = $name; + $_SERVER['PHP_AUTH_PW'] = $password; } - - if (x($_SERVER, 'HTTP_AUTHORIZATION')) { - $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ; - if(strlen($userpass)) { - list($name, $password) = explode(':', $userpass); - $_SERVER['PHP_AUTH_USER'] = $name; - $_SERVER['PHP_AUTH_PW'] = $password; - } + } + + if (x($_SERVER, 'HTTP_AUTHORIZATION')) { + $userpass = base64_decode(substr($_SERVER["HTTP_AUTHORIZATION"], 6)) ; + if(strlen($userpass)) { + list($name, $password) = explode(':', $userpass); + $_SERVER['PHP_AUTH_USER'] = $name; + $_SERVER['PHP_AUTH_PW'] = $password; } + } + $s = new \Zotlabs\Identity\OAuth2Server(); + $s->server->handleTokenRequest(\OAuth2\Request::createFromGlobals())->send(); - - require_once('include/oauth2.php'); - $oauth2_server->handleTokenRequest(\OAuth2\Request::createFromGlobals())->send(); - - killme(); + killme(); } } \ No newline at end of file -- cgit v1.2.3 From f492f808f4861ae9937dcaf3bf8476513ae1c091 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 16 Feb 2018 12:42:02 -0800 Subject: refactor of the DB update system. Updates are now stored individually in Zotlabs/Update/_nnnn.php and are objects; so only the pending updates need to be loaded and executed rather than all historical updates. There is one single number (DB_UPDATE_VERSION) representing the current version and it is EQUAL TO the last known update. A dummy update _1201 was created to address the difference in counting behaviour; it will be executed on the next change of DB_UPDATE_VERSION as well as the next update. The database config values are also loaded from disk on every update immediately before setting the update lock in order to reduce timing conflicts and race conditions. --- Zotlabs/Module/Admin/Dbsync.php | 54 ++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 25 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Dbsync.php b/Zotlabs/Module/Admin/Dbsync.php index cff8a2484..469af2aa5 100644 --- a/Zotlabs/Module/Admin/Dbsync.php +++ b/Zotlabs/Module/Admin/Dbsync.php @@ -7,36 +7,38 @@ namespace Zotlabs\Module\Admin; class Dbsync { - - function get() { $o = ''; if(argc() > 3 && intval(argv(3)) && argv(2) === 'mark') { - set_config('database', 'update_r' . intval(argv(3)), 'success'); - if(intval(get_config('system','db_version')) <= intval(argv(3))) - set_config('system','db_version',intval(argv(3)) + 1); + // remove the old style config if it exists + del_config('database', 'update_r' . intval(argv(3))); + set_config('database', '_' . intval(argv(3)), 'success'); + if(intval(get_config('system','db_version')) < intval(argv(3))) + set_config('system','db_version',intval(argv(3))); info( t('Update has been marked successful') . EOL); goaway(z_root() . '/admin/dbsync'); } if(argc() > 2 && intval(argv(2))) { - require_once('install/update.php'); - $func = 'update_r' . intval(argv(2)); - if(function_exists($func)) { - $retval = $func(); + $x = intval(argv(2)); + $s = '_' . $x; + $cls = '\\Zotlabs\Update\\' . $s ; + if(class_exists($cls)) { + $c = new $cls(); + $retval = $c->run(); if($retval === UPDATE_FAILED) { - $o .= sprintf( t('Executing %s failed. Check system logs.'), $func); + $o .= sprintf( t('Executing %s failed. Check system logs.'), $s); } elseif($retval === UPDATE_SUCCESS) { - $o .= sprintf( t('Update %s was successfully applied.'), $func); - set_config('database',$func, 'success'); + $o .= sprintf( t('Update %s was successfully applied.'), $s); + set_config('database',$s, 'success'); } else - $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $func); + $o .= sprintf( t('Update %s did not return a status. Unknown if it succeeded.'), $s); } else - $o .= sprintf( t('Update function %s could not be found.'), $func); + $o .= sprintf( t('Update function %s could not be found.'), $s); return $o; } @@ -45,23 +47,25 @@ class Dbsync { $r = q("select * from config where cat = 'database' "); if(count($r)) { foreach($r as $rr) { - $upd = intval(substr($rr['k'],8)); + $upd = intval(substr($rr['k'],-4)); if($rr['v'] === 'success') continue; $failed[] = $upd; } } - if(! count($failed)) - return '

' . t('No failed updates.') . '

'; - - $o = replace_macros(get_markup_template('failed_updates.tpl'),array( - '$base' => z_root(), - '$banner' => t('Failed Updates'), - '$desc' => '', - '$mark' => t('Mark success (if update was manually applied)'), - '$apply' => t('Attempt to execute this update step automatically'), - '$failed' => $failed + if(count($failed)) { + $o = replace_macros(get_markup_template('failed_updates.tpl'),array( + '$base' => z_root(), + '$banner' => t('Failed Updates'), + '$desc' => '', + '$mark' => t('Mark success (if update was manually applied)'), + '$apply' => t('Attempt to execute this update step automatically'), + '$failed' => $failed )); + } + else { + return '

' . t('No failed updates.') . '

'; + } return $o; } -- cgit v1.2.3 From 4a5d1076eda66f4d562219468b84dff2bd8de86b Mon Sep 17 00:00:00 2001 From: Klaus Weidenbach Date: Sat, 17 Feb 2018 01:49:01 +0100 Subject: Refactor OAuth2Server a bit. --- Zotlabs/Module/Authorize.php | 45 ++++++++++++++++++++++---------------------- Zotlabs/Module/Token.php | 9 +++++---- 2 files changed, 27 insertions(+), 27 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Authorize.php b/Zotlabs/Module/Authorize.php index 7676b0855..254700b4e 100644 --- a/Zotlabs/Module/Authorize.php +++ b/Zotlabs/Module/Authorize.php @@ -2,13 +2,13 @@ namespace Zotlabs\Module; +use Zotlabs\Identity\OAuth2Storage; -class Authorize extends \Zotlabs\Web\Controller { +class Authorize extends \Zotlabs\Web\Controller { function init() { - // workaround for HTTP-auth in CGI mode if (x($_SERVER, 'REDIRECT_REMOTE_USER')) { $userpass = base64_decode(substr($_SERVER["REDIRECT_REMOTE_USER"], 6)) ; @@ -28,41 +28,40 @@ class Authorize extends \Zotlabs\Web\Controller { } } - $s = new \Zotlabs\Identity\OAuth2Server(); + $s = new \Zotlabs\Identity\OAuth2Server(new OAuth2Storage(\DBA::$dba->db)); $request = \OAuth2\Request::createFromGlobals(); $response = new \OAuth2\Response(); // validate the authorize request - if (! $s->server->validateAuthorizeRequest($request, $response)) { - $response->send(); - killme(); + if (! $s->validateAuthorizeRequest($request, $response)) { + $response->send(); + killme(); } - // display an authorization form - if (empty($_POST)) { + // display an authorization form + if (empty($_POST)) { - return ' + return '

'; - } + } - // print the authorization code if the user has authorized your client - $is_authorized = ($_POST['authorized'] === 'yes'); - $s->server->handleAuthorizeRequest($request, $response, $is_authorized, local_channel()); - if ($is_authorized) { - // this is only here so that you get to see your code in the cURL request. Otherwise, - // we'd redirect back to the client - $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40); - echo("SUCCESS! Authorization Code: $code"); - - } + // print the authorization code if the user has authorized your client + $is_authorized = ($_POST['authorized'] === 'yes'); + $s->handleAuthorizeRequest($request, $response, $is_authorized, local_channel()); + if ($is_authorized) { + // this is only here so that you get to see your code in the cURL request. Otherwise, + // we'd redirect back to the client + $code = substr($response->getHttpHeader('Location'), strpos($response->getHttpHeader('Location'), 'code=')+5, 40); + echo("SUCCESS! Authorization Code: $code"); + } - $response->send(); - killme(); + $response->send(); + killme(); } -} \ No newline at end of file +} diff --git a/Zotlabs/Module/Token.php b/Zotlabs/Module/Token.php index 5cde58895..f7c074233 100644 --- a/Zotlabs/Module/Token.php +++ b/Zotlabs/Module/Token.php @@ -2,6 +2,8 @@ namespace Zotlabs\Module; +use Zotlabs\Identity\OAuth2Storage; + class Token extends \Zotlabs\Web\Controller { @@ -26,11 +28,10 @@ class Token extends \Zotlabs\Web\Controller { } } - - $s = new \Zotlabs\Identity\OAuth2Server(); - $s->server->handleTokenRequest(\OAuth2\Request::createFromGlobals())->send(); + $s = new \Zotlabs\Identity\OAuth2Server(new OAuth2Storage(\DBA::$dba->db)); + $s->handleTokenRequest(\OAuth2\Request::createFromGlobals())->send(); killme(); } -} \ No newline at end of file +} -- cgit v1.2.3 From ce8349662d8c9e309f3faf57114acddb67eb11b7 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 19 Feb 2018 20:12:58 -0800 Subject: Add 'Validate' button to new_channel page and disable submit until validated. This is to get around the issue that clicking submit without ever focusing and blurring the nickname field won't actually submit the form but only provide validation. It needs to be clicked again to submit. The first click processed the blur but remained on the page with no feedback. If somebody has better workarounds, please provide. The goal is to ensure that the name and the nickname are both validated before we can submit. --- Zotlabs/Module/New_channel.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/New_channel.php b/Zotlabs/Module/New_channel.php index 9f2fea802..548f28c4f 100644 --- a/Zotlabs/Module/New_channel.php +++ b/Zotlabs/Module/New_channel.php @@ -142,6 +142,7 @@ class New_channel extends \Zotlabs\Web\Controller { '$role' => $role, '$default_role' => $default_role, '$nickname' => $nickname, + '$validate' => t('Validate'), '$submit' => t('Create'), '$channel_usage_message' => $channel_usage_message )); -- cgit v1.2.3 From 2d69b419ff9a0b2186d9479447f75f37b9102fa6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 21 Feb 2018 20:59:30 -0800 Subject: move Zotlabs\Zot\Verify to Zotlabs\Lib\Verify as part of the z6 re-org --- Zotlabs/Module/Magic.php | 2 +- Zotlabs/Module/Owa.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Magic.php b/Zotlabs/Module/Magic.php index 9ad9c951c..15e5cedcf 100644 --- a/Zotlabs/Module/Magic.php +++ b/Zotlabs/Module/Magic.php @@ -166,7 +166,7 @@ class Magic extends \Zotlabs\Web\Controller { $token = random_string(); - \Zotlabs\Zot\Verify::create('auth',$channel['channel_id'],$token,$x[0]['hubloc_url']); + \Zotlabs\Lib\Verify::create('auth',$channel['channel_id'],$token,$x[0]['hubloc_url']); $target_url = $x[0]['hubloc_callback'] . '/?f=&auth=' . urlencode(channel_reddress($channel)) . '&sec=' . $token . '&dest=' . urlencode($dest) . '&version=' . ZOT_REVISION; diff --git a/Zotlabs/Module/Owa.php b/Zotlabs/Module/Owa.php index 23ee14f39..e62fc9592 100644 --- a/Zotlabs/Module/Owa.php +++ b/Zotlabs/Module/Owa.php @@ -42,7 +42,7 @@ class Owa extends \Zotlabs\Web\Controller { logger('OWA success: ' . $hubloc['hubloc_addr'],LOGGER_DATA); $ret['success'] = true; $token = random_string(32); - \Zotlabs\Zot\Verify::create('owt',0,$token,$hubloc['hubloc_addr']); + \Zotlabs\Lib\Verify::create('owt',0,$token,$hubloc['hubloc_addr']); $result = ''; openssl_public_encrypt($token,$result,$hubloc['xchan_pubkey']); $ret['encrypted_token'] = base64url_encode($result); -- cgit v1.2.3 From 80ce2def461705ebd0853e99ddfc0d1bc1de2915 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 22 Feb 2018 12:01:53 +0100 Subject: also sort by id to not make mysql change the queryplan if offset is > 0 after recent index changes --- Zotlabs/Module/Channel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Channel.php b/Zotlabs/Module/Channel.php index 231146999..3d3eb2a85 100644 --- a/Zotlabs/Module/Channel.php +++ b/Zotlabs/Module/Channel.php @@ -255,7 +255,7 @@ class Channel extends \Zotlabs\Web\Controller { AND (abook.abook_blocked = 0 or abook.abook_flags is null) AND item.item_wall = 1 $sql_extra $sql_extra2 - ORDER BY created DESC $pager_sql ", + ORDER BY created DESC, id $pager_sql ", intval(\App::$profile['profile_uid']) ); } -- cgit v1.2.3 From 8f95b8a824351d9bfd0542ed90c19d8c4e26239c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 22 Feb 2018 21:54:28 -0800 Subject: handle error logging in on cloud page (post method not implemented), politely ask viewer to refresh the page rather than alert 'unknown error'. --- Zotlabs/Module/Cloud.php | 3 +++ 1 file changed, 3 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cloud.php b/Zotlabs/Module/Cloud.php index 2215507ca..8b5476efc 100644 --- a/Zotlabs/Module/Cloud.php +++ b/Zotlabs/Module/Cloud.php @@ -110,6 +110,9 @@ class Cloud extends \Zotlabs\Web\Controller { elseif($err instanceof \Sabre\DAV\Exception\Forbidden) { notice( t('Permission denied') . EOL); } + elseif($err instanceof \Sabre\DAV\Exception\NotImplemented) { + notice( t('Please refresh page') . EOL); + } else { notice( t('Unknown error') . EOL); } -- cgit v1.2.3 From 048a636315671b7e9aaf9152273d101994e37c43 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 23 Feb 2018 12:44:07 -0800 Subject: Usability and member experience: remove street address info from the default basic profile fields, mention that the site banner can be full HTML, mention on the techlevel setting that this also controls what additional features may be visible. --- Zotlabs/Module/Admin/Site.php | 2 +- Zotlabs/Module/Go.php | 1 + Zotlabs/Module/Settings/Account.php | 2 +- 3 files changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index ca181d5f8..b7c558ce7 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -299,7 +299,7 @@ class Site { '$techlock' => [ 'techlock', t('Lock the technical skill level setting'), get_config('system','techlevel_lock'), t('Members can set their own technical comfort level by default') ], - '$banner' => array('banner', t("Banner/Logo"), $banner, ""), + '$banner' => array('banner', t("Banner/Logo"), $banner, t('Unfiltered HTML/CSS/JS is allowed')), '$admininfo' => array('admininfo', t("Administrator Information"), $admininfo, t("Contact information for site administrators. Displayed on siteinfo page. BBCode can be used here")), '$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php index 2c2dcf460..d23e940c3 100644 --- a/Zotlabs/Module/Go.php +++ b/Zotlabs/Module/Go.php @@ -33,6 +33,7 @@ class Go extends \Zotlabs\Web\Controller { $options = [ 'profile_photo' => t('Upload a profile photo'), + 'cover_photo' => t('Upload a cover photo'), 'profiles' => t('Edit your default profile'), 'suggest' => t('View friend suggestions'), 'directory' => t('View the directory to find other interesting channels'), diff --git a/Zotlabs/Module/Settings/Account.php b/Zotlabs/Module/Settings/Account.php index 18890e89f..9643c5958 100644 --- a/Zotlabs/Module/Settings/Account.php +++ b/Zotlabs/Module/Settings/Account.php @@ -113,7 +113,7 @@ class Account { '$origpass' => array('origpass', t('Current Password'), ' ',''), '$password1'=> array('npassword', t('Enter New Password'), '', ''), '$password2'=> array('confirm', t('Confirm New Password'), '', t('Leave password fields blank unless changing')), - '$techlevel' => [ 'techlevel', t('Your technical skill level'), $def_techlevel, t('Used to provide a member experience matched to your comfort level'), $techlevels ], + '$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, '$submit' => t('Submit'), '$email' => array('email', t('Email Address:'), $email, ''), -- cgit v1.2.3 From 2d91aed183a08a78bc2cc0f3554f3d4c277ae798 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 23 Feb 2018 19:23:17 -0800 Subject: use embed photos javascript widget to select existing photos for profile and cover photos --- Zotlabs/Module/Cover_photo.php | 9 +++++++-- Zotlabs/Module/Embedphotos.php | 2 +- Zotlabs/Module/Import.php | 2 +- Zotlabs/Module/Profile_photo.php | 9 ++++++--- 4 files changed, 15 insertions(+), 7 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index cfb513365..7dd53ab19 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -357,12 +357,17 @@ class Cover_photo extends \Zotlabs\Web\Controller { '$user' => \App::$channel['channel_address'], '$lbl_upfile' => t('Upload File:'), '$lbl_profiles' => t('Select a profile:'), - '$title' => t('Upload Cover Photo'), + '$title' => t('Change Cover Photo'), '$submit' => t('Upload'), '$profiles' => $profiles, + '$embedPhotos' => t('Use a photo from your albums'), + '$embedPhotosModalTitle' => t('Use a photo from your albums'), + '$embedPhotosModalCancel' => t('Cancel'), + '$embedPhotosModalOK' => t('OK'), '$form_security_token' => get_form_security_token("cover_photo"), /// @FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') + '$select' => t('or select an existing photo'), + )); call_hooks('cover_photo_content_end', $o); diff --git a/Zotlabs/Module/Embedphotos.php b/Zotlabs/Module/Embedphotos.php index 15cc68d7f..bcbb0e116 100644 --- a/Zotlabs/Module/Embedphotos.php +++ b/Zotlabs/Module/Embedphotos.php @@ -53,7 +53,7 @@ class Embedphotos extends \Zotlabs\Web\Controller { } else { json_return_and_die(array('errormsg' => 'Error retrieving resource ' . $resource_id, 'status' => false)); } - json_return_and_die(array('status' => true, 'photolink' => $photolink)); + json_return_and_die(array('status' => true, 'photolink' => $photolink, 'resource_id' => $resource_id)); } } diff --git a/Zotlabs/Module/Import.php b/Zotlabs/Module/Import.php index 2b16ff4e1..36bd72310 100644 --- a/Zotlabs/Module/Import.php +++ b/Zotlabs/Module/Import.php @@ -64,7 +64,7 @@ class Import extends \Zotlabs\Web\Controller { notice( t('Nothing to import.') . EOL); return; } else if(strpos($old_address, '@')) { - // if you copy the identity address from your profile page, make it work for convenience + // if you copy the identity address from your profile page, make it work for convenience - WARNING: this is a utf-8 variant and NOT an ASCII ampersand. Please do not edit. $old_address = str_replace('@', '@', $old_address); } diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 222b92721..6f517b695 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -441,14 +441,17 @@ class Profile_photo extends \Zotlabs\Web\Controller { '$importfile' => (($importing) ? \App::$data['importfile'] : ''), '$lbl_upfile' => t('Upload File:'), '$lbl_profiles' => t('Select a profile:'), - '$title' => (($importing) ? t('Use Photo for Profile') : t('Upload Profile Photo')), + '$title' => (($importing) ? t('Use Photo for Profile') : t('Change Profile Photo')), '$submit' => (($importing) ? t('Use') : t('Upload')), '$profiles' => $profiles, '$single' => ((count($profiles) == 1) ? true : false), '$profile0' => $profiles[0], + '$embedPhotos' => t('Use a photo from your albums'), + '$embedPhotosModalTitle' => t('Use a photo from your albums'), + '$embedPhotosModalCancel' => t('Cancel'), + '$embedPhotosModalOK' => t('OK'), '$form_security_token' => get_form_security_token("profile_photo"), - // FIXME - yuk - '$select' => sprintf('%s %s', t('or'), ($newuser) ? '' . t('skip this step') . '' : '' . t('select a photo from your photo albums') . '') + '$select' => t('or select an existing photo'), )); call_hooks('profile_photo_content_end', $o); -- cgit v1.2.3 From 59dafb610d049c8b19a038871fa282231f809c93 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 23 Feb 2018 19:36:46 -0800 Subject: style the 'use existing' button a wee bit --- Zotlabs/Module/Cover_photo.php | 2 +- Zotlabs/Module/Profile_photo.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index 7dd53ab19..047bcf3d4 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -366,7 +366,7 @@ class Cover_photo extends \Zotlabs\Web\Controller { '$embedPhotosModalOK' => t('OK'), '$form_security_token' => get_form_security_token("cover_photo"), /// @FIXME - yuk - '$select' => t('or select an existing photo'), + '$select' => t('Select existing photo'), )); diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 6f517b695..c772f0ed3 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -451,7 +451,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { '$embedPhotosModalCancel' => t('Cancel'), '$embedPhotosModalOK' => t('OK'), '$form_security_token' => get_form_security_token("profile_photo"), - '$select' => t('or select an existing photo'), + '$select' => t('Select existing photo'), )); call_hooks('profile_photo_content_end', $o); -- cgit v1.2.3 From e6f9f284bf04f0dc0471fa08d7dac118effe4ccb Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 23 Feb 2018 22:12:29 -0800 Subject: open_pubstream logic was messy and wrong --- Zotlabs/Module/Pubstream.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Pubstream.php b/Zotlabs/Module/Pubstream.php index af7bc7658..79f205a22 100644 --- a/Zotlabs/Module/Pubstream.php +++ b/Zotlabs/Module/Pubstream.php @@ -12,10 +12,16 @@ class Pubstream extends \Zotlabs\Web\Controller { if($load) $_SESSION['loadtime'] = datetime_convert(); - if((observer_prohibited(true)) || (! (intval(get_config('system','open_pubstream',1))) && get_observer_hash())) { + if((observer_prohibited(true))) { return login(); } + if(! intval(get_config('system','open_pubstream',1))) { + if(! get_observer_hash()) { + return login(); + } + } + $site_firehose = ((intval(get_config('system','site_firehose',0))) ? true : false); $net_firehose = ((get_config('system','disable_discover_tab',1)) ? false : true); -- cgit v1.2.3 From c618bfc607498998916f01fd9c6985c2ecd47356 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sat, 24 Feb 2018 19:42:39 +0100 Subject: mark connections where we do not have post_comments permissions with an no entry sign. --- Zotlabs/Module/Connections.php | 8 +++++++- Zotlabs/Module/Viewconnections.php | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Connections.php b/Zotlabs/Module/Connections.php index 255731c9c..55e716ace 100644 --- a/Zotlabs/Module/Connections.php +++ b/Zotlabs/Module/Connections.php @@ -245,6 +245,11 @@ class Connections extends \Zotlabs\Web\Controller { ((intval($rr['abook_blocked'])) ? t('Blocked') : ''), ((intval($rr['abook_not_here'])) ? t('Not connected at this location') : '') ); + + $oneway = false; + if(! intval(get_abconfig(local_channel(),$rr['xchan_hash'],'their_perms','post_comments'))) { + $oneway = true; + } foreach($status as $str) { if(!$str) @@ -283,7 +288,8 @@ class Connections extends \Zotlabs\Web\Controller { 'ignore_hover' => t('Ignore connection'), 'ignore' => ((! $rr['abook_ignored']) ? t('Ignore') : false), 'recent_label' => t('Recent activity'), - 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']) + 'recentlink' => z_root() . '/network/?f=&cid=' . intval($rr['abook_id']), + 'oneway' => $oneway ); } } diff --git a/Zotlabs/Module/Viewconnections.php b/Zotlabs/Module/Viewconnections.php index 1f9c03751..e024f1c5a 100644 --- a/Zotlabs/Module/Viewconnections.php +++ b/Zotlabs/Module/Viewconnections.php @@ -69,8 +69,13 @@ class Viewconnections extends \Zotlabs\Web\Controller { $contacts = array(); foreach($r as $rr) { + + $oneway = false; + if(! intval(get_abconfig(\App::$profile['uid'],$rr['xchan_hash'],'their_perms','post_comments'))) { + $oneway = true; + } - $url = chanlink_hash($rr['xchan_hash']); + $url = chanlink_hash($rr['xchan_hash']); if($url) { $contacts[] = array( 'id' => $rr['abook_id'], @@ -83,6 +88,7 @@ class Viewconnections extends \Zotlabs\Web\Controller { 'sparkle' => '', 'itemurl' => $rr['url'], 'network' => '', + 'oneway' => $oneway ); } } -- cgit v1.2.3 From 3153129e2eb968a189a8a7050d06892cbc13c651 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 24 Feb 2018 13:20:59 -0800 Subject: make the profile photo image picker work correctly with multiple profiles. --- Zotlabs/Module/Profile_photo.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index c772f0ed3..44b7c18c6 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -304,7 +304,7 @@ class Profile_photo extends \Zotlabs\Web\Controller { } $channel = \App::get_channel(); - + $pf = 0; $newuser = false; if(argc() == 2 && argv(1) === 'new') @@ -318,8 +318,8 @@ class Profile_photo extends \Zotlabs\Web\Controller { $resource_id = argv(2); - // When using an existing photo, we don't have a dialogue to offer a choice of profiles, - // so it gets attached to the default + + $pf = (($_REQUEST['pf']) ? intval($_REQUEST['pf']) : 0); $c = q("select id, is_default from profile where uid = %d", intval(local_channel()) @@ -331,6 +331,9 @@ class Profile_photo extends \Zotlabs\Web\Controller { $_REQUEST['profile'] = $c[0]['id']; $multi_profiles = false; } + else { + $_REQUEST['profile'] = $pf; + } $r = q("SELECT id, album, imgscale FROM photo WHERE uid = %d AND resource_id = '%s' ORDER BY imgscale ASC", intval(local_channel()), @@ -430,6 +433,16 @@ class Profile_photo extends \Zotlabs\Web\Controller { intval(local_channel()) ); + if($profiles) { + for($x = 0; $x < count($profiles); $x ++) { + $profiles[$x]['selected'] = false; + if($pf && $profiles[$x]['id'] == $pf) + $profiles[$x]['selected'] = true; + if((! $pf) && $profiles[$x]['is_default']) + $profiles[$x]['selected'] = true; + } + } + $importing = ((array_key_exists('importfile',\App::$data)) ? true : false); if(! x(\App::$data,'imagecrop')) { -- cgit v1.2.3 From fed61c082c8f9d6a7673125bd365d44d4b409fa4 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Sun, 25 Feb 2018 13:00:43 +0100 Subject: do not overwrite abook flags if we are not owner --- Zotlabs/Module/Viewconnections.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Viewconnections.php b/Zotlabs/Module/Viewconnections.php index e024f1c5a..8366e1325 100644 --- a/Zotlabs/Module/Viewconnections.php +++ b/Zotlabs/Module/Viewconnections.php @@ -44,7 +44,7 @@ class Viewconnections extends \Zotlabs\Web\Controller { $sql_extra = ''; if(! $is_owner) { - $abook_flags = " and abook_hidden = 0 "; + $abook_flags .= " and abook_hidden = 0 "; $sql_extra = " and xchan_hidden = 0 "; } -- cgit v1.2.3 From 87079e8071e491dd6d0bb4a76723b53010fdf509 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Mon, 26 Feb 2018 16:39:12 -0800 Subject: require directory servers to be using some modern form of encryption; which means we only currently have 2. --- Zotlabs/Module/Admin/Site.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index b7c558ce7..880dbbe4b 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -220,9 +220,10 @@ class Site { $realm = get_directory_realm(); // directory server should not be set or settable unless we are a directory client + // avoid older redmatrix servers which don't have modern encryption if($dirmode == DIRECTORY_MODE_NORMAL) { - $x = q("select site_url from site where site_flags in (%d,%d) and site_realm = '%s' and site_dead = 0", + $x = q("select site_url from site where site_flags in (%d,%d) and site_realm = '%s' and site_dead = 0 and site_project != 'redmatrix'", intval(DIRECTORY_MODE_SECONDARY), intval(DIRECTORY_MODE_PRIMARY), dbesc($realm) -- cgit v1.2.3 From be5187718c0f1791a692b7743aca51ea5f37649e Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 27 Feb 2018 19:34:51 -0800 Subject: provide usage hint on addon settings page to save each panel before opening another. [String change, not for 3.2] --- Zotlabs/Module/Settings/Featured.php | 1 + 1 file changed, 1 insertion(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php index 9c5a7b16c..3740eddfa 100644 --- a/Zotlabs/Module/Settings/Featured.php +++ b/Zotlabs/Module/Settings/Featured.php @@ -62,6 +62,7 @@ class Featured { $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_featured"), '$title' => t('Feature/Addon Settings'), + '$descrip' => t('Please save/submit changes to any panel before opening another.'), '$settings_addons' => $settings_addons )); return $o; -- cgit v1.2.3 From 6c60be9e8d57c26e92f704de0712def767ab8705 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 27 Feb 2018 19:51:29 -0800 Subject: rename Addon/Feature settings to addon settings [string change] --- Zotlabs/Module/Settings/Featured.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Settings/Featured.php b/Zotlabs/Module/Settings/Featured.php index 3740eddfa..1da139206 100644 --- a/Zotlabs/Module/Settings/Featured.php +++ b/Zotlabs/Module/Settings/Featured.php @@ -61,7 +61,7 @@ class Featured { $tpl = get_markup_template("settings_addons.tpl"); $o .= replace_macros($tpl, array( '$form_security_token' => get_form_security_token("settings_featured"), - '$title' => t('Feature/Addon Settings'), + '$title' => t('Addon Settings'), '$descrip' => t('Please save/submit changes to any panel before opening another.'), '$settings_addons' => $settings_addons )); -- cgit v1.2.3 From 1c07880c0178bbda875bbe2cda5d19ae7fb5e1c4 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 28 Feb 2018 18:01:51 -0800 Subject: important bugfix: if logged in locally and mod_display returns nothing owned by your uid, retry with known public uids rather than issue 'permission denied'. Affects the ability to view search results for otherwise public posts 'in context'. --- Zotlabs/Module/Display.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index 11dd0d174..8e8a1ed24 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -215,6 +215,7 @@ class Display extends \Zotlabs\Web\Controller { $pager_sql = sprintf(" LIMIT %d OFFSET %d ", intval(\App::$pager['itemspage']),intval(\App::$pager['start'])); if($load || ($checkjs->disabled()) || ($module_format !== 'html')) { + $r = null; require_once('include/channel.php'); @@ -235,7 +236,7 @@ class Display extends \Zotlabs\Web\Controller { } } - if($r === null) { + if(! $r) { // in case somebody turned off public access to sys channel content using permissions // make that content unsearchable by ensuring the owner uid can't match @@ -281,7 +282,7 @@ class Display extends \Zotlabs\Web\Controller { } } - if($r === null) { + if(! $r) { // in case somebody turned off public access to sys channel content using permissions // make that content unsearchable by ensuring the owner_xchan can't match if(! perm_is_allowed($sysid,$observer_hash,'view_stream')) -- cgit v1.2.3 From 14e14c6c92dadf4c95900978135a161f5da696d9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 28 Feb 2018 19:49:33 -0800 Subject: provide new member widget which sits beneath the notifications for the first 60 days after an account creation. --- Zotlabs/Module/Go.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Go.php b/Zotlabs/Module/Go.php index d23e940c3..d33136d9e 100644 --- a/Zotlabs/Module/Go.php +++ b/Zotlabs/Module/Go.php @@ -36,7 +36,7 @@ class Go extends \Zotlabs\Web\Controller { 'cover_photo' => t('Upload a cover photo'), 'profiles' => t('Edit your default profile'), 'suggest' => t('View friend suggestions'), - 'directory' => t('View the directory to find other interesting channels'), + 'directory' => t('View the channel directory'), 'settings' => t('View/edit your channel settings'), 'help' => t('View the site or project documentation'), 'channel/' . $channel['channel_address'] => t('Visit your channel homepage'), -- cgit v1.2.3 From 2b910eb5aa204e1914c8c73afe369c443bd1ff49 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 28 Feb 2018 20:31:06 -0800 Subject: Create one and only one 'registration successful, check your email' popup. --- Zotlabs/Module/Register.php | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Register.php b/Zotlabs/Module/Register.php index c7fa1cee8..5356669e9 100644 --- a/Zotlabs/Module/Register.php +++ b/Zotlabs/Module/Register.php @@ -123,9 +123,6 @@ class Register extends \Zotlabs\Web\Controller { if($policy == REGISTER_OPEN ) { if($email_verify) { $res = verify_email_address($result); - if($res) { - info( t('Registration successful. Please check your email for validation instructions.') . EOL ) ; - } } else { $res = send_register_success_email($result['email'],$result['password']); @@ -133,7 +130,8 @@ class Register extends \Zotlabs\Web\Controller { if($res) { if($invite_code) { info( t('Registration successful. Continue to create your first channel...') . EOL ) ; - } else { + } + else { info( t('Registration successful. Please check your email for validation instructions.') . EOL ) ; } } -- cgit v1.2.3 From 01015bc0d54343831189ce1b09a69b70a6371fd5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 28 Feb 2018 21:15:26 -0800 Subject: several email validation issues --- Zotlabs/Module/Email_validation.php | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Email_validation.php b/Zotlabs/Module/Email_validation.php index b8bb720cd..c1ba9a01a 100644 --- a/Zotlabs/Module/Email_validation.php +++ b/Zotlabs/Module/Email_validation.php @@ -7,12 +7,11 @@ class Email_validation extends \Zotlabs\Web\Controller { function post() { + $success = false; if($_POST['token']) { // This will redirect internally on success unless the channel is auto_created - if(! account_approve(trim(basename($_POST['token'])))) { - notice('Token verification failed.'); - } - else { + if(account_approve(trim(basename($_POST['token'])))) { + $success = true; if(get_config('system','auto_channel_create')) { $next_page = get_config('system', 'workflow_channel_next', 'profiles'); } @@ -21,7 +20,9 @@ class Email_validation extends \Zotlabs\Web\Controller { } } } - + if(! $success) { + notice( t('Token verification failed.') . EOL); + } } -- cgit v1.2.3 From 226aad357d58dd11283e83b4325ee65691fadaef Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 1 Mar 2018 16:38:14 -0800 Subject: add federation property to webfinger --- Zotlabs/Module/Wfinger.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Wfinger.php b/Zotlabs/Module/Wfinger.php index 753721d27..81d4beaed 100644 --- a/Zotlabs/Module/Wfinger.php +++ b/Zotlabs/Module/Wfinger.php @@ -123,7 +123,8 @@ class Wfinger extends \Zotlabs\Web\Controller { $result['properties'] = [ 'http://webfinger.net/ns/name' => $r[0]['channel_name'], 'http://xmlns.com/foaf/0.1/name' => $r[0]['channel_name'], - 'https://w3id.org/security/v1#publicKeyPem' => $r[0]['xchan_pubkey'] + 'https://w3id.org/security/v1#publicKeyPem' => $r[0]['xchan_pubkey'], + 'http://purl.org/zot/federation' => 'zot' ]; foreach($aliases as $alias) -- cgit v1.2.3 From 1eab488754abefa5e5b7a6b282f13351a4dc4f70 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 3 Mar 2018 15:19:39 -0800 Subject: There was no pdl for mod_thing; add one because it's only a link away from profile creation and remains on that page until you go elsewhere and new members may need help to find their way out --- Zotlabs/Module/Thing.php | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Thing.php b/Zotlabs/Module/Thing.php index f816632ab..c3d8ff802 100644 --- a/Zotlabs/Module/Thing.php +++ b/Zotlabs/Module/Thing.php @@ -20,6 +20,11 @@ class Thing extends \Zotlabs\Web\Controller { $channel = \App::get_channel(); + if($_SERVER['REQUEST_METHOD'] === 'GET' && argc() < 2) { + profile_load($channel['channel_address']); + } + + $term_hash = (($_REQUEST['term_hash']) ? $_REQUEST['term_hash'] : ''); $name = escape_tags($_REQUEST['term']); -- cgit v1.2.3 From 5d18996362bf51d38cea6d14f348064333153b27 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 3 Mar 2018 15:52:57 -0800 Subject: add dummy f= arg to suggestion urls, use directory version of suggest for newmember link instead of the suggest module as the UI is prettier. --- Zotlabs/Module/Directory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index b1552a694..85c0be6b6 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -17,7 +17,7 @@ class Directory extends \Zotlabs\Web\Controller { intval(local_channel()), dbesc($_GET['ignore']) ); - goaway(z_root() . '/directory?suggest=1'); + goaway(z_root() . '/directory?f=&suggest=1'); } $observer = get_observer_hash(); -- cgit v1.2.3 From af46c192bf7c217b7348082cbcacd3ea4659fae3 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 4 Mar 2018 15:29:10 -0800 Subject: bugfix: unable to reset profile fields to defaults in admin/profs by emptying the textarea --- Zotlabs/Module/Admin/Profs.php | 39 ++++++++++++++++++++++++++++++--------- 1 file changed, 30 insertions(+), 9 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Profs.php b/Zotlabs/Module/Admin/Profs.php index b3da09cb7..eb2501d43 100644 --- a/Zotlabs/Module/Admin/Profs.php +++ b/Zotlabs/Module/Admin/Profs.php @@ -9,17 +9,37 @@ class Profs { if(array_key_exists('basic',$_REQUEST)) { $arr = explode(',',$_REQUEST['basic']); - for($x = 0; $x < count($arr); $x ++) - if(trim($arr[$x])) - $arr[$x] = trim($arr[$x]); - set_config('system','profile_fields_basic',$arr); - + array_walk($arr,'array_trim'); + $narr = []; + if(count($arr)) { + foreach($arr as $a) { + if(strlen($a)) { + $narr[] = $a; + } + } + } + if(! $narr) + del_config('system','profile_fields_basic'); + else + set_config('system','profile_fields_basic',$narr); + + if(array_key_exists('advanced',$_REQUEST)) { $arr = explode(',',$_REQUEST['advanced']); - for($x = 0; $x < count($arr); $x ++) - if(trim($arr[$x])) - $arr[$x] = trim($arr[$x]); - set_config('system','profile_fields_advanced',$arr); + array_walk($arr,'array_trim'); + $narr = []; + if(count($arr)) { + foreach($arr as $a) { + if(strlen($a)) { + $narr[] = $a; + } + } + } + if(! $narr) + del_config('system','profile_fields_advanced'); + else + set_config('system','profile_fields_advanced',$narr); + } goaway(z_root() . '/admin/profs'); } @@ -98,6 +118,7 @@ class Profs { $basic = ''; $barr = array(); $fields = get_profile_fields_basic(); + if(! $fields) $fields = get_profile_fields_basic(1); if($fields) { -- cgit v1.2.3 From f02314dfd877ab13852ae169d40dcbcc65344bfb Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 4 Mar 2018 17:36:52 -0800 Subject: fix some issues with friend suggestions on standalone sites with no 'suggestme' volunteers. This wrongly pulled up a site directory suggesting everybody on the site. While a better outcome than finding nobody, this does not fit with our ethical design goals. If there are no friends of friends, we will only suggest those who volunteer to be on the default suggestion list. Also do not attempt to load poco data from dead sites. --- Zotlabs/Module/Directory.php | 5 +++++ Zotlabs/Module/Sitelist.php | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index 85c0be6b6..62a1670f9 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -101,6 +101,11 @@ class Directory extends \Zotlabs\Web\Controller { if($suggest) { $r = suggestion_query(local_channel(),get_observer_hash()); + + if(! $r) { + notice( t('No default suggestions were found.') . EOL); + return; + } // Remember in which order the suggestions were $addresses = array(); diff --git a/Zotlabs/Module/Sitelist.php b/Zotlabs/Module/Sitelist.php index e7d4187b7..2ac5ed1b8 100644 --- a/Zotlabs/Module/Sitelist.php +++ b/Zotlabs/Module/Sitelist.php @@ -32,7 +32,7 @@ class Sitelist extends \Zotlabs\Web\Controller { $result = array('success' => false); - $r = q("select count(site_url) as total from site where site_type = %d $sql_extra ", + $r = q("select count(site_url) as total from site where site_type = %d and site_dead = 0 $sql_extra ", intval(SITE_TYPE_ZOT) ); @@ -42,7 +42,7 @@ class Sitelist extends \Zotlabs\Web\Controller { $result['start'] = $start; $result['limit'] = $limit; - $r = q("select * from site where site_type = %d $sql_extra $sql_order $sql_limit", + $r = q("select * from site where site_type = %d and site_dead = 0 $sql_extra $sql_order $sql_limit", intval(SITE_TYPE_ZOT) ); -- cgit v1.2.3 From 89bbf6cd67b7996e6f877f198fe41db22f69b84a Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 7 Mar 2018 20:29:37 +0100 Subject: we do not support separate mobile themes anymore --- Zotlabs/Module/Admin/Site.php | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Admin/Site.php b/Zotlabs/Module/Admin/Site.php index 880dbbe4b..015c6535c 100644 --- a/Zotlabs/Module/Admin/Site.php +++ b/Zotlabs/Module/Admin/Site.php @@ -24,7 +24,7 @@ class Site { $siteinfo = ((x($_POST,'siteinfo')) ? trim($_POST['siteinfo']) : ''); $language = ((x($_POST,'language')) ? notags(trim($_POST['language'])) : ''); $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : ''); - $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : ''); +// $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : ''); // $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : ''); $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0); @@ -122,11 +122,11 @@ class Site { set_config('system','siteinfo',$siteinfo); set_config('system', 'language', $language); set_config('system', 'theme', $theme); - if ( $theme_mobile === '---' ) { - del_config('system', 'mobile_theme'); - } else { - set_config('system', 'mobile_theme', $theme_mobile); - } +// if ( $theme_mobile === '---' ) { +// del_config('system', 'mobile_theme'); +// } else { +// set_config('system', 'mobile_theme', $theme_mobile); +// } // set_config('system','site_channel', $site_channel); set_config('system','maximagesize', $maximagesize); @@ -305,7 +305,7 @@ class Site { '$siteinfo' => array('siteinfo', t('Site Information'), get_config('system','siteinfo'), t("Publicly visible description of this site. Displayed on siteinfo page. BBCode can be used here")), '$language' => array('language', t("System language"), get_config('system','language'), "", $lang_choices), '$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - change theme settings"), $theme_choices), - '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile), +// '$theme_mobile' => array('theme_mobile', t("Mobile system theme"), get_config('system','mobile_theme'), t("Theme for mobile devices"), $theme_choices_mobile), // '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")), '$feed_contacts' => array('feed_contacts', t('Allow Feeds as Connections'),get_config('system','feed_contacts'),t('(Heavy system resource usage)')), '$maximagesize' => array('maximagesize', t("Maximum image size"), intval(get_config('system','maximagesize')), t("Maximum size in bytes of uploaded images. Default is 0, which means no limits.")), -- cgit v1.2.3 From d2ffe29343657ea0b3fb779c22ad156b06ca2974 Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Wed, 7 Mar 2018 21:11:57 +0100 Subject: we need the javascript in the template since strings are involved --- Zotlabs/Module/Cover_photo.php | 6 ++++++ Zotlabs/Module/Profile_photo.php | 6 ++++++ 2 files changed, 12 insertions(+) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index 047bcf3d4..2da99b447 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -364,6 +364,12 @@ class Cover_photo extends \Zotlabs\Web\Controller { '$embedPhotosModalTitle' => t('Use a photo from your albums'), '$embedPhotosModalCancel' => t('Cancel'), '$embedPhotosModalOK' => t('OK'), + '$modalchooseimages' => t('Choose images to embed'), + '$modalchoosealbum' => t('Choose an album'), + '$modaldiffalbum' => t('Choose a different album'), + '$modalerrorlist' => t('Error getting album list'), + '$modalerrorlink' => t('Error getting photo link'), + '$modalerroralbum' => t('Error getting album'), '$form_security_token' => get_form_security_token("cover_photo"), /// @FIXME - yuk '$select' => t('Select existing photo'), diff --git a/Zotlabs/Module/Profile_photo.php b/Zotlabs/Module/Profile_photo.php index 44b7c18c6..2ce8686b9 100644 --- a/Zotlabs/Module/Profile_photo.php +++ b/Zotlabs/Module/Profile_photo.php @@ -463,6 +463,12 @@ class Profile_photo extends \Zotlabs\Web\Controller { '$embedPhotosModalTitle' => t('Use a photo from your albums'), '$embedPhotosModalCancel' => t('Cancel'), '$embedPhotosModalOK' => t('OK'), + '$modalchooseimages' => t('Choose images to embed'), + '$modalchoosealbum' => t('Choose an album'), + '$modaldiffalbum' => t('Choose a different album'), + '$modalerrorlist' => t('Error getting album list'), + '$modalerrorlink' => t('Error getting photo link'), + '$modalerroralbum' => t('Error getting album'), '$form_security_token' => get_form_security_token("profile_photo"), '$select' => t('Select existing photo'), )); -- cgit v1.2.3 From 8705882e6eb51f901e59a2b03ecfc8dc1588baa1 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 8 Mar 2018 10:50:03 +0100 Subject: use dbunescbin() for cover photos --- Zotlabs/Module/Cover_photo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Zotlabs/Module') diff --git a/Zotlabs/Module/Cover_photo.php b/Zotlabs/Module/Cover_photo.php index 2da99b447..56e35f912 100644 --- a/Zotlabs/Module/Cover_photo.php +++ b/Zotlabs/Module/Cover_photo.php @@ -207,7 +207,7 @@ class Cover_photo extends \Zotlabs\Web\Controller { } } - $imagedata = (($os_storage) ? @file_get_contents($imagedata) : $imagedata); + $imagedata = (($os_storage) ? @file_get_contents(dbunescbin($imagedata)) : dbunescbin($imagedata)); $ph = photo_factory($imagedata, $filetype); if(! $ph->is_valid()) { -- cgit v1.2.3