Merge branch 'dev' of https://github.com/redmatrix/hubzilla into dev_merge
This commit is contained in:
commit
b1876ac14f
@ -53,6 +53,13 @@ class Deliver {
|
|||||||
remove_queue_item($r[0]['outq_hash']);
|
remove_queue_item($r[0]['outq_hash']);
|
||||||
|
|
||||||
if($dresult && is_array($dresult)) {
|
if($dresult && is_array($dresult)) {
|
||||||
|
if(array_key_exists('iv',$dresult)) {
|
||||||
|
$dresult = json_decode(crypto_unencapsulate($dresult,get_config('system','prvkey')),true);
|
||||||
|
}
|
||||||
|
if(! $dresult) {
|
||||||
|
logger('dreport decryption failure');
|
||||||
|
}
|
||||||
|
else {
|
||||||
foreach($dresult as $xx) {
|
foreach($dresult as $xx) {
|
||||||
if(is_array($xx) && array_key_exists('message_id',$xx)) {
|
if(is_array($xx) && array_key_exists('message_id',$xx)) {
|
||||||
if(delivery_report_is_storable($xx)) {
|
if(delivery_report_is_storable($xx)) {
|
||||||
@ -68,7 +75,7 @@ class Deliver {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
q("delete from dreport where dreport_queue = '%s'",
|
q("delete from dreport where dreport_queue = '%s'",
|
||||||
dbesc($argv[$x])
|
dbesc($argv[$x])
|
||||||
);
|
);
|
||||||
|
@ -492,7 +492,7 @@ class Notifier {
|
|||||||
// Now we have collected recipients (except for external mentions, FIXME)
|
// Now we have collected recipients (except for external mentions, FIXME)
|
||||||
// Let's reduce this to a set of hubs; checking that the site is not dead.
|
// Let's reduce this to a set of hubs; checking that the site is not dead.
|
||||||
|
|
||||||
$r = q("select hubloc.*, site.site_crypto from hubloc left join site on site_url = hubloc_url where hubloc_hash in (" . implode(',',$recipients) . ")
|
$r = q("select hubloc.*, site.site_crypto, site.site_flags from hubloc left join site on site_url = hubloc_url where hubloc_hash in (" . implode(',',$recipients) . ")
|
||||||
and hubloc_error = 0 and hubloc_deleted = 0 and ( site_dead = 0 OR site_dead is null ) "
|
and hubloc_error = 0 and hubloc_deleted = 0 and ( site_dead = 0 OR site_dead is null ) "
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -607,10 +607,13 @@ class NativeWikiPage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static public function get_file_ext($arr) {
|
static public function get_file_ext($arr) {
|
||||||
if($arr['mimeType'] == 'text/bbcode')
|
if($arr['mimeType'] === 'text/bbcode')
|
||||||
return '.bb';
|
return '.bb';
|
||||||
else
|
elseif($arr['mimeType'] === 'text/markdown')
|
||||||
return '.md';
|
return '.md';
|
||||||
|
elseif($arr['mimeType'] === 'text/plain')
|
||||||
|
return '.txt';
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// This function is derived from
|
// This function is derived from
|
||||||
|
@ -19,12 +19,19 @@ class Post extends \Zotlabs\Web\Controller {
|
|||||||
function init() {
|
function init() {
|
||||||
if(array_key_exists('auth', $_REQUEST)) {
|
if(array_key_exists('auth', $_REQUEST)) {
|
||||||
$x = new \Zotlabs\Zot\Auth($_REQUEST);
|
$x = new \Zotlabs\Zot\Auth($_REQUEST);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function post() {
|
function post() {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$z = new \Zotlabs\Zot\Receiver($_REQUEST['data'], get_config('system', 'prvkey'), new \Zotlabs\Zot\ZotHandler());
|
$z = new \Zotlabs\Zot\Receiver($_REQUEST['data'], get_config('system', 'prvkey'), new \Zotlabs\Zot\ZotHandler());
|
||||||
|
|
||||||
// notreached;
|
// notreached;
|
||||||
|
@ -170,7 +170,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
'$create' => t('Create New'),
|
'$create' => t('Create New'),
|
||||||
'$submit' => t('Submit'),
|
'$submit' => t('Submit'),
|
||||||
'$wikiName' => array('wikiName', t('Wiki name')),
|
'$wikiName' => array('wikiName', t('Wiki name')),
|
||||||
'$mimeType' => array('mimeType', t('Content type'), '', '', ['text/markdown' => 'Markdown', 'text/bbcode' => 'BB Code']),
|
'$mimeType' => array('mimeType', t('Content type'), '', '', ['text/markdown' => t('Markdown'), 'text/bbcode' => t('BBcode'), 'text/plain' => t('Text') ]),
|
||||||
'$name' => t('Name'),
|
'$name' => t('Name'),
|
||||||
'$type' => t('Type'),
|
'$type' => t('Type'),
|
||||||
'$lockstate' => $x['lockstate'],
|
'$lockstate' => $x['lockstate'],
|
||||||
@ -262,6 +262,8 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$mimeType = $p['pageMimeType'];
|
$mimeType = $p['pageMimeType'];
|
||||||
|
|
||||||
$sampleContent = (($mimeType == 'text/bbcode') ? '[h3]' . t('New page') . '[/h3]' : '### ' . t('New page'));
|
$sampleContent = (($mimeType == 'text/bbcode') ? '[h3]' . t('New page') . '[/h3]' : '### ' . t('New page'));
|
||||||
|
if($mimeType === 'text/plain')
|
||||||
|
$sampleContent = t('New page');
|
||||||
|
|
||||||
$content = (($p['content'] == '') ? $sampleContent : $p['content']);
|
$content = (($p['content'] == '') ? $sampleContent : $p['content']);
|
||||||
|
|
||||||
@ -269,7 +271,10 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
if($mimeType == 'text/bbcode') {
|
if($mimeType == 'text/bbcode') {
|
||||||
$renderedContent = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))), argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
|
$renderedContent = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))), argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
|
||||||
}
|
}
|
||||||
else {
|
elseif($mimeType === 'text/plain') {
|
||||||
|
$renderedContent = str_replace(["\n",' ',"\t"],[EOL,' ',' '],htmlentities($content,ENT_COMPAT,'UTF-8',false));
|
||||||
|
}
|
||||||
|
elseif($mimeType === 'text/markdown') {
|
||||||
$content = Zlib\MarkdownSoap::unescape($content);
|
$content = Zlib\MarkdownSoap::unescape($content);
|
||||||
$html = Zlib\NativeWikiPage::generate_toc(zidify_text(MarkdownExtra::defaultTransform(Zlib\NativeWikiPage::bbcode($content))));
|
$html = Zlib\NativeWikiPage::generate_toc(zidify_text(MarkdownExtra::defaultTransform(Zlib\NativeWikiPage::bbcode($content))));
|
||||||
$renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
|
$renderedContent = Zlib\NativeWikiPage::convert_links($html, argv(0) . '/' . argv(1) . '/' . $wikiUrlName);
|
||||||
@ -323,7 +328,7 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
'$modalerroralbum' => t('Error getting album'),
|
'$modalerroralbum' => t('Error getting album'),
|
||||||
));
|
));
|
||||||
|
|
||||||
if($p['pageMimeType'] != 'text/bbcode')
|
if($p['pageMimeType'] === 'text/markdown')
|
||||||
head_add_js('/library/ace/ace.js'); // Ace Code Editor
|
head_add_js('/library/ace/ace.js'); // Ace Code Editor
|
||||||
|
|
||||||
return $o;
|
return $o;
|
||||||
@ -354,11 +359,10 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
|
|
||||||
$mimeType = $_POST['mimetype'];
|
$mimeType = $_POST['mimetype'];
|
||||||
|
|
||||||
if($mimeType == 'text/bbcode') {
|
if($mimeType === 'text/bbcode') {
|
||||||
$html = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))),$wikiURL);
|
$html = Zlib\NativeWikiPage::convert_links(zidify_links(smilies(bbcode($content))),$wikiURL);
|
||||||
}
|
}
|
||||||
else {
|
elseif($mimeType === 'text/markdown') {
|
||||||
|
|
||||||
$bb = Zlib\NativeWikiPage::bbcode($content);
|
$bb = Zlib\NativeWikiPage::bbcode($content);
|
||||||
$x = new ZLib\MarkdownSoap($bb);
|
$x = new ZLib\MarkdownSoap($bb);
|
||||||
$md = $x->clean();
|
$md = $x->clean();
|
||||||
@ -367,6 +371,9 @@ class Wiki extends \Zotlabs\Web\Controller {
|
|||||||
$html = Zlib\NativeWikiPage::generate_toc(zidify_text($html));
|
$html = Zlib\NativeWikiPage::generate_toc(zidify_text($html));
|
||||||
$html = Zlib\NativeWikiPage::convert_links($html,$wikiURL);
|
$html = Zlib\NativeWikiPage::convert_links($html,$wikiURL);
|
||||||
}
|
}
|
||||||
|
elseif($mimeType === 'text/plain') {
|
||||||
|
$html = str_replace(["\n",' ',"\t"],[EOL,' ',' '],htmlentities($content,ENT_COMPAT,'UTF-8',false));
|
||||||
|
}
|
||||||
json_return_and_die(array('html' => $html, 'success' => true));
|
json_return_and_die(array('html' => $html, 'success' => true));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -95,13 +95,18 @@ class HTTPSig {
|
|||||||
$algorithm = 'sha512';
|
$algorithm = 'sha512';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if($key && function_exists($key)) {
|
||||||
|
$result['signer'] = $sig_block['keyId'];
|
||||||
|
$key = $key($sig_block['keyId']);
|
||||||
|
}
|
||||||
|
|
||||||
if(! $key) {
|
if(! $key) {
|
||||||
$result['signer'] = $sig_block['keyId'];
|
$result['signer'] = $sig_block['keyId'];
|
||||||
$key = self::get_activitypub_key($sig_block['keyId']);
|
$key = self::get_activitypub_key($sig_block['keyId']);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! $key)
|
if(! $key)
|
||||||
return null;
|
return $result;
|
||||||
|
|
||||||
$x = rsa_verify($signed_data,$sig_block['signature'],$key,$algorithm);
|
$x = rsa_verify($signed_data,$sig_block['signature'],$key,$algorithm);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ class Wiki_pages {
|
|||||||
'$canadd' => $can_create,
|
'$canadd' => $can_create,
|
||||||
'$candel' => $can_delete,
|
'$candel' => $can_delete,
|
||||||
'$addnew' => t('Add new page'),
|
'$addnew' => t('Add new page'),
|
||||||
'$mimetype' => mimetype_select(0,$p['mimeType'], [ 'text/markdown','text/bbcode' ]),
|
'$mimetype' => mimetype_select(0,$w['mimeType'], [ 'text/markdown','text/bbcode', 'text/plain' ]),
|
||||||
'$pageName' => array('pageName', t('Page name')),
|
'$pageName' => array('pageName', t('Page name')),
|
||||||
'$refresh' => $arr['refresh']
|
'$refresh' => $arr['refresh']
|
||||||
));
|
));
|
||||||
|
11
boot.php
11
boot.php
@ -72,6 +72,8 @@ define ( 'DIRECTORY_MODE_PRIMARY', 0x0001); // There can only be *one* prima
|
|||||||
define ( 'DIRECTORY_MODE_SECONDARY', 0x0002); // All other mirror directory servers
|
define ( 'DIRECTORY_MODE_SECONDARY', 0x0002); // All other mirror directory servers
|
||||||
define ( 'DIRECTORY_MODE_STANDALONE', 0x0100); // A detached (off the grid) hub with itself as directory server.
|
define ( 'DIRECTORY_MODE_STANDALONE', 0x0100); // A detached (off the grid) hub with itself as directory server.
|
||||||
|
|
||||||
|
define ( 'ZOT6_COMPLIANT', 0x1000);
|
||||||
|
|
||||||
// We will look for upstream directories whenever me make contact
|
// We will look for upstream directories whenever me make contact
|
||||||
// with other sites, but if this is a new installation and isn't
|
// with other sites, but if this is a new installation and isn't
|
||||||
// a standalone hub, we need to seed the service with a starting
|
// a standalone hub, we need to seed the service with a starting
|
||||||
@ -606,13 +608,15 @@ function sys_boot() {
|
|||||||
|
|
||||||
|
|
||||||
if(! defined('DEFAULT_PLATFORM_ICON')) {
|
if(! defined('DEFAULT_PLATFORM_ICON')) {
|
||||||
define( 'DEFAULT_PLATFORM_ICON', '/images/rm-32.png' );
|
define( 'DEFAULT_PLATFORM_ICON', '/images/hz-32.png' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! defined('DEFAULT_NOTIFY_ICON')) {
|
if(! defined('DEFAULT_NOTIFY_ICON')) {
|
||||||
define( 'DEFAULT_NOTIFY_ICON', '/images/rm-32.png' );
|
define( 'DEFAULT_NOTIFY_ICON', '/images/hz-white-64.png' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
App::head_set_icon(DEFAULT_PLATFORM_ICON);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Try to open the database;
|
* Try to open the database;
|
||||||
*/
|
*/
|
||||||
@ -943,8 +947,6 @@ class App {
|
|||||||
self::$is_mobile = $mobile_detect->isMobile();
|
self::$is_mobile = $mobile_detect->isMobile();
|
||||||
self::$is_tablet = $mobile_detect->isTablet();
|
self::$is_tablet = $mobile_detect->isTablet();
|
||||||
|
|
||||||
self::head_set_icon(DEFAULT_PLATFORM_ICON);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* register template engines
|
* register template engines
|
||||||
*/
|
*/
|
||||||
@ -2446,4 +2448,3 @@ function observer_prohibited($allow_account = false) {
|
|||||||
return (((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) ? true : false );
|
return (((get_config('system','block_public')) && (! local_channel()) && (! remote_channel())) ? true : false );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,13 +629,20 @@ function get_vcard_array($vc,$id) {
|
|||||||
if($vc->ADR) {
|
if($vc->ADR) {
|
||||||
foreach($vc->ADR as $adr) {
|
foreach($vc->ADR as $adr) {
|
||||||
$type = (($adr['TYPE']) ? vcard_translate_type((string)$adr['TYPE']) : '');
|
$type = (($adr['TYPE']) ? vcard_translate_type((string)$adr['TYPE']) : '');
|
||||||
$adrs[] = [
|
$entry = [
|
||||||
'type' => $type,
|
'type' => $type,
|
||||||
'address' => $adr->getParts()
|
'address' => $adr->getParts()
|
||||||
];
|
];
|
||||||
$last_entry = end($adrs);
|
|
||||||
if($last_entry && is_array($adrs[$last_entry]['address']))
|
if(is_array($entry['address'])) {
|
||||||
array_walk($adrs[$last_entry]['address'],'array_escape_tags');
|
array_walk($entry['address'],'array_escape_tags');
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$entry['address'] = (string) escape_tags($entry['address']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$adrs[] = $entry;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2875,8 +2875,13 @@ function import_site($arr, $pubkey) {
|
|||||||
$site_directory = DIRECTORY_MODE_NORMAL;
|
$site_directory = DIRECTORY_MODE_NORMAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$site_flags = $site_directory;
|
||||||
|
|
||||||
|
if(array_key_exists('zot',$arr) && ((float) $arr['zot']) >= 6.0)
|
||||||
|
$site_flags = ($site_flags & ZOT6_COMPLIANT);
|
||||||
|
|
||||||
if($exists) {
|
if($exists) {
|
||||||
if(($siterecord['site_flags'] != $site_directory)
|
if(($siterecord['site_flags'] != $site_flags)
|
||||||
|| ($siterecord['site_access'] != $access_policy)
|
|| ($siterecord['site_access'] != $access_policy)
|
||||||
|| ($siterecord['site_directory'] != $directory_url)
|
|| ($siterecord['site_directory'] != $directory_url)
|
||||||
|| ($siterecord['site_sellpage'] != $sellpage)
|
|| ($siterecord['site_sellpage'] != $sellpage)
|
||||||
@ -2896,7 +2901,7 @@ function import_site($arr, $pubkey) {
|
|||||||
$r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s', site_version = '%s', site_crypto = '%s'
|
$r = q("update site set site_dead = 0, site_location = '%s', site_flags = %d, site_access = %d, site_directory = '%s', site_register = %d, site_update = '%s', site_sellpage = '%s', site_realm = '%s', site_type = %d, site_project = '%s', site_version = '%s', site_crypto = '%s'
|
||||||
where site_url = '%s'",
|
where site_url = '%s'",
|
||||||
dbesc($site_location),
|
dbesc($site_location),
|
||||||
intval($site_directory),
|
intval($site_flags),
|
||||||
intval($access_policy),
|
intval($access_policy),
|
||||||
dbesc($directory_url),
|
dbesc($directory_url),
|
||||||
intval($register_policy),
|
intval($register_policy),
|
||||||
@ -2929,7 +2934,7 @@ function import_site($arr, $pubkey) {
|
|||||||
'site_location' => $site_location,
|
'site_location' => $site_location,
|
||||||
'site_url' => $url,
|
'site_url' => $url,
|
||||||
'site_access' => intval($access_policy),
|
'site_access' => intval($access_policy),
|
||||||
'site_flags' => intval($site_directory),
|
'site_flags' => intval($site_flags),
|
||||||
'site_update' => datetime_convert(),
|
'site_update' => datetime_convert(),
|
||||||
'site_directory' => $directory_url,
|
'site_directory' => $directory_url,
|
||||||
'site_register' => intval($register_policy),
|
'site_register' => intval($register_policy),
|
||||||
@ -4161,10 +4166,31 @@ function zotinfo($arr) {
|
|||||||
if($x)
|
if($x)
|
||||||
$ret['locations'] = $x;
|
$ret['locations'] = $x;
|
||||||
|
|
||||||
$ret['site'] = array();
|
$ret['site'] = zot_site_info($e);
|
||||||
|
|
||||||
|
|
||||||
|
check_zotinfo($e,$x,$ret);
|
||||||
|
|
||||||
|
|
||||||
|
call_hooks('zot_finger',$ret);
|
||||||
|
return($ret);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function zot_site_info($channel = null) {
|
||||||
|
|
||||||
|
$signing_key = (($channel) ? $channel['channel_prvkey'] : get_config('system','prvkey'));
|
||||||
|
$sig_method = get_config('system','signature_algorithm','sha256');
|
||||||
|
|
||||||
|
$ret = [];
|
||||||
|
$ret['site'] = [];
|
||||||
$ret['site']['url'] = z_root();
|
$ret['site']['url'] = z_root();
|
||||||
$ret['site']['url_sig'] = base64url_encode(rsa_sign(z_root(),$e['channel_prvkey'],$sig_method));
|
$ret['site']['url_sig'] = base64url_encode(rsa_sign(z_root(),$signing_key,$sig_method));
|
||||||
$ret['site']['zot_auth'] = z_root() . '/magic';
|
$ret['site']['post'] = z_root() . '/post';
|
||||||
|
$ret['site']['openWebAuth'] = z_root() . '/owa';
|
||||||
|
$ret['site']['authRedirect'] = z_root() . '/magic';
|
||||||
|
$ret['site']['key'] = get_config('system','pubkey');
|
||||||
|
|
||||||
$dirmode = get_config('system','directory_mode');
|
$dirmode = get_config('system','directory_mode');
|
||||||
if(($dirmode === false) || ($dirmode == DIRECTORY_MODE_NORMAL))
|
if(($dirmode === false) || ($dirmode == DIRECTORY_MODE_NORMAL))
|
||||||
@ -4182,6 +4208,12 @@ function zotinfo($arr) {
|
|||||||
|
|
||||||
$ret['site']['encryption'] = crypto_methods();
|
$ret['site']['encryption'] = crypto_methods();
|
||||||
$ret['site']['signing'] = signing_methods();
|
$ret['site']['signing'] = signing_methods();
|
||||||
|
if(function_exists('zotvi_load')) {
|
||||||
|
$ret['site']['zot'] = '6.0';
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$ret['site']['zot'] = ZOT_REVISION;
|
||||||
|
}
|
||||||
|
|
||||||
// hide detailed site information if you're off the grid
|
// hide detailed site information if you're off the grid
|
||||||
|
|
||||||
@ -4234,15 +4266,10 @@ function zotinfo($arr) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
check_zotinfo($e,$x,$ret);
|
return $ret['site'];
|
||||||
|
|
||||||
|
|
||||||
call_hooks('zot_finger',$ret);
|
|
||||||
return($ret);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function check_zotinfo($channel,$locations,&$ret) {
|
function check_zotinfo($channel,$locations,&$ret) {
|
||||||
|
|
||||||
|
|
||||||
|
@ -455,8 +455,10 @@
|
|||||||
window.editor.on("input", function() {
|
window.editor.on("input", function() {
|
||||||
$('#save-page').removeClass('disabled');
|
$('#save-page').removeClass('disabled');
|
||||||
});
|
});
|
||||||
|
{{if $mimeType == 'text/bbcode'}}
|
||||||
window.editor.bbco_autocomplete('bbcode');
|
window.editor.bbco_autocomplete('bbcode');
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{/if}}
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).resize(function () {
|
$(window).resize(function () {
|
||||||
|
Reference in New Issue
Block a user