diff --git a/Zotlabs/Module/Cdav.php b/Zotlabs/Module/Cdav.php index 91d279f7a..6737ac4ee 100644 --- a/Zotlabs/Module/Cdav.php +++ b/Zotlabs/Module/Cdav.php @@ -39,7 +39,7 @@ class Cdav extends \Zotlabs\Web\Controller { $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]); if($sigblock) { - $keyId = $sigblock['keyId']; + $keyId = str_replace('acct:','',$sigblock['keyId']); if($keyId) { $r = q("select * from hubloc where hubloc_addr = '%s' limit 1", dbesc($keyId) diff --git a/Zotlabs/Module/Dav.php b/Zotlabs/Module/Dav.php index d506fe9f5..9f64e2fea 100644 --- a/Zotlabs/Module/Dav.php +++ b/Zotlabs/Module/Dav.php @@ -48,7 +48,7 @@ class Dav extends \Zotlabs\Web\Controller { $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]); if($sigblock) { - $keyId = $sigblock['keyId']; + $keyId = str_replace('acct:','',$sigblock['keyId']); if($keyId) { $r = q("select * from hubloc where hubloc_addr = '%s' limit 1", dbesc($keyId) diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 2528645f3..37a3a3a85 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -1139,7 +1139,29 @@ class Item extends \Zotlabs\Web\Controller { $ret['message'] = t('Unable to obtain post information from database.'); return $ret; } - + + // auto-upgrade beginner (techlevel 0) accounts - if they have at least two friends and ten posts + // and have uploaded something (like a profile photo), promote them to level 1. + + $a = q("select account_id, account_level from account where account_id = (select channel_account_id from channel where channel_id = %d limit 1)", + intval($channel_id) + ); + if((! intval($a[0]['account_level'])) && intval($r[0]['total']) > 10) { + $x = q("select count(abook_id) as total from abook where abook_channel = %d", + intval($channel_id) + ); + if($x && intval($x[0]['total']) > 2) { + $y = q("select count(id) as total from attach where uid = %d", + intval($channel_id) + ); + if($y && intval($y[0]['total']) > 1) { + q("update account set account_level = 1 where account_id = %d limit 1", + intval($a[0]['account_id']) + ); + } + } + } + if (!$iswebpage) { $max = engr_units_to_bytes(service_class_fetch($channel_id,'total_items')); if(! service_class_allows($channel_id,'total_items',$r[0]['total'])) { diff --git a/Zotlabs/Render/Comanche.php b/Zotlabs/Render/Comanche.php index cd06e11a8..fb400b6fe 100644 --- a/Zotlabs/Render/Comanche.php +++ b/Zotlabs/Render/Comanche.php @@ -534,7 +534,12 @@ class Comanche { require_once('widget/' . $clsname . '/' . $clsname . '.php'); elseif(file_exists('Zotlabs/Widget/' . $clsname . '.php')) require_once('Zotlabs/Widget/' . $clsname . '.php'); - + else { + $pth = theme_include($clsname . '.php'); + if($pth) { + require_once($pth); + } + } if(class_exists($nsname)) { $x = new $nsname; $f = 'widget'; @@ -550,11 +555,13 @@ class Comanche { require_once('widget/' . trim($name) . '.php'); elseif(file_exists('widget/' . trim($name) . '/' . trim($name) . '.php')) require_once('widget/' . trim($name) . '/' . trim($name) . '.php'); - } - else { - $theme_widget = $func . '.php'; - if((! function_exists($func)) && theme_include($theme_widget)) - require_once(theme_include($theme_widget)); + + if(! function_exists($func)) { + $theme_widget = $func . '.php'; + if(theme_include($theme_widget)) { + require_once(theme_include($theme_widget)); + } + } } if(function_exists($func)) diff --git a/Zotlabs/Widget/Notifications.php b/Zotlabs/Widget/Notifications.php index 450d3565e..a677d84c9 100644 --- a/Zotlabs/Widget/Notifications.php +++ b/Zotlabs/Widget/Notifications.php @@ -144,7 +144,7 @@ class Notifications { $o = replace_macros(get_markup_template('notifications_widget.tpl'), array( '$module' => \App::$module, '$notifications' => $notifications, - '$loading' => t('Loading...') + '$loading' => t('Loading') )); return $o; diff --git a/include/api_auth.php b/include/api_auth.php index 0818fa54b..5c0bcb317 100644 --- a/include/api_auth.php +++ b/include/api_auth.php @@ -52,6 +52,7 @@ function api_login(&$a){ /* Signature authentication */ if(array_key_exists($head,$_SERVER) && substr(trim($_SERVER[$head]),0,9) === 'Signature') { + if($head !== 'HTTP_AUTHORIZATION') { $_SERVER['HTTP_AUTHORIZATION'] = $_SERVER[$head]; continue; @@ -59,7 +60,7 @@ function api_login(&$a){ $sigblock = \Zotlabs\Web\HTTPSig::parse_sigheader($_SERVER[$head]); if($sigblock) { - $keyId = $sigblock['keyId']; + $keyId = str_replace('acct:','',$sigblock['keyId']); if($keyId) { $r = q("select * from hubloc where hubloc_addr = '%s' limit 1", dbesc($keyId) diff --git a/include/api_zot.php b/include/api_zot.php index aaa9ee497..54f905b4c 100644 --- a/include/api_zot.php +++ b/include/api_zot.php @@ -150,7 +150,11 @@ $start = ((array_key_exists('start',$_REQUEST)) ? intval($_REQUEST['start']) : 0); $records = ((array_key_exists('records',$_REQUEST)) ? intval($_REQUEST['records']) : 0); - $x = attach_list_files(api_user(),get_observer_hash(),$hash,$filename,$filetype,'created asc',$start,$records); + $since = ((array_key_exists('since',$_REQUEST)) ? datetime_convert(date_default_timezone_get(),'UTC',$_REQUEST['since']) : NULL_DATE); + $until = ((array_key_exists('until',$_REQUEST)) ? datetime_convert(date_default_timezone_get(),'UTC',$_REQUEST['until']) : datetime_convert()); + + $x = attach_list_files(api_user(),get_observer_hash(),$hash,$filename,$filetype,'created asc',$start,$records, $since, $until); + if($start || $records) { $x['start'] = $start; $x['records'] = count($x['results']); @@ -226,7 +230,10 @@ if(! $_REQUEST['file_id']) return false; - $ret = attach_export_data(api_user(),$_REQUEST['file_id']); + $channel = channelx_by_n(api_user()); + + $ret = attach_export_data($channel,$_REQUEST['file_id']); + if($ret) { json_return_and_die($ret); } diff --git a/include/attach.php b/include/attach.php index 3a802bd11..88b6fa8e7 100644 --- a/include/attach.php +++ b/include/attach.php @@ -189,7 +189,7 @@ function attach_count_files($channel_id, $observer, $hash = '', $filename = '', * * \e array|boolean \b results array with results, or false * * \e string \b message with error messages if any */ -function attach_list_files($channel_id, $observer, $hash = '', $filename = '', $filetype = '', $orderby = 'created desc', $start = 0, $entries = 0) { +function attach_list_files($channel_id, $observer, $hash = '', $filename = '', $filetype = '', $orderby = 'created desc', $start = 0, $entries = 0, $since = '', $until = '') { $ret = array('success' => false); @@ -198,6 +198,7 @@ function attach_list_files($channel_id, $observer, $hash = '', $filename = '', $ return $ret; } + require_once('include/security.php'); $sql_extra = permissions_sql($channel_id); @@ -213,14 +214,22 @@ function attach_list_files($channel_id, $observer, $hash = '', $filename = '', $ if($entries) $limit = " limit " . intval($start) . ", " . intval($entries) . " "; - // Retrieve all columns except 'data' + if(! $since) + $since = NULL_DATE; + + if(! $until) + $until = datetime_convert(); + + $sql_extra .= " and created >= '" . dbesc($since) . "' and created <= '" . dbesc($until) . "' "; + + // Retrieve all columns except 'content' $r = q("select id, aid, uid, hash, filename, filetype, filesize, revision, folder, os_path, display_path, os_storage, is_dir, is_photo, flags, created, edited, allow_cid, allow_gid, deny_cid, deny_gid from attach where uid = %d $sql_extra ORDER BY $orderby $limit", intval($channel_id) ); $ret['success'] = ((is_array($r)) ? true : false); - $ret['results'] = ((is_array($r)) ? $r : false); + $ret['results'] = ((is_array($r)) ? $r : []); return $ret; } @@ -2052,6 +2061,9 @@ function attach_export_data($channel, $resource_id, $deleted = false) { if($attach_ptr['is_photo']) { + + // This query could potentially result in a few megabytes of data use. + $r = q("select * from photo where resource_id = '%s' and uid = %d order by imgscale asc", dbesc($resource_id), intval($channel['channel_id']) @@ -2063,6 +2075,17 @@ function attach_export_data($channel, $resource_id, $deleted = false) { $ret['photo'] = $r; } +// This query can be used instead in memory starved environments. There will be a corresponding +// performance hit during sync because the data will need to be fetched over the network. +// $r = q("select aid,uid,xchan,resource_id,created,edited,title,description,album,filename,mimetype,height,width,filesize,imgscale,photo_usage,profile,is_nsfw,os_storage,display_path,photo_flags,allow_cid,allow_gid,deny_cid,deny_gid from photo where resource_id = '%s' and uid = %d order by imgscale asc", +// dbesc($resource_id), +// intval($channel['channel_id']) +// ); + +// if($r) { +// $ret['photo'] = $r; +// } + $r = q("select * from item where resource_id = '%s' and resource_type = 'photo' and uid = %d ", dbesc($resource_id), intval($channel['channel_id']) diff --git a/include/bbcode.php b/include/bbcode.php index e38473168..ed34bc5d6 100644 --- a/include/bbcode.php +++ b/include/bbcode.php @@ -711,7 +711,7 @@ function parseIdentityAwareHTML($Text) { function bbcode($Text, $options = []) { $preserve_nl = ((array_key_exists('preserve_nl',$options)) ? $options['preserve_nl'] : false); - $tryoembed = ((array_key_exists('tryomebed',$options)) ? $options['tryoembed'] : true); + $tryoembed = ((array_key_exists('tryoembed',$options)) ? $options['tryoembed'] : true); $cache = ((array_key_exists('cache',$options)) ? $options['cache'] : false); diff --git a/include/channel.php b/include/channel.php index 16afd8209..2d40b7db6 100644 --- a/include/channel.php +++ b/include/channel.php @@ -325,7 +325,7 @@ function create_identity($arr) { 'hubloc_guid_sig' => $sig, 'hubloc_hash' => $hash, 'hubloc_addr' => channel_reddress($ret['channel']), - 'hubloc_primary' => $primary, + 'hubloc_primary' => intval($primary), 'hubloc_url' => z_root(), 'hubloc_url_sig' => base64url_encode(rsa_sign(z_root(),$ret['channel']['channel_prvkey'])), 'hubloc_host' => App::get_hostname(), diff --git a/include/import.php b/include/import.php index cd7056497..a5e8adeb5 100644 --- a/include/import.php +++ b/include/import.php @@ -1263,10 +1263,43 @@ function sync_files($channel, $files) { ); } - if($p['imgscale'] === 0 && $p['os_storage']) + if(intval($p['imgscale']) === 0 && $p['os_storage']) $p['content'] = $store_path; else - $p['content'] = base64_decode($p['content']); + $p['content'] = (($p['content'])? base64_decode($p['content']) : ''); + + if(intval($p['imgscale']) && (! $p['content'])) { + + $time = datetime_convert(); + + $parr = array('hash' => $channel['channel_hash'], + 'time' => $time, + 'resource' => $att['hash'], + 'revision' => 0, + 'signature' => base64url_encode(rsa_sign($channel['channel_hash'] . '.' . $time, $channel['channel_prvkey'])), + 'resolution' => $p['imgscale'] + ); + + $stored_image = $newfname . '-' . intval($p['imgscale']); + + $fp = fopen($stored_image,'w'); + if(! $fp) { + logger('failed to open storage file.',LOGGER_NORMAL,LOG_ERR); + continue; + } + $redirects = 0; + + + $headers = []; + $headers['Accept'] = 'application/x-zot+json' ; + $headers['Sigtoken'] = random_string(); + $headers = \Zotlabs\Web\HTTPSig::create_sig('',$headers,$channel['channel_prvkey'], 'acct:' . $channel['channel_address'] . '@' . \App::get_hostname(),false,true,'sha512'); + + $x = z_post_url($fetch_url,$parr,$redirects,[ 'filep' => $fp, 'headers' => $headers]); + fclose($fp); + $p['content'] = file_get_contents($stored_image); + unlink($stored_image); + } if(!isset($p['display_path'])) $p['display_path'] = ''; diff --git a/include/items.php b/include/items.php index e4727e19e..7948a7c22 100755 --- a/include/items.php +++ b/include/items.php @@ -2694,8 +2694,8 @@ function tag_deliver($uid, $item_id) { } - if((! $mention) && (! $union)) { - logger('No mention for ' . $u[0]['channel_name'] . ' and no union.'); + if(! $mention) { + logger('No mention for ' . $u[0]['channel_name']); continue; } @@ -2714,6 +2714,18 @@ function tag_deliver($uid, $item_id) { } } + + if($union) { + if(intval($item['item_wall']) || intval($item['item_origin']) || (! intval($item['item_thread_top'])) || ($item['id'] != $item['parent'])) { + logger('Item was local or a comment. rejected.'); + return; + } + + logger('Creating second delivery chain.'); + start_delivery_chain($u[0],$item,$item_id,null); + + } + } /** diff --git a/include/nav.php b/include/nav.php index 66c4c1556..2366fe7f1 100644 --- a/include/nav.php +++ b/include/nav.php @@ -313,7 +313,7 @@ EOT; '$sitelocation' => $sitelocation, '$nav' => $x['nav'], '$banner' => $banner, - '$emptynotifications' => t('Loading...'), + '$emptynotifications' => t('Loading'), '$userinfo' => $x['usermenu'], '$localuser' => local_channel(), '$is_owner' => $is_owner, diff --git a/include/socgraph.php b/include/socgraph.php index 3c7a893c6..26446d9c7 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -178,9 +178,11 @@ function poco_load($xchan = '', $url = null) { ); if(! $r) { - q("insert into xlink ( xlink_xchan, xlink_link, xlink_updated, xlink_static ) values ( '%s', '%s', '%s', 0 ) ", + q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_rating_text, xlink_updated, xlink_static ) values ( '%s', '%s', %d, '%s', '%s', 0 ) ", dbesc($xchan), dbesc($hash), + intval(0), + dbesc(''), dbesc(datetime_convert()) ); } diff --git a/include/zot.php b/include/zot.php index d60494d94..6c0d92a42 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2552,7 +2552,7 @@ function sync_locations($sender, $arr, $absolute = false) { 'hubloc_hash' => $sender['hash'], 'hubloc_addr' => $location['address'], 'hubloc_network' => 'zot', - 'hubloc_primary' => $location['primary'], + 'hubloc_primary' => intval($location['primary']), 'hubloc_url' => $location['url'], 'hubloc_url_sig' => $location['url_sig'], 'hubloc_host' => $location['host'], diff --git a/view/theme/redbasic/css/style.css b/view/theme/redbasic/css/style.css index 5728d7948..d88340a4e 100644 --- a/view/theme/redbasic/css/style.css +++ b/view/theme/redbasic/css/style.css @@ -306,6 +306,49 @@ nav { /* spinner end */ +/* jumping dots */ +.jumping-dots span { + position: relative; + bottom: 0px; + transition-timing-function: ease-in-out; + -webkit-animation: jump 1s infinite; + animation: jump 1s infinite; +} + +.jumping-dots .dot-1 { + -webkit-animation-delay: 200ms; + animation-delay: 200ms; +} + +.jumping-dots .dot-2 { + -webkit-animation-delay: 400ms; + animation-delay: 400ms; +} + +.jumping-dots .dot-3 { + -webkit-animation-delay: 600ms; + animation-delay: 600ms; +} + +@-webkit-keyframes jump { + 0% { + bottom: 0px; + } + 20% { + bottom: 3px; + } + 40% { + bottom: 0px; + } +} + +@keyframes jump { + 0% {bottom: 0px;} + 20% {bottom: 3px;} + 40% {bottom: 0px;} +} +/* jumping dots end */ + /* footer */ footer { @@ -1759,3 +1802,12 @@ dl.bb-dl > dd > li { overflow: hidden; } +#cloud-index { + width: 100%; + table-layout: fixed; +} + +#cloud-index td { + width: auto; + overflow: hidden; +} \ No newline at end of file diff --git a/view/tpl/cloud_directory.tpl b/view/tpl/cloud_directory.tpl index ad3caff88..660e1e011 100644 --- a/view/tpl/cloud_directory.tpl +++ b/view/tpl/cloud_directory.tpl @@ -39,12 +39,12 @@ {{else}} - - - + + + - - + + {{if $parentpath}} diff --git a/view/tpl/navbar_tucson.tpl b/view/tpl/navbar_tucson.tpl index 4e045571f..08fc40656 100755 --- a/view/tpl/navbar_tucson.tpl +++ b/view/tpl/navbar_tucson.tpl @@ -113,7 +113,7 @@ {{/if}} @@ -126,7 +126,7 @@ {{/if}} @@ -139,7 +139,7 @@ {{/if}} @@ -152,7 +152,7 @@ {{/if}} @@ -164,7 +164,7 @@ {{/if}} @@ -177,7 +177,7 @@ {{/if}} diff --git a/view/tpl/notifications_widget.tpl b/view/tpl/notifications_widget.tpl index 9751f2e75..0974045fe 100644 --- a/view/tpl/notifications_widget.tpl +++ b/view/tpl/notifications_widget.tpl @@ -43,7 +43,9 @@ e.preventDefault(); if(! page_load) { - $(this).fadeOut(); + if($(this).parent().attr('id') !== 'nav-pubs-menu') + $(this).fadeOut(); + getData(b64mid, notify_id); } @@ -110,7 +112,7 @@ {{$notification.filter.label}} {{/if}} - {{$loading}} + {{$loading}}... {{/foreach}}
{{$name}}{{$name}} {{*{{$type}}*}}{{$size}}{{$lastmod}}{{$size}}{{$lastmod}}