From 9a155cf5a576e01960c8d8b6128bfc27077211af Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 23 Mar 2018 19:03:30 -0700 Subject: turn newmember widget into a feature --- Zotlabs/Widget/Newmember.php | 12 +----------- include/features.php | 10 +++++++++- 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Zotlabs/Widget/Newmember.php b/Zotlabs/Widget/Newmember.php index afa808e6f..1a4b575b9 100644 --- a/Zotlabs/Widget/Newmember.php +++ b/Zotlabs/Widget/Newmember.php @@ -9,9 +9,6 @@ class Newmember { if(! local_channel()) return EMPTY_STR; - if(get_pconfig(local_channel(), 'system', 'disable_newmemberwidget')) - return EMPTY_STR; - $c = \App::get_channel(); if(! $c) return EMPTY_STR; @@ -20,16 +17,9 @@ class Newmember { if(! $a) return EMPTY_STR; - if(datetime_convert('UTC','UTC',$a['account_created']) < datetime_convert('UTC','UTC', 'now - 60 days')) - return EMPTY_STR; - - // This could be a new account that was used to clone a very old channel - - $ob = \App::get_observer(); - if($ob && array_key_exists('xchan_name_date',$ob) && $ob['xchan_name_date'] < datetime_convert('UTC','UTC','now - 60 days')) + if(! feature_enabled(local_channel(),'start_menu')) return EMPTY_STR; - $options = [ t('Profile Creation'), [ diff --git a/include/features.php b/include/features.php index 993266977..3928fc5cf 100644 --- a/include/features.php +++ b/include/features.php @@ -45,6 +45,7 @@ function feature_level($feature,$def) { function get_features($filtered = true) { + $account = \App::get_account(); $arr = [ @@ -53,7 +54,14 @@ function get_features($filtered = true) { t('General Features'), - + [ + 'start_menu', + t('New Member Links'), + t('Display new member quick links menu'), + true, + get_config('feature_lock','start_menu'), + feature_level('start_menu',1), + ], [ 'advanced_profiles', -- cgit v1.2.3 From 4ef2493e957ce1f2c8ea4045dba2746032f34d41 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 25 Mar 2018 21:15:23 -0700 Subject: testing start_menu feature --- include/features.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/features.php b/include/features.php index 3928fc5cf..5481c37a4 100644 --- a/include/features.php +++ b/include/features.php @@ -28,8 +28,9 @@ function get_feature_default($feature) { $f = get_features(false); foreach($f as $cat) { foreach($cat as $feat) { - if(is_array($feat) && $feat[0] === $feature) + if(is_array($feat) && $feat[0] === $feature) { return $feat[3]; + } } } return false; @@ -58,7 +59,7 @@ function get_features($filtered = true) { 'start_menu', t('New Member Links'), t('Display new member quick links menu'), - true, + (($account['account_created'] > datetime_convert('','','now - 60 days')) ? true : false), get_config('feature_lock','start_menu'), feature_level('start_menu',1), ], -- cgit v1.2.3 From 2fc3f381ac3486e8c4910e70a3933a4b6718ba19 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 25 Mar 2018 21:48:42 -0700 Subject: php strpos() empty needle warning when a term entry has no url --- include/text.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/text.php b/include/text.php index c1e064857..f9cefd020 100644 --- a/include/text.php +++ b/include/text.php @@ -1491,7 +1491,7 @@ function format_hashtags(&$item) { $term = htmlspecialchars($t['term'], ENT_COMPAT, 'UTF-8', false) ; if(! trim($term)) continue; - if(strpos($item['body'], $t['url'])) + if($t['url'] && strpos($item['body'], $t['url'])) continue; if($s) $s .= ' '; -- cgit v1.2.3 From a92f22a4a40e2ad2c01ffa86be899bc20d991ce0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sun, 25 Mar 2018 23:02:41 -0700 Subject: IDN: force baseurl to be punycode; for consistency and federation all internal urls are US-ASCII, unicode MAY be used for display. --- boot.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/boot.php b/boot.php index 6db71b8fb..62cd6ceb5 100755 --- a/boot.php +++ b/boot.php @@ -857,7 +857,7 @@ class App { self::$scheme = 'https'; if(x($_SERVER,'SERVER_NAME')) { - self::$hostname = $_SERVER['SERVER_NAME']; + self::$hostname = punify($_SERVER['SERVER_NAME']); if(x($_SERVER,'SERVER_PORT') && $_SERVER['SERVER_PORT'] != 80 && $_SERVER['SERVER_PORT'] != 443) self::$hostname .= ':' . $_SERVER['SERVER_PORT']; @@ -954,14 +954,14 @@ class App { && is_array(self::$config['system']) && array_key_exists('baseurl',self::$config['system']) && strlen(self::$config['system']['baseurl'])) { - $url = self::$config['system']['baseurl']; + $url = punify(self::$config['system']['baseurl']); $url = trim($url,'\\/'); return $url; } $scheme = self::$scheme; - self::$baseurl = $scheme . "://" . self::$hostname . ((isset(self::$path) && strlen(self::$path)) ? '/' . self::$path : '' ); + self::$baseurl = $scheme . "://" . punify(self::$hostname) . ((isset(self::$path) && strlen(self::$path)) ? '/' . self::$path : '' ); return self::$baseurl; } @@ -972,7 +972,7 @@ class App { && is_array(self::$config['system']) && array_key_exists('baseurl',self::$config['system']) && strlen(self::$config['system']['baseurl'])) { - $url = self::$config['system']['baseurl']; + $url = punify(self::$config['system']['baseurl']); $url = trim($url,'\\/'); } @@ -983,7 +983,7 @@ class App { if($parsed !== false) { self::$scheme = $parsed['scheme']; - self::$hostname = $parsed['host']; + self::$hostname = punify($parsed['host']); if(x($parsed,'port')) self::$hostname .= ':' . $parsed['port']; if(x($parsed,'path')) -- cgit v1.2.3 From 35b6c2baad74c28a993e6cd1008bc0d66e7361ae Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 27 Mar 2018 15:08:27 -0700 Subject: Hard fail imports of removed channels. This is silly. --- include/import.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/import.php b/include/import.php index 9920df8be..d8b7030b6 100644 --- a/include/import.php +++ b/include/import.php @@ -21,6 +21,11 @@ function import_channel($channel, $account_id, $seize) { $channel['channel_removed'] = (($channel['channel_pageflags'] & 0x8000) ? 1 : 0); } + if(intval($channel['channel_removed'])) { + notice( t('Unable to import a removed channel.') . EOL); + return false; + } + // Ignore the hash provided and re-calculate $channel['channel_hash'] = make_xchan_hash($channel['channel_guid'],$channel['channel_guid_sig']); -- cgit v1.2.3 From 5ea11d1222c24330dee496dade4bd08d362e95bd Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 27 Mar 2018 16:27:28 -0700 Subject: don't include the q and PHPSESSID request variables in a redirected rpost --- Zotlabs/Module/Rpost.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Zotlabs/Module/Rpost.php b/Zotlabs/Module/Rpost.php index e6ea52845..f0c4a06b9 100644 --- a/Zotlabs/Module/Rpost.php +++ b/Zotlabs/Module/Rpost.php @@ -45,7 +45,9 @@ class Rpost extends \Zotlabs\Web\Controller { $url = get_rpost_path(\App::get_observer()); // make sure we're not looping to our own hub if(($url) && (! stristr($url, \App::get_hostname()))) { - foreach($_REQUEST as $key => $arg) { + foreach($_GET as $key => $arg) { + if($key === 'q') + continue; $url .= '&' . $key . '=' . $arg; } goaway($url); -- cgit v1.2.3 From 08274ffab733a2e7c861006d6ba72f4695b069e6 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 27 Mar 2018 18:01:20 -0700 Subject: put vcard widget with author of top-level post on display page --- Zotlabs/Module/Display.php | 10 +++++++++- include/connections.php | 1 - view/pdl/mod_display.pdl | 3 +++ 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Display.php b/Zotlabs/Module/Display.php index fa29ce66c..d3047bc59 100644 --- a/Zotlabs/Module/Display.php +++ b/Zotlabs/Module/Display.php @@ -102,7 +102,7 @@ class Display extends \Zotlabs\Web\Controller { if($decoded) $item_hash = $decoded; - $r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, item_blocked from item where mid like '%s' limit 1", + $r = q("select id, uid, mid, parent_mid, thr_parent, verb, item_type, item_deleted, author_xchan, item_blocked from item where mid like '%s' limit 1", dbesc($item_hash . '%') ); @@ -110,6 +110,13 @@ class Display extends \Zotlabs\Web\Controller { $target_item = $r[0]; } + $x = q("select * from xchan where xchan_hash = '%s' limit 1", + dbesc($target_item['author_xchan']) + ); + if($x) { + \App::$poi = $x[0]; + } + //if the item is to be moderated redirect to /moderate if($target_item['item_blocked'] == ITEM_MODERATED) { goaway(z_root() . '/moderate/' . $target_item['id']); @@ -169,6 +176,7 @@ class Display extends \Zotlabs\Web\Controller { } } + $static = ((array_key_exists('static',$_REQUEST)) ? intval($_REQUEST['static']) : 0); diff --git a/include/connections.php b/include/connections.php index c5d74d4ca..8d1b9e07f 100644 --- a/include/connections.php +++ b/include/connections.php @@ -100,7 +100,6 @@ function vcard_from_xchan($xchan, $observer = null, $mode = '') { if(! $xchan) return; -// FIXME - show connect button to observer if appropriate $connect = false; if(local_channel()) { $r = q("select * from abook where abook_xchan = '%s' and abook_channel = %d limit 1", diff --git a/view/pdl/mod_display.pdl b/view/pdl/mod_display.pdl index 95f069031..a5461df50 100644 --- a/view/pdl/mod_display.pdl +++ b/view/pdl/mod_display.pdl @@ -1,3 +1,6 @@ +[region=aside] +[widget=vcard][/widget] +[/region] [region=right_aside] [widget=notifications][/widget] [widget=newmember][/widget] -- cgit v1.2.3 From 14383a4c4aac4fc1b62e3dca25f9a2783cdd154c Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 27 Mar 2018 18:43:59 -0700 Subject: uexport: set content-type to json and add sections info to the default filename if present --- Zotlabs/Module/Uexport.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Uexport.php b/Zotlabs/Module/Uexport.php index 28c840ceb..9af1887dc 100644 --- a/Zotlabs/Module/Uexport.php +++ b/Zotlabs/Module/Uexport.php @@ -22,8 +22,8 @@ class Uexport extends \Zotlabs\Web\Controller { $month = intval(argv(2)); } - header('content-type: application/octet_stream'); - header('content-disposition: attachment; filename="' . $channel['channel_address'] . (($year) ? '-' . $year : '') . (($month) ? '-' . $month : '') . '.json"' ); + header('content-type: application/json'); + header('content-disposition: attachment; filename="' . $channel['channel_address'] . (($year) ? '-' . $year : '') . (($month) ? '-' . $month : '') . (($_REQUEST['sections']) ? '-' . $_REQUEST['sections'] : '') . '.json"' ); if($year) { echo json_encode(identity_export_year(local_channel(),$year,$month)); -- cgit v1.2.3 From 662316e6873fa8152bb96b172c42ca424cb5fbd3 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 27 Mar 2018 21:13:14 -0700 Subject: update folder timestamp on uploaded files (fixme - we need to recurse back to the storage root but that is for another day) --- include/attach.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/attach.php b/include/attach.php index 39269eb03..363005029 100644 --- a/include/attach.php +++ b/include/attach.php @@ -948,6 +948,16 @@ function attach_store($channel, $observer_hash, $options = '', $arr = null) { return $ret; } + // Update the folder timestamp @todo recurse to the storage root folder + + if($folder_hash) { + q("UPDATE attach set edited = '%s' where hash = '%s' and uid = %d and is_dir = 1", + dbesc($edited), + dbesc($folder_hash), + intval($channel_id) + ); + } + // Caution: This re-uses $sql_options set further above $r = q("select * from attach where uid = %d and hash = '%s' $sql_options limit 1", -- cgit v1.2.3 From 1cf0de568ddb4b49ad27e50572779a61f4e7fd13 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 28 Mar 2018 18:32:04 -0700 Subject: use context method --- view/js/autocomplete.js | 1 + 1 file changed, 1 insertion(+) diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 2d017db18..f7570523e 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -212,6 +212,7 @@ function string2bb(element) { index: 3, search: function(term, callback) { $.getJSON('/hashtags/' + '$f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); }, replace: function(item) { return "$1$2" + item.text + ' '; }, + context: function(text) { return text.toLowerCase(); }, template: tag_format }; -- cgit v1.2.3 From cd485b0fdf159ed30b73d7bf84d132ab3af9a418 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Wed, 28 Mar 2018 19:25:11 -0700 Subject: hubzilla issue #1015 - login with unicode domain name --- include/account.php | 3 ++- include/auth.php | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/account.php b/include/account.php index 40cf281c3..2b24364f4 100644 --- a/include/account.php +++ b/include/account.php @@ -23,6 +23,7 @@ function get_account_by_id($account_id) { function check_account_email($email) { + $email = punify($email); $result = array('error' => false, 'message' => ''); // Caution: empty email isn't counted as an error in this function. @@ -139,7 +140,7 @@ function create_account($arr) { $result = array('success' => false, 'email' => '', 'password' => '', 'message' => ''); $invite_code = ((x($arr,'invite_code')) ? notags(trim($arr['invite_code'])) : ''); - $email = ((x($arr,'email')) ? notags(trim($arr['email'])) : ''); + $email = ((x($arr,'email')) ? notags(punify(trim($arr['email']))) : ''); $password = ((x($arr,'password')) ? trim($arr['password']) : ''); $password2 = ((x($arr,'password2')) ? trim($arr['password2']) : ''); $parent = ((x($arr,'parent')) ? intval($arr['parent']) : 0 ); diff --git a/include/auth.php b/include/auth.php index 6f5e58361..844566919 100644 --- a/include/auth.php +++ b/include/auth.php @@ -37,6 +37,7 @@ require_once('include/security.php'); function account_verify_password($login, $pass) { $ret = [ 'account' => null, 'channel' => null, 'xchan' => null ]; + $login = punify($login); $email_verify = get_config('system', 'verify_email'); $register_policy = get_config('system', 'register_policy'); @@ -235,7 +236,7 @@ else { $record = null; $addon_auth = array( - 'username' => trim($_POST['username']), + 'username' => punify(trim($_POST['username'])), 'password' => trim($_POST['password']), 'authenticated' => 0, 'user_record' => null @@ -261,7 +262,7 @@ else { $verify = account_verify_password($_POST['username'], $_POST['password']); if($verify && array_key_exists('reason',$verify) && $verify['reason'] === 'unvalidated') { notice( t('Email validation is incomplete. Please check your email.')); - goaway(z_root() . '/email_validation/' . bin2hex(trim(escape_tags($_POST['username'])))); + goaway(z_root() . '/email_validation/' . bin2hex(punify(trim(escape_tags($_POST['username']))))); } elseif($verify) { $atoken = $verify['xchan']; -- cgit v1.2.3 From e06e64823fbecbe67bcf59897ecad6b9c402744e Mon Sep 17 00:00:00 2001 From: Mario Vavti Date: Thu, 29 Mar 2018 10:30:32 +0200 Subject: bump version --- boot.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boot.php b/boot.php index 62cd6ceb5..639d68ad6 100755 --- a/boot.php +++ b/boot.php @@ -50,7 +50,7 @@ require_once('include/attach.php'); require_once('include/bbcode.php'); define ( 'PLATFORM_NAME', 'hubzilla' ); -define ( 'STD_VERSION', '3.3.2' ); +define ( 'STD_VERSION', '3.3.3' ); define ( 'ZOT_REVISION', '6.0a' ); -- cgit v1.2.3 From 33bb89729cdb7d8cc462253fd2b984e2e2bf4471 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 29 Mar 2018 02:26:25 -0700 Subject: hubzilla issue #1019 - punycode urls on connedit page when displaying locations --- Zotlabs/Module/Connedit.php | 6 +++--- include/hubloc.php | 3 ++- include/text.php | 8 +++++--- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Zotlabs/Module/Connedit.php b/Zotlabs/Module/Connedit.php index f359175c1..cb9c19cf0 100644 --- a/Zotlabs/Module/Connedit.php +++ b/Zotlabs/Module/Connedit.php @@ -828,7 +828,7 @@ class Connedit extends \Zotlabs\Web\Controller { $locstr = locations_by_netid($contact['xchan_hash']); if(! $locstr) - $locstr = $contact['xchan_url']; + $locstr = unpunify($contact['xchan_url']); $clone_warn = ''; $clonable = (in_array($contact['xchan_network'],['zot','rss']) ? true : false); @@ -852,8 +852,8 @@ class Connedit extends \Zotlabs\Web\Controller { '$permcat' => [ 'permcat', t('Permission role'), '', '',$permcats ], '$permcat_new' => t('Add permission role'), '$permcat_enable' => feature_enabled(local_channel(),'permcats'), - '$addr' => $contact['xchan_addr'], - '$primeurl' => $contact['xchan_url'], + '$addr' => unpunify($contact['xchan_addr']), + '$primeurl' => unpunify($contact['xchan_url']), '$section' => $section, '$sections' => $sections, '$vcard' => $vcard, diff --git a/include/hubloc.php b/include/hubloc.php index 0d1a2e560..33d5dcbb2 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -270,7 +270,8 @@ function locations_by_netid($netid) { dbesc($netid) ); - return array_elm_to_str($locs,'location',', '); + + return array_elm_to_str($locs,'location',', ','trim_and_unpunify'); } diff --git a/include/text.php b/include/text.php index f9cefd020..f634f0d55 100644 --- a/include/text.php +++ b/include/text.php @@ -2189,13 +2189,13 @@ function ids_to_querystr($arr,$idx = 'id',$quote = false) { * @returns string */ -function array_elm_to_str($arr,$elm,$delim = ',') { +function array_elm_to_str($arr,$elm,$delim = ',',$each = 'trim') { $tmp = []; if($arr && is_array($arr)) { foreach($arr as $x) { if(is_array($x) && array_key_exists($elm,$x)) { - $z = trim($x[$elm]); + $z = $each($x[$elm]); if(($z) && (! in_array($z,$tmp))) { $tmp[] = $z; } @@ -2205,7 +2205,9 @@ function array_elm_to_str($arr,$elm,$delim = ',') { return implode($delim,$tmp); } - +function trim_and_unpunify($s) { + return unpunify(trim($s)); +} /** -- cgit v1.2.3 From 998f39868fd6a4dce11e9f32aabc2744c76785dd Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 29 Mar 2018 14:27:26 -0700 Subject: directory: link entry keywords to a directory keyword search --- Zotlabs/Module/Directory.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Directory.php b/Zotlabs/Module/Directory.php index 62a1670f9..87387ef56 100644 --- a/Zotlabs/Module/Directory.php +++ b/Zotlabs/Module/Directory.php @@ -299,9 +299,9 @@ class Directory extends \Zotlabs\Web\Controller { if(strlen($out)) $out .= ', '; if($marr && in_arrayi($k,$marr)) - $out .= '' . $k . ''; + $out .= '' . $k . ''; else - $out .= $k; + $out .= '' . $k . ''; } } -- cgit v1.2.3 From 238303d81913dd81a1e8907d216ed6c866bd834a Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 29 Mar 2018 15:32:35 -0700 Subject: add directory keyword links to profile --- include/channel.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/include/channel.php b/include/channel.php index c94f5c657..460c818da 100644 --- a/include/channel.php +++ b/include/channel.php @@ -1573,14 +1573,25 @@ function advanced_profile() { $profile['howlong'] = relative_date(App::$profile['howlong'], t('for %1$d %2$s')); } + if(App::$profile['keywords']) { + $keywords = str_replace(',',' ', App::$profile['keywords']); + $keywords = str_replace(' ',' ', $keywords); + $karr = explode(' ', $keywords); + if($karr) { + for($cnt = 0; $cnt < count($karr); $cnt ++) { + $karr[$cnt] = '' . $karr[$cnt] . ''; + } + } + $profile['keywords'] = array( t('Tags:'), implode(' ', $karr)); + } + + if(App::$profile['sexual']) $profile['sexual'] = array( t('Sexual Preference:'), App::$profile['sexual'] ); if(App::$profile['homepage']) $profile['homepage'] = array( t('Homepage:'), linkify(App::$profile['homepage']) ); if(App::$profile['hometown']) $profile['hometown'] = array( t('Hometown:'), linkify(App::$profile['hometown']) ); - if(App::$profile['keywords']) $profile['keywords'] = array( t('Tags:'), App::$profile['keywords']); - if(App::$profile['politic']) $profile['politic'] = array( t('Political Views:'), App::$profile['politic']); if(App::$profile['religion']) $profile['religion'] = array( t('Religion:'), App::$profile['religion']); -- cgit v1.2.3 From 6d0e1b0e07f26ee07d9f53732daab8ade12566d0 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Thu, 29 Mar 2018 17:06:23 -0700 Subject: display and link issues with quoted tags --- Zotlabs/Module/Tagger.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Zotlabs/Module/Tagger.php b/Zotlabs/Module/Tagger.php index 603a95f2b..24adf1bde 100644 --- a/Zotlabs/Module/Tagger.php +++ b/Zotlabs/Module/Tagger.php @@ -80,6 +80,8 @@ class Tagger extends \Zotlabs\Web\Controller { break; } + + $clean_term = trim($term,'"\' '); $links = array(array('rel' => 'alternate','type' => 'text/html', 'href' => z_root() . '/display/' . gen_link_id($item['mid']))); @@ -103,15 +105,15 @@ class Tagger extends \Zotlabs\Web\Controller { ), )); - $tagid = z_root() . '/search?tag=' . $term; + $tagid = z_root() . '/search?tag=' . $clean_term; $objtype = ACTIVITY_OBJ_TAGTERM; $obj = json_encode(array( 'type' => $objtype, 'id' => $tagid, 'link' => array(array('rel' => 'alternate','type' => 'text/html', 'href' => $tagid)), - 'title' => $term, - 'content' => $term + 'title' => $clean_term, + 'content' => $clean_term )); $bodyverb = t('%1$s tagged %2$s\'s %3$s with %4$s'); @@ -119,7 +121,7 @@ class Tagger extends \Zotlabs\Web\Controller { // saving here for reference // also check out x22d5 and x2317 and x0d6b and x0db8 and x24d0 and xff20 !!! - $termlink = html_entity_decode('⋕') . '[zrl=' . z_root() . '/search?tag=' . urlencode($term) . ']'. $term . '[/zrl]'; + $termlink = html_entity_decode('⋕') . '[zrl=' . z_root() . '/search?tag=' . urlencode($clean_term) . ']'. $clean_term . '[/zrl]'; $channel = \App::get_channel(); @@ -143,8 +145,7 @@ class Tagger extends \Zotlabs\Web\Controller { $arr['obj_type'] = $objtype; $arr['obj'] = $obj; $arr['parent_mid'] = $item['mid']; - - store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_COMMUNITYTAG,$term,$tagid); + store_item_tag($item['uid'],$item['id'],TERM_OBJ_POST,TERM_COMMUNITYTAG,$clean_term,$tagid); $ret = post_activity_item($arr); if($ret['success']) { -- cgit v1.2.3 From f54aa4f21e63e2d0be94ee92f681ddec641da441 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 30 Mar 2018 01:59:32 -0700 Subject: allow case independence of replacements as well as patterns --- Zotlabs/Module/Hashtags.php | 2 +- view/js/autocomplete.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Zotlabs/Module/Hashtags.php b/Zotlabs/Module/Hashtags.php index edb631871..300485196 100644 --- a/Zotlabs/Module/Hashtags.php +++ b/Zotlabs/Module/Hashtags.php @@ -18,7 +18,7 @@ class Hashtags extends \Zotlabs\Web\Controller { ); if($r) { foreach($r as $rv) { - $result[] = [ 'text' => strtolower($rv['term']) ]; + $result[] = [ 'text' => $rv['term'] ]; } } diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index f7570523e..7a1a7673d 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -210,7 +210,7 @@ function string2bb(element) { tags = { match: /(^|\s)(\#)([^ \n]{2,})$/, index: 3, - search: function(term, callback) { $.getJSON('/hashtags/' + '$f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.indexOf(term) === 0 ? entry : null; })); }); }, + search: function(term, callback) { $.getJSON('/hashtags/' + '$f=&t=' + term).done(function(data) { callback($.map(data, function(entry) { return entry.text.toLowerCase().indexOf(term.toLowerCase()) === 0 ? entry : null; })); }); }, replace: function(item) { return "$1$2" + item.text + ' '; }, context: function(text) { return text.toLowerCase(); }, template: tag_format -- cgit v1.2.3 From 43249bd4be8495dadaae859bf42f14a90af7b574 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 30 Mar 2018 15:18:33 -0700 Subject: hubzilla issue #1020 - PM using unicode domain for recipient. May require further testing --- Zotlabs/Module/Acl.php | 2 +- Zotlabs/Module/Mail.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index 245b0a9b7..ef901aef1 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -95,7 +95,7 @@ class Acl extends \Zotlabs\Web\Controller { . "' IN xchan_name) else position('" . protect_sprintf(dbesc(punify($search))) . "' IN xchan_addr) end, "; $col = ((strpos($search,'@') !== false) ? 'xchan_addr' : 'xchan_name' ); - $sql_extra3 = "AND $col like " . protect_sprintf( "'%" . dbesc($search) . "%'" ) . " "; + $sql_extra3 = "AND $col like " . protect_sprintf( "'%" . dbesc(($col === 'xchan_addr') ? punify($search) : $search) . "%'" ) . " "; } else { diff --git a/Zotlabs/Module/Mail.php b/Zotlabs/Module/Mail.php index b58b169d0..ca183f644 100644 --- a/Zotlabs/Module/Mail.php +++ b/Zotlabs/Module/Mail.php @@ -67,14 +67,14 @@ class Mail extends \Zotlabs\Web\Controller { if(! $recipient) { $channel = \App::get_channel(); - $j = \Zotlabs\Zot\Finger::run($rstr,$channel); + $j = \Zotlabs\Zot\Finger::run(punify($rstr),$channel); if(! $j['success']) { notice( t('Unable to lookup recipient.') . EOL); return; } - logger('message_post: lookup: ' . $url . ' ' . print_r($j,true)); + logger('message_post: lookup: ' . $rstr . ' ' . print_r($j,true)); if(! $j['guid']) { notice( t('Unable to communicate with requested channel.')); -- cgit v1.2.3 From af125fbe4f72b1f170ef6722d1bf9ca4beb3c7c5 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 30 Mar 2018 16:09:25 -0700 Subject: Hubzilla issue #1022 - provide a way to share wiki pages. Currently this is only implemented in the 'edit' pane and could use some improvement/enhancement --- Zotlabs/Module/Wiki.php | 4 ++++ view/tpl/wiki.tpl | 3 +++ 2 files changed, 7 insertions(+) diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index ae543eb98..a2cc87f13 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -284,6 +284,8 @@ class Wiki extends \Zotlabs\Web\Controller { $wikiheaderPage = urldecode($pageUrlName); $renamePage = (($wikiheaderPage === 'Home') ? '' : t('Rename page')); + $sharePage = t('Share page'); + $p = []; if(! $ignore_language) { @@ -354,6 +356,8 @@ class Wiki extends \Zotlabs\Web\Controller { '$wikiheaderName' => $wikiheaderName, '$wikiheaderPage' => $wikiheaderPage, '$renamePage' => $renamePage, + '$sharePage' => $sharePage, + '$shareLink' => urlencode('#^[zrl=' . z_root() . '/wiki/' . argv(1) . '/' . $wikiUrlName . '/' . $pageUrlName . ']' . $wikiheaderName . ' - ' . $wikiheaderPage . '[/zrl]'), '$showPageControls' => $showPageControls, '$editOrSourceLabel' => (($showPageControls) ? t('Edit') : t('Source')), '$tools_label' => 'Page Tools', diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl index 2be323deb..1a83179a3 100644 --- a/view/tpl/wiki.tpl +++ b/view/tpl/wiki.tpl @@ -11,6 +11,9 @@ {{if $renamePage}}  {{$renamePage}} {{/if}} + {{if $sharePage}} + + {{/if}}  Embed Image -- cgit v1.2.3 From 1c3e6697615b70d2528856b6c8e69962a14763dc Mon Sep 17 00:00:00 2001 From: zotlabs Date: Fri, 30 Mar 2018 16:47:47 -0700 Subject: Hubzilla issue #1022 - improve the usability --- Zotlabs/Module/Wiki.php | 4 ++-- view/tpl/wiki.tpl | 4 +--- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/Zotlabs/Module/Wiki.php b/Zotlabs/Module/Wiki.php index a2cc87f13..696191f70 100644 --- a/Zotlabs/Module/Wiki.php +++ b/Zotlabs/Module/Wiki.php @@ -284,7 +284,7 @@ class Wiki extends \Zotlabs\Web\Controller { $wikiheaderPage = urldecode($pageUrlName); $renamePage = (($wikiheaderPage === 'Home') ? '' : t('Rename page')); - $sharePage = t('Share page'); + $sharePage = t('Share'); $p = []; @@ -357,7 +357,7 @@ class Wiki extends \Zotlabs\Web\Controller { '$wikiheaderPage' => $wikiheaderPage, '$renamePage' => $renamePage, '$sharePage' => $sharePage, - '$shareLink' => urlencode('#^[zrl=' . z_root() . '/wiki/' . argv(1) . '/' . $wikiUrlName . '/' . $pageUrlName . ']' . $wikiheaderName . ' - ' . $wikiheaderPage . '[/zrl]'), + '$shareLink' => urlencode('#^[zrl=' . z_root() . '/wiki/' . argv(1) . '/' . $wikiUrlName . '/' . $pageUrlName . ']' . '[ ' . $owner['channel_name'] . ' ] - ' . $wikiheaderName . ' - ' . $wikiheaderPage . '[/zrl]'), '$showPageControls' => $showPageControls, '$editOrSourceLabel' => (($showPageControls) ? t('Edit') : t('Source')), '$tools_label' => 'Page Tools', diff --git a/view/tpl/wiki.tpl b/view/tpl/wiki.tpl index 1a83179a3..6ca4b0c77 100644 --- a/view/tpl/wiki.tpl +++ b/view/tpl/wiki.tpl @@ -11,13 +11,11 @@ {{if $renamePage}}  {{$renamePage}} {{/if}} - {{if $sharePage}} - - {{/if}}  Embed Image {{/if}} + -- cgit v1.2.3