Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8db98becb7 | ||
|
|
b5ebc4a3d7 | ||
|
|
fb6a9ccf09 | ||
|
|
10201dc463 | ||
|
|
c468b74b9b | ||
|
|
e4cc9ef4f6 | ||
|
|
9a5be5521b | ||
|
|
0319a16b15 | ||
|
|
1be1047a94 | ||
|
|
a5e8eeaaf9 | ||
|
|
4a35428499 | ||
|
|
3470dcd9a8 | ||
|
|
5db3412b69 | ||
|
|
f9c8441edb | ||
|
|
90e83ddb30 | ||
|
|
c3c1473dc9 | ||
|
|
676a02619d | ||
|
|
119c3931cc |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -1,6 +1,14 @@
|
|||||||
# PrivateBin version history
|
# PrivateBin version history
|
||||||
|
|
||||||
* **1.2 (not yet released)**
|
* **1.3 (not yet released)**
|
||||||
|
* **1.2.1 (2018-08-11)**
|
||||||
|
* ADDED: Add support for mega.nz links in pastes and comments (#331)
|
||||||
|
* CHANGED: Added some missing Russian translations (#348)
|
||||||
|
* CHANGED: Minor PHP refactoring: Rename PrivateBin class to Controller, improved logic of some persistence classes (#342)
|
||||||
|
* CHANGED: Upgrading DOMpurify library to 1.0.7
|
||||||
|
* FIXED: Ensure legacy browsers without webcrypto support can't create paste keys with insufficient entropy (#346)
|
||||||
|
* FIXED: Re-add support for old browsers (Firefox<21, Chrome<31, Safari<7, IE<11), broken in 1.2, will be removed again in 1.3
|
||||||
|
* **1.2 (2018-07-22)**
|
||||||
* ADDED: Translations for Spanish, Occitan, Norwegian, Portuguese, Dutch and Hungarian
|
* ADDED: Translations for Spanish, Occitan, Norwegian, Portuguese, Dutch and Hungarian
|
||||||
* ADDED: Option in configuration to change the default "PrivateBin" title of the site
|
* ADDED: Option in configuration to change the default "PrivateBin" title of the site
|
||||||
* ADDED: Added display of video, audio & PDF, drag & drop, preview of attachments (#182)
|
* ADDED: Added display of video, audio & PDF, drag & drop, preview of attachments (#182)
|
||||||
|
|||||||
@@ -165,7 +165,7 @@ CREATE INDEX parent ON prefix_comment(pasteid);
|
|||||||
CREATE TABLE prefix_config (
|
CREATE TABLE prefix_config (
|
||||||
id CHAR(16) NOT NULL, value TEXT, PRIMARY KEY (id)
|
id CHAR(16) NOT NULL, value TEXT, PRIMARY KEY (id)
|
||||||
);
|
);
|
||||||
INSERT INTO prefix_config VALUES('VERSION', '1.2');
|
INSERT INTO prefix_config VALUES('VERSION', '1.2.1');
|
||||||
```
|
```
|
||||||
|
|
||||||
In **PostgreSQL**, the data, attachment, nickname and vizhash columns needs to be TEXT and not BLOB or MEDIUMBLOB.
|
In **PostgreSQL**, the data, attachment, nickname and vizhash columns needs to be TEXT and not BLOB or MEDIUMBLOB.
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
[](https://www.codacy.com/app/PrivateBin/PrivateBin)
|
[](https://www.codacy.com/app/PrivateBin/PrivateBin)
|
||||||
[](https://codeclimate.com/github/PrivateBin/PrivateBin/coverage) [](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/?branch=master)
|
[](https://codeclimate.com/github/PrivateBin/PrivateBin/coverage) [](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/?branch=master)
|
||||||
|
|
||||||
*Current version: 1.2*
|
*Current version: 1.2.1*
|
||||||
|
|
||||||
**PrivateBin** is a minimalist, open source online [pastebin](https://en.wikipedia.org/wiki/Pastebin)
|
**PrivateBin** is a minimalist, open source online [pastebin](https://en.wikipedia.org/wiki/Pastebin)
|
||||||
where the server has zero knowledge of pasted data.
|
where the server has zero knowledge of pasted data.
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
body {
|
body {
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* When there is no script at all other */
|
/* When there is no script at all other */
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* CSS Reset from YUI 3.4.1 (build 4118) - Copyright 2011 Yahoo! Inc. All rights reserved.
|
/* CSS Reset from YUI 3.4.1 (build 4118) - Copyright 2011 Yahoo! Inc. All rights reserved.
|
||||||
|
|||||||
@@ -142,8 +142,8 @@
|
|||||||
"The cloned file '%s' was attached to this paste.":
|
"The cloned file '%s' was attached to this paste.":
|
||||||
"Дубликат файла '%s' был прикреплен к этой записи.",
|
"Дубликат файла '%s' был прикреплен к этой записи.",
|
||||||
"Attach a file": "Прикрепить файл",
|
"Attach a file": "Прикрепить файл",
|
||||||
"alternatively drag & drop a file or paste an image from the clipboard": "alternatively drag & drop a file or paste an image from the clipboard",
|
"alternatively drag & drop a file or paste an image from the clipboard": "так же можно перенести файл в окно браузера или вставить изображение из буфера",
|
||||||
"File too large, to display a preview. Please download the attachment.": "File too large, to display a preview. Please download the attachment.",
|
"File too large, to display a preview. Please download the attachment.": "Файл слишком большой для отображения предпросмотра. Пожалуйста скачайте прикрепленный файл.",
|
||||||
"Remove attachment": "Удалить вложение",
|
"Remove attachment": "Удалить вложение",
|
||||||
"Your browser does not support uploading encrypted files. Please use a newer browser.":
|
"Your browser does not support uploading encrypted files. Please use a newer browser.":
|
||||||
"Ваш браузер не поддерживает отправку зашифрованных файлов. Используйте более новый браузер.",
|
"Ваш браузер не поддерживает отправку зашифрованных файлов. Используйте более новый браузер.",
|
||||||
@@ -165,5 +165,5 @@
|
|||||||
"Если данное сообщение не исчезает длительное время, посмотрите <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">этот FAQ с информацией о возможном решении проблемы (на английском)</a>.",
|
"Если данное сообщение не исчезает длительное время, посмотрите <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">этот FAQ с информацией о возможном решении проблемы (на английском)</a>.",
|
||||||
"+++ no paste text +++": "+++ в записи нет текста +++",
|
"+++ no paste text +++": "+++ в записи нет текста +++",
|
||||||
"Could not get paste data: %s":
|
"Could not get paste data: %s":
|
||||||
"Could not get paste data: %s"
|
"Не удалось получить данные записи: %s"
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// change this, if your php files and data is outside of your webservers document root
|
// change this, if your php files and data is outside of your webservers document root
|
||||||
@@ -15,4 +15,4 @@ define('PATH', '');
|
|||||||
|
|
||||||
define('PUBLIC_PATH', __DIR__);
|
define('PUBLIC_PATH', __DIR__);
|
||||||
require PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
require PATH . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
|
||||||
new PrivateBin\PrivateBin;
|
new PrivateBin\Controller;
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ require('./prettify');
|
|||||||
global.prettyPrint = window.PR.prettyPrint;
|
global.prettyPrint = window.PR.prettyPrint;
|
||||||
global.prettyPrintOne = window.PR.prettyPrintOne;
|
global.prettyPrintOne = window.PR.prettyPrintOne;
|
||||||
global.showdown = require('./showdown-1.8.6');
|
global.showdown = require('./showdown-1.8.6');
|
||||||
global.DOMPurify = require('./purify-1.0.5');
|
global.DOMPurify = require('./purify-1.0.7');
|
||||||
require('./bootstrap-3.3.7');
|
require('./bootstrap-3.3.7');
|
||||||
require('./privatebin');
|
require('./privatebin');
|
||||||
|
|
||||||
@@ -26,6 +26,7 @@ var a2zString = ['a','b','c','d','e','f','g','h','i','j','k','l','m',
|
|||||||
'n','o','p','q','r','s','t','u','v','w','x','y','z'],
|
'n','o','p','q','r','s','t','u','v','w','x','y','z'],
|
||||||
alnumString = a2zString.concat(['0','1','2','3','4','5','6','7','8','9']),
|
alnumString = a2zString.concat(['0','1','2','3','4','5','6','7','8','9']),
|
||||||
queryString = alnumString.concat(['+','%','&','.','*','-','_']),
|
queryString = alnumString.concat(['+','%','&','.','*','-','_']),
|
||||||
|
hashString = queryString.concat(['!']),
|
||||||
base64String = alnumString.concat(['+','/','=']).concat(
|
base64String = alnumString.concat(['+','/','=']).concat(
|
||||||
a2zString.map(function(c) {
|
a2zString.map(function(c) {
|
||||||
return c.toUpperCase();
|
return c.toUpperCase();
|
||||||
@@ -127,6 +128,11 @@ exports.jscQueryString = function() {
|
|||||||
return jsc.elements(queryString);
|
return jsc.elements(queryString);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// provides random characters allowed in hash queries
|
||||||
|
exports.jscHashString = function() {
|
||||||
|
return jsc.elements(hashString);
|
||||||
|
};
|
||||||
|
|
||||||
// provides random characters allowed in base64 encoded strings
|
// provides random characters allowed in base64 encoded strings
|
||||||
exports.jscBase64String = function() {
|
exports.jscBase64String = function() {
|
||||||
return jsc.elements(base64String);
|
return jsc.elements(base64String);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
* @see {@link https://github.com/PrivateBin/PrivateBin}
|
* @see {@link https://github.com/PrivateBin/PrivateBin}
|
||||||
* @copyright 2012 Sébastien SAUVAGE ({@link http://sebsauvage.net})
|
* @copyright 2012 Sébastien SAUVAGE ({@link http://sebsauvage.net})
|
||||||
* @license {@link https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License}
|
* @license {@link https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License}
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
* @name PrivateBin
|
* @name PrivateBin
|
||||||
* @namespace
|
* @namespace
|
||||||
*/
|
*/
|
||||||
@@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
// Immediately start random number generator collector.
|
// Immediately start random number generator collector.
|
||||||
sjcl.random.startCollectors();
|
sjcl.random.startCollectors();
|
||||||
|
// Setting this to 10 ensures 1024 bits of entropy get collected before generating the paste key
|
||||||
|
sjcl.random.setDefaultParanoia(10);
|
||||||
|
|
||||||
// main application start, called when DOM is fully loaded
|
// main application start, called when DOM is fully loaded
|
||||||
jQuery(document).ready(function() {
|
jQuery(document).ready(function() {
|
||||||
@@ -145,7 +147,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
|||||||
me.urls2links = function(html)
|
me.urls2links = function(html)
|
||||||
{
|
{
|
||||||
return html.replace(
|
return html.replace(
|
||||||
/(((http|https|ftp):\/\/[\w?=&.\/-;#@~%+*-]+(?![\w\s?&.\/;#~%"=-]*>))|((magnet):[\w?=&.\/-;#@~%+*-]+))/ig,
|
/(((https?|ftp):\/\/[\w?!=&.\/-;#@~%+*-]+(?![\w\s?!&.\/;#~%"=-]*>))|((magnet):[\w?=&.\/-;#@~%+*-]+))/ig,
|
||||||
'<a href="$1" rel="nofollow">$1</a>'
|
'<a href="$1" rel="nofollow">$1</a>'
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
@@ -229,7 +231,8 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
|||||||
return baseUri;
|
return baseUri;
|
||||||
}
|
}
|
||||||
|
|
||||||
baseUri = window.location.origin + window.location.pathname;
|
// window.location.origin is a newer alternative, but requires FF 21 / Chrome 31 / Safari 7 / IE 11
|
||||||
|
baseUri = window.location.protocol + '//' + window.location.host + window.location.pathname;
|
||||||
return baseUri;
|
return baseUri;
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -640,7 +643,7 @@ jQuery.PrivateBin = (function($, sjcl, Base64, RawDeflate) {
|
|||||||
*/
|
*/
|
||||||
me.getSymmetricKey = function()
|
me.getSymmetricKey = function()
|
||||||
{
|
{
|
||||||
return sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 0), 0);
|
return sjcl.codec.base64.fromBits(sjcl.random.randomWords(8, 10), 0);
|
||||||
};
|
};
|
||||||
|
|
||||||
return me;
|
return me;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
1
js/purify-1.0.7.js
Normal file
1
js/purify-1.0.7.js
Normal file
File diff suppressed because one or more lines are too long
@@ -94,7 +94,7 @@ describe('Helper', function () {
|
|||||||
jsc.elements(['http', 'https', 'ftp']),
|
jsc.elements(['http', 'https', 'ftp']),
|
||||||
jsc.nearray(common.jscA2zString()),
|
jsc.nearray(common.jscA2zString()),
|
||||||
jsc.array(common.jscQueryString()),
|
jsc.array(common.jscQueryString()),
|
||||||
jsc.array(common.jscQueryString()),
|
jsc.array(common.jscHashString()),
|
||||||
'string',
|
'string',
|
||||||
function (prefix, schema, address, query, fragment, postfix) {
|
function (prefix, schema, address, query, fragment, postfix) {
|
||||||
var query = query.join(''),
|
var query = query.join(''),
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ describe('Model', function () {
|
|||||||
'returns the query string without separator, if any',
|
'returns the query string without separator, if any',
|
||||||
jsc.nearray(common.jscA2zString()),
|
jsc.nearray(common.jscA2zString()),
|
||||||
jsc.nearray(common.jscA2zString()),
|
jsc.nearray(common.jscA2zString()),
|
||||||
jsc.nearray(common.jscQueryString()),
|
jsc.nearray(common.jscHashString()),
|
||||||
'string',
|
'string',
|
||||||
function (schema, address, query, fragment) {
|
function (schema, address, query, fragment) {
|
||||||
var queryString = query.join(''),
|
var queryString = query.join(''),
|
||||||
@@ -145,7 +145,7 @@ describe('Model', function () {
|
|||||||
jsc.nearray(common.jscA2zString()),
|
jsc.nearray(common.jscA2zString()),
|
||||||
jsc.array(common.jscQueryString()),
|
jsc.array(common.jscQueryString()),
|
||||||
jsc.nearray(common.jscBase64String()),
|
jsc.nearray(common.jscBase64String()),
|
||||||
jsc.array(common.jscQueryString()),
|
jsc.array(common.jscHashString()),
|
||||||
function (schema, address, query, fragment, trail) {
|
function (schema, address, query, fragment, trail) {
|
||||||
var fragmentString = fragment.join(''),
|
var fragmentString = fragment.join(''),
|
||||||
clean = jsdom('', {
|
clean = jsdom('', {
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
@@ -17,18 +17,18 @@ use PrivateBin\Persistence\ServerSalt;
|
|||||||
use PrivateBin\Persistence\TrafficLimiter;
|
use PrivateBin\Persistence\TrafficLimiter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PrivateBin
|
* Controller
|
||||||
*
|
*
|
||||||
* Controller, puts it all together.
|
* Puts it all together.
|
||||||
*/
|
*/
|
||||||
class PrivateBin
|
class Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* version
|
* version
|
||||||
*
|
*
|
||||||
* @const string
|
* @const string
|
||||||
*/
|
*/
|
||||||
const VERSION = '1.2';
|
const VERSION = '1.2.1';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* minimal required PHP version
|
* minimal required PHP version
|
||||||
@@ -151,7 +151,7 @@ class PrivateBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* initialize privatebin
|
* initialize PrivateBin
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
@@ -368,7 +368,7 @@ class PrivateBin
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display PrivateBin frontend.
|
* Display frontend.
|
||||||
*
|
*
|
||||||
* @access private
|
* @access private
|
||||||
*/
|
*/
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Data;
|
namespace PrivateBin\Data;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Data;
|
namespace PrivateBin\Data;
|
||||||
@@ -15,7 +15,7 @@ namespace PrivateBin\Data;
|
|||||||
use Exception;
|
use Exception;
|
||||||
use PDO;
|
use PDO;
|
||||||
use PDOException;
|
use PDOException;
|
||||||
use PrivateBin\PrivateBin;
|
use PrivateBin\Controller;
|
||||||
use stdClass;
|
use stdClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -122,7 +122,7 @@ class Database extends AbstractData
|
|||||||
}
|
}
|
||||||
|
|
||||||
// create config table if necessary
|
// create config table if necessary
|
||||||
$db_version = PrivateBin::VERSION;
|
$db_version = Controller::VERSION;
|
||||||
if (!in_array(self::_sanitizeIdentifier('config'), $tables)) {
|
if (!in_array(self::_sanitizeIdentifier('config'), $tables)) {
|
||||||
self::_createConfigTable();
|
self::_createConfigTable();
|
||||||
// if we only needed to create the config table, the DB is older then 0.22
|
// if we only needed to create the config table, the DB is older then 0.22
|
||||||
@@ -134,7 +134,7 @@ class Database extends AbstractData
|
|||||||
}
|
}
|
||||||
|
|
||||||
// update database structure if necessary
|
// update database structure if necessary
|
||||||
if (version_compare($db_version, PrivateBin::VERSION, '<')) {
|
if (version_compare($db_version, Controller::VERSION, '<')) {
|
||||||
self::_upgradeDatabase($db_version);
|
self::_upgradeDatabase($db_version);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -623,7 +623,7 @@ class Database extends AbstractData
|
|||||||
self::_exec(
|
self::_exec(
|
||||||
'INSERT INTO ' . self::_sanitizeIdentifier('config') .
|
'INSERT INTO ' . self::_sanitizeIdentifier('config') .
|
||||||
' VALUES(?,?)',
|
' VALUES(?,?)',
|
||||||
array('VERSION', PrivateBin::VERSION)
|
array('VERSION', Controller::VERSION)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -698,7 +698,7 @@ class Database extends AbstractData
|
|||||||
self::_exec(
|
self::_exec(
|
||||||
'UPDATE ' . self::_sanitizeIdentifier('config') .
|
'UPDATE ' . self::_sanitizeIdentifier('config') .
|
||||||
' SET value = ? WHERE id = ?',
|
' SET value = ? WHERE id = ?',
|
||||||
array(PrivateBin::VERSION, 'VERSION')
|
array(Controller::VERSION, 'VERSION')
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Data;
|
namespace PrivateBin\Data;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Model;
|
namespace PrivateBin\Model;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Model;
|
namespace PrivateBin\Model;
|
||||||
|
|||||||
@@ -7,14 +7,14 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Model;
|
namespace PrivateBin\Model;
|
||||||
|
|
||||||
use Exception;
|
use Exception;
|
||||||
|
use PrivateBin\Controller;
|
||||||
use PrivateBin\Persistence\ServerSalt;
|
use PrivateBin\Persistence\ServerSalt;
|
||||||
use PrivateBin\PrivateBin;
|
|
||||||
use PrivateBin\Sjcl;
|
use PrivateBin\Sjcl;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -35,14 +35,14 @@ class Paste extends AbstractModel
|
|||||||
{
|
{
|
||||||
$data = $this->_store->read($this->getId());
|
$data = $this->_store->read($this->getId());
|
||||||
if ($data === false) {
|
if ($data === false) {
|
||||||
throw new Exception(PrivateBin::GENERIC_ERROR, 64);
|
throw new Exception(Controller::GENERIC_ERROR, 64);
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if paste has expired and delete it if neccessary.
|
// check if paste has expired and delete it if neccessary.
|
||||||
if (property_exists($data->meta, 'expire_date')) {
|
if (property_exists($data->meta, 'expire_date')) {
|
||||||
if ($data->meta->expire_date < time()) {
|
if ($data->meta->expire_date < time()) {
|
||||||
$this->delete();
|
$this->delete();
|
||||||
throw new Exception(PrivateBin::GENERIC_ERROR, 63);
|
throw new Exception(Controller::GENERIC_ERROR, 63);
|
||||||
}
|
}
|
||||||
// We kindly provide the remaining time before expiration (in seconds)
|
// We kindly provide the remaining time before expiration (in seconds)
|
||||||
$data->meta->remaining_time = $data->meta->expire_date - time();
|
$data->meta->remaining_time = $data->meta->expire_date - time();
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Persistence;
|
namespace PrivateBin\Persistence;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Persistence;
|
namespace PrivateBin\Persistence;
|
||||||
@@ -70,23 +70,18 @@ class PurgeLimiter extends AbstractPersistence
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = 'purge_limiter.php';
|
$now = time();
|
||||||
$now = time();
|
$file = 'purge_limiter.php';
|
||||||
$content = '<?php' . PHP_EOL . '$GLOBALS[\'purge_limiter\'] = ' . $now . ';' . PHP_EOL;
|
if (self::_exists($file)) {
|
||||||
if (!self::_exists($file)) {
|
require self::getPath($file);
|
||||||
self::_store($file, $content);
|
$pl = $GLOBALS['purge_limiter'];
|
||||||
|
if ($pl + self::$_limit >= $now) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = self::getPath($file);
|
$content = '<?php' . PHP_EOL . '$GLOBALS[\'purge_limiter\'] = ' . $now . ';';
|
||||||
require $path;
|
self::_store($file, $content);
|
||||||
$pl = $GLOBALS['purge_limiter'];
|
return true;
|
||||||
|
|
||||||
if ($pl + self::$_limit >= $now) {
|
|
||||||
$result = false;
|
|
||||||
} else {
|
|
||||||
$result = true;
|
|
||||||
self::_store($file, $content);
|
|
||||||
}
|
|
||||||
return $result;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Persistence;
|
namespace PrivateBin\Persistence;
|
||||||
@@ -83,7 +83,7 @@ class ServerSalt extends AbstractPersistence
|
|||||||
self::$_salt = self::generate();
|
self::$_salt = self::generate();
|
||||||
self::_store(
|
self::_store(
|
||||||
self::$_file,
|
self::$_file,
|
||||||
'<?php /* |' . self::$_salt . '| */ ?>'
|
'<?php # |' . self::$_salt . '|'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return self::$_salt;
|
return self::$_salt;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin\Persistence;
|
namespace PrivateBin\Persistence;
|
||||||
@@ -101,27 +101,22 @@ class TrafficLimiter extends AbstractPersistence
|
|||||||
}
|
}
|
||||||
|
|
||||||
$file = 'traffic_limiter.php';
|
$file = 'traffic_limiter.php';
|
||||||
if (!self::_exists($file)) {
|
if (self::_exists($file)) {
|
||||||
self::_store(
|
require self::getPath($file);
|
||||||
$file,
|
$tl = $GLOBALS['traffic_limiter'];
|
||||||
'<?php' . PHP_EOL .
|
} else {
|
||||||
'$GLOBALS[\'traffic_limiter\'] = array();' . PHP_EOL
|
$tl = array();
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$path = self::getPath($file);
|
|
||||||
require $path;
|
|
||||||
$now = time();
|
|
||||||
$tl = $GLOBALS['traffic_limiter'];
|
|
||||||
|
|
||||||
// purge file of expired hashes to keep it small
|
// purge file of expired hashes to keep it small
|
||||||
|
$now = time();
|
||||||
foreach ($tl as $key => $time) {
|
foreach ($tl as $key => $time) {
|
||||||
if ($time + self::$_limit < $now) {
|
if ($time + self::$_limit < $now) {
|
||||||
unset($tl[$key]);
|
unset($tl[$key]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// this hash is used as an array key, hence a shorter hash is used
|
// this hash is used as an array key, hence a shorter algo is used
|
||||||
$hash = self::getHash('sha256');
|
$hash = self::getHash('sha256');
|
||||||
if (array_key_exists($hash, $tl) && ($tl[$hash] + self::$_limit >= $now)) {
|
if (array_key_exists($hash, $tl) && ($tl[$hash] + self::$_limit >= $now)) {
|
||||||
$result = false;
|
$result = false;
|
||||||
@@ -132,8 +127,7 @@ class TrafficLimiter extends AbstractPersistence
|
|||||||
self::_store(
|
self::_store(
|
||||||
$file,
|
$file,
|
||||||
'<?php' . PHP_EOL .
|
'<?php' . PHP_EOL .
|
||||||
'$GLOBALS[\'traffic_limiter\'] = ' .
|
'$GLOBALS[\'traffic_limiter\'] = ' . var_export($tl, true) . ';'
|
||||||
var_export($tl, true) . ';' . PHP_EOL
|
|
||||||
);
|
);
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
* @link https://github.com/PrivateBin/PrivateBin
|
* @link https://github.com/PrivateBin/PrivateBin
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 1.2
|
* @version 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
* @link http://sebsauvage.net/wiki/doku.php?id=php:vizhash_gd
|
* @link http://sebsauvage.net/wiki/doku.php?id=php:vizhash_gd
|
||||||
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
||||||
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
||||||
* @version 0.0.5 beta PrivateBin 1.2
|
* @version 0.0.5 beta PrivateBin 1.2.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace PrivateBin;
|
namespace PrivateBin;
|
||||||
|
|||||||
@@ -71,11 +71,11 @@ endif;
|
|||||||
if ($MARKDOWN):
|
if ($MARKDOWN):
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/showdown-1.8.6.js" integrity="sha512-YFg2sBCGT00I6X5KzgCLP4VqRlmPMRhkVvJS9oJKk5LxiUzzcjzV5m4fNf6mQMctLrhgS5LFKiFF3vzIuXbjAw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/showdown-1.8.6.js" integrity="sha512-YFg2sBCGT00I6X5KzgCLP4VqRlmPMRhkVvJS9oJKk5LxiUzzcjzV5m4fNf6mQMctLrhgS5LFKiFF3vzIuXbjAw==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.5.js" integrity="sha512-IpCJCwlqipmuhbr7fdEOTA4ENcBURsQSDAqXqbr/3dcA2swwJon7D6IStGUQntycGCNCdIM/FdPciBq0gUrLJA==" crossorigin="anonymous"></script>
|
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-C/vlB/eumPPeHhG1yef+INPYUqgFX2wZqKEXTdexDscnUfhXQZxQBvmrURPAgMhElJqlk9Tfn+jILk0d2Ds1DQ==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
||||||
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-5xT6WHyurvC0LFESbkycBMAjhsi0KL/Xhx2oU+d0bqiJPkWK6ZAZgZ7I02oQiXaLtFSLf7UqpBo5XEePlfhH7Q==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|||||||
@@ -49,11 +49,11 @@ endif;
|
|||||||
if ($MARKDOWN):
|
if ($MARKDOWN):
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/showdown-1.8.6.js" integrity="sha512-YFg2sBCGT00I6X5KzgCLP4VqRlmPMRhkVvJS9oJKk5LxiUzzcjzV5m4fNf6mQMctLrhgS5LFKiFF3vzIuXbjAw==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/showdown-1.8.6.js" integrity="sha512-YFg2sBCGT00I6X5KzgCLP4VqRlmPMRhkVvJS9oJKk5LxiUzzcjzV5m4fNf6mQMctLrhgS5LFKiFF3vzIuXbjAw==" crossorigin="anonymous"></script>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.5.js" integrity="sha512-IpCJCwlqipmuhbr7fdEOTA4ENcBURsQSDAqXqbr/3dcA2swwJon7D6IStGUQntycGCNCdIM/FdPciBq0gUrLJA==" crossorigin="anonymous"></script>
|
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-C/vlB/eumPPeHhG1yef+INPYUqgFX2wZqKEXTdexDscnUfhXQZxQBvmrURPAgMhElJqlk9Tfn+jILk0d2Ds1DQ==" crossorigin="anonymous"></script>
|
<script type="text/javascript" data-cfasync="false" src="js/purify-1.0.7.js" integrity="sha512-VnKJHLosO8z2ojNvWk9BEKYqnhZyWK9rM90FgZUUEp/PRnUqR5OLLKE0a3BkVmn7YgB7LXRrjHgFHQYKd6DAIA==" crossorigin="anonymous"></script>
|
||||||
|
<script type="text/javascript" data-cfasync="false" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-5xT6WHyurvC0LFESbkycBMAjhsi0KL/Xhx2oU+d0bqiJPkWK6ZAZgZ7I02oQiXaLtFSLf7UqpBo5XEePlfhH7Q==" crossorigin="anonymous"></script>
|
||||||
<!--[if lt IE 10]>
|
<!--[if lt IE 10]>
|
||||||
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use PrivateBin\Controller;
|
||||||
use PrivateBin\Data\Filesystem;
|
use PrivateBin\Data\Filesystem;
|
||||||
use PrivateBin\Persistence\ServerSalt;
|
use PrivateBin\Persistence\ServerSalt;
|
||||||
use PrivateBin\Persistence\TrafficLimiter;
|
use PrivateBin\Persistence\TrafficLimiter;
|
||||||
use PrivateBin\PrivateBin;
|
|
||||||
|
|
||||||
class PrivateBinTest extends PHPUnit_Framework_TestCase
|
class ControllerTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
protected $_model;
|
protected $_model;
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testView()
|
public function testView()
|
||||||
{
|
{
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
@@ -74,7 +74,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
Helper::createIniFile(CONF, $options);
|
Helper::createIniFile(CONF, $options);
|
||||||
$_COOKIE['lang'] = 'de';
|
$_COOKIE['lang'] = 'de';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
@@ -95,7 +95,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
Helper::createIniFile(CONF, $options);
|
Helper::createIniFile(CONF, $options);
|
||||||
$_COOKIE['lang'] = 'de';
|
$_COOKIE['lang'] = 'de';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertContains(
|
$this->assertContains(
|
||||||
@@ -116,7 +116,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
Helper::createIniFile(CONF, $options);
|
Helper::createIniFile(CONF, $options);
|
||||||
$_COOKIE['lang'] = 'de';
|
$_COOKIE['lang'] = 'de';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
@@ -139,7 +139,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
|
|
||||||
$this->assertFileExists($file, 'htaccess recreated');
|
$this->assertFileExists($file, 'htaccess recreated');
|
||||||
@@ -152,7 +152,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testConf()
|
public function testConf()
|
||||||
{
|
{
|
||||||
file_put_contents(CONF, '');
|
file_put_contents(CONF, '');
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -168,7 +168,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -196,7 +196,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
TrafficLimiter::canPass();
|
TrafficLimiter::canPass();
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -224,7 +224,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -246,7 +246,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -274,7 +274,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -298,7 +298,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
$time = time();
|
$time = time();
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -329,7 +329,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
$time = time();
|
$time = time();
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -359,7 +359,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -387,7 +387,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -409,7 +409,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -432,7 +432,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exists before posting data');
|
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exists before posting data');
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -469,7 +469,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exists before posting data');
|
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exists before posting data');
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -487,11 +487,11 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->_model->delete(Helper::getPasteId());
|
$this->_model->delete(Helper::getPasteId());
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -513,7 +513,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -544,7 +544,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
|
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -568,7 +568,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
|
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -592,7 +592,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
|
$this->_model->create(Helper::getPasteId(), Helper::getPaste());
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -617,7 +617,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$paste = Helper::getPaste(array('opendiscussion' => false));
|
$paste = Helper::getPaste(array('opendiscussion' => false));
|
||||||
$this->_model->create(Helper::getPasteId(), $paste);
|
$this->_model->create(Helper::getPasteId(), $paste);
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -640,7 +640,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -666,7 +666,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -682,7 +682,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['QUERY_STRING'] = 'foo';
|
$_SERVER['QUERY_STRING'] = 'foo';
|
||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -698,7 +698,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -716,7 +716,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -734,7 +734,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -762,7 +762,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -792,7 +792,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -818,7 +818,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_GET['pasteid'] = Helper::getPasteId();
|
$_GET['pasteid'] = Helper::getPasteId();
|
||||||
$_GET['deletetoken'] = hash_hmac('sha256', Helper::getPasteId(), $paste->meta->salt);
|
$_GET['deletetoken'] = hash_hmac('sha256', Helper::getPasteId(), $paste->meta->salt);
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
@@ -838,7 +838,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_GET['pasteid'] = 'foo';
|
$_GET['pasteid'] = 'foo';
|
||||||
$_GET['deletetoken'] = 'bar';
|
$_GET['deletetoken'] = 'bar';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
@@ -857,7 +857,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_GET['pasteid'] = Helper::getPasteId();
|
$_GET['pasteid'] = Helper::getPasteId();
|
||||||
$_GET['deletetoken'] = 'bar';
|
$_GET['deletetoken'] = 'bar';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
@@ -876,7 +876,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_GET['pasteid'] = Helper::getPasteId();
|
$_GET['pasteid'] = Helper::getPasteId();
|
||||||
$_GET['deletetoken'] = 'bar';
|
$_GET['deletetoken'] = 'bar';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
@@ -900,7 +900,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -920,7 +920,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -940,7 +940,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_GET['pasteid'] = Helper::getPasteId();
|
$_GET['pasteid'] = Helper::getPasteId();
|
||||||
$_GET['deletetoken'] = 'does not matter in this context, but has to be set';
|
$_GET['deletetoken'] = 'does not matter in this context, but has to be set';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
@@ -963,7 +963,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
|
|||||||
$_GET['pasteid'] = Helper::getPasteId();
|
$_GET['pasteid'] = Helper::getPasteId();
|
||||||
$_GET['deletetoken'] = hash_hmac('sha256', Helper::getPasteId(), ServerSalt::get());
|
$_GET['deletetoken'] = hash_hmac('sha256', Helper::getPasteId(), ServerSalt::get());
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertRegExp(
|
$this->assertRegExp(
|
||||||
@@ -2,9 +2,9 @@
|
|||||||
|
|
||||||
use PrivateBin\Data\Database;
|
use PrivateBin\Data\Database;
|
||||||
|
|
||||||
require_once 'PrivateBinTest.php';
|
require_once 'ControllerTest.php';
|
||||||
|
|
||||||
class PrivateBinWithDbTest extends PrivateBinTest
|
class ControllerWithDbTest extends ControllerTest
|
||||||
{
|
{
|
||||||
private $_options = array(
|
private $_options = array(
|
||||||
'usr' => null,
|
'usr' => null,
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use PrivateBin\Controller;
|
||||||
use PrivateBin\Data\Database;
|
use PrivateBin\Data\Database;
|
||||||
use PrivateBin\PrivateBin;
|
|
||||||
|
|
||||||
class DatabaseTest extends PHPUnit_Framework_TestCase
|
class DatabaseTest extends PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
@@ -318,7 +318,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
|
|||||||
$statement->execute(array('VERSION'));
|
$statement->execute(array('VERSION'));
|
||||||
$result = $statement->fetch(PDO::FETCH_ASSOC);
|
$result = $statement->fetch(PDO::FETCH_ASSOC);
|
||||||
$statement->closeCursor();
|
$statement->closeCursor();
|
||||||
$this->assertEquals(PrivateBin::VERSION, $result['value']);
|
$this->assertEquals(Controller::VERSION, $result['value']);
|
||||||
Helper::rmDir($this->_path);
|
Helper::rmDir($this->_path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
use PrivateBin\Controller;
|
||||||
use PrivateBin\Data\Filesystem;
|
use PrivateBin\Data\Filesystem;
|
||||||
use PrivateBin\Persistence\ServerSalt;
|
use PrivateBin\Persistence\ServerSalt;
|
||||||
use PrivateBin\PrivateBin;
|
|
||||||
use PrivateBin\Request;
|
use PrivateBin\Request;
|
||||||
|
|
||||||
class JsonApiTest extends PHPUnit_Framework_TestCase
|
class JsonApiTest extends PHPUnit_Framework_TestCase
|
||||||
@@ -53,7 +53,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -86,7 +86,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
$_SERVER['REQUEST_METHOD'] = 'PUT';
|
||||||
$_SERVER['REMOTE_ADDR'] = '::1';
|
$_SERVER['REMOTE_ADDR'] = '::1';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
unlink($file);
|
unlink($file);
|
||||||
@@ -120,7 +120,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
$_SERVER['REQUEST_METHOD'] = 'DELETE';
|
$_SERVER['REQUEST_METHOD'] = 'DELETE';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
unlink($file);
|
unlink($file);
|
||||||
@@ -144,7 +144,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
$_SERVER['REQUEST_METHOD'] = 'POST';
|
$_SERVER['REQUEST_METHOD'] = 'POST';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -166,7 +166,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
|
||||||
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$response = json_decode($content, true);
|
$response = json_decode($content, true);
|
||||||
@@ -192,7 +192,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->_model->create(Helper::getPasteId(), $paste);
|
$this->_model->create(Helper::getPasteId(), $paste);
|
||||||
$_GET['jsonld'] = 'paste';
|
$_GET['jsonld'] = 'paste';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertEquals(str_replace(
|
$this->assertEquals(str_replace(
|
||||||
@@ -211,7 +211,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->_model->create(Helper::getPasteId(), $paste);
|
$this->_model->create(Helper::getPasteId(), $paste);
|
||||||
$_GET['jsonld'] = 'comment';
|
$_GET['jsonld'] = 'comment';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertEquals(str_replace(
|
$this->assertEquals(str_replace(
|
||||||
@@ -230,7 +230,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->_model->create(Helper::getPasteId(), $paste);
|
$this->_model->create(Helper::getPasteId(), $paste);
|
||||||
$_GET['jsonld'] = 'pastemeta';
|
$_GET['jsonld'] = 'pastemeta';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertEquals(str_replace(
|
$this->assertEquals(str_replace(
|
||||||
@@ -249,7 +249,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->_model->create(Helper::getPasteId(), $paste);
|
$this->_model->create(Helper::getPasteId(), $paste);
|
||||||
$_GET['jsonld'] = 'commentmeta';
|
$_GET['jsonld'] = 'commentmeta';
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertEquals(str_replace(
|
$this->assertEquals(str_replace(
|
||||||
@@ -268,7 +268,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
|
|||||||
$this->_model->create(Helper::getPasteId(), $paste);
|
$this->_model->create(Helper::getPasteId(), $paste);
|
||||||
$_GET['jsonld'] = CONF;
|
$_GET['jsonld'] = CONF;
|
||||||
ob_start();
|
ob_start();
|
||||||
new PrivateBin;
|
new Controller;
|
||||||
$content = ob_get_contents();
|
$content = ob_get_contents();
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
$this->assertEquals('{}', $content, 'does not output nasty data');
|
$this->assertEquals('{}', $content, 'does not output nasty data');
|
||||||
|
|||||||
@@ -25,10 +25,10 @@ class PurgeLimiterTest extends PHPUnit_Framework_TestCase
|
|||||||
public function testLimit()
|
public function testLimit()
|
||||||
{
|
{
|
||||||
// initialize it
|
// initialize it
|
||||||
|
PurgeLimiter::setLimit(1);
|
||||||
PurgeLimiter::canPurge();
|
PurgeLimiter::canPurge();
|
||||||
|
|
||||||
// try setting it
|
// try setting it
|
||||||
PurgeLimiter::setLimit(1);
|
|
||||||
$this->assertEquals(false, PurgeLimiter::canPurge());
|
$this->assertEquals(false, PurgeLimiter::canPurge());
|
||||||
sleep(2);
|
sleep(2);
|
||||||
$this->assertEquals(true, PurgeLimiter::canPurge());
|
$this->assertEquals(true, PurgeLimiter::canPurge());
|
||||||
|
|||||||
2
vendor/composer/autoload_classmap.php
vendored
2
vendor/composer/autoload_classmap.php
vendored
@@ -12,6 +12,7 @@ return array(
|
|||||||
'Identicon\\Generator\\ImageMagickGenerator' => $vendorDir . '/yzalis/identicon/src/Identicon/Generator/ImageMagickGenerator.php',
|
'Identicon\\Generator\\ImageMagickGenerator' => $vendorDir . '/yzalis/identicon/src/Identicon/Generator/ImageMagickGenerator.php',
|
||||||
'Identicon\\Identicon' => $vendorDir . '/yzalis/identicon/src/Identicon/Identicon.php',
|
'Identicon\\Identicon' => $vendorDir . '/yzalis/identicon/src/Identicon/Identicon.php',
|
||||||
'PrivateBin\\Configuration' => $baseDir . '/lib/Configuration.php',
|
'PrivateBin\\Configuration' => $baseDir . '/lib/Configuration.php',
|
||||||
|
'PrivateBin\\Controller' => $baseDir . '/lib/Controller.php',
|
||||||
'PrivateBin\\Data\\AbstractData' => $baseDir . '/lib/Data/AbstractData.php',
|
'PrivateBin\\Data\\AbstractData' => $baseDir . '/lib/Data/AbstractData.php',
|
||||||
'PrivateBin\\Data\\Database' => $baseDir . '/lib/Data/Database.php',
|
'PrivateBin\\Data\\Database' => $baseDir . '/lib/Data/Database.php',
|
||||||
'PrivateBin\\Data\\Filesystem' => $baseDir . '/lib/Data/Filesystem.php',
|
'PrivateBin\\Data\\Filesystem' => $baseDir . '/lib/Data/Filesystem.php',
|
||||||
@@ -27,7 +28,6 @@ return array(
|
|||||||
'PrivateBin\\Persistence\\PurgeLimiter' => $baseDir . '/lib/Persistence/PurgeLimiter.php',
|
'PrivateBin\\Persistence\\PurgeLimiter' => $baseDir . '/lib/Persistence/PurgeLimiter.php',
|
||||||
'PrivateBin\\Persistence\\ServerSalt' => $baseDir . '/lib/Persistence/ServerSalt.php',
|
'PrivateBin\\Persistence\\ServerSalt' => $baseDir . '/lib/Persistence/ServerSalt.php',
|
||||||
'PrivateBin\\Persistence\\TrafficLimiter' => $baseDir . '/lib/Persistence/TrafficLimiter.php',
|
'PrivateBin\\Persistence\\TrafficLimiter' => $baseDir . '/lib/Persistence/TrafficLimiter.php',
|
||||||
'PrivateBin\\PrivateBin' => $baseDir . '/lib/PrivateBin.php',
|
|
||||||
'PrivateBin\\Request' => $baseDir . '/lib/Request.php',
|
'PrivateBin\\Request' => $baseDir . '/lib/Request.php',
|
||||||
'PrivateBin\\Sjcl' => $baseDir . '/lib/Sjcl.php',
|
'PrivateBin\\Sjcl' => $baseDir . '/lib/Sjcl.php',
|
||||||
'PrivateBin\\View' => $baseDir . '/lib/View.php',
|
'PrivateBin\\View' => $baseDir . '/lib/View.php',
|
||||||
|
|||||||
2
vendor/composer/autoload_static.php
vendored
2
vendor/composer/autoload_static.php
vendored
@@ -41,6 +41,7 @@ class ComposerStaticInitDontChange
|
|||||||
'Identicon\\Generator\\ImageMagickGenerator' => __DIR__ . '/..' . '/yzalis/identicon/src/Identicon/Generator/ImageMagickGenerator.php',
|
'Identicon\\Generator\\ImageMagickGenerator' => __DIR__ . '/..' . '/yzalis/identicon/src/Identicon/Generator/ImageMagickGenerator.php',
|
||||||
'Identicon\\Identicon' => __DIR__ . '/..' . '/yzalis/identicon/src/Identicon/Identicon.php',
|
'Identicon\\Identicon' => __DIR__ . '/..' . '/yzalis/identicon/src/Identicon/Identicon.php',
|
||||||
'PrivateBin\\Configuration' => __DIR__ . '/../..' . '/lib/Configuration.php',
|
'PrivateBin\\Configuration' => __DIR__ . '/../..' . '/lib/Configuration.php',
|
||||||
|
'PrivateBin\\Controller' => __DIR__ . '/../..' . '/lib/Controller.php',
|
||||||
'PrivateBin\\Data\\AbstractData' => __DIR__ . '/../..' . '/lib/Data/AbstractData.php',
|
'PrivateBin\\Data\\AbstractData' => __DIR__ . '/../..' . '/lib/Data/AbstractData.php',
|
||||||
'PrivateBin\\Data\\Database' => __DIR__ . '/../..' . '/lib/Data/Database.php',
|
'PrivateBin\\Data\\Database' => __DIR__ . '/../..' . '/lib/Data/Database.php',
|
||||||
'PrivateBin\\Data\\Filesystem' => __DIR__ . '/../..' . '/lib/Data/Filesystem.php',
|
'PrivateBin\\Data\\Filesystem' => __DIR__ . '/../..' . '/lib/Data/Filesystem.php',
|
||||||
@@ -56,7 +57,6 @@ class ComposerStaticInitDontChange
|
|||||||
'PrivateBin\\Persistence\\PurgeLimiter' => __DIR__ . '/../..' . '/lib/Persistence/PurgeLimiter.php',
|
'PrivateBin\\Persistence\\PurgeLimiter' => __DIR__ . '/../..' . '/lib/Persistence/PurgeLimiter.php',
|
||||||
'PrivateBin\\Persistence\\ServerSalt' => __DIR__ . '/../..' . '/lib/Persistence/ServerSalt.php',
|
'PrivateBin\\Persistence\\ServerSalt' => __DIR__ . '/../..' . '/lib/Persistence/ServerSalt.php',
|
||||||
'PrivateBin\\Persistence\\TrafficLimiter' => __DIR__ . '/../..' . '/lib/Persistence/TrafficLimiter.php',
|
'PrivateBin\\Persistence\\TrafficLimiter' => __DIR__ . '/../..' . '/lib/Persistence/TrafficLimiter.php',
|
||||||
'PrivateBin\\PrivateBin' => __DIR__ . '/../..' . '/lib/PrivateBin.php',
|
|
||||||
'PrivateBin\\Request' => __DIR__ . '/../..' . '/lib/Request.php',
|
'PrivateBin\\Request' => __DIR__ . '/../..' . '/lib/Request.php',
|
||||||
'PrivateBin\\Sjcl' => __DIR__ . '/../..' . '/lib/Sjcl.php',
|
'PrivateBin\\Sjcl' => __DIR__ . '/../..' . '/lib/Sjcl.php',
|
||||||
'PrivateBin\\View' => __DIR__ . '/../..' . '/lib/View.php',
|
'PrivateBin\\View' => __DIR__ . '/../..' . '/lib/View.php',
|
||||||
|
|||||||
Reference in New Issue
Block a user