Merge branch 'dev' of /home/macgirvin/z into dev

This commit is contained in:
nobody 2020-10-25 18:18:50 -07:00
commit df723ce76a
32 changed files with 10105 additions and 9832 deletions

1
.gitignore vendored
View file

@ -21,6 +21,7 @@ Thumbs.db
## Ignore site specific files and folders ## Ignore site specific files and folders
.htconfig.php .htconfig.php
.htstartup.php
favicon.* favicon.*
addon/ addon/
widget/ widget/

View file

@ -1,4 +1,4 @@
<?php /** @file */ <?php
namespace Zotlabs\Daemon; namespace Zotlabs\Daemon;
@ -10,6 +10,8 @@ class Convo {
static public function run($argc,$argv) { static public function run($argc,$argv) {
logger('convo invoked: ' . print_r($argv,true));
if($argc != 4) { if($argc != 4) {
killme(); killme();
} }
@ -43,7 +45,9 @@ class Convo {
if (is_string($message)) { if (is_string($message)) {
$message = Activity::fetch($message,$channel); $message = Activity::fetch($message,$channel);
} }
$AS = new ActivityStreams($message); // set client flag because comments will probably just be objects and not full blown activities
// and that lets us use implied_create
$AS = new ActivityStreams($message, null, true);
if ($AS->is_valid() && is_array($AS->obj)) { if ($AS->is_valid() && is_array($AS->obj)) {
$item = Activity::decode_note($AS,true); $item = Activity::decode_note($AS,true);
Activity::store($channel,$contact['abook_xchan'],$AS,$item); Activity::store($channel,$contact['abook_xchan'],$AS,$item);

View file

@ -153,5 +153,6 @@ class ASCollection {
$this->nextpage = false; $this->nextpage = false;
} }
} }
logger('nextpage: ' . $this->nextpage, LOGGER_DEBUG);
} }
} }

View file

