replaced the term "paste" with the more generic "document"

Some of the references to "paste" in code or comments got changed as well, but to clarify the intended usage of the terms:

- A PrivateBin document can consist of a paste text (key "paste" in the encrypted payload) and one or several attachments and discussion entries.
- Internally the root document is called a "Paste" and each discussion entry is called a "Discussion".
- When referring to a whole document with one paste and optional discussion(s), we call it just "document".
- When talking about a particular JSON payload type in the internal logic, i.e. during storage or transmission, we call them a paste or discussion to distinguish which type we refer to.

closes #397
This commit is contained in:
El RIDO 2025-07-24 10:46:31 +02:00
parent e2bf8ffb2d
commit ddd2d72064
No known key found for this signature in database
GPG key ID: 0F5C940A6BD81F92
62 changed files with 1141 additions and 1140 deletions

View file

@ -114,9 +114,9 @@ class Configuration
'js/dark-mode-switch.js' => 'sha512-BhY7dNU14aDN5L+muoUmA66x0CkYUWkQT0nxhKBLP/o2d7jE025+dvWJa4OiYffBGEFgmhrD/Sp+QMkxGMTz2g==',
'js/jquery-3.7.1.js' => 'sha512-v2CJ7UaYy4JwqLDIrZUI/4hqeoQieOmAZNXBeQyjo21dadnwR+8ZaIJVT8EE2iyI61OV8e6M8PP2/4hpQINQ/g==',
'js/kjua-0.10.0.js' => 'sha512-BYj4xggowR7QD150VLSTRlzH62YPfhpIM+b/1EUEr7RQpdWAGKulxWnOvjFx1FUlba4m6ihpNYuQab51H6XlYg==',
'js/legacy.js' => 'sha512-UxW/TOZKon83n6dk/09GsYKIyeO5LeBHokxyIq+r7KFS5KMBeIB/EM7NrkVYIezwZBaovnyNtY2d9tKFicRlXg==',
'js/legacy.js' => 'sha512-08+subq1Lo+r+la5ENqeXiMgNJcVaaTtBIFGkrjziSpvtgCId3Jtin4/OkSdHYSoeztwwIab8uvCzPKHta6puQ==',
'js/prettify.js' => 'sha512-puO0Ogy++IoA2Pb9IjSxV1n4+kQkKXYAEUtVzfZpQepyDPyXk8hokiYDS7ybMogYlyyEIwMLpZqVhCkARQWLMg==',
'js/privatebin.js' => 'sha512-gwzwJC0yMtonwX7zzx58e+mpYKUmuQYnuuyIC/Z0XOtYrZlR+DyDkP9hHqj6ejCyAV74SPA670+rUDnYQGS5/Q==',
'js/privatebin.js' => 'sha512-ytZMcsBxoon+uFaTyES2QBm0oN445Fu1iE4txInHaME1wpo3NUu02gxOvjrZhCimM59wTLgSMhm60BxE/DIm3w==',
'js/purify-3.2.6.js' => 'sha512-zqwL4OoBLFx89QPewkz4Lz5CSA2ktU+f31fuECkF0iK3Id5qd3Zpq5dMby8KwHjIEpsUgOqwF58cnmcaNem0EA==',
'js/showdown-2.1.0.js' => 'sha512-WYXZgkTR0u/Y9SVIA4nTTOih0kXMEd8RRV6MLFdL6YU8ymhR528NLlYQt1nlJQbYz4EW+ZsS0fx1awhiQJme1Q==',
'js/zlib-1.3.1-1.js' => 'sha512-5bU9IIP4PgBrOKLZvGWJD4kgfQrkTz8Z3Iqeu058mbQzW3mCumOU6M3UVbVZU9rrVoVwaW4cZK8U8h5xjF88eQ==',

View file

@ -37,11 +37,11 @@ class Controller
const MIN_PHP_VERSION = '7.4.0';
/**
* show the same error message if the paste expired or does not exist
* show the same error message if the document expired or does not exist
*
* @const string
*/
const GENERIC_ERROR = 'Paste does not exist, has expired or has been deleted.';
const GENERIC_ERROR = 'Document does not exist, has expired or has been deleted.';
/**
* configuration
@ -280,7 +280,7 @@ class Controller
$this->_return_message(
1,
I18n::_(
'Paste is limited to %s of encrypted data.',
'Document is limited to %s of encrypted data.',
Filter::formatHumanReadableSize($sizelimit)
)
);
@ -309,7 +309,7 @@ class Controller
try {
$this->_model->purge();
} catch (Exception $e) {
error_log('Error purging pastes: ' . $e->getMessage() . PHP_EOL .
error_log('Error purging documents: ' . $e->getMessage() . PHP_EOL .
'Use the administration scripts statistics to find ' .
'damaged paste IDs and either delete them or restore them ' .
'from backup.');
@ -327,7 +327,7 @@ class Controller
}
/**
* Delete an existing paste
* Delete an existing document
*
* @access private
* @param string $dataid
@ -338,16 +338,16 @@ class Controller
try {
$paste = $this->_model->getPaste($dataid);
if ($paste->exists()) {
// accessing this method ensures that the paste would be
// accessing this method ensures that the document would be
// deleted if it has already expired
$paste->get();
if (hash_equals($paste->getDeleteToken(), $deletetoken)) {
// Paste exists and deletion token is valid: Delete the paste.
// Document exists and deletion token is valid: Delete the it.
$paste->delete();
$this->_status = 'Paste was properly deleted.';
$this->_status = 'Document was properly deleted.';
$this->_is_deleted = true;
} else {
$this->_error = 'Wrong deletion token. Paste was not deleted.';
$this->_error = 'Wrong deletion token. Document was not deleted.';
}
} else {
$this->_error = self::GENERIC_ERROR;
@ -365,7 +365,7 @@ class Controller
}
/**
* Read an existing paste or comment, only allowed via a JSON API call
* Read an existing document, only allowed via a JSON API call
*
* @access private
* @param string $dataid
@ -402,7 +402,7 @@ class Controller
header('Content-Security-Policy: ' . $this->_conf->getKey('cspheader'));
header('Cross-Origin-Resource-Policy: same-origin');
header('Cross-Origin-Embedder-Policy: require-corp');
// disabled, because it prevents links from a paste to the same site to
// disabled, because it prevents links from a document to the same site to
// be opened. Didn't work with `same-origin-allow-popups` either.
// See issue https://github.com/PrivateBin/PrivateBin/issues/970 for details.
// header('Cross-Origin-Opener-Policy: same-origin');

View file

@ -46,7 +46,7 @@ class Comment extends AbstractModel
throw new Exception('Invalid data.', 67);
}
// Make sure the discussion is opened in this paste and in configuration.
// Make sure the discussion is opened in this paste and allowed in the configuration.
if (!$this->getPaste()->isOpendiscussion() || !$this->_conf->getKey('discussion')) {
throw new Exception('Invalid data.', 68);
}

View file

@ -181,7 +181,7 @@ class TrafficLimiter extends AbstractPersistence
return true;
}
}
throw new Exception(I18n::_('Your IP is not authorized to create pastes.'));
throw new Exception(I18n::_('Your IP is not authorized to create documents.'));
}
// disable limits if set to less then 1

View file

@ -75,7 +75,7 @@ class Request
private $_isJsonApi = false;
/**
* Return the paste ID of the current paste.
* Return the paste ID of the current document.
*
* @access private
* @return string