diff options
author | tuscanhobbit <tuscanhobbit@users.noreply.github.com> | 2014-09-22 22:44:10 +0200 |
---|---|---|
committer | tuscanhobbit <tuscanhobbit@users.noreply.github.com> | 2014-09-22 22:44:10 +0200 |
commit | 6a9e8fcd20c0101d448061fdbf51034ab456d2c3 (patch) | |
tree | 08e4a6d051636b90a98a6889a0b677a7d7049982 /mod | |
parent | ed7f3001c1c1deec5076ae12114e5c42865b6251 (diff) | |
parent | 2070dbfdeace4a902208e9dfb50d950647142e99 (diff) | |
download | volse-hubzilla-6a9e8fcd20c0101d448061fdbf51034ab456d2c3.tar.gz volse-hubzilla-6a9e8fcd20c0101d448061fdbf51034ab456d2c3.tar.bz2 volse-hubzilla-6a9e8fcd20c0101d448061fdbf51034ab456d2c3.zip |
Merge from upstream
Diffstat (limited to 'mod')
-rw-r--r-- | mod/admin.php | 13 | ||||
-rw-r--r-- | mod/connedit.php | 22 | ||||
-rw-r--r-- | mod/display.php | 2 | ||||
-rw-r--r-- | mod/home.php | 47 | ||||
-rw-r--r-- | mod/import.php | 42 | ||||
-rw-r--r-- | mod/item.php | 4 | ||||
-rw-r--r-- | mod/new_channel.php | 7 | ||||
-rw-r--r-- | mod/photos.php | 15 | ||||
-rw-r--r-- | mod/post.php | 4 | ||||
-rw-r--r-- | mod/receive.php | 2 | ||||
-rw-r--r-- | mod/settings.php | 23 | ||||
-rw-r--r-- | mod/siteinfo.php | 8 | ||||
-rw-r--r-- | mod/uexport.php | 2 | ||||
-rw-r--r-- | mod/webpages.php | 2 | ||||
-rw-r--r-- | mod/xchan.php | 20 | ||||
-rw-r--r-- | mod/zfinger.php | 23 |
16 files changed, 155 insertions, 81 deletions
diff --git a/mod/admin.php b/mod/admin.php index 5bb97d158..06f44c89b 100644 --- a/mod/admin.php +++ b/mod/admin.php @@ -239,7 +239,7 @@ function admin_page_site_post(&$a){ $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : ''); $theme_mobile = ((x($_POST,'theme_mobile')) ? notags(trim($_POST['theme_mobile'])) : ''); $theme_accessibility = ((x($_POST,'theme_accessibility')) ? notags(trim($_POST['theme_accessibility'])) : ''); - $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : ''); +// $site_channel = ((x($_POST,'site_channel')) ? notags(trim($_POST['site_channel'])) : ''); $maximagesize = ((x($_POST,'maximagesize')) ? intval(trim($_POST['maximagesize'])) : 0); @@ -304,7 +304,7 @@ function admin_page_site_post(&$a){ set_config('system','accessibility_theme', $theme_accessibility); } - set_config('system','site_channel', $site_channel); +// set_config('system','site_channel', $site_channel); set_config('system','maximagesize', $maximagesize); set_config('system','register_policy', $register_policy); @@ -426,7 +426,7 @@ function admin_page_site(&$a) { '$theme' => array('theme', t("System theme"), get_config('system','theme'), t("Default system theme - may be over-ridden by user profiles - <a href='#' id='cnftheme'>change theme settings</a>"), $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_accessibility' => array('theme_accessibility', t("Accessibility system theme"), get_config('system','accessibility_theme'), t("Accessibility theme"), $theme_choices_accessibility), - '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")), +// '$site_channel' => array('site_channel', t("Channel to use for this website's static pages"), get_config('system','site_channel'), t("Site Channel")), '$diaspora_enabled' => array('diaspora_enabled',t('Enable Diaspora Protocol'), get_config('system','diaspora_enabled'), t('Communicate with Diaspora and Friendica - experimental')), '$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.")), @@ -687,7 +687,9 @@ function admin_page_users(&$a){ $order = " order by account_email asc "; if($_REQUEST['order'] === 'expires') $order = " order by account_expires desc "; - + if($_REQUEST['order'] === 'created') + $order = " order by account_created desc "; + $users =q("SELECT `account_id` , `account_email`, `account_lastlog`, `account_created`, `account_expires`, " . "`account_service_class`, ( account_flags & %d ) > 0 as `blocked`, " . "(SELECT GROUP_CONCAT( ch.channel_address SEPARATOR ' ') FROM channel as ch " . "WHERE ch.channel_account_id = ac.account_id and not (ch.channel_pageflags & %d )) as `channels` " . @@ -768,7 +770,7 @@ function admin_page_channels_post(&$a){ ); proc_run('php','include/directory.php',$uid,'nopush'); } - notice( sprintf( tt("%s channel censored/uncensored", "%s channelss censored/uncensored", count($channels)), count($channels)) ); + notice( sprintf( tt("%s channel censored/uncensored", "%s channels censored/uncensored", count($channels)), count($channels)) ); } if (x($_POST,'page_channels_delete')){ require_once("include/Contact.php"); @@ -814,6 +816,7 @@ function admin_page_channels(&$a){ intval(PAGE_CENSORED), intval( $uid ) ); + proc_run('php','include/directory.php',$uid,'nopush'); notice( sprintf( (($channel[0]['channel_pageflags'] & PAGE_CENSORED) ? t("Channel '%s' uncensored"): t("Channel '%s' censored")) , $channel[0]['channel_name'] . ' (' . $channel[0]['channel_address'] . ')' ) . EOL); }; break; diff --git a/mod/connedit.php b/mod/connedit.php index b2de42343..7ad719738 100644 --- a/mod/connedit.php +++ b/mod/connedit.php @@ -255,6 +255,28 @@ function connedit_content(&$a) { return login(); } + $my_perms = 0; + $role = get_pconfig(local_user(),'system','permissions_role'); + if($role) { + $x = get_role_perms($role); + if($x['perms_accept']) + $my_perms = $x['perms_accept']; + } + if($my_perms) { + $o .= "<script>function connectDefaultShare() { + \$('.abook-edit-me').each(function() { + if(! $(this).is(':disabled')) + $(this).removeAttr('checked'); + });\n\n"; + $perms = get_perms(); + foreach($perms as $p => $v) { + if($my_perms & $v[1]) { + $o .= "\$('#me_id_perms_" . $p . "').attr('checked','checked'); \n"; + } + } + $o .= "abook_perms_msg(); }\n</script>\n"; + } + if(argc() == 3) { $contact_id = intval(argv(1)); diff --git a/mod/display.php b/mod/display.php index c389eb976..be06c1e82 100644 --- a/mod/display.php +++ b/mod/display.php @@ -85,6 +85,8 @@ function display_content(&$a, $update = 0, $load = false) { $target_item = $r[0]; } + $r = null; + if($target_item['item_restrict'] & ITEM_WEBPAGE) { $x = q("select * from channel where channel_id = %d limit 1", intval($target_item['uid']) diff --git a/mod/home.php b/mod/home.php index bc352976d..576213e06 100644 --- a/mod/home.php +++ b/mod/home.php @@ -39,10 +39,29 @@ function home_content(&$a) { if(x($_SESSION,'mobile_theme')) unset($_SESSION['mobile_theme']); - $channel_address = get_config("system", "site_channel" ); - if ($channel_address){ - // We can do better, but until we figure out auto-linkification, let's keep things simple + if(get_config('system','projecthome')) { + $o .= file_get_contents('assets/home.html'); + $a->page['template'] = 'full'; + $a->page['title'] = t('Red Matrix - "The Network"'); + return $o; + } + + +// Deprecated + $channel_address = get_config("system", "site_channel" ); + +// See if the sys channel set a homepage + if (! $channel_address) { + $u = get_sys_channel(); + if ($u) { + $u = array($u); + // change to channel_id when below deprecated and skip the $u=... + $channel_address = $u[0]['channel_address']; + } + } + + if ($channel_address){ $page_id = 'home'; @@ -50,11 +69,6 @@ function home_content(&$a) { dbesc($channel_address) ); - if(! $u) { - notice( t('Channel not found.') . EOL); - return; - } - $r = q("select item.* from item left join item_id on item.id = item_id.iid where item.uid = %d and sid = '%s' and service = 'WEBPAGE' and item_restrict = %d limit 1", @@ -63,31 +77,24 @@ function home_content(&$a) { intval(ITEM_WEBPAGE) ); - if(! $r) { - notice( t('Item not found.') . EOL); - return; - } - + if($r) { xchan_query($r); $r = fetch_post_tags($r,true); $a->profile = array('profile_uid' => $u[0]['channel_id']); $o .= prepare_page($r[0]); return $o; - } + } - if(get_config('system','projecthome')) { - $o .= file_get_contents('assets/home.html'); - $a->page['template'] = 'full'; - $a->page['title'] = t('Red Matrix - "The Network"'); - return $o; } +// Nope, we didn't find an item. Let's see if there's any html + if(file_exists('home.html')) { $o .= file_get_contents('home.html'); } else { - // If there's no site channel or home contents configured, fallback to the old behaviour + // If there's nothing special happening, just spit out a login box $sitename = get_config('system','sitename'); if($sitename) diff --git a/mod/import.php b/mod/import.php index 7452bcdc9..2fbb71fc4 100644 --- a/mod/import.php +++ b/mod/import.php @@ -9,10 +9,25 @@ require_once('include/identity.php'); function import_post(&$a) { - if(! get_account_id()) { + $account_id = get_account_id(); + if(! $account_id) return; + + $max_identities = account_service_class_fetch($account_id,'total_identities'); + $max_friends = account_service_class_fetch($account_id,'total_channels'); + $max_feeds = account_service_class_fetch($account_id,'total_feeds'); + + if($max_identities !== false) { + $r = q("select channel_id from channel where channel_account_id = %d", + intval($account_id) + ); + if($r && count($r) > $max_identities) { + notice( sprintf( t('Your service plan only allows %d channels.'), $max_identities) . EOL); + return; + } } + $data = null; $seize = ((x($_REQUEST,'make_primary')) ? intval($_REQUEST['make_primary']) : 0); @@ -276,10 +291,18 @@ function import_post(&$a) { // FIXME - ensure we have an xchan if somebody is trying to pull a fast one + $friends = 0; + $feeds = 0; + // import contacts $abooks = $data['abook']; if($abooks) { foreach($abooks as $abook) { + if($max_friends !== false && $friends > $max_friends) + continue; + if($max_feeds !== false && ($abook['abook_flags'] & ABOOK_FLAG_FEED) && $feeds > $max_feeds) + continue; + unset($abook['abook_id']); $abook['abook_account'] = get_account_id(); $abook['abook_channel'] = $channel['channel_id']; @@ -289,6 +312,10 @@ function import_post(&$a) { . "`) VALUES ('" . implode("', '", array_values($abook)) . "')" ); + + $friends ++; + if($abook['abook_flags'] & ABOOK_FLAG_FEED) + $feeds ++; } } @@ -349,18 +376,20 @@ function import_post(&$a) { } } +//FIXME just a note here for when folks want to import content - be very careful to unset ITEM_ORIGIN on all imported content. Or you could end up with a nasty routing loop when somebody tries to reply to one of those posts. + + // FIXME - ensure we have a self entry if somebody is trying to pull a fast one - if($seize) { - // notify old server that it is no longer primary. - - } + // send out refresh requests + // notify old server that it may no longer be primary. + + proc_run('php','include/notifier.php','location',$channel['channel_id']); // This will indirectly perform a refresh_all *and* update the directory proc_run('php', 'include/directory.php', $channel['channel_id']); - // send out refresh requests notice( t('Import completed.') . EOL); @@ -368,7 +397,6 @@ function import_post(&$a) { goaway(z_root() . '/network' ); - } diff --git a/mod/item.php b/mod/item.php index 23d39a62c..7f25b35b8 100644 --- a/mod/item.php +++ b/mod/item.php @@ -854,7 +854,9 @@ function item_post(&$a) { if($parent) { // Store the comment signature information in case we need to relay to Diaspora //FIXME - store_diaspora_comment_sig($datarray,$channel,$parent_item, $post_id); + $ditem = $datarray; + $ditem['author'] = $observer; + store_diaspora_comment_sig($ditem,$channel,$parent_item, $post_id); } update_remote_id($channel,$post_id,$webpage,$pagetitle,$namespace,$remote_id,$mid); diff --git a/mod/new_channel.php b/mod/new_channel.php index eafef2c08..8329f0ec3 100644 --- a/mod/new_channel.php +++ b/mod/new_channel.php @@ -1,6 +1,8 @@ <?php require_once('include/identity.php'); +require_once('include/permissions.php'); + function new_channel_init(&$a) { @@ -100,7 +102,7 @@ function new_channel_content(&$a) { $name = ((x($_REQUEST,'name')) ? $_REQUEST['name'] : "" ); $nickname = ((x($_REQUEST,'nickname')) ? $_REQUEST['nickname'] : "" ); - + $privacy_role = ((x($_REQUEST,'permissions_role')) ? $_REQUEST['permissions_role'] : "" ); $o = replace_macros(get_markup_template('new_channel.tpl'), array( @@ -113,6 +115,9 @@ function new_channel_content(&$a) { '$nick_desc' => t('Your nickname will be used to create an easily remembered channel address (like an email address) which you can share with others.'), '$label_import' => t('Or <a href="import">import an existing channel</a> from another location'), '$name' => $name, + '$label_role' => t('Channel Type'), + '$help_role' => t('Please choose a channel type (such as social networking or community forum) and privacy requirements so we can select the best permissions for you'), + '$role_select' => role_selector(($privacy_role) ? $privacy_role : 'social'), '$nickname' => $nickname, '$submit' => t('Create') )); diff --git a/mod/photos.php b/mod/photos.php index f2df894c0..44a7ce0f0 100644 --- a/mod/photos.php +++ b/mod/photos.php @@ -703,7 +703,7 @@ function photos_content(&$a) { if(count($r)) { $twist = 'rotright'; $o .= "<script> var page_query = '" . $_GET['q'] . "'; var extra_args = '" . extra_query_args() . "' ; </script>"; - $o .= '<div id="photo-album-contents-' . $a->pager['page'] . '">'; + $o .= '<div id="photo-album-contents">'; foreach($r as $rr) { @@ -758,20 +758,15 @@ function photos_content(&$a) { echo $ajaxout; killme(); } - - echo '<div id="photo-album-contents-' . $a->pager['page'] . '">'; echo $ajaxout; - echo '</div>'; - echo '<script>justifyPhotos(' . $a->pager['page'] . ');</script>'; + echo '<script>justifyPhotosAjax();</script>'; killme(); } - - $o .= '</div>'; // photo-album-contents - $o .= '<script>justifyPhotos(' . $a->pager['page'] . ');</script>'; $o .= '<div id="page-end"></div>'; + $o .= '</div>'; // photo-album-contents $o .= '<div id="photo-album-end"></div>'; - $o .= '<script>$(document).ready(function() { loadingPage = false;});</script>'; + $o .= '<script>$(document).ready(function() { loadingPage = false; justifyPhotos(); });</script>'; $o .= '<div id="page-spinner"></div>'; // $o .= paginate($a); @@ -1226,7 +1221,6 @@ function photos_content(&$a) { if($photos) { $o = replace_macros(get_markup_template('photosajax.tpl'),array( '$photos' => $photos, - '$page' => $a->pager['page'] )); } else { @@ -1243,7 +1237,6 @@ function photos_content(&$a) { '$can_post' => $can_post, '$upload' => array(t('Upload New Photos'), $a->get_baseurl().'/photos/'.$a->data['channel']['channel_address'].'/upload'), '$photos' => $photos, - '$page' => $a->pager['page'] )); } diff --git a/mod/post.php b/mod/post.php index 3b4f66baf..d62233ca1 100644 --- a/mod/post.php +++ b/mod/post.php @@ -415,8 +415,8 @@ function post_init(&$a) { * } *} * - * Currently defined message types are 'activity', 'mail', 'profile' and 'channel_sync', which each have - * different content schemas. + * Currently defined message types are 'activity', 'mail', 'profile', 'location' and 'channel_sync', + * which each have different content schemas. * * Ping packet: * A ping packet does not require any parameters except the type. It may or may not be encrypted. diff --git a/mod/receive.php b/mod/receive.php index 2a68019e0..4071b169b 100644 --- a/mod/receive.php +++ b/mod/receive.php @@ -58,7 +58,7 @@ function receive_post(&$a) { logger('mod-diaspora: decoded', LOGGER_DEBUG); - logger('mod-diaspora: decoded msg: ' . print_r($msg,true), LOGGER_DEBUG); + logger('mod-diaspora: decoded msg: ' . print_r($msg,true), LOGGER_DATA); if(! is_array($msg)) http_status_exit(500); diff --git a/mod/settings.php b/mod/settings.php index 5038a63c4..876216871 100644 --- a/mod/settings.php +++ b/mod/settings.php @@ -136,7 +136,8 @@ function settings_post(&$a) { $theme = ((x($_POST,'theme')) ? notags(trim($_POST['theme'])) : $a->channel['channel_theme']); $mobile_theme = ((x($_POST,'mobile_theme')) ? notags(trim($_POST['mobile_theme'])) : ''); $user_scalable = ((x($_POST,'user_scalable')) ? intval($_POST['user_scalable']) : 0); - $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); + $nosmile = ((x($_POST,'nosmile')) ? intval($_POST['nosmile']) : 0); + $title_tosource = ((x($_POST,'title_tosource')) ? intval($_POST['title_tosource']) : 0); $browser_update = ((x($_POST,'browser_update')) ? intval($_POST['browser_update']) : 0); $browser_update = $browser_update * 1000; if($browser_update < 10000) @@ -156,6 +157,7 @@ function settings_post(&$a) { set_pconfig(local_user(),'system','update_interval', $browser_update); set_pconfig(local_user(),'system','itemspage', $itemspage); set_pconfig(local_user(),'system','no_smilies',$nosmile); + set_pconfig(local_user(),'system','title_tosource',$title_tosource); // set_pconfig(local_user(),'system','chanview_full',$chanview_full); @@ -589,10 +591,9 @@ function settings_content(&$a) { if((argc() > 1) && (argv(1) === 'featured')) { $settings_addons = ""; - $r = q("SELECT * FROM `hook` WHERE `hook` = 'plugin_settings' "); - // FIXME: This is always 0, even if there are plugin settings on this page - // if(! count($r)) - // $settings_addons = t('No feature settings configured'); + $r = q("SELECT * FROM `hook` WHERE `hook` = 'feature_settings' "); + if(! count($r)) + $settings_addons = t('No feature settings configured'); call_hooks('feature_settings', $settings_addons); @@ -735,7 +736,7 @@ function settings_content(&$a) { $user_scalable = (($user_scalable===false)? '1': $user_scalable); // default if not set: 1 $browser_update = intval(get_pconfig(local_user(), 'system','update_interval')); - $browser_update = (($browser_update == 0) ? 40 : $browser_update / 1000); // default if not set: 40 seconds + $browser_update = (($browser_update == 0) ? 80 : $browser_update / 1000); // default if not set: 40 seconds $itemspage = intval(get_pconfig(local_user(), 'system','itemspage')); $itemspage = (($itemspage > 0 && $itemspage < 101) ? $itemspage : 20); // default if not set: 20 items @@ -743,6 +744,9 @@ function settings_content(&$a) { $nosmile = get_pconfig(local_user(),'system','no_smilies'); $nosmile = (($nosmile===false)? '0': $nosmile); // default if not set: 0 + $title_tosource = get_pconfig(local_user(),'system','title_tosource'); + $title_tosource = (($title_tosource===false)? '0': $title_tosource); // default if not set: 0 + $theme_config = ""; if( ($themeconfigfile = get_theme_config_file($theme_selected)) != null){ require_once($themeconfigfile); @@ -763,6 +767,7 @@ function settings_content(&$a) { '$ajaxint' => array('browser_update', t("Update browser every xx seconds"), $browser_update, t('Minimum of 10 seconds, no maximum')), '$itemspage' => array('itemspage', t("Maximum number of conversations to load at any time:"), $itemspage, t('Maximum of 100 items')), '$nosmile' => array('nosmile', t("Don't show emoticons"), $nosmile, ''), + '$title_tosource' => array('title_tosource', t("Link post titles to source"), $title_tosource, ''), '$layout_editor' => t('System Page Layout Editor - (advanced)'), '$theme_config' => $theme_config, '$expert' => feature_enabled(local_user(),'expert'), @@ -930,6 +935,10 @@ function settings_content(&$a) { } } + + $permissions_role = get_pconfig(local_user(),'system','permissions_role'); + $permissions_set = (($permissions_role && $permissions_role != 'custom') ? true : false); + $o .= replace_macros($stpl,array( '$ptitle' => t('Channel Settings'), @@ -950,6 +959,8 @@ function settings_content(&$a) { '$adult' => array('adult', t('Adult Content'), $adult_flag, t('This channel frequently or regularly publishes adult content. (Please tag any adult material and/or nudity with #NSFW)')), '$h_prv' => t('Security and Privacy Settings'), + '$permissions_set' => $permissions_set, + '$perms_set_msg' => t('Your permissions are already configured. Click to view/adjust'), '$hide_presence' => array('hide_presence', t('Hide my online presence'),$hide_presence, t('Prevents displaying in your profile that you are online')), diff --git a/mod/siteinfo.php b/mod/siteinfo.php index 061989413..01355a51d 100644 --- a/mod/siteinfo.php +++ b/mod/siteinfo.php @@ -13,7 +13,13 @@ function siteinfo_init(&$a) { if($r) { $admin = array(); foreach($r as $rr) { - $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']); + if($rr['channel_pageflags'] & PAGE_HUBADMIN) + $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']); + } + if(! $admin) { + foreach($r as $rr) { + $admin[] = array( 'name' => $rr['channel_name'], 'address' => $rr['channel_address'] . '@' . get_app()->get_hostname(), 'channel' => z_root() . '/channel/' . $rr['channel_address']); + } } } else { diff --git a/mod/uexport.php b/mod/uexport.php index f3a2ce67c..6304115c8 100644 --- a/mod/uexport.php +++ b/mod/uexport.php @@ -18,7 +18,7 @@ function uexport_init(&$a) { } if(argc() > 1 && argv(1) === 'complete') { - echo json_encode('not yet implemented'); + echo json_encode(identity_basic_export(local_user(),true)); killme(); } diff --git a/mod/webpages.php b/mod/webpages.php index 1b906a97f..efaf3c4bf 100644 --- a/mod/webpages.php +++ b/mod/webpages.php @@ -46,7 +46,7 @@ function webpages_content(&$a) { // } - if(feature_enabled($owner,'expert_mode')) { + if(feature_enabled($owner,'expert')) { $mimetype = (($_REQUEST['mimetype']) ? $_REQUEST['mimetype'] : get_pconfig($owner,'system','page_mimetype')); if(! $mimetype) $mimetype = 'choose'; diff --git a/mod/xchan.php b/mod/xchan.php index 9d4cdcc22..714603f6e 100644 --- a/mod/xchan.php +++ b/mod/xchan.php @@ -7,7 +7,7 @@ function xchan_content(&$a) { $o .= '<h3>Xchan Lookup</h3>'; $o .= '<form action="xchan" method="get">'; - $o .= 'Lookup xchan beginning with: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />'; + $o .= 'Lookup xchan beginning with (or webbie): <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" />'; $o .= '<input type="submit" name="submit" value="Submit" /></form>'; $o .= '<br /><br />'; @@ -15,16 +15,28 @@ function xchan_content(&$a) { if(x($_GET,'addr')) { $addr = trim($_GET['addr']); - $r = q("select xchan_name from xchan where xchan_hash like '%s%%'", + $r = q("select * from xchan where xchan_hash like '%s%%' or xchan_addr = '%s' group by xchan_hash", + dbesc($addr), dbesc($addr) ); if($r) { - foreach($r as $rr) - $o .= $rr['xchan_name'] . EOL; + foreach($r as $rr) { + $o .= str_replace(array("\n"," "),array("<br/>"," "),print_r($rr,true)) . EOL; + + $s = q("select * from hubloc where hubloc_hash like '%s'", + dbesc($r[0]['xchan_hash']) + ); + + if($s) { + foreach($s as $rr) + $o .= str_replace(array("\n"," "),array("<br/>"," "),print_r($rr,true)) . EOL; + } + } } else notice( t('Not found.') . EOL); + } return $o; } diff --git a/mod/zfinger.php b/mod/zfinger.php index 1226f74fe..666f141ec 100644 --- a/mod/zfinger.php +++ b/mod/zfinger.php @@ -208,28 +208,11 @@ function zfinger_init(&$a) { if($permissions['view_profile']) $ret['profile'] = $profile; - // array of (verified) hubs this channel uses - $ret['locations'] = array(); - - $x = zot_get_hublocs($e['channel_hash']); - if($x && count($x)) { - foreach($x as $hub) { - if(! ($hub['hubloc_flags'] & HUBLOC_FLAGS_UNVERIFIED)) { - $ret['locations'][] = array( - 'host' => $hub['hubloc_host'], - 'address' => $hub['hubloc_addr'], - 'primary' => (($hub['hubloc_flags'] & HUBLOC_FLAGS_PRIMARY) ? true : false), - 'url' => $hub['hubloc_url'], - 'url_sig' => $hub['hubloc_url_sig'], - 'callback' => $hub['hubloc_callback'], - 'sitekey' => $hub['hubloc_sitekey'], - 'deleted' => (($hub['hubloc_flags'] & HUBLOC_FLAGS_DELETED) ? true : false) - ); - } - } - } + $x = zot_encode_locations($e); + if($x) + $ret['locations'] = $x; $ret['site'] = array(); $ret['site']['url'] = z_root(); |