From 3327645fd40bc0791b6111087b3e2b66399514ff Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 14 Jun 2021 06:44:30 +0200 Subject: [PATCH] updated doc blocks, comments, fixed indentations, moved some constant strings --- lib/Data/AbstractData.php | 6 +++--- lib/Data/Database.php | 2 +- lib/Data/Filesystem.php | 27 +++++++++++++++++++-------- lib/Data/GoogleCloudStorage.php | 2 -- tst/Bootstrap.php | 2 +- 5 files changed, 24 insertions(+), 15 deletions(-) diff --git a/lib/Data/AbstractData.php b/lib/Data/AbstractData.php index 52a85a4..591b91f 100644 --- a/lib/Data/AbstractData.php +++ b/lib/Data/AbstractData.php @@ -15,7 +15,7 @@ namespace PrivateBin\Data; /** * AbstractData * - * Abstract model for PrivateBin data access, implemented as a singleton. + * Abstract model for data access, implemented as a singleton. */ abstract class AbstractData { @@ -40,7 +40,7 @@ abstract class AbstractData /** * Enforce singleton, disable constructor * - * Instantiate using {@link getInstance()}, privatebin is a singleton object. + * Instantiate using {@link getInstance()}, this object implements the singleton pattern. * * @access protected */ @@ -51,7 +51,7 @@ abstract class AbstractData /** * Enforce singleton, disable cloning * - * Instantiate using {@link getInstance()}, privatebin is a singleton object. + * Instantiate using {@link getInstance()}, this object implements the singleton pattern. * * @access private */ diff --git a/lib/Data/Database.php b/lib/Data/Database.php index 1d1327f..0c66d33 100644 --- a/lib/Data/Database.php +++ b/lib/Data/Database.php @@ -234,7 +234,7 @@ class Database extends AbstractData self::$_cache[$pasteid] = false; try { - $paste = self::_select( + $paste = self::_select( 'SELECT * FROM ' . self::_sanitizeIdentifier('paste') . ' WHERE dataid = ?', array($pasteid), true ); diff --git a/lib/Data/Filesystem.php b/lib/Data/Filesystem.php index 9b8e7ba..25cca45 100644 --- a/lib/Data/Filesystem.php +++ b/lib/Data/Filesystem.php @@ -23,12 +23,19 @@ use PrivateBin\Json; class Filesystem extends AbstractData { /** - * first line in file, to protect its contents + * first line in paste or comment files, to protect their contents from browsing exposed data directories * * @const string */ const PROTECTION_LINE = '_info = $info; $this->_connection = $connection; $timeCreated = new Datetime(); - $this->_info['metadata']['timeCreated'] = $timeCreated->format(GoogleCloudStorage::DATETIME_FORMAT); + $this->_info['metadata']['timeCreated'] = $timeCreated->format('Y-m-d\TH:i:s.u\Z'); } public function acl()