From 0dc33900b6799681683fd02f597e95acbd58e960 Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 14 Sep 2014 22:19:19 -0700 Subject: provide a way to sync locations and get rid of bogus hublocs, now implemented --- include/diaspora.php | 6 ++++++ include/hubloc.php | 41 +++++++++++++++++++++++++++++------------ include/notifier.php | 27 +++++++++++++++++++++++++++ include/poller.php | 3 +++ include/zot.php | 10 ++++++++-- 5 files changed, 73 insertions(+), 14 deletions(-) diff --git a/include/diaspora.php b/include/diaspora.php index 33404da74..ea3c78bfe 100755 --- a/include/diaspora.php +++ b/include/diaspora.php @@ -142,6 +142,7 @@ function diaspora_process_outbound($arr) { 'cmd' => $cmd, 'expire' => $expire, 'mail' => $mail, + 'location' => $location, 'fsuggest' => $fsuggest, 'normal_mode' => $normal_mode, 'packet_type' => $packet_type, @@ -150,6 +151,10 @@ function diaspora_process_outbound($arr) { */ + if($arr['location']) + return; + + $target_item = $arr['target_item']; if($target_item && array_key_exists('item_flags',$target_item) && ($target_item['item_flags'] & ITEM_OBSCURED)) { @@ -161,6 +166,7 @@ function diaspora_process_outbound($arr) { } + if($arr['env_recips']) { $hashes = array(); diff --git a/include/hubloc.php b/include/hubloc.php index d51e38eae..cdc9de4af 100644 --- a/include/hubloc.php +++ b/include/hubloc.php @@ -46,6 +46,8 @@ function prune_hub_reinstalls() { function remove_obsolete_hublocs() { + logger('remove_obsolete_hublocs',LOGGER_DEBUG); + // Get rid of any hublocs which are ours but aren't valid anymore - // e.g. they point to a different and perhaps transient URL that we aren't using. @@ -66,7 +68,9 @@ function remove_obsolete_hublocs() { if((! $r) || (! count($r))) return; - // Good. We have at least one valid hubloc. + $channels = array(); + + // Good. We have at least one *valid* hubloc. // Do we have any invalid ones? @@ -74,25 +78,38 @@ function remove_obsolete_hublocs() { dbesc(get_config('system','pubkey')), dbesc(z_root()) ); + $p = q("select hubloc_id from hubloc where hubloc_sitekey != '%s' and hubloc_url = '%s'", + dbesc(get_config('system','pubkey')), + dbesc(z_root()) + ); + if(is_array($r) && is_array($p)) + $r = array_merge($r,$p); + if(! $r) return; - logger('remove_obsolete_hublocs: removing ' . count($r) . ' hublocs.'); - // We've got invalid hublocs. Get rid of them. - $r = q("delete from hubloc where hubloc_sitekey = '%s' and hubloc_url != '%s'", - dbesc(get_config('system','pubkey')), - dbesc(z_root()) - ); + logger('remove_obsolete_hublocs: removing ' . count($r) . ' hublocs.'); - // We should probably tell everybody... But we don't have an easy way to do this - // for the entire site. We'd have to do a channel at a time. - // They will find out anyway - it just might take a little while. + $interval = ((get_config('system','delivery_interval') !== false) + ? intval(get_config('system','delivery_interval')) : 2 ); - // FIXME we probably also need to check that the sys channel has a valid hubloc - // and re-create it if it doesn't. + foreach($r as $rr) { + q("update hubloc set hubloc_flags = (hubloc_flags | %d) where hubloc_id = %d limit 1", + intval(HUBLOC_FLAGS_DELETED), + intval($rr['hubloc_id']) + ); + $x = q("select channel_id from channel where channel_hash = '%s' limit 1", + dbesc($rr['hubloc_hash']) + ); + if($x) { +// proc_run('php','include/notifier.php','location',$x[0]['channel_id']); +// if($interval) +// @time_sleep_until(microtime(true) + (float) $interval); + } + } } diff --git a/include/notifier.php b/include/notifier.php index 0b5744b29..ae781bcf8 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -57,6 +57,7 @@ require_once('include/html2plain.php'); * purge_all channel_id * expire channel_id * relay item_id (item was relayed to owner, we will deliver it as owner) + * location channel_id * */ @@ -144,6 +145,7 @@ function notifier_run($argv, $argc){ $mail = false; $fsuggest = false; $top_level = false; + $location = false; $recipients = array(); $url_recipients = array(); $normal_mode = true; @@ -230,6 +232,30 @@ function notifier_run($argv, $argc){ $private = false; $packet_type = 'refresh'; } + elseif($cmd === 'location') { + logger('notifier: location: ' . $item_id); + $s = q("select * from channel where channel_id = %d limit 1", + intval($item_id) + ); + if($s) + $channel = $s[0]; + $uid = $item_id; + $recipients = array(); + $r = q("select abook_xchan from abook where abook_channel = %d", + intval($item_id) + ); + if($r) { + foreach($r as $rr) { + $recipients[] = $rr['abook_xchan']; + } + } + + $encoded_item = array('locations' => zot_encode_locations($channel),'type' => 'location', 'encoding' => 'zot'); + $target_item = array('aid' => $channel['channel_account_id'],'uid' => $channel['channel_id']); + $private = false; + $packet_type = 'location'; + $location = true; + } elseif($cmd === 'purge_all') { logger('notifier: purge_all: ' . $item_id); $s = q("select * from channel where channel_id = %d limit 1", @@ -516,6 +542,7 @@ function notifier_run($argv, $argc){ 'cmd' => $cmd, 'expire' => $expire, 'mail' => $mail, + 'location' => $location, 'fsuggest' => $fsuggest, 'normal_mode' => $normal_mode, 'packet_type' => $packet_type, diff --git a/include/poller.php b/include/poller.php index c90e48d6b..f689059b9 100644 --- a/include/poller.php +++ b/include/poller.php @@ -171,6 +171,9 @@ function poller_run($argv, $argc){ proc_run('php','include/expire.php'); proc_run('php','include/cli_suggest.php'); + require_once('include/hubloc.php'); + remove_obsolete_hublocs(); + /** * End Cron Daily */ diff --git a/include/zot.php b/include/zot.php index c204375e1..f6732037a 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1121,6 +1121,11 @@ function zot_import($arr, $sender_url) { $deliveries = allowed_public_recips($i); + if($i['message'] && array_key_exists('type',$i['message']) && $i['message']['type'] === 'location') { + $sys = get_sys_channel(); + $deliveries = array(array('hash' => $sys['xchan_hash'])); + } + // if the scope is anything but 'public' we're going to store it as private regardless // of the private flag on the post. @@ -1206,7 +1211,7 @@ function zot_import($arr, $sender_url) { $arr = $i['message']; logger('Location message received: ' . print_r($arr,true), LOGGER_DATA); - logger('Location messaeg recipients: ' . print_r($deliveries,true), LOGGER_DATA); + logger('Location message recipients: ' . print_r($deliveries,true), LOGGER_DATA); $result = process_location_delivery($i['notify']['sender'],$arr,$deliveries); } @@ -1665,7 +1670,8 @@ function process_location_delivery($sender,$arr,$deliveries) { if($r) $sender['key'] = $r[0]['xchan_pubkey']; - sync_locations($sender,$arr,true); + $x = sync_locations($sender,$arr,true); + logger('process_location_delivery: results: ' . print_r($x,true), LOGGER_DATA); } // We need to merge this code with that in the import_xchan function so as to make it -- cgit v1.2.3 From ea8a01791e521a9ae4ea211e1b2e152b27a0486c Mon Sep 17 00:00:00 2001 From: friendica Date: Sun, 14 Sep 2014 22:43:56 -0700 Subject: allow the site to designate an admin channel that's visible to the outside world (via siteinfo/json). Otherwise we'll use the default channel of any accounts that have the account admin role. --- boot.php | 3 ++- mod/siteinfo.php | 8 +++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/boot.php b/boot.php index b8457467e..339a1f052 100755 --- a/boot.php +++ b/boot.php @@ -216,8 +216,9 @@ define ( 'PAGE_DIRECTORY_CHANNEL', 0x0008 ); // system channel used for director define ( 'PAGE_PREMIUM', 0x0010 ); define ( 'PAGE_ADULT', 0x0020 ); define ( 'PAGE_CENSORED', 0x0040 ); // Site admin has blocked this channel from appearing in casual search results and site feeds - define ( 'PAGE_SYSTEM', 0x1000 ); +define ( 'PAGE_HUBADMIN', 0x2000 ); // set this to indicate a preferred admin channel rather than the + // default channel of any accounts with the admin role. define ( 'PAGE_REMOVED', 0x8000 ); 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 { -- cgit v1.2.3 From 58aad83e5cb0edaf1ccc543147030e782c5e7ba9 Mon Sep 17 00:00:00 2001 From: marijus Date: Mon, 15 Sep 2014 09:56:30 +0200 Subject: this is probably better in most cases --- view/js/main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/view/js/main.js b/view/js/main.js index d0fcf0077..d6b405258 100644 --- a/view/js/main.js +++ b/view/js/main.js @@ -713,7 +713,7 @@ function updateConvItems(mode,data) { 'lt100': '-2', 'lt240': '-2', 'lt320': '-2', - 'lt500': '-0', + 'lt500': '-1', 'lt640': '-1', 'lt1024': '-0' } -- cgit v1.2.3 From 5ab85b076bcab9f64903b74facce9466259fed15 Mon Sep 17 00:00:00 2001 From: marijus Date: Mon, 15 Sep 2014 10:39:38 +0200 Subject: heading font-size should not be tied to font-size for posts and comments --- view/theme/redbasic/css/style.css | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index bb11ddbb9..7c203d475 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -2260,11 +2260,11 @@ h1, h2 { } h3, h4 { - font-size: $font_size; + font-size: 1rem; } h5, h6 { - font-size: $body_font_size; + font-size: 0.75rem; } .dropdown-menu { -- cgit v1.2.3 From eaf3bd3326a657662321df791280b41293f54ef2 Mon Sep 17 00:00:00 2001 From: Jeroen Date: Mon, 15 Sep 2014 15:35:40 +0000 Subject: See comments on commit 5ab85b0. Also fixed some bb typo's in docu index. --- doc/main.bb | 4 ++-- view/theme/redbasic/css/style.css | 24 ++++++++++++++++++------ 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/doc/main.bb b/doc/main.bb index e0cca3d31..9baeeebda 100644 --- a/doc/main.bb +++ b/doc/main.bb @@ -49,8 +49,8 @@ Zot is the great new communicaton protocol invented especially for the Red Matri [zrl=[baseurl]/help/faq_admins]FAQ For Admins[/zrl] [size=large][b]Technical Documentation[/b][/size] -[zrl=[baseurl]/help/Zot---A-High-Level-Overview.md[/zrl]A high level overview of Zot[/zrl] -[zrl=[baseurl]/help/zot]An introduction to Zot/zrl] +[zrl=[baseurl]/help/Zot---A-High-Level-Overview]A high level overview of Zot[/zrl] +[zrl=[baseurl]/help/zot]An introduction to Zot[/zrl] [zrl=[baseurl]/help/zot_structures]Zot Stuctures[/zrl] [zrl=[baseurl]/help/comanche]Comanche Page Descriptions[/zrl] [zrl=[baseurl]/help/Creating-Templates]Creating Comanche Templates[/zrl] diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 7c203d475..380d6d49c 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -2060,11 +2060,11 @@ img.mail-list-sender-photo { .wall-item-ago { color: #777; - font-size: 0.8em; + font-size: 0.833em; } .wall-item-ago i { - font-size: 0.8em; + font-size: 0.833em; } .wall-item-content { @@ -2082,7 +2082,7 @@ img.mail-list-sender-photo { } .comment-icon { - font-size: 0.8em; + font-size: 0.833em; color: $toolicon_colour; } @@ -2256,15 +2256,27 @@ blockquote { } h1, h2 { - font-size: 1.15rem; + font-size: 1.583em; } h3, h4 { - font-size: 1rem; + font-size: 1.334em; } h5, h6 { - font-size: 0.75rem; + font-size: 0.75rem; +} + +.wall-item-content h1, .wall-item-content h2 { + font-size: 1.319em; +} + +.wall-item-title { + font-size: $font_size; +} + +.wall-item-title h3, .wall-item-content h3, .wall-item-content h4 { + font-size: 1.112em; } .dropdown-menu { -- cgit v1.2.3