diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 459187329..cbbb49cdd 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -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; diff --git a/include/conversation.php b/include/conversation.php index 3a4332d2a..e7feb1e5c 100644 --- a/include/conversation.php +++ b/include/conversation.php @@ -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)')), diff --git a/view/tpl/jot.tpl b/view/tpl/jot.tpl index be0545dd0..3e2c8689a 100755 --- a/view/tpl/jot.tpl +++ b/view/tpl/jot.tpl @@ -18,8 +18,8 @@ - - + +