@ -13,6 +13,7 @@ use Zotlabs\Lib\Config;
use Zotlabs\Lib\LibBlock; use Zotlabs\Lib\LibBlock;
use Zotlabs\Lib\Markdown; use Zotlabs\Lib\Markdown;
use Zotlabs\Lib\Libzotdir; use Zotlabs\Lib\Libzotdir;
use Zotlabs\Lib\Nodeinfo;
use Emoji; use Emoji;
require_once('include/html2bbcode.php'); require_once('include/html2bbcode.php');
@ -1689,13 +1690,13 @@ class Activity {
return; return;
} }
$name = $person_obj['name']; $name = escape_tags($person_obj['name']);
if (! $name) if (! $name)
$name = $person_obj['preferredUsername']; $name = escape_tags($person_obj['preferredUsername']);
if (! $name) if (! $name)
$name = t('Unknown'); $name = escape_tags( t('Unknown'));
$username = $person_obj['preferredUsername']; $username = escape_tags($person_obj['preferredUsername']);
$h = parse_url($url); $h = parse_url($url);
if ($h && $h['host']) { if ($h && $h['host']) {
$username .= '@' . $h['host']; $username .= '@' . $h['host'];
@ -1867,6 +1868,39 @@ class Activity {
} }
} }
$m = parse_url($url);
if ($m['scheme'] && $m['host']) {
$site_url = $m['scheme'] . '://' . $m['host'];
$ni = Nodeinfo::fetch($site_url);
if ($ni && is_array($ni)) {
$software = ((array_path_exists('software/name',$ni)) ? $ni['software']['name'] : '');
$version = ((array_path_exists('software/version',$ni)) ? $ni['software']['version'] : '');
$r = q("select * from site where site_url = '%s'",
dbesc($site_url)
);
if ($r) {
q("update site set site_project = '%s', site_version = '%s' where site_url = '%s'",
dbesc($software),
dbesc($version),
dbesc($site_url)
);
}
else {
site_store_lowlevel(
[
'site_url' => $site_url,
'site_update' => datetime_convert(),
'site_dead' => 0,
'site_type' => SITE_TYPE_NOTZOT,
'site_project' => $software,
'site_version' => $version
]
);
}
}
}
Libzotdir::import_directory_profile($url,[ 'about' => $about, 'keywords' => $keywords, 'dob' => '0000-00-00' ], null,0,true); Libzotdir::import_directory_profile($url,[ 'about' => $about, 'keywords' => $keywords, 'dob' => '0000-00-00' ], null,0,true);
if ($collections) { if ($collections) {
@ -2893,7 +2927,7 @@ class Activity {
if ($is_child_node) { if ($is_child_node) {
$parent = q("select parent_mid from item where mid = '%s' and uid = %d limit 1", $parent = q("select * from item where mid = '%s' and uid = %d limit 1",
dbesc($item['parent_mid']), dbesc($item['parent_mid']),
intval($item['uid']) intval($item['uid'])
); );
@ -2907,7 +2941,7 @@ class Activity {
$fetch = (($fetch_parents) ? self::fetch_and_store_parents($channel,$observer_hash,$act,$item) : false); $fetch = (($fetch_parents) ? self::fetch_and_store_parents($channel,$observer_hash,$act,$item) : false);
} }
if ($fetch) { if ($fetch) {
$parent = q("select parent_mid from item where mid = '%s' and uid = %d limit 1", $parent = q("select * from item where mid = '%s' and uid = %d limit 1",
dbesc($item['parent_mid']), dbesc($item['parent_mid']),
intval($item['uid']) intval($item['uid'])
); );
@ -2948,6 +2982,7 @@ class Activity {
} }
if ($fetch_parents && $parent && ! intval($parent[0]['item_private'])) { if ($fetch_parents && $parent && ! intval($parent[0]['item_private'])) {
logger('topfetch', LOGGER_DEBUG);
// if the thread owner is a connnection, we will already receive any additional comments to their posts // if the thread owner is a connnection, we will already receive any additional comments to their posts
// but if they are not we can try to fetch others in the background // but if they are not we can try to fetch others in the background
$x = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash $x = q("SELECT abook.*, xchan.* FROM abook left join xchan on abook_xchan = xchan_hash
@ -2956,12 +2991,17 @@ class Activity {
dbesc($parent[0]['owner_xchan']) dbesc($parent[0]['owner_xchan'])
); );
if (! $x) { if (! $x) {
// determine if the top-level post provides a replies collection
if ($parent[0]['obj']) {
$parent[0]['obj'] = json_decode($parent[0]['obj'],true);
}
logger('topfetch: ' . print_r($parent[0],true), LOGGER_ALL);
$id = ((array_path_exists('obj/replies/id',$parent[0])) ? $parent[0]['obj']['replies']['id'] : false); $id = ((array_path_exists('obj/replies/id',$parent[0])) ? $parent[0]['obj']['replies']['id'] : false);
if (! $id) { if (! $id) {
$id = ((array_path_exists('obj/replies',$parent[0]) && is_string($parent[0]['obj']['replies'])) ? $parent[0]['obj']['replies'] : false); $id = ((array_path_exists('obj/replies',$parent[0]) && is_string($parent[0]['obj']['replies'])) ? $parent[0]['obj']['replies'] : false);
} }
if ($id) { if ($id) {
Run::Summon( [ 'Convo',$id, $channel['channel_id'], $observer_hash ] ); Run::Summon( [ 'Convo', $id, $channel['channel_id'], $observer_hash ] );
} }
} }
} }

View file

@ -344,6 +344,7 @@ class Apps {
'Photomap' => t('Photomap'), 'Photomap' => t('Photomap'),
'Events' => t('Events'), 'Events' => t('Events'),
'Tasks' => t('Tasks'), 'Tasks' => t('Tasks'),
'Tagadelic' => t('Tagadelic'),
'No Comment' => t('No Comment'), 'No Comment' => t('No Comment'),
'Directory' => t('Directory'), 'Directory' => t('Directory'),
'Help' => t('Help'), 'Help' => t('Help'),

View file

@ -165,7 +165,7 @@ class Libzotdir {
'$header' => t('Directory Options'), '$header' => t('Directory Options'),
'$forumsurl' => $forumsurl, '$forumsurl' => $forumsurl,
'$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''), '$safemode' => array('safemode', t('Safe Mode'),$safe_mode,'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&safe="+(this.checked ? 1 : 0)\''),
'$pubforums' => array('pubforums', t('Public Groups Only'),(($pubforums == 1) ? true : false),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&type="+(this.checked ? 1 : 0)\''), '$pubforums' => array('pubforums', t('Groups Only'),(($pubforums == 1) ? true : false),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&type="+(this.checked ? 1 : 0)\''),
'$collections' => array('collections', t('Collections Only'),(($pubforums == 2) ? true : false),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&type="+(this.checked ? 2 : 0)\''), '$collections' => array('collections', t('Collections Only'),(($pubforums == 2) ? true : false),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&type="+(this.checked ? 2 : 0)\''),
'$hide_local' => $hide_local, '$hide_local' => $hide_local,
'$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''), '$globaldir' => array('globaldir', t('This Website Only'), 1-intval($globaldir),'',array(t('No'), t('Yes')),' onchange=\'window.location.href="' . $forumsurl . '&global="+(this.checked ? 0 : 1)\''),

37
Zotlabs/Lib/Nodeinfo.php Normal file
View file

@ -0,0 +1,37 @@
<?php
namespace Zotlabs\Lib;
class Nodeinfo {
static public function fetch($url) {
$href = EMPTY_STR;
$m = parse_url($url);
if ($m['scheme'] && $m['host']) {
$s = $m['scheme'] . '://' . $m['host'] . '/.well-known/nodeinfo';
$n = z_fetch_url($s);
if ($n['success']) {
$j = json_decode($n['body'], true);
if ($j && $j['links']) {
foreach ($j['links'] as $l) {
if ($l['rel'] === 'http://nodeinfo.diaspora.software/ns/schema/2.0' && $l['href']) {
$href = $l['href'];
}
}
}
}
}
if ($href) {
$n = z_fetch_url($href);
if ($n['success']) {
return json_decode($n['body'],true);
}
}
return [];
}
}

View file

@ -166,7 +166,7 @@ class Queue {
'site_url' => $base, 'site_url' => $base,
'site_update' => datetime_convert(), 'site_update' => datetime_convert(),
'site_dead' => 0, 'site_dead' => 0,
'site_type' => intval(($outq['outq_driver'] === 'post') ? SITE_TYPE_NOTZOT : SITE_TYPE_UNKNOWN), 'site_type' => ((in_array($outq['outq_driver'], [ 'post', 'activitypub' ])) ? SITE_TYPE_NOTZOT : SITE_TYPE_UNKNOWN),
'site_crypto' => '' 'site_crypto' => ''
] ]
); );

View file

@ -56,6 +56,7 @@ class Site {
$disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True); $disable_discover_tab = ((x($_POST,'disable_discover_tab')) ? False : True);
$site_firehose = ((x($_POST,'site_firehose')) ? True : False); $site_firehose = ((x($_POST,'site_firehose')) ? True : False);
$open_pubstream = ((x($_POST,'open_pubstream')) ? True : False); $open_pubstream = ((x($_POST,'open_pubstream')) ? True : False);
$animations = ((x($_POST,'animations')) ? True : False);
$login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False); $login_on_homepage = ((x($_POST,'login_on_homepage')) ? True : False);
$enable_context_help = ((x($_POST,'enable_context_help')) ? True : False); $enable_context_help = ((x($_POST,'enable_context_help')) ? True : False);
$global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : ''); $global_directory = ((x($_POST,'directory_submit_url')) ? notags(trim($_POST['directory_submit_url'])) : '');
@ -116,6 +117,8 @@ class Site {
set_config('system', 'pubstream_excl',$pub_excl); set_config('system', 'pubstream_excl',$pub_excl);
set_config('system', 'block_public_directory', $block_public_dir); set_config('system', 'block_public_directory', $block_public_dir);
set_config('system', 'max_imported_follow', $max_imported_follow); set_config('system', 'max_imported_follow', $max_imported_follow);
set_config('system', 'animated_avatars', $animations);
if ($directory_server) { if ($directory_server) {
set_config('system','directory_server',$directory_server); set_config('system','directory_server',$directory_server);
@ -315,6 +318,7 @@ class Site {
'$site_firehose' => [ 'site_firehose', t('Site only Public stream'), get_config('system','site_firehose'), t('Provide access to public content originating only from this site if Public stream is disabled.') ], '$site_firehose' => [ 'site_firehose', t('Site only Public stream'), get_config('system','site_firehose'), t('Provide access to public content originating only from this site if Public stream is disabled.') ],
'$open_pubstream' => [ 'open_pubstream', t('Allow anybody on the internet to access the Public stream'), get_config('system','open_pubstream',0), t('Default is to only allow viewing by site members. Warning: this content is unmoderated.') ], '$open_pubstream' => [ 'open_pubstream', t('Allow anybody on the internet to access the Public stream'), get_config('system','open_pubstream',0), t('Default is to only allow viewing by site members. Warning: this content is unmoderated.') ],
'$show_like_counts' => [ 'show_like_counts', t('Show numbers of likes and dislikes in conversations'), get_config('system','show_like_counts',1), t('If disabled, the presence of likes and dislikes will be shown, but without totals.') ], '$show_like_counts' => [ 'show_like_counts', t('Show numbers of likes and dislikes in conversations'), get_config('system','show_like_counts',1), t('If disabled, the presence of likes and dislikes will be shown, but without totals.') ],
'$animations' => [ 'animations', t('Permit animated profile photos'), get_config('system','animated_avatars',true), t('Changing this may take several days to work through the system') ],
'$incl' => [ 'pub_incl',t('Only import Public stream posts with this text'), get_config('system','pubstream_incl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts') ], '$incl' => [ 'pub_incl',t('Only import Public stream posts with this text'), get_config('system','pubstream_incl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts') ],
'$excl' => [ 'pub_excl',t('Do not import Public stream posts with this text'), get_config('system','pubstream_excl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts') ], '$excl' => [ 'pub_excl',t('Do not import Public stream posts with this text'), get_config('system','pubstream_excl'),t('words one per line or #tags or /patterns/ or lang=xx, leave blank to import all posts') ],
'$max_imported_follow' => [ 'max_imported_follow', t('Maximum number of imported friends of friends'), get_config('system','max_imported_follow',10), t('Warning: higher numbers will improve the quality of friend suggestions and directory results but can exponentially increase resource usage') ], '$max_imported_follow' => [ 'max_imported_follow', t('Maximum number of imported friends of friends'), get_config('system','max_imported_follow',10), t('Warning: higher numbers will improve the quality of friend suggestions and directory results but can exponentially increase resource usage') ],

View file

@ -1172,11 +1172,19 @@ class Item extends Controller {
$obj = $this->extract_bb_poll_data($body,[ 'item_private' => $private, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_contact_deny ]); $obj = $this->extract_bb_poll_data($body,[ 'item_private' => $private, 'allow_cid' => $str_contact_allow, 'allow_gid' => $str_contact_deny ]);
} }
$comments_closed = NULL_DATE;
if ($obj) { if ($obj) {
$obj['url'] = $mid; $obj['url'] = $mid;
$obj['attributedTo'] = channel_url($channel); $obj['attributedTo'] = channel_url($channel);
$datarray['obj'] = $obj; $datarray['obj'] = $obj;
$obj_type = 'Question'; $obj_type = 'Question';
if ($obj['endTime']) {
$d = datetime_convert('UTC','UTC', $obj['endTime']);
if ($d > NULL_DATE) {
$comments_closed = $d;
}
}
} }
if(! $parent_mid) { if(! $parent_mid) {
@ -1243,6 +1251,7 @@ class Item extends Controller {
$datarray['commented'] = (($orig_post) ? datetime_convert() : $created); $datarray['commented'] = (($orig_post) ? datetime_convert() : $created);
$datarray['received'] = (($orig_post) ? datetime_convert() : $created); $datarray['received'] = (($orig_post) ? datetime_convert() : $created);
$datarray['changed'] = (($orig_post) ? datetime_convert() : $created); $datarray['changed'] = (($orig_post) ? datetime_convert() : $created);
$datarray['comments_closed'] = $comments_closed;
$datarray['mid'] = $mid; $datarray['mid'] = $mid;
$datarray['parent_mid'] = $parent_mid; $datarray['parent_mid'] = $parent_mid;
$datarray['mimetype'] = $mimetype; $datarray['mimetype'] = $mimetype;

View file

@ -62,9 +62,28 @@ class Linkinfo extends Controller {
killme(); killme();
} }
if ((substr($url,0,1) != '/') && (substr($url,0,4) != 'http')) $m = parse_url($url);
$url = 'http://' . $url;
if (! $m['scheme']) {
if (strpos($url,'@')) {
$xc = discover_by_webbie($url);
if ($xc) {
$x = q("select * from xchan where xchan_hash = '%s'",
dbesc($xc)
);
if ($x) {
$url = $x[0]['xchan_url'];
}
}
else {
echo $br . '[url=mailto:' . $url . ']' . $url . '[/url]' . $br;
killme();
}
}
else {
$url = 'http://' . $url;
}
}
if ($_GET['title']) if ($_GET['title'])
$title = strip_tags(trim($_GET['title'])); $title = strip_tags(trim($_GET['title']));

View file

@ -120,20 +120,22 @@ class Profile_photo extends Controller {
'edited' => $base_image['edited'] 'edited' => $base_image['edited']
]; ];
$animated = get_config('system','animated_avatars',true);
$p['imgscale'] = PHOTO_RES_PROFILE_300; $p['imgscale'] = PHOTO_RES_PROFILE_300;
$p['photo_usage'] = (($is_default_profile) ? PHOTO_PROFILE : PHOTO_NORMAL); $p['photo_usage'] = (($is_default_profile) ? PHOTO_PROFILE : PHOTO_NORMAL);
$r1 = $im->storeThumbnail($p, PHOTO_RES_PROFILE_300); $r1 = $im->storeThumbnail($p, PHOTO_RES_PROFILE_300, $animated);
$im->scaleImage(80); $im->scaleImage(80);
$p['imgscale'] = PHOTO_RES_PROFILE_80; $p['imgscale'] = PHOTO_RES_PROFILE_80;
$r2 = $im->storeThumbnail($p, PHOTO_RES_PROFILE_80); $r2 = $im->storeThumbnail($p, PHOTO_RES_PROFILE_80, $animated);
$im->scaleImage(48); $im->scaleImage(48);
$p['imgscale'] = PHOTO_RES_PROFILE_48; $p['imgscale'] = PHOTO_RES_PROFILE_48;
$r3 = $im->storeThumbnail($p, PHOTO_RES_PROFILE_48); $r3 = $im->storeThumbnail($p, PHOTO_RES_PROFILE_48, $animated);
if ($r1 === false || $r2 === false || $r3 === false) { if ($r1 === false || $r2 === false || $r3 === false) {
// if one failed, delete them all so we can start over. // if one failed, delete them all so we can start over.

View file

@ -674,7 +674,7 @@ class Channel {
'$vnotify14' => array('vnotify14', t('Unseen likes and dislikes'), ($vnotify & VNOTIFY_LIKE), VNOTIFY_LIKE, '', $yes_no), '$vnotify14' => array('vnotify14', t('Unseen likes and dislikes'), ($vnotify & VNOTIFY_LIKE), VNOTIFY_LIKE, '', $yes_no),
'$vnotify15' => array('vnotify15', t('Unseen forum posts'), ($vnotify & VNOTIFY_FORUMS), VNOTIFY_FORUMS, '', $yes_no), '$vnotify15' => array('vnotify15', t('Unseen forum posts'), ($vnotify & VNOTIFY_FORUMS), VNOTIFY_FORUMS, '', $yes_no),
'$vnotify16' => ((is_site_admin()) ? array('vnotify16', t('Reported content'), ($vnotify & VNOTIFY_REPORTS), VNOTIFY_REPORTS, '', $yes_no) : [] ), '$vnotify16' => ((is_site_admin()) ? array('vnotify16', t('Reported content'), ($vnotify & VNOTIFY_REPORTS), VNOTIFY_REPORTS, '', $yes_no) : [] ),
'$mailhost' => [ 'mailhost', t('Email notification hub (hostname)'), get_pconfig(local_channel(),'system','email_notify_host',App::get_hostname()), sprintf( t('If your channel is mirrored to multiple locations, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'),App::get_hostname()) ], '$mailhost' => [ 'mailhost', t('Email notifications sent from (hostname)'), get_pconfig(local_channel(),'system','email_notify_host',App::get_hostname()), sprintf( t('If your channel is mirrored to multiple locations, set this to your preferred location. This will prevent duplicate email notifications. Example: %s'),App::get_hostname()) ],
'$always_show_in_notices' => array('always_show_in_notices', t('Show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no), '$always_show_in_notices' => array('always_show_in_notices', t('Show new wall posts, private messages and connections under Notices'), $always_show_in_notices, 1, '', $yes_no),
'$permit_all_mentions' => [ 'permit_all_mentions', t('Accept messages from strangers which mention me'), get_pconfig(local_channel(),'system','permit_all_mentions'), t('This setting bypasses normal permissions'), $yes_no ], '$permit_all_mentions' => [ 'permit_all_mentions', t('Accept messages from strangers which mention me'), get_pconfig(local_channel(),'system','permit_all_mentions'), t('This setting bypasses normal permissions'), $yes_no ],
'$followed_tags' => [ 'followed_tags', t('Accept messages from strangers which include any of the following hashtags'), $followed, t('comma separated, do not include the #') ], '$followed_tags' => [ 'followed_tags', t('Accept messages from strangers which include any of the following hashtags'), $followed, t('comma separated, do not include the #') ],

View file

@ -0,0 +1,48 @@
<?php
namespace Zotlabs\Module;
use App;
use Zotlabs\Lib\Apps;
use Zotlabs\Lib\Libsync;
use Zotlabs\Lib\Libprofile;
use Zotlabs\Web\Controller;
use Zotlabs\Render\Comanche;
class Tagadelic extends Controller {
function init() {
if(local_channel()) {
$channel = App::get_channel();
if($channel && $channel['channel_address']) {
$which = $channel['channel_address'];
}
Libprofile::load($which,0);
}
}
function get() {
$desc = t('This app displays a hashtag cloud on your channel homepage.');
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
if(! ( local_channel() && Apps::system_app_installed(local_channel(),'Tagadelic'))) {
return $text;
}
$desc = t('This app is installed. It displays a hashtag cloud on your channel homepage.');
$text = '<div class="section-content-info-wrapper">' . $desc . '</div>';
$c = new Comanche;
return $text . EOL . EOL . $c->widget('tagcloud_wall',EMPTY_STR);
}
}

View file

@ -11,30 +11,30 @@ class Zot_probe extends \Zotlabs\Web\Controller {
function get() { function get() {
$o .= '<h3>Zot6 Probe Diagnostic</h3>'; $o = replace_macros(get_markup_template('zot_probe.tpl'), [
'$page_title' => t('Zot6 Probe Diagnostic'),
'$resource' => [ 'resource', t('Object URL') , $_REQUEST['resource'], EMPTY_STR ],
'$authf' => [ 'authf', t('Authenticated fetch'), $_REQUEST['authf'], EMPTY_STR, [ t('No'), t('Yes') ] ],
'$submit' => t('Submit')
]);
$o .= '<form action="zot_probe" method="get">';
$o .= 'Lookup URI: <input type="text" style="width: 250px;" name="addr" value="' . $_GET['addr'] .'" /><br>';
$o .= '<input type="submit" name="submit" value="Submit" /></form>';
$o .= '<br><br>'; if(x($_GET,'resource')) {
$resource = $_GET['resource'];
$channel = (($_GET['authf']) ? \App::get_channel() : null);
if(x($_GET,'addr')) { if(strpos($resource,'x-zot:') === 0) {
$addr = $_GET['addr']; $x = ZotURL::fetch($resource,$channel);
$channel = (($_GET['auth']) ? \App::get_channel() : null);
if(strpos($addr,'x-zot:') === 0) {
$x = ZotURL::fetch($addr,$channel);
} }
else { else {
$x = Zotfinger::exec($addr,$channel); $x = Zotfinger::exec($resource,$channel);
$o .= '<pre>' . htmlspecialchars(print_array($x)) . '</pre>'; $o .= '<pre>' . htmlspecialchars(print_array($x)) . '</pre>';
$headers = 'Accept: application/x-zot+json, application/jrd+json, application/json'; $headers = 'Accept: application/x-zot+json, application/jrd+json, application/json';
$redirects = 0; $redirects = 0;
$x = z_fetch_url($addr,true,$redirects, [ 'headers' => [ $headers ]]); $x = z_fetch_url($resource,true,$redirects, [ 'headers' => [ $headers ]]);
} }
if($x['success']) { if($x['success']) {

View file

@ -103,7 +103,7 @@ abstract class PhotoDriver {
* *
* @return string A Binary String. * @return string A Binary String.
*/ */
abstract public function imageString(); abstract public function imageString($animations = true);
abstract public function clearexif(); abstract public function clearexif();
@ -169,11 +169,11 @@ abstract class PhotoDriver {
* @param string $path Path and filename where to save the image * @param string $path Path and filename where to save the image
* @return boolean False on failure, otherwise true * @return boolean False on failure, otherwise true
*/ */
public function saveImage($path) { public function saveImage($path, $animated = true) {
if (! $this->is_valid()) { if (! $this->is_valid()) {
return false; return false;
} }
return (file_put_contents($path, $this->imageString()) ? true : false); return (file_put_contents($path, $this->imageString($animated)) ? true : false);
} }
/** /**
@ -522,7 +522,7 @@ abstract class PhotoDriver {
* @return boolean|array * @return boolean|array
*/ */
public function storeThumbnail($arr, $scale = 0) { public function storeThumbnail($arr, $scale = 0, $animated = true) {
$arr['imgscale'] = $scale; $arr['imgscale'] = $scale;
@ -530,7 +530,7 @@ abstract class PhotoDriver {
$channel = channelx_by_n($arr['uid']); $channel = channelx_by_n($arr['uid']);
$arr['os_storage'] = 1; $arr['os_storage'] = 1;
$arr['os_syspath'] = 'store/' . $channel['channel_address'] . '/' . $arr['os_path'] . '-' . $scale; $arr['os_syspath'] = 'store/' . $channel['channel_address'] . '/' . $arr['os_path'] . '-' . $scale;
if (! $this->saveImage($arr['os_syspath'])) { if (! $this->saveImage($arr['os_syspath'], $animated)) {
return false; return false;
} }
} }

View file

@ -157,7 +157,7 @@ class PhotoGd extends PhotoDriver {
* {@inheritDoc} * {@inheritDoc}
* @see \Zotlabs\Photo\PhotoDriver::imageString() * @see \Zotlabs\Photo\PhotoDriver::imageString()
*/ */
public function imageString() { public function imageString($animated = true) {
if (! $this->is_valid()) { if (! $this->is_valid()) {
return false; return false;
} }

View file

@ -201,14 +201,17 @@ class PhotoImagick extends PhotoDriver {
$this->doScaleImage($maxx, $maxy); $this->doScaleImage($maxx, $maxy);
} }
public function imageString() { public function imageString($animated = true) {
if (! $this->is_valid()) { if (! $this->is_valid()) {
return false; return false;
} }
/* Clean it */ /* Clean it */
$this->image = $this->image->deconstructImages(); $this->image = $this->image->deconstructImages();
if ($animated) {
return $this->image->getImagesBlob(); return $this->image->getImagesBlob();
} }
return $this->image->getImageBlob();
}
} }

View file

@ -2,18 +2,20 @@
namespace Zotlabs\Widget; namespace Zotlabs\Widget;
use App;
class Catcloud_wall { class Catcloud_wall {
function widget($arr) { function widget($arr) {
if((! \App::$profile['profile_uid']) || (! \App::$profile['channel_hash'])) if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash']))
return ''; return '';
if(! perm_is_allowed(\App::$profile['profile_uid'], get_observer_hash(), 'view_stream')) if(! perm_is_allowed(App::$profile['profile_uid'], get_observer_hash(), 'view_stream'))
return ''; return '';
$limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50); $limit = ((array_key_exists('limit',$arr)) ? intval($arr['limit']) : 50);
return catblock(\App::$profile['profile_uid'], $limit, '', \App::$profile['channel_hash'], 'wall'); return catblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall');
} }
} }

View file

@ -9,7 +9,7 @@ class Site_projects {
$r = q("select site_project, count(site_project) as total from site where site_project != '' and site_flags != 256 and site_dead = 0 group by site_project order by site_project desc"); $r = q("select site_project, count(site_project) as total from site where site_project != '' and site_flags != 256 and site_dead = 0 and site_type = 0 group by site_project order by site_project desc");
$results = []; $results = [];

View file

@ -2,18 +2,21 @@
namespace Zotlabs\Widget; namespace Zotlabs\Widget;
use App;
use Zotlabs\Lib\Apps;
class Tagcloud_wall { class Tagcloud_wall {
function widget($arr) { function widget($arr) {
if((! \App::$profile['profile_uid']) || (! \App::$profile['channel_hash'])) if((! App::$profile['profile_uid']) || (! App::$profile['channel_hash']))
return ''; return '';
if(! perm_is_allowed(\App::$profile['profile_uid'], get_observer_hash(), 'view_stream')) if(! perm_is_allowed(\App::$profile['profile_uid'], get_observer_hash(), 'view_stream'))
return ''; return '';
$limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50); $limit = ((array_key_exists('limit', $arr)) ? intval($arr['limit']) : 50);
if(feature_enabled(\App::$profile['profile_uid'], 'tagadelic')) if(Apps::system_app_installed(App::$profile['profile_uid'], 'Tagadelic'))
return wtagblock(\App::$profile['profile_uid'], $limit, '', \App::$profile['channel_hash'], 'wall'); return wtagblock(App::$profile['profile_uid'], $limit, '', App::$profile['channel_hash'], 'wall');
return ''; return '';
} }

6
app/tagadelic.apd Normal file
View file

@ -0,0 +1,6 @@
version: 1
url: $baseurl/tagadelic
requires: local_channel
name: Tagadelic
photo: icon:tags
categories: Networking

View file

@ -16,7 +16,7 @@ use Zotlabs\Daemon\Run;
* @brief This file defines some global constants and includes the central App class. * @brief This file defines some global constants and includes the central App class.
*/ */
define ( 'STD_VERSION', '20.10.19' ); define ( 'STD_VERSION', '20.10.26' );
define ( 'ZOT_REVISION', '6.0' ); define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1243 ); define ( 'DB_UPDATE_VERSION', 1243 );

View file

@ -1024,7 +1024,7 @@ function md_codeblock($content) {
// Build one block so that we not create each paragraph. // Build one block so that we not create each paragraph.
$content = str_replace("\n", '<br>', $content[4]); $content = str_replace("\n", '<br>', $content[4]);
return sprintf('<pre><code%s>%s</code></pre>', $class, $content); return sprintf('<pre><code%s>%s</code></pre>', $class, bb_code_protect($content));
} }
function md_italic($content) { function md_italic($content) {
@ -1302,7 +1302,6 @@ function bbcode($Text, $options = []) {
$Text = preg_replace('#(?<!\\\)([*_]{2})([^\n]+?)\1#','<strong>$2</strong>',$Text); $Text = preg_replace('#(?<!\\\)([*_]{2})([^\n]+?)\1#','<strong>$2</strong>',$Text);
// The character check is so we don't mistake underscore in the middle of a code variable as an italic trigger. // The character check is so we don't mistake underscore in the middle of a code variable as an italic trigger.
$Text = preg_replace_callback('#(^| )(?<!\\\)([*_])([^\n|`]+?)\2#m','md_italic',$Text); $Text = preg_replace_callback('#(^| )(?<!\\\)([*_])([^\n|`]+?)\2#m','md_italic',$Text);
// $Text = preg_replace('#(?<!\\\)([*_])([^\n|`]+?)\1#','<em>$2</em>',$Text);
$Text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx','md_topheader', $Text); $Text = preg_replace_callback('{ ^(.+?)[ ]*\n(=+|-+)[ ]*\n+ }mx','md_topheader', $Text);
$Text = preg_replace_callback('#^(\#{1,6})\s+([^\#]+?)\s*\#*$#m','md_header', $Text); $Text = preg_replace_callback('#^(\#{1,6})\s+([^\#]+?)\s*\#*$#m','md_header', $Text);
$Text = preg_replace_callback('#(^|\n)([`~]{3,})(?: *\.?([a-zA-Z0-9\-.]+))?\n+([\s\S]+?)\n+\2(\n|$)#','md_codeblock',$Text); $Text = preg_replace_callback('#(^|\n)([`~]{3,})(?: *\.?([a-zA-Z0-9\-.]+))?\n+([\s\S]+?)\n+\2(\n|$)#','md_codeblock',$Text);

View file

@ -240,10 +240,17 @@ function relative_date($posted_date, $format = null) {
return t('never'); return t('never');
} }
if ($abs > time()) {
$direction = t('from now');
$etime = $abs - time();
}
else {
$direction = t('ago');
$etime = time() - $abs; $etime = time() - $abs;
}
if ($etime < 1) { if ($etime < 1) {
return t('less than a second ago'); return sprintf( t('less than a second %s'), $direction);
} }
$a = array( 12 * 30 * 24 * 60 * 60 => 'y', $a = array( 12 * 30 * 24 * 60 * 60 => 'y',
@ -261,9 +268,9 @@ function relative_date($posted_date, $format = null) {
if ($d >= 1) { if ($d >= 1) {
$r = round($d); $r = round($d);
if (! $format) if (! $format)
$format = t('%1$d %2$s ago', 'e.g. 22 hours ago, 1 minute ago'); $format = t('%1$d %2$s %3$s', 'e.g. 22 hours ago, 1 minute ago');
return sprintf($format, $r, plural_dates($str,$r)); return sprintf($format, $r, plural_dates($str,$r), $direction);
} }
} }
} }

View file

@ -2991,6 +2991,12 @@ function start_delivery_chain($channel, $item, $item_id, $parent, $group = false
if($post_id) { if($post_id) {
Run::Summon([ 'Notifier','tgroup',$post_id ]); Run::Summon([ 'Notifier','tgroup',$post_id ]);
} }
q("update channel set channel_lastpost = '%s' where channel_id = %d",
dbesc(datetime_convert()),
intval($channel['channel_id'])
);
return; return;
} }

View file

@ -346,6 +346,8 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) {
$hash = basename($path); $hash = basename($path);
$animated = get_config('system','animated_avatars',true);
$modified = ((file_exists($outfile)) ? @filemtime($outfile) : 0); $modified = ((file_exists($outfile)) ? @filemtime($outfile) : 0);
// Maybe it's already a cached xchan photo // Maybe it's already a cached xchan photo
@ -415,7 +417,7 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) {
$savepath = $path . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR); $savepath = $path . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR);
$photo = z_root() . '/xp/' . $hash . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR); $photo = z_root() . '/xp/' . $hash . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR);
$r = $img->saveImage($savepath); $r = $img->saveImage($savepath,$animated);
if ($r === false) { if ($r === false) {
$failed = true; $failed = true;
} }
@ -423,7 +425,7 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) {
$p['imgscale'] = 5; $p['imgscale'] = 5;
$savepath = $path . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR); $savepath = $path . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR);
$thumb = z_root() . '/xp/' . $hash . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR); $thumb = z_root() . '/xp/' . $hash . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR);
$r = $img->saveImage($savepath); $r = $img->saveImage($savepath,$animated);
if ($r === false) { if ($r === false) {
$failed = true; $failed = true;
} }
@ -431,7 +433,7 @@ function import_remote_xchan_photo($photo, $xchan, $thing = false) {
$p['imgscale'] = 6; $p['imgscale'] = 6;
$savepath = $path . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR); $savepath = $path . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR);
$micro = z_root() . '/xp/' . $hash . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR); $micro = z_root() . '/xp/' . $hash . '-' . $p['imgscale'] . (($thing) ? '.obj' : EMPTY_STR);
$r = $img->saveImage($savepath); $r = $img->saveImage($savepath,$animated);
if ($r === false) { if ($r === false) {
$failed = true; $failed = true;
} }

View file

@ -1617,7 +1617,8 @@ function prepare_body(&$item,$attach = false,$opts = false) {
} }
else { else {
if($item['summary']) { if($item['summary']) {
$s .= prepare_text('[summary]' . $item['summary'] . '[/summary]' . $item['body'],$item['mimetype'],$opts); // 8203 is a zero-width space so as not to trigger a markdown link if the summary starts with parentheses
$s .= prepare_text('[summary]&#8203;' . $item['summary'] . '[/summary]' . $item['body'],$item['mimetype'],$opts);
} }
else { else {
if ($item['html']) { if ($item['html']) {
@ -1781,7 +1782,7 @@ function format_poll($item,$s,$opts) {
$output .= '<input type="checkbox" name="answer[]" value="' . htmlspecialchars($text) . '"> ' . $text . '</input>' . ' (' . $total . ')' . EOL; $output .= '<input type="checkbox" name="answer[]" value="' . htmlspecialchars($text) . '"> ' . $text . '</input>' . ' (' . $total . ')' . EOL;
} }
else { else {
$output .= '[ ] ' . $text . ' (' . $total . ')' . EOL; $output .= $text . ' (' . $total . ')' . EOL;
} }
} }
} }
@ -1806,7 +1807,7 @@ function format_poll($item,$s,$opts) {
$output .= '<input type="radio" name="answer" value="' . htmlspecialchars($text) . '"> ' . $text . '</input>' . ' (' . $total . ')' . (($totalResponses) ? ' ' . intval($total / $totalResponses * 100) . '%' : '') . EOL; $output .= '<input type="radio" name="answer" value="' . htmlspecialchars($text) . '"> ' . $text . '</input>' . ' (' . $total . ')' . (($totalResponses) ? ' ' . intval($total / $totalResponses * 100) . '%' : '') . EOL;
} }
else { else {
$output .= '( ) ' . $text . ' (' . $total . ')' . (($totalResponses) ? ' ' . intval($total / $totalResponses * 100) . '%' : '') . EOL; $output .= $text . ' (' . $total . ')' . (($totalResponses) ? ' ' . intval($total / $totalResponses * 100) . '%' : '') . EOL;
} }
} }
@ -1816,7 +1817,7 @@ function format_poll($item,$s,$opts) {
$message = t('Poll has ended.'); $message = t('Poll has ended.');
} }
elseif ($closing) { elseif ($closing) {
$message = sprintf(t('Poll ends: %s'),$t); $message = sprintf(t('Poll ends: %1$s (%2$s)'),relative_date($t),$t);
} }
$output .= EOL . '<div>' . $message . '</div>'; $output .= EOL . '<div>' . $message . '</div>';

File diff suppressed because it is too large Load diff

View file

@ -5,7 +5,7 @@
[widget=fullprofile][/widget] [widget=fullprofile][/widget]
[widget=common_friends][/widget] [widget=common_friends][/widget]
[widget=archive][var=wall]1[/var][/widget] [widget=archive][var=wall]1[/var][/widget]
[widget=categories][/widget] [widget=catcloud_wall][/widget]
[widget=tagcloud_wall][var=limit]24[/var][/widget] [widget=tagcloud_wall][var=limit]24[/var][/widget]
[/region] [/region]
[region=right_aside] [region=right_aside]

View file

@ -110,6 +110,7 @@
{{include file="field_checkbox.tpl" field=$verify_email}} {{include file="field_checkbox.tpl" field=$verify_email}}
{{include file="field_checkbox.tpl" field=$show_like_counts}} {{include file="field_checkbox.tpl" field=$show_like_counts}}
{{include file="field_checkbox.tpl" field=$ap_contacts}} {{include file="field_checkbox.tpl" field=$ap_contacts}}
{{include file="field_checkbox.tpl" field=$animations}}
{{include file="field_checkbox.tpl" field=$block_public_dir}} {{include file="field_checkbox.tpl" field=$block_public_dir}}
{{include file="field_checkbox.tpl" field=$force_publish}} {{include file="field_checkbox.tpl" field=$force_publish}}
{{include file="field_checkbox.tpl" field=$disable_discover_tab}} {{include file="field_checkbox.tpl" field=$disable_discover_tab}}

10
view/tpl/zot_probe.tpl Normal file
View file

@ -0,0 +1,10 @@
<h3>{{$page_title}}</h3>
<form action="zot_probe" method="get">
{{include file="field_input.tpl" field=$resource}}
{{include file="field_checkbox.tpl" field=$authf}}
<input type="submit" name="submit" value="{{$submit}}" >
</form>
<br>
<br>