From 79509ad48a2e0e3dd0040f93340dd4ad02f96bfb Mon Sep 17 00:00:00 2001 From: El RIDO Date: Mon, 11 Jul 2016 11:58:15 +0200 Subject: [PATCH] renaming the fork to PrivateBin --- CHANGELOG.md | 8 +- cfg/conf.ini.sample | 16 ++-- css/bootstrap/{zerobin.css => privatebin.css} | 2 +- css/{zerobin.css => privatebin.css} | 2 +- doc/README.md | 2 +- i18n/de.json | 22 ++--- i18n/fr.json | 22 ++--- i18n/pl.json | 22 ++--- i18n/sl.json | 22 ++--- i18n/zh.json | 22 ++--- index.php | 6 +- js/{zerobin.js => privatebin.js} | 58 ++++++------ lib/auto.php | 4 +- lib/configuration.php | 12 +-- lib/filter.php | 4 +- lib/i18n.php | 4 +- lib/model.php | 17 ++-- lib/model/abstract.php | 12 +-- lib/model/comment.php | 6 +- lib/model/paste.php | 12 +-- lib/persistence.php | 4 +- lib/{zerobin.php => privatebin.php} | 16 ++-- lib/{zerobin => privatebin}/abstract.php | 18 ++-- lib/{zerobin => privatebin}/data.php | 14 +-- lib/{zerobin => privatebin}/db.php | 18 ++-- lib/request.php | 4 +- lib/serversalt.php | 10 +- lib/sjcl.php | 4 +- lib/trafficlimiter.php | 4 +- lib/vizhash16x16.php | 4 +- tpl/bootstrap-compact.html | 16 ++-- tpl/bootstrap-dark-page.html | 16 ++-- tpl/bootstrap-dark.html | 16 ++-- tpl/bootstrap-page.html | 16 ++-- tpl/bootstrap.html | 16 ++-- tpl/page.html | 14 +-- tst/README.md | 2 +- tst/RainTPL.php | 2 +- tst/configGenerator.php | 8 +- tst/configuration.php | 2 +- tst/jsonApi.php | 22 ++--- tst/model.php | 2 +- tst/phpunit.xml | 4 +- tst/{zerobin.php => privatebin.php} | 92 +++++++++---------- tst/{zerobin => privatebin}/data.php | 6 +- tst/{zerobin => privatebin}/db.php | 20 ++-- ...zerobinWithDb.php => privatebinWithDb.php} | 8 +- tst/test.ini | 2 +- 48 files changed, 320 insertions(+), 315 deletions(-) rename css/bootstrap/{zerobin.css => privatebin.css} (93%) rename css/{zerobin.css => privatebin.css} (99%) rename js/{zerobin.js => privatebin.js} (95%) rename lib/{zerobin.php => privatebin.php} (98%) rename lib/{zerobin => privatebin}/abstract.php (86%) rename lib/{zerobin => privatebin}/data.php (96%) rename lib/{zerobin => privatebin}/db.php (98%) rename tst/{zerobin.php => privatebin.php} (96%) rename tst/{zerobin => privatebin}/data.php (95%) rename tst/{zerobin => privatebin}/db.php (92%) rename tst/{zerobinWithDb.php => privatebinWithDb.php} (82%) diff --git a/CHANGELOG.md b/CHANGELOG.md index cdfc92d..6edc86a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -33,10 +33,10 @@ * for simpler maintenance the functions were grouped into objects: zerobin (display logic, event handling), filter (compression, encryption), i18n (translation, counterpart of i18n.php) and helper (stateless utilities) * Wiki pages were added to address common topics: - * [Upgrading from ZeroBin 0.19 Alpha](https://github.com/elrido/ZeroBin/wiki/Upgrading-from-ZeroBin-0.19-Alpha) - * [ZeroBin Directory of public servers](https://github.com/elrido/ZeroBin/wiki/ZeroBin-Directory) - * [Translation](https://github.com/elrido/ZeroBin/wiki/Translation) - * [Templates](https://github.com/elrido/ZeroBin/wiki/Templates) + * [Upgrading from ZeroBin 0.19 Alpha](https://github.com/PrivateBin/PrivateBin/wiki/Upgrading-from-ZeroBin-0.19-Alpha) + * [Directory of public PrivateBin servers](https://github.com/PrivateBin/PrivateBin/wiki/PrivateBin-Directory) + * [Translation](https://github.com/PrivateBin/PrivateBin/wiki/Translation) + * [Templates](https://github.com/PrivateBin/PrivateBin/wiki/Templates) * **0.20 (2015-09-03)**: * ADDED: Password protected pastes (optional) * ADDED: configuration options for highlighting, password, discussions, expiration times, rate limiting diff --git a/cfg/conf.ini.sample b/cfg/conf.ini.sample index a453538..fcaf52f 100644 --- a/cfg/conf.ini.sample +++ b/cfg/conf.ini.sample @@ -53,7 +53,7 @@ languageselection = false ; the pastes encryption key ; urlshortener = "https://shortener.example.com/api?link=" -; stay compatible with ZeroBin Alpha 0.19, less secure +; stay compatible with PrivateBin Alpha 0.19, less secure ; if enabled will use base64.js version 1.7 instead of 2.1.9 and sha1 instead of ; sha256 in HMAC for the deletion token zerobincompatibility = false @@ -100,24 +100,24 @@ dir = PATH "data" [model] ; name of data model class to load and directory for storage -; the default model "zerobin_data" stores everything in the filesystem -class = zerobin_data +; the default model "privatebin_data" stores everything in the filesystem +class = privatebin_data [model_options] dir = PATH "data" ;[model] ; example of DB configuration for MySQL -;class = zerobin_db +;class = privatebin_db ;[model_options] -;dsn = "mysql:host=localhost;dbname=zerobin;charset=UTF8" -;tbl = "zerobin_" ; table prefix -;usr = "zerobin" +;dsn = "mysql:host=localhost;dbname=privatebin;charset=UTF8" +;tbl = "privatebin_" ; table prefix +;usr = "privatebin" ;pwd = "Z3r0P4ss" ;opt[12] = true ; PDO::ATTR_PERSISTENT ;[model] ; example of DB configuration for SQLite -;class = zerobin_db +;class = privatebin_db ;[model_options] ;dsn = "sqlite:" PATH "data/db.sq3" ;usr = null diff --git a/css/bootstrap/zerobin.css b/css/bootstrap/privatebin.css similarity index 93% rename from css/bootstrap/zerobin.css rename to css/bootstrap/privatebin.css index 863baec..42a2eb5 100644 --- a/css/bootstrap/zerobin.css +++ b/css/bootstrap/privatebin.css @@ -1,4 +1,4 @@ -/* ZeroBin 0.22 - http://sebsauvage.net/wiki/doku.php?id=php:zerobin */ +/* PrivateBin 0.22 - https://github.com/PrivateBin/PrivateBin */ body { diff --git a/css/zerobin.css b/css/privatebin.css similarity index 99% rename from css/zerobin.css rename to css/privatebin.css index 966c750..ab3c6d0 100644 --- a/css/zerobin.css +++ b/css/privatebin.css @@ -1,4 +1,4 @@ -/* ZeroBin 0.22 - http://sebsauvage.net/wiki/doku.php?id=php:zerobin */ +/* PrivateBin 0.22 - https://github.com/PrivateBin/PrivateBin */ /* CSS Reset from YUI 3.4.1 (build 4118) - Copyright 2011 Yahoo! Inc. All rights reserved. diff --git a/doc/README.md b/doc/README.md index 4087008..cf2961c 100644 --- a/doc/README.md +++ b/doc/README.md @@ -18,6 +18,6 @@ $ sudo pear install phpdoc/phpDocumentor To generate the documentation, change into the main directory and run phpdoc: ```console -$ cd ZeroBin +$ cd PrivateBin $ phpdoc -d lib/ -t doc/ ``` diff --git a/i18n/de.json b/i18n/de.json index 5c398eb..e479f1a 100644 --- a/i18n/de.json +++ b/i18n/de.json @@ -2,10 +2,10 @@ "en": "de", "Paste does not exist, has expired or has been deleted.": "Diesen Text gibt es nicht, er ist abgelaufen oder wurde gelöscht.", - "ZeroBin requires php 5.2.6 or above to work. Sorry.": - "ZeroBin benötigt PHP 5.2.6 oder höher, um zu funktionieren. Sorry.", - "ZeroBin requires configuration section [%s] to be present in configuration file.": - "ZeroBin benötigt den Konfigurationsabschnitt [%s] in der Konfigurationsdatei um zu funktionieren.", + "PrivateBin requires php 5.2.6 or above to work. Sorry.": + "PrivateBin benötigt PHP 5.2.6 oder höher, um zu funktionieren. Sorry.", + "PrivateBin requires configuration section [%s] to be present in configuration file.": + "PrivateBin benötigt den Konfigurationsabschnitt [%s] in der Konfigurationsdatei um zu funktionieren.", "Please wait %d seconds between each post.": "Bitte warte %d Sekunden zwischen dem Absenden.", "Paste is limited to %s of encrypted data.": @@ -26,15 +26,15 @@ "Falscher Lösch-Code. Text wurde nicht gelöscht.", "Paste was properly deleted.": "Text wurde erfolgreich gelöscht.", - "ZeroBin": "ZeroBin", - "ZeroBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": - "ZeroBin ist ein minimalistischer, quelloffener \"Pastebin\"-artiger Dienst, bei dem der Server keinerlei Kenntnis der Inhalte hat. Die Daten werden im Browser mit 256 Bit AES ver- und entschlüsselt. Weitere Informationen sind auf der Projektseite zu finden.", + "PrivateBin": "PrivateBin", + "PrivateBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": + "PrivateBin ist ein minimalistischer, quelloffener \"Pastebin\"-artiger Dienst, bei dem der Server keinerlei Kenntnis der Inhalte hat. Die Daten werden im Browser mit 256 Bit AES ver- und entschlüsselt. Weitere Informationen sind auf der Projektseite zu finden.", "Because ignorance is bliss": "Unwissenheit ist ein Segen", - "Javascript is required for ZeroBin to work.
Sorry for the inconvenience.": - "Javascript ist eine Voraussetzung, um ZeroBin zu nutzen.
Bitte entschuldige die Unannehmlichkeiten.", - "ZeroBin requires a modern browser to work.": - "ZeroBin setzt einen modernen Browser voraus, um funktionieren zu können.", + "Javascript is required for PrivateBin to work.
Sorry for the inconvenience.": + "Javascript ist eine Voraussetzung, um PrivateBin zu nutzen.
Bitte entschuldige die Unannehmlichkeiten.", + "PrivateBin requires a modern browser to work.": + "PrivateBin setzt einen modernen Browser voraus, um funktionieren zu können.", "Still using Internet Explorer? Do yourself a favor, switch to a modern browser:": "Du benutzt immer noch den Internet Explorer? Tu Dir einen Gefallen und wechsle zu einem moderneren Browser:", "New": diff --git a/i18n/fr.json b/i18n/fr.json index 6fe650c..bbb4493 100644 --- a/i18n/fr.json +++ b/i18n/fr.json @@ -2,10 +2,10 @@ "en": "fr", "Paste does not exist, has expired or has been deleted.": "Le paste n'existe pas, a expiré, ou a été supprimé.", - "ZeroBin requires php 5.2.6 or above to work. Sorry.": - "Désolé, ZeroBin nécessite php 5.2.6 ou supérieur pour fonctionner.", - "ZeroBin requires configuration section [%s] to be present in configuration file.": - "ZeroBin a besoin de la section de configuration [%s] dans le fichier de configuration pour fonctionner.", + "PrivateBin requires php 5.2.6 or above to work. Sorry.": + "Désolé, PrivateBin nécessite php 5.2.6 ou supérieur pour fonctionner.", + "PrivateBin requires configuration section [%s] to be present in configuration file.": + "PrivateBin a besoin de la section de configuration [%s] dans le fichier de configuration pour fonctionner.", "Please wait %d seconds between each post.": "Merci d'attendre %d secondes entre chaque publication.", "Paste is limited to %s of encrypted data.": @@ -26,15 +26,15 @@ "Jeton de suppression incorrect. Le paste n'a pas été supprimé.", "Paste was properly deleted.": "Le paste a été correctement supprimé.", - "ZeroBin": "ZeroBin", - "ZeroBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": - "Zerobin est un 'pastebin' (ou gestionnaire d'extraits de texte et de code source) minimaliste et open source, dans lequel le serveur n'a aucune connaissance des données envoyées. Les données sont chiffrées/déchiffrées dans le navigateur par un chiffrage AES 256 bits. Plus d'informations sur la page du projet.", + "PrivateBin": "PrivateBin", + "PrivateBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": + "PrivateBin est un 'pastebin' (ou gestionnaire d'extraits de texte et de code source) minimaliste et open source, dans lequel le serveur n'a aucune connaissance des données envoyées. Les données sont chiffrées/déchiffrées dans le navigateur par un chiffrage AES 256 bits. Plus d'informations sur la page du projet.", "Because ignorance is bliss": "Parce que l'ignorance est le bonheur", - "Javascript is required for ZeroBin to work.
Sorry for the inconvenience.": - "Javascript est requis pour faire fonctionner ZeroBin.
Désolé pour cet inconvénient.", - "ZeroBin requires a modern browser to work.": - "ZeroBin nécessite un navigateur moderne pour fonctionner.", + "Javascript is required for PrivateBin to work.
Sorry for the inconvenience.": + "Javascript est requis pour faire fonctionner PrivateBin.
Désolé pour cet inconvénient.", + "PrivateBin requires a modern browser to work.": + "PrivateBin nécessite un navigateur moderne pour fonctionner.", "Still using Internet Explorer? Do yourself a favor, switch to a modern browser:": "Encore sur Internet Explorer ? Faites-vous une faveur, passez à un navigateur moderne :", "New": diff --git a/i18n/pl.json b/i18n/pl.json index b86cc2a..c276658 100644 --- a/i18n/pl.json +++ b/i18n/pl.json @@ -2,10 +2,10 @@ "en": "pl", "Paste does not exist, has expired or has been deleted.": "Wklejka nie istnieje, wygasła albo została usunięta.", - "ZeroBin requires php 5.2.6 or above to work. Sorry.": - "ZeroBin wymaga PHP w wersji 5.2.6 lub nowszej, sorry.", - "ZeroBin requires configuration section [%s] to be present in configuration file.": - "ZeroBin wymaga obecności sekcji [%s] w pliku konfiguracyjnym.", + "PrivateBin requires php 5.2.6 or above to work. Sorry.": + "PrivateBin wymaga PHP w wersji 5.2.6 lub nowszej, sorry.", + "PrivateBin requires configuration section [%s] to be present in configuration file.": + "PrivateBin wymaga obecności sekcji [%s] w pliku konfiguracyjnym.", "Please wait %d seconds between each post.": "Poczekaj %d sekund pomiędzy każdą wklejką.", "Paste is limited to %s of encrypted data.": @@ -26,15 +26,15 @@ "Nieprawidłowy token usuwania. Wklejka nie została usunięta.", "Paste was properly deleted.": "Wklejka usunięta poprawnie.", - "ZeroBin": "ZeroBin", - "ZeroBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": - "ZeroBin jest minimalistycznym, otwartoźródłowym serwisem typu pastebin, w którym serwer nie ma jakichkolwiek informacji o tym, co jest wklejane. Dane są szyfrowane i deszyfrowane w przeglądarce z użyciem 256-bitowego klucza AES. Więcej informacji na stronie projektu.", + "PrivateBin": "PrivateBin", + "PrivateBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": + "PrivateBin jest minimalistycznym, otwartoźródłowym serwisem typu pastebin, w którym serwer nie ma jakichkolwiek informacji o tym, co jest wklejane. Dane są szyfrowane i deszyfrowane w przeglądarce z użyciem 256-bitowego klucza AES. Więcej informacji na stronie projektu.", "Because ignorance is bliss": "Ponieważ ignorancja jest cnotą", - "Javascript is required for ZeroBin to work.
Sorry for the inconvenience.": - "Do działania ZeroBina jest wymagany JavaScript. Przepraszamy za tę niedogodność.", - "ZeroBin requires a modern browser to work.": - "ZeroBin wymaga do działania nowoczesnej przeglądarki.", + "Javascript is required for PrivateBin to work.
Sorry for the inconvenience.": + "Do działania PrivateBina jest wymagany JavaScript. Przepraszamy za tę niedogodność.", + "PrivateBin requires a modern browser to work.": + "PrivateBin wymaga do działania nowoczesnej przeglądarki.", "Still using Internet Explorer? Do yourself a favor, switch to a modern browser:": "Cały czas używasz Internet Explorera? Zrób sobie przysługę, przesiądź się na nowoczesną przeglądarkę:", "New": diff --git a/i18n/sl.json b/i18n/sl.json index baff6ca..6526a65 100644 --- a/i18n/sl.json +++ b/i18n/sl.json @@ -2,10 +2,10 @@ "en": "sl", "Paste does not exist, has expired or has been deleted.": "Prilepek ne obstaja, mu je potekla življenjska doba, ali pa je izbrisan.", - "ZeroBin requires php 5.2.6 or above to work. Sorry.": - "Oprosti, ZeroBin za delovanje potrebuje vsaj php 5.2.6.", - "ZeroBin requires configuration section [%s] to be present in configuration file.": - "ZeroBin potrebuje sekcijo konfiguracij [%s] v konfiguracijski datoteki.", + "PrivateBin requires php 5.2.6 or above to work. Sorry.": + "Oprosti, PrivateBin za delovanje potrebuje vsaj php 5.2.6.", + "PrivateBin requires configuration section [%s] to be present in configuration file.": + "PrivateBin potrebuje sekcijo konfiguracij [%s] v konfiguracijski datoteki.", "Please wait %d seconds between each post.": "Prosim počakaj vsaj %d sekund pred vsako naslednjo objavo.", "Paste is limited to %s of encrypted data.": @@ -26,15 +26,15 @@ "Napačen token za izbris. Prilepek ni bil izbrisan..", "Paste was properly deleted.": "Prilepek je uspešno izbrisan.", - "ZeroBin": "ZeroBin", - "ZeroBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": - "Zerobin je minimalističen, odprtokodni spletni 'pastebin', kjer server ne ve ničesar o prilepljenih podatkih. Podatki so zakodirani/odkodirani v brskalniku z uporabo 256 bitnega AES. Več informacij na < href=\"https://github.com/elrido/ZeroBin/wiki\">spletni strani projekta..", + "PrivateBin": "PrivateBin", + "PrivateBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": + "PrivateBin je minimalističen, odprtokodni spletni 'pastebin', kjer server ne ve ničesar o prilepljenih podatkih. Podatki so zakodirani/odkodirani v brskalniku z uporabo 256 bitnega AES. Več informacij na < href=\"https://github.com/elrido/PrivateBin/wiki\">spletni strani projekta..", "Because ignorance is bliss": "Ker kar ne veš ne boli.", - "Javascript is required for ZeroBin to work.
Sorry for the inconvenience.": - "Da ZeroBin deluje, moraš vklopiti Javascript.
Oprosti za povročene nevšečnosti.", - "ZeroBin requires a modern browser to work.": - "ZeroBin za svoje delovanje potrebuje moderen brskalnik.", + "Javascript is required for PrivateBin to work.
Sorry for the inconvenience.": + "Da PrivateBin deluje, moraš vklopiti Javascript.
Oprosti za povročene nevšečnosti.", + "PrivateBin requires a modern browser to work.": + "PrivateBin za svoje delovanje potrebuje moderen brskalnik.", "Still using Internet Explorer? Do yourself a favor, switch to a modern browser:": "Še vedno uporabljaš Internet Explorer? Naredi si uslugo, preklopi na moderen brskalnik:", "New": diff --git a/i18n/zh.json b/i18n/zh.json index e8b476c..52da2d6 100644 --- a/i18n/zh.json +++ b/i18n/zh.json @@ -2,10 +2,10 @@ "en": "zh", "Paste does not exist, has expired or has been deleted.": "粘贴不存在,已过期或者已被删除。", - "ZeroBin requires php 5.2.6 or above to work. Sorry.": - "ZeroBin需要工作于PHP 5.2.6及以上版本,抱歉。", - "ZeroBin requires configuration section [%s] to be present in configuration file.": - "ZeroBin需要设置配置文件中 [%s] 的部分。", + "PrivateBin requires php 5.2.6 or above to work. Sorry.": + "PrivateBin需要工作于PHP 5.2.6及以上版本,抱歉。", + "PrivateBin requires configuration section [%s] to be present in configuration file.": + "PrivateBin需要设置配置文件中 [%s] 的部分。", "Please wait %d seconds between each post.": "每 %d 秒只能粘贴一次。", "Paste is limited to %s of encrypted data.": @@ -26,15 +26,15 @@ "错误的删除token,粘贴没有被删除。", "Paste was properly deleted.": "粘贴已被正确删除。", - "ZeroBin": "ZeroBin", - "ZeroBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": - "ZeroBin是一个极简,开源,对粘贴内容毫不知情的在线粘贴板,数据在浏览器内进行AES-256加密。更多信息请查看项目主页。", + "PrivateBin": "PrivateBin", + "PrivateBin is a minimalist, opensource online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted in the browser using 256 bits AES. More information on the project page.": + "PrivateBin是一个极简,开源,对粘贴内容毫不知情的在线粘贴板,数据在浏览器内进行AES-256加密。更多信息请查看项目主页。", "Because ignorance is bliss": "因为无知是福", - "Javascript is required for ZeroBin to work.
Sorry for the inconvenience.": - "ZeroBin需要JavaScript来进行加解密。
带来的不便敬请谅解。", - "ZeroBin requires a modern browser to work.": - "ZeroBin需要工作于现代化的浏览器。", + "Javascript is required for PrivateBin to work.
Sorry for the inconvenience.": + "PrivateBin需要JavaScript来进行加解密。
带来的不便敬请谅解。", + "PrivateBin requires a modern browser to work.": + "PrivateBin需要工作于现代化的浏览器。", "Still using Internet Explorer? Do yourself a favor, switch to a modern browser:": "还在使用Internet Explorer?帮自己个忙,换上一个现代化的浏览器:", "New": diff --git a/index.php b/index.php index 19144e9..918c0ea 100644 --- a/index.php +++ b/index.php @@ -1,10 +1,10 @@ %s (Hit [Ctrl]+[c] to copy)', url, url - ) + zerobin.shortenUrl(url) + ) + privatebin.shortenUrl(url) ); $('#deletelink').html('' + i18n._('Delete data') + ''); - zerobin.pasteResult.removeClass('hidden'); + privatebin.pasteResult.removeClass('hidden'); // We pre-select the link so that the user only has to [Ctrl]+[c] the link. helper.selectText('pasteurl'); - zerobin.showStatus('', false); - zerobin.formatPaste(data_to_send.formatter, zerobin.message.val()); + privatebin.showStatus('', false); + privatebin.formatPaste(data_to_send.formatter, privatebin.message.val()); } else if (data.status==1) { - zerobin.showError(i18n._('Could not create paste: %s', data.message)); + privatebin.showError(i18n._('Could not create paste: %s', data.message)); } else { - zerobin.showError(i18n._('Could not create paste: %s', i18n._('unknown status'))); + privatebin.showError(i18n._('Could not create paste: %s', i18n._('unknown status'))); } } }) .fail(function() { - zerobin.showError(i18n._('Could not create paste: %s', i18n._('server error or not responding'))); + privatebin.showError(i18n._('Could not create paste: %s', i18n._('server error or not responding'))); }); }, @@ -1397,8 +1397,8 @@ $(function() { /** * main application start, called when DOM is fully loaded - * runs zerobin when translations were loaded + * runs privatebin when translations were loaded */ - i18n.loadTranslations($.proxy(zerobin.init, zerobin)); + i18n.loadTranslations($.proxy(privatebin.init, privatebin)); }); diff --git a/lib/auto.php b/lib/auto.php index 2b0ebe1..6fd5d9a 100644 --- a/lib/auto.php +++ b/lib/auto.php @@ -1,10 +1,10 @@ '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]; } diff --git a/lib/filter.php b/lib/filter.php index f9bc463..f4db8a3 100644 --- a/lib/filter.php +++ b/lib/filter.php @@ -1,10 +1,10 @@ _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; } -} \ No newline at end of file +} diff --git a/lib/model/abstract.php b/lib/model/abstract.php index 979f759..f85b57f 100644 --- a/lib/model/abstract.php +++ b/lib/model/abstract.php @@ -1,10 +1,10 @@ _conf = $configuration; $this->_store = $storage; diff --git a/lib/model/comment.php b/lib/model/comment.php index 11d4558..1d180bf 100644 --- a/lib/model/comment.php +++ b/lib/model/comment.php @@ -1,10 +1,10 @@ _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=&deletetoken= + * http://example.com/privatebin/?pasteid=&deletetoken= * * @access public * @return string diff --git a/lib/persistence.php b/lib/persistence.php index 36b964b..9dcc59d 100644 --- a/lib/persistence.php +++ b/lib/persistence.php @@ -1,10 +1,10 @@ - {function="t('ZeroBin')"} + {function="t('PrivateBin')"} - {if="$SYNTAXHIGHLIGHTING"} + {if="$SYNTAXHIGHLIGHTING"} {if="strlen($SYNTAXHIGHLIGHTINGTHEME)"} {/if}{/if} @@ -19,7 +19,7 @@ {if="$SYNTAXHIGHLIGHTING"} {/if}{if="$MARKDOWN"} {/if} - + @@ -39,7 +39,7 @@ - {function="t('ZeroBin')"} + {function="t('PrivateBin')"} {/if} - - + + {/if} - - + + {/if} - - + + {/if} - - + + {/if} - - + + #', @@ -706,7 +706,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $this->_model->create(helper::getPasteId(), $burnPaste); $_SERVER['QUERY_STRING'] = helper::getPasteId(); ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); unset($burnPaste['meta']['salt']); $this->assertContains( @@ -729,7 +729,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_SERVER['QUERY_STRING'] = helper::getPasteId(); $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $response = json_decode($content, true); $this->assertEquals(0, $response['status'], 'outputs success status'); @@ -752,7 +752,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_SERVER['QUERY_STRING'] = helper::getPasteId(); $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $response = json_decode($content, true); $this->assertEquals(1, $response['status'], 'outputs error status'); @@ -774,7 +774,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $this->_model->create(helper::getPasteId(), $oldPaste); $_SERVER['QUERY_STRING'] = helper::getPasteId(); ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $meta['formatter'] = 'syntaxhighlighting'; $this->assertContains( @@ -797,7 +797,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $this->_model->create(helper::getPasteId(), $oldPaste); $_SERVER['QUERY_STRING'] = helper::getPasteId(); ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $oldPaste['meta']['formatter'] = 'plaintext'; unset($oldPaste['meta']['salt']); @@ -822,7 +822,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_GET['pasteid'] = helper::getPasteId(); $_GET['deletetoken'] = hash_hmac('sha256', helper::getPasteId(), $paste->meta->salt); ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $this->assertRegExp( '#]*id="status"[^>]*>.*Paste was properly deleted[^<]*#s', @@ -842,7 +842,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_GET['pasteid'] = 'foo'; $_GET['deletetoken'] = 'bar'; ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $this->assertRegExp( '#]*id="errormessage"[^>]*>.*Invalid paste ID\.#', @@ -861,7 +861,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_GET['pasteid'] = helper::getPasteId(); $_GET['deletetoken'] = 'bar'; ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $this->assertRegExp( '#]*id="errormessage"[^>]*>.*Paste does not exist[^<]*#', @@ -880,7 +880,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_GET['pasteid'] = helper::getPasteId(); $_GET['deletetoken'] = 'bar'; ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $this->assertRegExp( '#]*id="errormessage"[^>]*>.*Wrong deletion token[^<]*#', @@ -904,7 +904,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['REQUEST_METHOD'] = 'POST'; ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $response = json_decode($content, true); $this->assertEquals(0, $response['status'], 'outputs status'); @@ -924,7 +924,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['REQUEST_METHOD'] = 'POST'; ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $response = json_decode($content, true); $this->assertEquals(1, $response['status'], 'outputs status'); @@ -944,7 +944,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_GET['pasteid'] = helper::getPasteId(); $_GET['deletetoken'] = 'does not matter in this context, but has to be set'; ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $this->assertRegExp( '#]*id="errormessage"[^>]*>.*Paste does not exist[^<]*#', @@ -967,7 +967,7 @@ class zerobinTest extends PHPUnit_Framework_TestCase $_GET['pasteid'] = helper::getPasteId(); $_GET['deletetoken'] = hash_hmac('sha256', helper::getPasteId(), serversalt::get()); ob_start(); - new zerobin; + new privatebin; $content = ob_get_contents(); $this->assertRegExp( '#]*id="status"[^>]*>.*Paste was properly deleted[^<]*#s', diff --git a/tst/zerobin/data.php b/tst/privatebin/data.php similarity index 95% rename from tst/zerobin/data.php rename to tst/privatebin/data.php index 87c6afb..6c728fe 100644 --- a/tst/zerobin/data.php +++ b/tst/privatebin/data.php @@ -1,5 +1,5 @@ _path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'zerobin_data'; - $this->_model = zerobin_data::getInstance(array('dir' => $this->_path)); + $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; + $this->_model = privatebin_data::getInstance(array('dir' => $this->_path)); } public function tearDown() diff --git a/tst/zerobin/db.php b/tst/privatebin/db.php similarity index 92% rename from tst/zerobin/db.php rename to tst/privatebin/db.php index a3f4e0a..6006723 100644 --- a/tst/zerobin/db.php +++ b/tst/privatebin/db.php @@ -1,5 +1,5 @@ _model = zerobin_db::getInstance($this->_options); + $this->_model = privatebin_db::getInstance($this->_options); } public function testDatabaseBasedDataStoreWorks() @@ -67,7 +67,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase */ public function testGetIbmInstance() { - zerobin_db::getInstance(array( + privatebin_db::getInstance(array( 'dsn' => 'ibm:', 'usr' => null, 'pwd' => null, 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) )); @@ -78,7 +78,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase */ public function testGetInformixInstance() { - zerobin_db::getInstance(array( + privatebin_db::getInstance(array( 'dsn' => 'informix:', 'usr' => null, 'pwd' => null, 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) )); @@ -89,7 +89,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase */ public function testGetMssqlInstance() { - zerobin_db::getInstance(array( + privatebin_db::getInstance(array( 'dsn' => 'mssql:', 'usr' => null, 'pwd' => null, 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) )); @@ -100,7 +100,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase */ public function testGetMysqlInstance() { - zerobin_db::getInstance(array( + privatebin_db::getInstance(array( 'dsn' => 'mysql:', 'usr' => null, 'pwd' => null, 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) )); @@ -111,7 +111,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase */ public function testGetOciInstance() { - zerobin_db::getInstance(array( + privatebin_db::getInstance(array( 'dsn' => 'oci:', 'usr' => null, 'pwd' => null, 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) )); @@ -122,7 +122,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase */ public function testGetPgsqlInstance() { - zerobin_db::getInstance(array( + privatebin_db::getInstance(array( 'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null, 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) )); @@ -134,7 +134,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase */ public function testGetFooInstance() { - zerobin_db::getInstance(array( + privatebin_db::getInstance(array( 'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null )); } @@ -160,7 +160,7 @@ class zerobin_dbTest extends PHPUnit_Framework_TestCase 'opendiscussion INT, ' . 'burnafterreading INT );' ); - zerobin_db::getInstance($this->_options); + privatebin_db::getInstance($this->_options); @unlink($path); } } diff --git a/tst/zerobinWithDb.php b/tst/privatebinWithDb.php similarity index 82% rename from tst/zerobinWithDb.php rename to tst/privatebinWithDb.php index 18c0b88..1061720 100644 --- a/tst/zerobinWithDb.php +++ b/tst/privatebinWithDb.php @@ -1,7 +1,7 @@ 'sqlite:../data/tst.sq3', @@ -16,7 +16,7 @@ class zerobinWithDbTest extends zerobinTest public function setUp() { /* Setup Routine */ - $this->_model = zerobin_db::getInstance($this->_options); + $this->_model = privatebin_db::getInstance($this->_options); serversalt::setPath(PATH . 'data'); $this->reset(); } @@ -34,7 +34,7 @@ class zerobinWithDbTest extends zerobinTest // but then inject a db config $options = parse_ini_file(CONF, true); $options['model'] = array( - 'class' => 'zerobin_db', + 'class' => 'privatebin_db', ); $options['model_options'] = $this->_options; helper::confBackup(); diff --git a/tst/test.ini b/tst/test.ini index f413d8f..8d59388 100644 --- a/tst/test.ini +++ b/tst/test.ini @@ -37,7 +37,7 @@ limit = 0 dir = "../data" [model] -class = "zerobin_db" +class = "privatebin_db" [model_options] dsn = "sqlite:../data/db.sq3"