hubzilla issue #1019 - punycode urls on connedit page when displaying locations

This commit is contained in:
zotlabs 2018-03-29 02:26:25 -07:00
parent cd485b0fdf
commit 33bb89729c
3 changed files with 10 additions and 7 deletions

View File

@ -828,7 +828,7 @@ class Connedit extends \Zotlabs\Web\Controller {
$locstr = locations_by_netid($contact['xchan_hash']); $locstr = locations_by_netid($contact['xchan_hash']);
if(! $locstr) if(! $locstr)
$locstr = $contact['xchan_url']; $locstr = unpunify($contact['xchan_url']);
$clone_warn = ''; $clone_warn = '';
$clonable = (in_array($contact['xchan_network'],['zot','rss']) ? true : false); $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'), '', '<span class="loading invisible">' . t('Loading') . '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span></span>',$permcats ], '$permcat' => [ 'permcat', t('Permission role'), '', '<span class="loading invisible">' . t('Loading') . '<span class="jumping-dots"><span class="dot-1">.</span><span class="dot-2">.</span><span class="dot-3">.</span></span></span>',$permcats ],
'$permcat_new' => t('Add permission role'), '$permcat_new' => t('Add permission role'),
'$permcat_enable' => feature_enabled(local_channel(),'permcats'), '$permcat_enable' => feature_enabled(local_channel(),'permcats'),
'$addr' => $contact['xchan_addr'], '$addr' => unpunify($contact['xchan_addr']),
'$primeurl' => $contact['xchan_url'], '$primeurl' => unpunify($contact['xchan_url']),
'$section' => $section, '$section' => $section,
'$sections' => $sections, '$sections' => $sections,
'$vcard' => $vcard, '$vcard' => $vcard,

View File

@ -270,7 +270,8 @@ function locations_by_netid($netid) {
dbesc($netid) dbesc($netid)
); );
return array_elm_to_str($locs,'location',', ');
return array_elm_to_str($locs,'location',', ','trim_and_unpunify');
} }

View File

@ -2189,13 +2189,13 @@ function ids_to_querystr($arr,$idx = 'id',$quote = false) {
* @returns string * @returns string
*/ */
function array_elm_to_str($arr,$elm,$delim = ',') { function array_elm_to_str($arr,$elm,$delim = ',',$each = 'trim') {
$tmp = []; $tmp = [];
if($arr && is_array($arr)) { if($arr && is_array($arr)) {
foreach($arr as $x) { foreach($arr as $x) {
if(is_array($x) && array_key_exists($elm,$x)) { if(is_array($x) && array_key_exists($elm,$x)) {
$z = trim($x[$elm]); $z = $each($x[$elm]);
if(($z) && (! in_array($z,$tmp))) { if(($z) && (! in_array($z,$tmp))) {
$tmp[] = $z; $tmp[] = $z;
} }
@ -2205,7 +2205,9 @@ function array_elm_to_str($arr,$elm,$delim = ',') {
return implode($delim,$tmp); return implode($delim,$tmp);
} }
function trim_and_unpunify($s) {
return unpunify(trim($s));
}
/** /**