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

This commit is contained in:
nobody 2021-03-27 14:55:12 -07:00
commit 8ba6890d39
6 changed files with 308 additions and 246 deletions

View file

@ -110,7 +110,7 @@ class Editpost extends \Zotlabs\Web\Controller {
'visitor' => true, 'visitor' => true,
'title' => htmlspecialchars_decode($itm[0]['title'],ENT_COMPAT), 'title' => htmlspecialchars_decode($itm[0]['title'],ENT_COMPAT),
'category' => $category, 'category' => $category,
'showacl' => ((intval($itm[0]['unpublished'])) ? true : false), 'showacl' => ((intval($itm[0]['item_unpublished'])) ? true : false),
// @todo - need acl and lockstate when item_unpublished is 1 // @todo - need acl and lockstate when item_unpublished is 1
'permissions' => $itm[0], 'permissions' => $itm[0],
'profile_uid' => $owner_uid, 'profile_uid' => $owner_uid,

View file

@ -105,9 +105,16 @@ class Rpost extends Controller {
$channel = App::get_channel(); $channel = App::get_channel();
$acl = new AccessControl($channel); $acl = new AccessControl($channel);
if (array_key_exists('to',$_REQUEST) && $_REQUEST['to']) {
$acl->set([ 'allow_cid' => '<' . $_REQUEST['to'] . '>',
'allow_gid' => EMPTY_STR,
'deny_cid' => EMPTY_STR,
'deny_gid' => EMPTY_STR ]
);
}
$channel_acl = $acl->get(); $channel_acl = $acl->get();
if($_REQUEST['url']) { if($_REQUEST['url']) {

View file

@ -60,7 +60,6 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
array_walk($deny_gid,'fixacl'); array_walk($deny_gid,'fixacl');
} }
$channel = ((local_channel()) ? App::get_channel() : ''); $channel = ((local_channel()) ? App::get_channel() : '');
$has_acl = false; $has_acl = false;
$single_group = false; $single_group = false;
@ -77,7 +76,7 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
$custom = false; $custom = false;
} }
if (count($allow_cid) === 1 && $channel && $allow_cid[0] = $channel['channel_hash'] && (! $allow_gid) && (! $deny_gid) && (! $deny_cid)) { if (count($allow_cid) === 1 && $channel && $allow_cid[0] === $channel['channel_hash'] && (! $allow_gid) && (! $deny_gid) && (! $deny_cid)) {
$just_me = true; $just_me = true;
$custom = false; $custom = false;
} }
@ -105,12 +104,11 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
$selected = (($single_group && 'zot:' . $channel['channel_hash'] === $allow_gid[0]) ? ' selected = "selected" ' : ''); $selected = (($single_group && 'zot:' . $channel['channel_hash'] === $allow_gid[0]) ? ' selected = "selected" ' : '');
$groups .= '<option id="vg3" value="zot:' . $channel['channel_hash'] . '"' . $selected . '>' . t('My Zot connections') . ' ' . t('(Virtual List)') . '</option>' . "\r\n"; $groups .= '<option id="vg3" value="zot:' . $channel['channel_hash'] . '"' . $selected . '>' . t('My Zot connections') . ' ' . t('(Virtual List)') . '</option>' . "\r\n";
} }
$forums = get_forum_channels(local_channel(),1);
$forums = get_forum_channels(local_channel(),1);
$selected = false;
if ($forums) { if ($forums) {
foreach ($forums as $f) { foreach ($forums as $f) {
$selected = (($single_group && $f['hash'] === $allow_cid[0]) ? ' selected = "selected" ' : ''); $selected = (($single_group && $f['hash'] === $allow_cid[0]) ? ' selected = "selected" ' : '');
@ -118,14 +116,26 @@ function populate_acl($defaults = null,$show_jotnets = true, $emptyACL_descripti
} }
} }
// preset acl with DM to a single xchan (not a group)
if ($selected === false && count($allow_cid) === 1 && $channel && $allow_cid[0] !== $channel['channel_hash'] && (! $allow_gid) && (! $deny_gid) && (! $deny_cid)) {
$f = q("select * from xchan where xchan_hash = '%s'",
dbesc($allow_cid[0])
);
if ($f) {
$custom = false;
$selected = ' selected="selected" ';
$groups .= '<option id="^DM" value="^' . $f[0]['xchan_hash'] . '"' . $selected . '>' . $f[0]['xchan_name'] . ' ' . t('(DM)') . '</option>' . "\r\n";
}
}
$tpl = get_markup_template("acl_selector.tpl"); $tpl = get_markup_template("acl_selector.tpl");
$o = replace_macros($tpl, array( $o = replace_macros($tpl, array(
'$showall' => $showall_caption, '$showall' => $showall_caption,
'$onlyme' => t('Only me'), '$onlyme' => t('Only me'),
'$groups' => $groups, '$groups' => $groups,
'$public_selected' => (($has_acl) ? false : true), '$public_selected' => (($has_acl) ? false : ' selected="selected" '),
'$justme_selected' => $just_me, '$justme_selected' => (($just_me) ? ' selected="selected" ' : ''),
'$custom_selected' => $custom, '$custom_selected' => (($custom) ? ' selected="selected" ' : ''),
'$showallOrigin' => $showall_origin, '$showallOrigin' => $showall_origin,
'$showallIcon' => $showall_icon, '$showallIcon' => $showall_icon,
'$select_label' => t('Who can see this?'), '$select_label' => t('Who can see this?'),
@ -165,11 +175,11 @@ function get_post_aclDialogDescription() {
// *shown* the post, istead of who is able to see the post, i.e. make it clear that clicking // *shown* the post, istead of who is able to see the post, i.e. make it clear that clicking
// the "Show" button on a group does not post it to the feed of people in that group, it // the "Show" button on a group does not post it to the feed of people in that group, it
// mearly allows those people to view the post if they are viewing/following this channel. // mearly allows those people to view the post if they are viewing/following this channel.
$description = t('Post permissions cannot be changed after a post is shared.</br />These permissions set who is allowed to view the post.'); $description = t('Post permissions cannot be changed after a post is shared.<br>These permissions set who is allowed to view the post.');
// Lets keep the emphasis styling seperate from the translation. It may change. // Lets keep the emphasis styling seperate from the translation. It may change.
$emphasisOpen = '<b><a href="' . z_root() . '/help/acl_dialog_post" target="hubzilla-help">'; //$emphasisOpen = '<b><a href="' . z_root() . '/help/acl_dialog_post" target="hubzilla-help">';
$emphasisClose = '</a></b>'; //$emphasisClose = '</a></b>';
return $description; return $description;
} }

File diff suppressed because it is too large Load diff

View file

@ -1495,6 +1495,10 @@ function bbcode($Text, $options = []) {
$Text = preg_replace_callback('#(^|\n| )(?<!\\\)([*_]{3})([^\n]+?)\2#','md_bolditalic',$Text); $Text = preg_replace_callback('#(^|\n| )(?<!\\\)([*_]{3})([^\n]+?)\2#','md_bolditalic',$Text);
$Text = preg_replace_callback('#(^|\n| )(?<!\\\)([*_]{2})([^\n]+?)\2#','md_bold',$Text); $Text = preg_replace_callback('#(^|\n| )(?<!\\\)([*_]{2})([^\n]+?)\2#','md_bold',$Text);
$Text = preg_replace_callback('#(^|\n| )(?<!\\\)([*_])([^\n|`]+?)\2#m','md_italic',$Text); $Text = preg_replace_callback('#(^|\n| )(?<!\\\)([*_])([^\n|`]+?)\2#m','md_italic',$Text);
// strip the backslash from escaped bold/italic markdown sequences
$Text = preg_replace('#(\\\)([*_])#','$2',$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);
@ -1502,6 +1506,8 @@ function bbcode($Text, $options = []) {
// $Text = preg_replace('#^(?:\0(.*?)\0\n)?( {4}|\t)(.*?)$#m','<pre><code>$3</code></pre>',$Text); // $Text = preg_replace('#^(?:\0(.*?)\0\n)?( {4}|\t)(.*?)$#m','<pre><code>$3</code></pre>',$Text);
// markdown inline code blocks must be preceded by space or linebreak // markdown inline code blocks must be preceded by space or linebreak
$Text = preg_replace('#(^|\n| )(?<!\\\)`([^\n]+?)`#','$1<code class="inline-code">$2</code>', $Text); $Text = preg_replace('#(^|\n| )(?<!\\\)`([^\n]+?)`#','$1<code class="inline-code">$2</code>', $Text);
// strip backslash escape for inline code
$Text = preg_replace('#(\\\)`#','`',$Text);
$Text = preg_replace('#<\/code><\/pre>\n<pre><code(>| .*?>)#','<br>',$Text); $Text = preg_replace('#<\/code><\/pre>\n<pre><code(>| .*?>)#','<br>',$Text);
// blockquotes // blockquotes
@ -1514,7 +1520,9 @@ function bbcode($Text, $options = []) {
$Text = preg_replace('#\[([^\[]+)\]\((?:javascript:)?([^\)]+)\)(?!`)#','<a href="$2">$1</a>',$Text); $Text = preg_replace('#\[([^\[]+)\]\((?:javascript:)?([^\)]+)\)(?!`)#','<a href="$2">$1</a>',$Text);
// unordered lists // unordered lists
$Text = preg_replace('#^ *[*\-+] +(.*?)$#m','<ul><li>$1</li></ul>',$Text); $Text = preg_replace('#^(?<!\\\)[*\-+] +(.*?)$#m','<ul><li>$1</li></ul>',$Text);
// strip the backslash escape if present
$Text = preg_replace('#^(\\\)([*\-+]) #m','$2',$Text);
// order lists // order lists
$Text = preg_replace('#^\d+[\.] +(.*?)$#m','<ol><li>$1</li></ol>',$Text); $Text = preg_replace('#^\d+[\.] +(.*?)$#m','<ol><li>$1</li></ol>',$Text);

View file

@ -1020,10 +1020,20 @@ function thread_author_menu($item, $mode = '') {
$contact_url = z_root() . '/connedit/' . $contact['abook_id']; $contact_url = z_root() . '/connedit/' . $contact['abook_id'];
} }
$posts_link = z_root() . '/stream/?cid=' . $contact['abook_id']; $posts_link = z_root() . '/stream/?cid=' . $contact['abook_id'];
$clean_url = $item['author']['xchan_url']; $clean_url = $item['author']['xchan_url'];
} }
$can_dm = false;
if ($local_channel && $contact) {
$can_dm = perm_is_allowed($local_channel,$item['author_xchan'],'send_stream');
}
elseif ($item['author']['xchan_network'] === 'activitypub') {
$can_dm = true;
}
// if ($can_dm) {
// $pm_url = z_root() . '/rpost?to=' . urlencode($item['author_xchan']);
// }
if($profile_link) { if($profile_link) {
$menu[] = [ $menu[] = [
@ -1068,7 +1078,7 @@ function thread_author_menu($item, $mode = '') {
if(isset($pm_url) && $pm_url) { if(isset($pm_url) && $pm_url) {
$menu[] = [ $menu[] = [
'menu' => 'prv_message', 'menu' => 'prv_message',
'title' => t('Message'), 'title' => t('Direct Message'),
'icon' => 'fw', 'icon' => 'fw',
'action' => '', 'action' => '',
'href' => $pm_url 'href' => $pm_url