mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 21:55:15 +00:00
backend support for 'Leave' (checkout)
This commit is contained in:
parent
ca06310293
commit
866527872b
4 changed files with 10 additions and 5 deletions
|
@ -3338,7 +3338,7 @@ class Activity
|
|||
$s['item_private'] = 2;
|
||||
}
|
||||
|
||||
if ($s['verb'] === 'Arrive') {
|
||||
if (in_array($s['verb'], ['Arrive', 'Leave'])) {
|
||||
if (($s['lat'] || $s['lon']) && !str_contains($s['body'],'[map=')) {
|
||||
$s['body'] .= "\n\n" . '[map=' . $s['lat'] . ',' . $s['lon'] . ']' . "\n";
|
||||
}
|
||||
|
|
|
@ -168,7 +168,8 @@ class Editpost extends Controller
|
|||
'jotnets' => true,
|
||||
'hide_expire' => true,
|
||||
'bbcode' => true,
|
||||
'checkin' => ($item['verb'] === 'Arrive')
|
||||
'checkin' => ($item['verb'] === 'Arrive'),
|
||||
'checkout' => ($item['verb'] === 'Leave'),
|
||||
];
|
||||
|
||||
$editor = status_editor($x);
|
||||
|
|
|
@ -491,6 +491,7 @@ class Item extends Controller
|
|||
$plink = ((x($_REQUEST, 'permalink')) ? escape_tags($_REQUEST['permalink']) : '');
|
||||
$obj_type = ((x($_REQUEST, 'obj_type')) ? escape_tags($_REQUEST['obj_type']) : ACTIVITY_OBJ_NOTE);
|
||||
$checkin = ((x($_REQUEST, 'checkin')) ? 1 : 0);
|
||||
$checkout = ((x($_REQUEST, 'checkout')) ? 1 : 0);
|
||||
|
||||
$item_unpublished = ((isset($_REQUEST['draft'])) ? intval($_REQUEST['draft']) : 0);
|
||||
|
||||
|
@ -883,7 +884,7 @@ class Item extends Controller
|
|||
$body .= ((isset($_REQUEST['attachment'])) ? trim($_REQUEST['attachment']) : EMPTY_STR);
|
||||
$postopts = '';
|
||||
$haslocation = $lat || $lon;
|
||||
$allow_empty = (($checkin && $haslocation) || $_REQUEST['allow_empty']);
|
||||
$allow_empty = ((($checkin || $checkout) && $haslocation) || $_REQUEST['allow_empty']);
|
||||
$private = ((isset($private) && $private) ? $private : intval($acl->is_private() || ($public_policy)));
|
||||
|
||||
// If this is a comment, set the permissions from the parent.
|
||||
|
@ -978,6 +979,9 @@ class Item extends Controller
|
|||
if ($checkin) {
|
||||
$verb = 'Arrive';
|
||||
}
|
||||
if ($checkout) {
|
||||
$verb = 'Leave';
|
||||
}
|
||||
|
||||
if (in_array($mimetype, [ 'text/bbcode', 'text/x-multicode' ])) {
|
||||
// BBCODE alert: the following functions assume bbcode input
|
||||
|
@ -1187,7 +1191,7 @@ class Item extends Controller
|
|||
$lat = $hook_args['latitude'];
|
||||
$lon = $hook_args['longitude'];
|
||||
|
||||
if ($verb === 'Arrive') {
|
||||
if (in_array($verb, ['Arrive', 'Leave'])) {
|
||||
$body = preg_replace('/\[map=(.*?)\]/','', $body);
|
||||
$body = preg_replace('/\[map\](.*?)\[\/map\]/','', $body);
|
||||
|
||||
|
|
|
@ -170,7 +170,7 @@ function z_input_filter($s, $type = 'text/x-multicode', $allow_code = false)
|
|||
* @see HTMLPurifier
|
||||
*
|
||||
* @param string $s raw HTML
|
||||
* @param bool $allow_position allow CSS position
|
||||
* @param array $opts
|
||||
* @return string standards compliant filtered HTML
|
||||
*/
|
||||
function purify_html($s, $opts = [])
|
||||
|
|
Loading…
Reference in a new issue