mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-12-29 13:15:44 +01:00
allow disabling comment date display using discussiondatedisplay
configuration option
This commit is contained in:
parent
5421e8e558
commit
0f9158b37b
7 changed files with 31 additions and 14 deletions
|
@ -5,7 +5,7 @@
|
|||
* ADDED: Input sanitation to some not yet filtered query and server parameters
|
||||
* CHANGED: "Send" button now labeled "Create" (#946)
|
||||
* CHANGED: drop some PHP < 5.6 fallbacks, minimum version is PHP 7.3 as of release 1.6.0
|
||||
* CHANGED: `create` attribute is no longer returned in API for pastes (#1290)
|
||||
* CHANGED: `create` attribute is no longer returned in API for pastes & can be disabled for comments using `discussiondatedisplay` as well (#1290)
|
||||
* FIXED: Add cache control headers also to API calls (#1263)
|
||||
* FIXED: Shortened paste URL does not appear in email (#606)
|
||||
|
||||
|
|
|
@ -18,6 +18,11 @@ discussion = true
|
|||
; preselect the discussion feature, defaults to false
|
||||
opendiscussion = false
|
||||
|
||||
; enable or disable the diplay of dates & times in the comments, defaults to true
|
||||
; note that internally the creation time will still get tracked in order to sort
|
||||
; the comments by creation time, but you can choose not to display them
|
||||
; discussiondatedisplay = false
|
||||
|
||||
; enable or disable the password feature, defaults to true
|
||||
password = true
|
||||
|
||||
|
@ -242,7 +247,7 @@ dir = PATH "data"
|
|||
; - AWS_ACCESS_KEY_ID
|
||||
; - AWS_SECRET_ACCESS_KEY
|
||||
; - AWS_SESSION_TOKEN (if needed)
|
||||
; for more details, see https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html#default-credential-chain
|
||||
; for more details, see https://docs.aws.amazon.com/sdk-for-php/v3/developer-guide/guide_credentials.html#default-credential-chain
|
||||
;class = S3Storage
|
||||
;[model_options]
|
||||
;region = "eu-central-1"
|
||||
|
@ -264,4 +269,4 @@ dir = PATH "data"
|
|||
; (optional) the "signature" (access key) issued by YOURLS for the using account
|
||||
; signature = ""
|
||||
; (optional) the URL of the YOURLS API, called to shorten a PrivateBin URL
|
||||
; apiurl = "https://yourls.example.com/yourls-api.php"
|
||||
; apiurl = "https://yourls.example.com/yourls-api.php"
|
||||
|
|
|
@ -196,7 +196,7 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
*/
|
||||
this.getCreated = function()
|
||||
{
|
||||
return this.meta[this.v === 1 ? 'postdate' : 'created'];
|
||||
return this.meta[this.v === 1 ? 'postdate' : 'created'] || 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -3484,9 +3484,11 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
|||
}
|
||||
|
||||
// set date
|
||||
const created = comment.getCreated();
|
||||
const commentDate = created == 0 ? '' : ' (' + (new Date(created * 1000).toLocaleString()) + ')';
|
||||
$commentEntry.find('span.commentdate')
|
||||
.text(' (' + (new Date(comment.getCreated() * 1000).toLocaleString()) + ')')
|
||||
.attr('title', 'CommentID: ' + comment.id);
|
||||
.text(commentDate)
|
||||
.attr('title', 'CommentID: ' + comment.id);
|
||||
|
||||
// if an avatar is available, display it
|
||||
const icon = comment.getIcon();
|
||||
|
|
|
@ -40,6 +40,7 @@ class Configuration
|
|||
'basepath' => '',
|
||||
'discussion' => true,
|
||||
'opendiscussion' => false,
|
||||
'discussiondatedisplay' => true,
|
||||
'password' => true,
|
||||
'fileupload' => false,
|
||||
'burnafterreadingselected' => false,
|
||||
|
|
|
@ -47,11 +47,10 @@ class Paste extends AbstractModel
|
|||
$data['meta']['time_to_live'] = $data['meta']['expire_date'] - time();
|
||||
unset($data['meta']['expire_date']);
|
||||
}
|
||||
if (array_key_exists('created', $data['meta'])) {
|
||||
unset($data['meta']['created']);
|
||||
}
|
||||
if (array_key_exists('postdate', $data['meta'])) {
|
||||
unset($data['meta']['postdate']);
|
||||
foreach (array('created', 'postdate') as $key) {
|
||||
if (array_key_exists($key, $data['meta'])) {
|
||||
unset($data['meta'][$key]);
|
||||
}
|
||||
}
|
||||
|
||||
// check if non-expired burn after reading paste needs to be deleted
|
||||
|
@ -164,7 +163,17 @@ class Paste extends AbstractModel
|
|||
*/
|
||||
public function getComments()
|
||||
{
|
||||
return $this->_store->readComments($this->getId());
|
||||
if ($this->_conf->getKey('discussiondatedisplay')) {
|
||||
return $this->_store->readComments($this->getId());
|
||||
}
|
||||
return array_map(function($comment) {
|
||||
foreach (array('created', 'postdate') as $key) {
|
||||
if (array_key_exists($key, $comment['meta'])) {
|
||||
unset($comment['meta'][$key]);
|
||||
}
|
||||
}
|
||||
return $comment;
|
||||
}, $this->_store->readComments($this->getId()));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -73,7 +73,7 @@ endif;
|
|||
?>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/purify-3.0.8.js" integrity="sha512-wWBDKh5wYGtJ1Df+PPZIn59jHVBnJ4/Yb2W/pVnzaXab8cmlZnHVx+FEBGu5JX39s3P2Qlt+aNQou0XnjW86hg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-I0F8qtFtaBvVvTThlXa63q0fLptZHP+hg9SbUqZ/qpimAPvHYGFfRj06aqEvECByNgKlQOWab3p8NQ2waDZ+fQ==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-q2+Xxj6aqq8VCdEZs60z/nQTeHYb400bmfyWVh7gIICdNEz2LIVt95hH/DMVDr3pv+vkIcdDL8va5J9rtaY6WA==" crossorigin="anonymous"></script>
|
||||
<!-- icon -->
|
||||
<link rel="apple-touch-icon" href="<?php echo I18n::encode($BASEPATH); ?>img/apple-touch-icon.png" sizes="180x180" />
|
||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png" sizes="32x32" />
|
||||
|
|
|
@ -51,7 +51,7 @@ endif;
|
|||
?>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/purify-3.0.8.js" integrity="sha512-wWBDKh5wYGtJ1Df+PPZIn59jHVBnJ4/Yb2W/pVnzaXab8cmlZnHVx+FEBGu5JX39s3P2Qlt+aNQou0XnjW86hg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/legacy.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-LYos+qXHIRqFf5ZPNphvtTB0cgzHUizu2wwcOwcwz/VIpRv9lpcBgPYz4uq6jx0INwCAj6Fbnl5HoKiLufS2jg==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-I0F8qtFtaBvVvTThlXa63q0fLptZHP+hg9SbUqZ/qpimAPvHYGFfRj06aqEvECByNgKlQOWab3p8NQ2waDZ+fQ==" crossorigin="anonymous"></script>
|
||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-q2+Xxj6aqq8VCdEZs60z/nQTeHYb400bmfyWVh7gIICdNEz2LIVt95hH/DMVDr3pv+vkIcdDL8va5J9rtaY6WA==" crossorigin="anonymous"></script>
|
||||
<!-- icon -->
|
||||
<link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
|
||||
<link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
|
||||
|
|
Loading…
Reference in a new issue