Merge branch 'dev' into nomadic

This commit is contained in:
Mike Macgirvin 2024-06-10 08:58:35 +10:00
commit 78f0840253
10 changed files with 1083 additions and 1053 deletions

View file

@ -304,12 +304,15 @@ function purify_html($s, $opts = [])
$def->addElement('aside', 'Block', 'Flow', 'Common');
$def->addElement('header', 'Block', 'Flow', 'Common');
$def->addElement('footer', 'Block', 'Flow', 'Common');
$def->addElement('details', 'Block', 'Flow', 'Common');
$def->addElement('summary', 'Block', 'Flow', 'Common');
//Inline
$def->addElement('button', 'Inline', 'Inline', 'Common');
$def->addElement('mark', 'Inline', 'Inline', 'Common');
$def->addElement('ins', 'Inline', 'Inline', 'Common');
$def->addElement('del', 'Inline', 'Inline', 'Common');
if (in_array('allow_position', $opts)) {
$cssDefinition = $config->getCSSDefinition();

View file

@ -397,7 +397,7 @@ function photo_upload($channel, $observer, $args)
$photo_link = '[zrl=' . Channel::getDidResolver($channel) . '/photos/image/' . $photo_hash . ']' . t('a new photo') . '[/zrl]';
if (array_path_exists('/directory/hash',$args)) {
$album_link = '[zrl=' . Channel::getDidResolver($channel) . '/photos/album/' . $args['directory']['hash'] . ']' . ((strlen($album)) ? $album : '/') . '[/zrl]';
$album_link = '[zrl=' . Channel::getDidResolver($channel) . '/album/' . $args['directory']['hash'] . ']' . ((strlen($album)) ? $album : '/') . '[/zrl]';
$activity_format = sprintf(t('%1$s posted %2$s to %3$s', 'photo_upload'), $author_link, $photo_link, $album_link);
}
else {
@ -439,7 +439,7 @@ function photo_upload($channel, $observer, $args)
}
$target = [
'type' => 'orderedCollection',
'type' => 'Collection',
'name' => ((strlen($album)) ? $album : '/'),
'id' => Channel::getDidResolver($channel) . '/album/' . ((isset($args['folder'])) ? '/' . $args['folder'] : EMPTY_STR),
'attributedTo' => Channel::getDidResolver($channel, true),
@ -468,20 +468,17 @@ function photo_upload($channel, $observer, $args)
$item = get_item_elements($i);
$force = false;
if (intval($item['item_wall']) && $item['mid'] === $item['parent_mid']) {
$object['commentPolicy'] = $item['comment_policy'];
if ($item['comments_closed'] && Time::convert(datetime: $item['comments_closed']) > NULL_DATE) {
$object['endTime'] = Time::convert(datetime: $item['comments_closed'], format: ISO8601);
}
if (intval($item['item_nocomment'])) {
if ($object['commentPolicy']) {
$object['commentPolicy'] .= ' ';
if ($item['mid'] === $item['parent_mid']) {
if (in_array($item['comment_policy'], ['self', 'none']) || $item['item_nocomment'] || ($item['comments_closed'] > NULL_DATE && Time::convert('UTC', 'UTC', $item['comments_closed']) <= Time::convert())) {
$object['canReply'] = [];
} elseif (in_array($item['comment_policy'], ['public', 'authenticated'])) {
$object['canReply'] = [ACTIVITY_PUBLIC_INBOX];
} elseif (in_array($item['comment_policy'], ['contacts', 'specific'])) {
$object['canReply'] = [z_root() . '/followers/' . $channel['channel_address']];
}
$object['commentPolicy'] .= 'until=' . Time::convert('UTC', 'UTC', $item['created'], ISO8601);
} elseif (array_key_exists('comments_closed', $item) && $item['comments_closed'] !== EMPTY_STR && $item['comments_closed'] > NULL_DATE) {
if ($object['commentPolicy']) {
$object['commentPolicy'] .= ' ';
}
$object['commentPolicy'] .= 'until=' . Time::convert('UTC', 'UTC', $item['comments_closed'], ISO8601);
}
if ($item['mid'] === $item['parent_mid']) {
@ -553,7 +550,7 @@ function photo_upload($channel, $observer, $args)
];
if (intval($arr['item_wall']) && $arr['mid'] === $arr['parent_mid']) {
$object['commentPolicy'] = $arr['comment_policy'] = map_scope(PermissionLimits::Get($channel['channel_id'], 'post_comments'));
$arr['comment_policy'] = map_scope(PermissionLimits::Get($channel['channel_id'], 'post_comments'));
}
$arr['obj'] = json_encode($object);

View file

@ -684,6 +684,10 @@ class Account {
intval($account_id)
);
$r = q("delete from xconfig where xchan = '%s'",
dbesc('a_' . $account_id)
);
if ($unset_session) {
App::$session->nuke();
notice(sprintf(t('Account \'%s\' deleted'), $account_email) . EOL);

View file

@ -4,6 +4,7 @@ namespace Code\Module\Admin;
use App;
use Code\Lib\Account;
use Code\Lib\AConfig;
use Code\Lib\Channel;
use Code\Lib\Time;
use Code\Render\Theme;
@ -131,6 +132,11 @@ class Accounts
"SELECT account.*, register.hash from account left join register on account_id = register.uid where (account_flags & %d ) != 0 ",
intval(ACCOUNT_PENDING)
);
if ($pending) {
for ($count = 0; $count < count($pending); $count++) {
$pending[$count]['reason'] = AConfig::Get($pending[$count]['account_id'], 'register', 'reason', '');
}
}
/* get accounts */
@ -186,7 +192,11 @@ class Accounts
'$submit' => t('Submit'),
'$select_all' => t('select all'),
'$h_pending' => t('Registrations waiting for confirm'),
'$th_pending' => array(t('Request date'), t('Email')),
'$th_pending' => [
t('Request date'),
t('Email'),
t('Reason'),
],
'$no_pending' => t('No registrations.'),
'$approve' => t('Approve'),
'$deny' => t('Deny'),

View file

@ -138,7 +138,7 @@ class Register extends Controller
set_aconfig($result['account']['account_id'], 'register', 'permissions_role', $_REQUEST['permissions_role']);
}
if ($_REQUEST['reason']) {
set_aconfig($result['account']['account_id'], 'register', 'reason', trim(escape_tags($_REQUEST['reason'])));
set_aconfig($result['account']['account_id'], 'register', 'reason', substr(trim(escape_tags($_REQUEST['reason'])),0, 500));
}
// At this point the account has been created without error. Purge any error messages from prior failed registration
@ -218,13 +218,14 @@ class Register extends Controller
$registration_is = EMPTY_STR;
$other_sites = false;
$policy = (int)Config::Get('system','register_policy');
if (intval(get_config('system', 'register_policy')) === REGISTER_CLOSED) {
if ($policy === REGISTER_CLOSED) {
notice(t('Registration on this website is disabled.') . EOL);
$other_sites = true;
}
if (intval(get_config('system', 'register_policy')) == REGISTER_APPROVE) {
if ($policy == REGISTER_APPROVE) {
$registration_is = t('Registration on this website is by approval only.');
$other_sites = true;
}
@ -289,6 +290,7 @@ class Register extends Controller
$invite_code = ['invite_code', t('Please enter your invitation code'), ((x($_REQUEST, 'invite_code')) ? strip_tags(trim($_REQUEST['invite_code'])) : "")];
$name = ['name', t('Your Name'), ((x($_REQUEST, 'name')) ? $_REQUEST['name'] : ''), t('Real names are preferred.')];
$nickhub = '@' . str_replace(['http://', 'https://', '/'], '', get_config('system', 'baseurl'));
$reason = ($policy === REGISTER_APPROVE) ? ['reason', t('Please tell us briefly why you are requesting this account'), '', ''] : null;
$nickname = ['nickname', t('Choose a short nickname'), ((x($_REQUEST, 'nickname')) ? $_REQUEST['nickname'] : ''), sprintf(t('Your nickname will be used to create an easy to remember channel address e.g. nickname%s'), $nickhub)];
$role = ['permissions_role', t('Channel role and privacy'), ($privacy_role) ?: 'social', t('Select a channel permission role for your usage needs and privacy requirements.'), $perm_roles];
$tos = ['tos', $label_tos, '', '', [t('no'), t('yes')], ' required '];
@ -318,6 +320,7 @@ class Register extends Controller
'$email' => $email,
'$pass1' => $password,
'$pass2' => $password2,
'$reason' => $reason,
'$submit' => t('Register'),
'$verify_note' => (($email_verify) ? t('This site requires email verification. After completing this form, please check your email for further instructions.') : ''),
]);

File diff suppressed because it is too large Load diff

View file

@ -1,2 +1,2 @@
<?php
define ('STD_VERSION', '24.06.05');
define ('STD_VERSION', '24.06.10');

View file

@ -31,6 +31,7 @@
<tr>
<td class="created">{{$u.account_created}}</td>
<td class="email">{{$u.account_email}}</td>
<td class="reason">{{$u.reason}}</td>
<td class="checkbox_bulkedit"><input type="checkbox" class="pending_ckbx" id="id_pending_{{$u.hash}}" name="pending[]" value="{{$u.hash}}"></td>
<td class="tools">
<a href="{{$baseurl}}/regmod/allow/{{$u.hash}}" class="btn btn-outline-secondary btn-sm" title="{{$approve}}"><i class="fa fa-thumbs-o-up admin-icons"></i></a>

View file

@ -5,7 +5,7 @@
{{if $albums}}
{{foreach $albums as $al}}
{{if $al.shorttext}}
<li class="nav-item"><a class="nav-link" href="{{$baseurl}}/photos/{{$nick}}/album/{{$al.bin2hex}}"><span class="badge bg-secondary float-end">{{$al.total}}</span>{{$al.shorttext}}</a></li>
<li class="nav-item"><a class="nav-link" href="{{$baseurl}}/album/{{$nick}}/{{$al.bin2hex}}"><span class="badge bg-secondary float-end">{{$al.total}}</span>{{$al.shorttext}}</a></li>
{{/if}}
{{/foreach}}
{{/if}}

View file

@ -28,6 +28,10 @@
{{include file="field_password.tpl" field=$pass2}}
{{if $reason}}
{{include file="field_textarea.tpl" field=$reason}}
{{/if}}
{{if $auto_create}}
{{if $default_role}}
<input type="hidden" name="permissions_role" value="{{$default_role}}" />