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

This commit is contained in:
nobody 2021-04-13 21:13:47 -07:00
commit d945a2e93c
3 changed files with 22 additions and 5 deletions

View file

@ -378,8 +378,12 @@ class Item extends Controller {
$nocomment = 1 - intval($_REQUEST['comments_enabled']);
}
// this is in days, convert to absolute time
$channel_comments_closed = get_pconfig($profile_uid,'system','close_comments');
if (! intval($channel_comments_closed)) {
if (intval($channel_comments_closed)) {
$channel_comments_closed = datetime_convert(date_Default_timezone_get(),'UTC', 'now + ' . intval($channel_comments_closed) . ' days');
}
else {
$channel_comments_closed = NULL_DATE;
}
@ -1333,7 +1337,7 @@ class Item extends Controller {
$datarray['item_blocked'] = intval($item_blocked);
$datarray['layout_mid'] = $layout_mid;
$datarray['public_policy'] = $public_policy;
$datarray['comment_policy'] = ((ctype_digit($comment_policy)) ? map_scope($comment_policy) : $comment_policy); // only map scope if it is numeric, otherwise use what we have
$datarray['comment_policy'] = ((is_numeric($comment_policy)) ? map_scope($comment_policy) : $comment_policy); // only map scope if it is numeric, otherwise use what we have
$datarray['term'] = $post_tags;
$datarray['plink'] = $plink;
$datarray['route'] = $route;

View file

@ -1372,6 +1372,16 @@ function z_status_editor($x, $popup = false) {
}
$defclosecomm = ((($z = get_pconfig($x['profile_uid'], 'system', 'close_comments',0)) && (! $webpage)) ? intval($z) : '');
if($defclosecomm) {
$closecommdays = intval($defclosecomm);
}
else {
$closecommdays = EMPTY_STR;
}
$defcommuntil = (($closecommdays) ? datetime_convert('UTC', date_default_timezone_get(), 'now + ' . $closecommdays . ' days') : EMPTY_STR);
$defpublish = ((($z = get_pconfig($x['profile_uid'], 'system', 'default_post_publish')) && (! $webpage)) ? $z : '');
if($defpublish)
$defpublish = datetime_convert('UTC',date_default_timezone_get(),$defpublish,'Y-m-d H:i');
@ -1426,7 +1436,8 @@ function z_status_editor($x, $popup = false) {
}
}
$defcommpolicy = $limits['post_comments'];
// avoid illegal offset errors
if(! array_key_exists('permissions',$x))
$x['permissions'] = [ 'allow_cid' => '', 'allow_gid' => '', 'deny_cid' => '', 'deny_gid' => '' ];
@ -1493,6 +1504,8 @@ function z_status_editor($x, $popup = false) {
'$comments_closed' => ((isset($x['item']) && isset($x['item']['comments_closed']) && $x['item']['comments_closed']) ? $x['item']['comments_closed'] : ''),
'$commclosedate' => t('Disable comments after (date)'),
'$comment_perms' => $comment_perms,
'$defcommpolicy' => $defcommpolicy,
'$defcommuntil' => $defcommuntil,
'$clearloc' => $clearloc,
'$title' => ((x($x, 'title')) ? htmlspecialchars($x['title'], ENT_COMPAT,'UTF-8') : ''),
'$placeholdertitle' => ((x($x, 'placeholdertitle')) ? $x['placeholdertitle'] : t('Title (optional)')),

View file

@ -18,8 +18,8 @@
<input type="hidden" name="return" value="{{$return_path}}" />
<input type="hidden" name="location" id="jot-location" value="{{$defloc}}" />
<input type="hidden" name="expire" id="jot-expire" value="{{$defexpire}}" />
<input type="hidden" name="comments_closed" id="jot-commclosed" value="{{$defexpire}}" />
<input type="hidden" name="comments_from" id="jot-commfrom" value="{{$defexpire}}" />
<input type="hidden" name="comments_closed" id="jot-commclosed" value="{{$defcommuntil}}" />
<input type="hidden" name="comments_from" id="jot-commfrom" value="{{$defcommpolicy}}" />
<input type="hidden" name="created" id="jot-created" value="{{$defpublish}}" />
<input type="hidden" name="media_str" id="jot-media" value="" />
<input type="hidden" name="source" id="jot-source" value="{{$source}}" />