renaming the fork to PrivateBin

This commit is contained in:
El RIDO
2016-07-11 11:58:15 +02:00
parent 6a663ba07f
commit 79509ad48a
48 changed files with 320 additions and 315 deletions

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
@@ -71,7 +71,7 @@ class configuration
'dir' => 'data',
),
'model' => array(
'class' => 'zerobin_data',
'class' => 'privatebin_data',
),
'model_options' => array(
'dir' => 'data',
@@ -92,7 +92,7 @@ class configuration
$config = parse_ini_file($configFile, true);
foreach (array('main', 'model') as $section) {
if (!array_key_exists($section, $config)) {
throw new Exception(i18n::_('ZeroBin requires configuration section [%s] to be present in configuration file.', $section), 2);
throw new Exception(i18n::_('PrivateBin requires configuration section [%s] to be present in configuration file.', $section), 2);
}
}
}
@@ -110,7 +110,7 @@ class configuration
continue;
}
// provide different defaults for database model
elseif ($section == 'model_options' && $this->_configuration['model']['class'] == 'zerobin_db')
elseif ($section == 'model_options' && $this->_configuration['model']['class'] == 'privatebin_db')
{
$values = array(
'dsn' => 'sqlite:' . PATH . 'data/db.sq3',
@@ -228,7 +228,7 @@ class configuration
{
if (!array_key_exists($section, $this->_configuration))
{
throw new Exception(i18n::_('ZeroBin requires configuration section [%s] to be present in configuration file.', $section), 3);
throw new Exception(i18n::_('PrivateBin requires configuration section [%s] to be present in configuration file.', $section), 3);
}
return $this->_configuration[$section];
}

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
@@ -13,7 +13,7 @@
/**
* model
*
* Factory of ZeroBin instance models.
* Factory of PrivateBin instance models.
*/
class model
{
@@ -27,7 +27,7 @@ class model
/**
* Data storage.
*
* @var zerobin_abstract
* @var privatebin_abstract
*/
private $_store = null;
@@ -61,11 +61,16 @@ class model
{
if ($this->_store === null)
{
// added option to support old config file format
$model = str_replace(
'zerobin_', 'privatebin_',
$this->_conf->getKey('class', 'model')
);
$this->_store = forward_static_call(
array($this->_conf->getKey('class', 'model'), 'getInstance'),
array($model, 'getInstance'),
$this->_conf->getSection('model_options')
);
}
return $this->_store;
}
}
}

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
@@ -13,7 +13,7 @@
/**
* model_abstract
*
* Abstract model for ZeroBin objects.
* Abstract model for PrivateBin objects.
*/
abstract class model_abstract
{
@@ -45,7 +45,7 @@ abstract class model_abstract
* Data storage.
*
* @access protected
* @var zerobin_abstract
* @var privatebin_abstract
*/
protected $_store;
@@ -54,10 +54,10 @@ abstract class model_abstract
*
* @access public
* @param configuration $configuration
* @param zerobin_abstract $storage
* @param privatebin_abstract $storage
* @return void
*/
public function __construct(configuration $configuration, zerobin_abstract $storage)
public function __construct(configuration $configuration, privatebin_abstract $storage)
{
$this->_conf = $configuration;
$this->_store = $storage;

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
@@ -13,7 +13,7 @@
/**
* model_comment
*
* Model of a ZeroBin comment.
* Model of a PrivateBin comment.
*/
class model_comment extends model_abstract
{

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
@@ -13,7 +13,7 @@
/**
* model_paste
*
* Model of a ZeroBin paste.
* Model of a PrivateBin paste.
*/
class model_paste extends model_abstract
{
@@ -27,7 +27,7 @@ class model_paste extends model_abstract
public function get()
{
$this->_data = $this->_store->read($this->getId());
if ($this->_data === false) throw new Exception(zerobin::GENERIC_ERROR, 64);
if ($this->_data === false) throw new Exception(privatebin::GENERIC_ERROR, 64);
// check if paste has expired and delete it if neccessary.
if (property_exists($this->_data->meta, 'expire_date'))
@@ -35,7 +35,7 @@ class model_paste extends model_abstract
if ($this->_data->meta->expire_date < time())
{
$this->delete();
throw new Exception(zerobin::GENERIC_ERROR, 63);
throw new Exception(privatebin::GENERIC_ERROR, 63);
}
// We kindly provide the remaining time before expiration (in seconds)
$this->_data->meta->remaining_time = $this->_data->meta->expire_date - time();
@@ -153,7 +153,7 @@ class model_paste extends model_abstract
*
* The token is the hmac of the pastes ID signed with the server salt.
* The paste can be deleted by calling:
* http://example.com/zerobin/?pasteid=<pasteid>&deletetoken=<deletetoken>
* http://example.com/privatebin/?pasteid=<pasteid>&deletetoken=<deletetoken>
*
* @access public
* @return string

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22

View File

@@ -1,21 +1,21 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
*/
/**
* zerobin
* privatebin
*
* Controller, puts it all together.
*/
class zerobin
class privatebin
{
/**
* version
@@ -106,7 +106,7 @@ class zerobin
/**
* constructor
*
* initializes and runs ZeroBin
* initializes and runs PrivateBin
*
* @access public
* @return void
@@ -115,7 +115,7 @@ class zerobin
{
if (version_compare(PHP_VERSION, '5.2.6') < 0)
{
throw new Exception(i18n::_('ZeroBin requires php 5.2.6 or above to work. Sorry.'), 1);
throw new Exception(i18n::_('PrivateBin requires php 5.2.6 or above to work. Sorry.'), 1);
}
// load config from ini file
@@ -156,7 +156,7 @@ class zerobin
}
/**
* initialize zerobin
* initialize privatebin
*
* @access private
* @return void
@@ -388,7 +388,7 @@ class zerobin
}
/**
* Display ZeroBin frontend.
* Display PrivateBin frontend.
*
* @access private
* @return void

View File

@@ -1,35 +1,35 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
*/
/**
* zerobin_abstract
* privatebin_abstract
*
* Abstract model for ZeroBin data access, implemented as a singleton.
* Abstract model for PrivateBin data access, implemented as a singleton.
*/
abstract class zerobin_abstract
abstract class privatebin_abstract
{
/**
* singleton instance
*
* @access protected
* @static
* @var zerobin_abstract
* @var privatebin_abstract
*/
protected static $_instance = null;
/**
* enforce singleton, disable constructor
*
* Instantiate using {@link getInstance()}, zerobin is a singleton object.
* Instantiate using {@link getInstance()}, privatebin is a singleton object.
*
* @access protected
*/
@@ -38,7 +38,7 @@ abstract class zerobin_abstract
/**
* enforce singleton, disable cloning
*
* Instantiate using {@link getInstance()}, zerobin is a singleton object.
* Instantiate using {@link getInstance()}, privatebin is a singleton object.
*
* @access private
*/
@@ -50,7 +50,7 @@ abstract class zerobin_abstract
* @access public
* @static
* @param array $options
* @return zerobin_abstract
* @return privatebin_abstract
*/
public static function getInstance($options) {}

View File

@@ -1,21 +1,21 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
*/
/**
* zerobin_data
* privatebin_data
*
* Model for data access, implemented as a singleton.
*/
class zerobin_data extends zerobin_abstract
class privatebin_data extends privatebin_abstract
{
/**
* directory where data is stored
@@ -32,7 +32,7 @@ class zerobin_data extends zerobin_abstract
* @access public
* @static
* @param array $options
* @return zerobin_data
* @return privatebin_data
*/
public static function getInstance($options = null)
{
@@ -42,7 +42,7 @@ class zerobin_data extends zerobin_abstract
array_key_exists('dir', $options)
) self::$_dir = $options['dir'] . DIRECTORY_SEPARATOR;
// if needed initialize the singleton
if(!(self::$_instance instanceof zerobin_data)) {
if(!(self::$_instance instanceof privatebin_data)) {
self::$_instance = new self;
self::_init();
}
@@ -211,7 +211,7 @@ class zerobin_data extends zerobin_abstract
}
/**
* initialize zerobin
* initialize privatebin
*
* @access private
* @static

View File

@@ -1,21 +1,21 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
*/
/**
* zerobin_db
* privatebin_db
*
* Model for DB access, implemented as a singleton.
*/
class zerobin_db extends zerobin_abstract
class privatebin_db extends privatebin_abstract
{
/**
* cache for select queries
@@ -58,12 +58,12 @@ class zerobin_db extends zerobin_abstract
* @static
* @param array $options
* @throws Exception
* @return zerobin_db
* @return privatebin_db
*/
public static function getInstance($options = null)
{
// if needed initialize the singleton
if(!(self::$_instance instanceof zerobin_db)) {
if(!(self::$_instance instanceof privatebin_db)) {
self::$_instance = new self;
}
@@ -116,7 +116,7 @@ class zerobin_db extends zerobin_abstract
}
// create config table if necessary
$db_version = zerobin::VERSION;
$db_version = privatebin::VERSION;
if (!in_array(self::$_prefix . 'config', $tables))
{
self::_createConfigTable();
@@ -129,7 +129,7 @@ class zerobin_db extends zerobin_abstract
}
// update database structure if necessary
if (version_compare($db_version, zerobin::VERSION, '<'))
if (version_compare($db_version, privatebin::VERSION, '<'))
{
self::_upgradeDatabase($db_version);
}
@@ -588,7 +588,7 @@ class zerobin_db extends zerobin_abstract
);
self::_exec(
'INSERT INTO ' . self::$_prefix . 'config VALUES(?,?)',
array('VERSION', zerobin::VERSION)
array('VERSION', privatebin::VERSION)
);
}

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22
@@ -13,12 +13,12 @@
/**
* serversalt
*
* This is a random string which is unique to each ZeroBin installation.
* This is a random string which is unique to each PrivateBin installation.
* It is automatically created if not present.
*
* Salt is used:
* - to generate unique VizHash in discussions (which are not reproductible across ZeroBin servers)
* - to generate unique deletion token (which are not re-usable across ZeroBin servers)
* - to generate unique VizHash in discussions (which are not reproductible across PrivateBin servers)
* - to generate unique deletion token (which are not re-usable across PrivateBin servers)
*/
class serversalt extends persistence
{

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22

View File

@@ -1,10 +1,10 @@
<?php
/**
* ZeroBin
* PrivateBin
*
* a zero-knowledge paste bin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.22

View File

@@ -3,12 +3,12 @@
* VizHash_GD
*
* Visual Hash implementation in php4+GD,
* stripped down and modified version for ZeroBin
* stripped down and modified version for PrivateBin
*
* @link http://sebsauvage.net/wiki/doku.php?id=php:vizhash_gd
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.0.4 beta ZeroBin 0.22
* @version 0.0.4 beta PrivateBin 0.22
*/
/**