Merge remote-tracking branch 'PrivateBin/master'

This commit is contained in:
Stefano Martinelli 2017-03-22 18:46:53 +01:00
commit e4c30e8613
108 changed files with 6310 additions and 3572 deletions

18
.dockerignore Normal file
View File

@ -0,0 +1,18 @@
# Documentation, might leak version number
CHANGELOG.md
LICENSE.md
CREDITS.md
INSTALL.md
README.md
doc/
# Dotfiles, pointless
.codeclimate.yml
.csslintrc
.editorconfig
.eslint*
.git*
.php_cs
.styleci.yml
.travis.yml
.github

View File

@ -38,6 +38,6 @@ indent_style = space
indent_size = 2 indent_size = 2
trim_trailing_whitespace = false trim_trailing_whitespace = false
[.travis.yml] [*.yml]
indent_style = space indent_style = space
indent_size = 4 indent_size = 2

View File

@ -15,7 +15,9 @@ globals:
# http://eslint.org/docs/rules/ # http://eslint.org/docs/rules/
rules: rules:
# Possible Errors # Possible Errors
comma-dangle: [2, never] comma-dangle:
- error
- never
no-cond-assign: 2 no-cond-assign: 2
no-console: 0 no-console: 0
no-constant-condition: 2 no-constant-condition: 2
@ -31,7 +33,9 @@ rules:
no-extra-parens: 0 no-extra-parens: 0
no-extra-semi: 2 no-extra-semi: 2
no-func-assign: 2 no-func-assign: 2
no-inner-declarations: [2, functions] no-inner-declarations:
- error
- functions
no-invalid-regexp: 2 no-invalid-regexp: 2
no-irregular-whitespace: 2 no-irregular-whitespace: 2
no-negated-in-lhs: 2 no-negated-in-lhs: 2
@ -47,7 +51,9 @@ rules:
# Best Practices # Best Practices
accessor-pairs: 2 accessor-pairs: 2
block-scoped-var: 0 block-scoped-var: 0
complexity: [2, 6] complexity:
- error
- 20
consistent-return: 0 consistent-return: 0
curly: 0 curly: 0
default-case: 0 default-case: 0
@ -99,7 +105,7 @@ rules:
no-with: 2 no-with: 2
radix: 2 radix: 2
vars-on-top: 0 vars-on-top: 0
wrap-iife: 2 wrap-iife: 0
yoda: 0 yoda: 0
# Strict # Strict
@ -152,7 +158,9 @@ rules:
max-len: 0 max-len: 0
max-nested-callbacks: 0 max-nested-callbacks: 0
max-params: 0 max-params: 0
max-statements: [2, 30] max-statements:
- error
- 60
new-cap: 0 new-cap: 0
new-parens: 0 new-parens: 0
newline-after-var: 0 newline-after-var: 0

7
.gitattributes vendored
View File

@ -1,7 +1,12 @@
doc/ export-ignore doc/ export-ignore
tst/ export-ignore tst/ export-ignore
js/.istanbul.yml export-ignore
js/test.js export-ignore
js/mocha-3.2.0.js export-ignore
css/mocha-3.2.0.css export-ignore
.codeclimate.yml export-ignore .codeclimate.yml export-ignore
.csslintrc export-ignore .csslintrc export-ignore
.dockerignore export-ignore
.editorconfig export-ignore .editorconfig export-ignore
.eslintignore export-ignore .eslintignore export-ignore
.eslintrc export-ignore .eslintrc export-ignore
@ -9,4 +14,6 @@ tst/ export-ignore
.github export-ignore .github export-ignore
.gitignore export-ignore .gitignore export-ignore
.php_cs export-ignore .php_cs export-ignore
.styleci.yml export-ignore
.travis.yml export-ignore .travis.yml export-ignore
Dockerfile export-ignore

View File

@ -1,5 +1,5 @@
<!-- Please have a look at our FAQ before submitting an issue: https://github.com/PrivateBin/PrivateBin/wiki/FAQ --> <!-- Please have a look at our FAQ before submitting an issue: https://github.com/PrivateBin/PrivateBin/wiki/FAQ -->
<!-- This is a template for an bug report. If you would like to suggest a feature, feel free to delete the part below. --> <!-- This is a template for a bug report. If you would like to suggest a feature, feel free to delete the part below. -->
## Steps to reproduce ## Steps to reproduce
<!-- Tell us how to reproduce the problem. --> <!-- Tell us how to reproduce the problem. -->
@ -18,8 +18,6 @@ Here you can add screenshots. If the issue is e.g. a client-side issue (= an iss
If you have access to the server log files, also copy them here. If you have access to the server log files, also copy them here.
--> -->
* I can reproduce this issue on <https://privatebin.net>: Yes / No
## Basic information ## Basic information
<!-- If you use a public server enter the address of it here. --> <!-- If you use a public server enter the address of it here. -->
@ -36,3 +34,6 @@ If you have access to the server log files, also copy them here.
<!-- The version of PrivateBin, if you use an unstable version paste the commit hash or the GitHub link to the commit here (you can get it by running `git rev-parse HEAD`) --> <!-- The version of PrivateBin, if you use an unstable version paste the commit hash or the GitHub link to the commit here (you can get it by running `git rev-parse HEAD`) -->
**PrivateBin version:** **PrivateBin version:**
* I can reproduce this issue on <https://privatebin.net>: Yes / No

View File

@ -1,12 +1,5 @@
<!-- This is a template for your Pull Request. This are just some suggestions for you. You do not have to use all of them. --> <!-- This is a template for your Pull Request. This are just some suggestions for you. You do not have to use all of them. -->
<!-- **Attention:** Please tick this box to agree to release your code under the projects license. Otherwise your PR cannot be accepted. -->
* [ ] I agree to release the changes in this PR under the Zlib/libpng license as shown in the [LICENSE file](https://github.com/PrivateBin/PrivateBin/blob/master/LICENSE.md#zliblibpng-license-for-privatebin).
<!-- Alternatively uncomment and tick this box to release your code under public domain:
* [ ] To the extent possible under law, I have waived all copyright and related or neighboring rights to this PR and publish it as public domain.
-->
<!-- If your PR fixes an issue, mention it here. You can also just copy the URL - GitHub will convert it for you. <!-- If your PR fixes an issue, mention it here. You can also just copy the URL - GitHub will convert it for you.
If this PR fixes several issues, please prepend each issue url/number with the word "fix"/"fixes" or "close"/"closes" as this automatically closes the issues you mentioned when the PR is merged. If this PR fixes several issues, please prepend each issue url/number with the word "fix"/"fixes" or "close"/"closes" as this automatically closes the issues you mentioned when the PR is merged.
--> -->

10
.gitignore vendored
View File

@ -1,6 +1,7 @@
# Ignore server files for safety # Ignore server files for safety
.htaccess .htaccess
.htpasswd .htpasswd
cfg/conf.ini
# Ignore data/ # Ignore data/
data/ data/
@ -9,6 +10,10 @@ data/
doc/* doc/*
!doc/*.md !doc/*.md
# Ignore developers composer status so it isn't accidentally checked in,
# see https://github.com/PrivateBin/PrivateBin/issues/84
composer.lock
# Ignore vendor dir of Composer except PHP files # Ignore vendor dir of Composer except PHP files
vendor/*.* vendor/*.*
vendor/*/*.* vendor/*/*.*
@ -23,9 +28,8 @@ vendor/**/tests
vendor/**/build_phar.php vendor/**/build_phar.php
!vendor/**/*.php !vendor/**/*.php
composer.lock # Ignore local node modules, unit testing logs, api docs and eclipse project files
js/node_modules/
# Ignore unit testing logs, api docs and eclipse project files
tst/log/ tst/log/
.settings .settings
.buildpath .buildpath

View File

@ -1,3 +1,3 @@
RewriteEngine on RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} ^.*(bot|spider|crawl|https?://|WhatsApp|SkypeUriPreview) [NC] RewriteCond %{HTTP_USER_AGENT} ^.*(bot|spider|crawl|https?://|WhatsApp|SkypeUriPreview|facebookexternalhit) [NC]
RewriteRule .* - [R=403,L] RewriteRule .* - [R=403,L]

View File

@ -15,9 +15,9 @@ return Symfony\CS\Config\Config::create()
->fixers(['concat_with_spaces', 'long_array_syntax', 'standardize_not_equal', ->fixers(['concat_with_spaces', 'long_array_syntax', 'standardize_not_equal',
'operators_spaces', 'duplicate_semicolon', 'operators_spaces', 'duplicate_semicolon',
'remove_leading_slash_use', 'align_equals', 'remove_leading_slash_use', 'align_equals',
'single_array_no_trailing_comma', 'phpdoc_indent', 'phpdoc_scalar', 'single_array_no_trailing_comma', 'phpdoc_indent', 'phpdoc_order',
'phpdoc_to_comment', 'phpdoc_trim', 'phpdoc_scalar', 'phpdoc_to_comment', 'phpdoc_trim',
'phpdoc_types', 'print_to_echo', 'self_accessor', 'single_quote', 'phpdoc_types', 'print_to_echo', 'self_accessor', 'single_quote',
'spaces_cast', 'ternary_spaces', 'phpdoc_order']) 'spaces_cast', 'ternary_spaces'])
->finder($finder) ->finder($finder)
; ;

26
.styleci.yml Normal file
View File

@ -0,0 +1,26 @@
preset: recommended
risky: false
enabled:
- no_empty_comment
- align_equals
- long_array_syntax
- concat_with_spaces
disabled:
- blank_line_after_opening_tag
- blank_line_before_return
- concat_without_spaces
- declare_equal_normalize
- heredoc_to_nowdoc
- method_argument_space
- new_with_braces
- phpdoc_align
- phpdoc_no_access
- phpdoc_separation
- phpdoc_single_line_var_spacing
- phpdoc_summary
- short_array_syntax
- single_line_after_imports
- unalign_equals

View File

@ -9,7 +9,7 @@ before_script:
- composer install -n - composer install -n
script: script:
- cd tst && phpunit - cd tst && ../vendor/bin/phpunit
after_script: after_script:
- cd .. - cd ..

View File

@ -1,5 +1,20 @@
# PrivateBin version history # PrivateBin version history
* **next (not yet released)**
* ADDED: Translations for Spanish, Occitan, Norwegian and Portuguese
* ADDED: Option in configuration to change the default "PrivateBin" title of the site
* CHANGED: Minimum required PHP version is 5.4 (#186)
* CHANGED: Shipped .htaccess files were updated for Apache 2.4 (#192)
* CHANGED: Cleanup of bootstrap template variants and moved icons to `img` directory
* **1.1 (2016-12-26)**
* ADDED: Translations for Italian and Russian
* ADDED: Loading message displayed until decryption succeeded for slower (in terms of CPU or network) systems
* ADDED: Dockerfile for docker container creation
* CHANGED: Using modal dialog to request password input instead of native JS input window (#69)
* CHANGED: Suppressed referrer HTTP header sending when following links in a paste or comment (#96) and added additional HTTP headers for XSS mitigation (#91)
* CHANGED: Updated random_compat and jQuery libraries
* FIXED: XSS using JavaScript stored as markdown formatted paste, after clicking on Raw paste button (#137)
* FIXED: Automatic purging deleting non-expiring pastes, when using database store (#149)
* **1.0 (2016-08-25)** * **1.0 (2016-08-25)**
* ADDED: Translations for Slowene and Chinese * ADDED: Translations for Slowene and Chinese
* ADDED: re-introduced (optional) URL shortener support, which was removed back in version 0.16 for privacy concerns * ADDED: re-introduced (optional) URL shortener support, which was removed back in version 0.16 for privacy concerns

View File

@ -2,7 +2,7 @@
## Active contributors ## Active contributors
Simon Rupf - current developer and maintainer Simon Rupf - current developer and maintainer
rugk - security review, doc improvment & various other stuff rugk - security review, doc improvment & various other stuff
## Past contributions ## Past contributions
@ -19,6 +19,9 @@ Sébastien Sauvage - original idea and main developer
* Adam Fisher - old Favicons * Adam Fisher - old Favicons
* rugk - new logo/icons * rugk - new logo/icons
* Sobak - PSR-4 and PSR-2 refactoring * Sobak - PSR-4 and PSR-2 refactoring
* Nathaniel Olsen - jQuery upgrade
* Alexander Demenshin - modal password dialog
* PunKeel - Dockerfile
## Translations ## Translations
* Hexalyse - French * Hexalyse - French
@ -27,3 +30,9 @@ Sébastien Sauvage - original idea and main developer
* Draky50110 - French * Draky50110 - French
* Filip Muki Dobranić - Slovene * Filip Muki Dobranić - Slovene
* Jiawei Zhou - Chinese * Jiawei Zhou - Chinese
* Stefano Marty - Italian
* R4SAS - Russian
* Alfredo Fabián Altamirano Tena - Spanish
* Quent-in - Occitan
* idarlund - Norwegian
* Tulio Leao - Portuguese

17
Dockerfile Normal file
View File

@ -0,0 +1,17 @@
FROM php:apache
RUN apt-get update && apt-get install -y \
libfreetype6-dev \
libjpeg62-turbo-dev \
libpng12-dev \
wget \
zip \
unzip; \
# We install and enable php-gd
docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/; \
docker-php-ext-install -j$(nproc) gd; \
# We enable Apache's mod_rewrite
a2enmod rewrite
COPY . .

View File

@ -3,8 +3,8 @@
**TL;DR:** Download the **TL;DR:** Download the
[latest release archive](https://github.com/PrivateBin/PrivateBin/releases/latest) [latest release archive](https://github.com/PrivateBin/PrivateBin/releases/latest)
and extract it in your web hosts folder where you want to install your PrivateBin and extract it in your web hosts folder where you want to install your PrivateBin
instance. We try to provide a safe default configuration, but advise you to check instance. We try to provide a safe default configuration, but we advise you to
the options and adjust them as you see fit. check the options and adjust them as you see fit.
## Basic installation ## Basic installation
@ -20,7 +20,7 @@ the options and adjust them as you see fit.
Mcrypt needs to be able to access `/dev/urandom`. This means if `open_basedir` is set, it must include this file. Mcrypt needs to be able to access `/dev/urandom`. This means if `open_basedir` is set, it must include this file.
- GD extension - GD extension
- (optional) a database supported by [PDO](https://secure.php.net/manual/book.pdo.php) - some disk space or (optional) a database supported by [PDO](https://secure.php.net/manual/book.pdo.php)
- ability to create files and folders in the installation directory and the PATH - ability to create files and folders in the installation directory and the PATH
- A web browser with javascript support - A web browser with javascript support
@ -39,6 +39,17 @@ to your PrivateBin installation.
More details can be found in the More details can be found in the
[configuration documentation](https://github.com/PrivateBin/PrivateBin/wiki/Configuration). [configuration documentation](https://github.com/PrivateBin/PrivateBin/wiki/Configuration).
## Further configuration
After (or before) setting up PrivateBin, also set up HTTPS, as without HTTPS
PrivateBin is not secure. (
[More information](https://github.com/PrivateBin/PrivateBin/wiki/FAQ#how-should-i-setup-https))
If you want to use PrivateBin behind Cloudflare, make sure you disabled Rocket
loader and unchecked "Javascript" for Auto Minify, found in your domain settings,
under "Speed". (More information
[in this FAQ entry](https://github.com/PrivateBin/PrivateBin/wiki/FAQ#user-content-how-to-make-privatebin-work-when-using-cloudflare-for-ddos-protection))
## Advanced installation ## Advanced installation
### Changing the path ### Changing the path
@ -104,7 +115,8 @@ The table prefix option is called `tbl`.
> know. > know.
For reference or if you want to create the table schema for yourself (replace For reference or if you want to create the table schema for yourself (replace
`prefix_` with your own table prefix): `prefix_` with your own table prefix and create the table schema with phpMyAdmin
or the MYSQL console):
CREATE TABLE prefix_paste ( CREATE TABLE prefix_paste (
dataid CHAR(16) NOT NULL, dataid CHAR(16) NOT NULL,
@ -134,4 +146,4 @@ For reference or if you want to create the table schema for yourself (replace
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', '0.22'); INSERT INTO prefix_config VALUES('VERSION', '1.1');

View File

@ -7,7 +7,7 @@
[![Codacy Badge](https://api.codacy.com/project/badge/Coverage/094500f62abf4c9aa0c8a8a4520e4789)](https://www.codacy.com/app/PrivateBin/PrivateBin) [![Codacy Badge](https://api.codacy.com/project/badge/Coverage/094500f62abf4c9aa0c8a8a4520e4789)](https://www.codacy.com/app/PrivateBin/PrivateBin)
[![Test Coverage](https://codeclimate.com/github/PrivateBin/PrivateBin/badges/coverage.svg)](https://codeclimate.com/github/PrivateBin/PrivateBin/coverage) [![Code Coverage](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/?branch=master) [![Test Coverage](https://codeclimate.com/github/PrivateBin/PrivateBin/badges/coverage.svg)](https://codeclimate.com/github/PrivateBin/PrivateBin/coverage) [![Code Coverage](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/PrivateBin/PrivateBin/?branch=master)
*Current version: 1.0* *Current version: 1.1*
**PrivateBin** is a minimalist, open source online pastebin where the server has **PrivateBin** is a minimalist, open source online pastebin where the server has
zero knowledge of pasted data. zero knowledge of pasted data.
@ -16,10 +16,10 @@ Data is encrypted/decrypted in the browser using 256bit AES in [Galois Counter m
This is a fork of ZeroBin, originally developed by This is a fork of ZeroBin, originally developed by
[Sébastien Sauvage](https://github.com/sebsauvage/ZeroBin). It was refactored [Sébastien Sauvage](https://github.com/sebsauvage/ZeroBin). It was refactored
to allow easier and cleaner extensions and has now much more features than the to allow easier and cleaner extensions and has now many more features than the
original. It is however still fully compatible to the original ZeroBin 0.19 original. It is however still fully compatible to the original ZeroBin 0.19
data storage scheme. Therefore such installations can be upgraded to this fork data storage scheme. Therefore such installations can be upgraded to this fork
without loosing any data. without losing any data.
## What PrivateBin provides ## What PrivateBin provides

View File

@ -2,9 +2,9 @@
<browserconfig> <browserconfig>
<msapplication> <msapplication>
<tile> <tile>
<square150x150logo src="mstile-150x150.png"/> <square150x150logo src="img/mstile-150x150.png"/>
<square310x310logo src="mstile-310x310.png"/> <square310x310logo src="img/mstile-310x310.png"/>
<wide310x150logo src="mstile-310x150.png"/> <wide310x150logo src="img/mstile-310x150.png"/>
<TileColor>#ffc40d</TileColor> <TileColor>#ffc40d</TileColor>
</tile> </tile>
</msapplication> </msapplication>

1
cfg/.gitignore vendored
View File

@ -1 +0,0 @@
/conf.ini

View File

@ -1,2 +1 @@
Allow from none Require all denied
Deny from all

View File

@ -3,6 +3,9 @@
; An explanation of each setting can be find online at https://github.com/PrivateBin/PrivateBin/wiki/Configuration. ; An explanation of each setting can be find online at https://github.com/PrivateBin/PrivateBin/wiki/Configuration.
[main] [main]
; (optional) set a project name to be displayed on the website
; name = "PrivateBin"
; enable or disable the discussion feature, defaults to true ; enable or disable the discussion feature, defaults to true
discussion = true discussion = true
@ -25,10 +28,10 @@ defaultformatter = "plaintext"
; (optional) set a syntax highlighting theme, as found in css/prettify/ ; (optional) set a syntax highlighting theme, as found in css/prettify/
; syntaxhighlightingtheme = "sons-of-obsidian" ; syntaxhighlightingtheme = "sons-of-obsidian"
; size limit per paste or comment in bytes, defaults to 2 Mibibytes ; size limit per paste or comment in bytes, defaults to 2 Mebibytes
sizelimit = 2097152 sizelimit = 2097152
; template to include, default is "bootstrap" (tpl/bootstrap.html) ; template to include, default is "bootstrap" (tpl/bootstrap.php)
template = "bootstrap" template = "bootstrap"
; (optional) notice to display ; (optional) notice to display
@ -60,7 +63,8 @@ languageselection = false
; custom scripts from third-party domains to your templates, e.g. tracking ; custom scripts from third-party domains to your templates, e.g. tracking
; scripts or run your site behind certain DDoS-protection services. ; scripts or run your site behind certain DDoS-protection services.
; Check the documentation at https://content-security-policy.com/ ; Check the documentation at https://content-security-policy.com/
; cspheader = "default-src 'none'; manifest-src 'self'; connect-src *; script-src 'self'; style-src 'self'; font-src 'self'; img-src 'self' data:; referrer no-referrer;" ; Note: If you use a bootstrap theme, you can remove the allow-popups from the sandbox restrictions.
; cspheader = "default-src 'none'; manifest-src 'self'; connect-src *; script-src 'self'; style-src 'self'; font-src 'self'; img-src 'self' data:; referrer no-referrer; sandbox allow-same-origin allow-scripts allow-forms allow-popups"
; stay compatible with PrivateBin 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 ; if enabled will use base64.js version 1.7 instead of 2.1.9 and sha1 instead of

View File

@ -18,13 +18,14 @@
} }
], ],
"require": { "require": {
"php": "^5.2.6 || ^7.0", "php": "^5.3.0 || ^7.0",
"paragonie/random_compat": "^2.0", "paragonie/random_compat": "2.0.4",
"yzalis/identicon": "^1.1" "yzalis/identicon": "1.1.0"
}, },
"require-dev": { "require-dev": {
"codacy/coverage": "dev-master", "codacy/coverage": "dev-master",
"codeclimate/php-test-reporter": "dev-master" "codeclimate/php-test-reporter": "dev-master",
"phpunit/phpunit": "^4.6 || ^5.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {

View File

@ -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.0 * @version 1.1
*/ */
body { body {
@ -17,6 +17,10 @@ body.navbar-spacing {
padding-top: 70px; padding-top: 70px;
} }
body.loading {
cursor: wait;
}
.buttondisabled { .buttondisabled {
opacity: 0.3; opacity: 0.3;
} }
@ -102,6 +106,12 @@ body.navbar-spacing {
border-left: 1px solid #ccc; border-left: 1px solid #ccc;
padding: 5px 0 5px 10px; padding: 5px 0 5px 10px;
white-space: pre-wrap; white-space: pre-wrap;
transition: background-color 0.75s ease-out;
}
.comment.highlight {
background-color: #ffdd86;
transition: background-color 0.2s ease-in;
} }
footer h4 { footer h4 {

15
css/noscript.css Normal file
View File

@ -0,0 +1,15 @@
/**
* PrivateBin
*
* CSS file only loaded when no JavaScript available.
*
* @link https://github.com/PrivateBin/PrivateBin
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
/* When there is no script at all other */
.noscript-hide {
display: none;
}

View File

@ -1,12 +1,12 @@
/** /**
* PrivateBin * PrivateBin
* *
* a zero-knowledge paste bin * Main CSS file.
* *
* @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.0 * @version 1.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.
@ -117,7 +117,7 @@ h3.title {
#pasteresult { #pasteresult {
background-color: #1F2833; background-color: #1F2833;
color: #fff; color: #fff;
padding: 4px 12px; padding: 4px 12px;
clear: both; clear: both;
-moz-box-shadow: inset 0 2px 2px #000; -moz-box-shadow: inset 0 2px 2px #000;
-webkit-box-shadow: inset 0 2px 2px #000; -webkit-box-shadow: inset 0 2px 2px #000;
@ -161,7 +161,7 @@ button, .button {
background-clip: padding-box; background-clip: padding-box;
} }
button:hover { button:hover {
background-image: linear-gradient(bottom, #424b57 0%, #61707e 100%); background-image: linear-gradient(bottom, #424b57 0%, #61707e 100%);
background-image: -o-linear-gradient(bottom, #424b57 0%, #61707e 100%); background-image: -o-linear-gradient(bottom, #424b57 0%, #61707e 100%);
background-image: -moz-linear-gradient(bottom, #424b57 0%, #61707e 100%); background-image: -moz-linear-gradient(bottom, #424b57 0%, #61707e 100%);
@ -193,8 +193,8 @@ button img {
top: 2px; top: 2px;
} }
.button { .button {
background-color: #414d5a; background-color: #414d5a;
padding: 6px 8px; padding: 6px 8px;
margin: 0 5px 0 0; margin: 0 5px 0 0;
position: relative; position: relative;
@ -218,7 +218,7 @@ button img {
} }
#remainingtime, #password { #remainingtime, #password {
color: #94a3b4; color: #94a3b4;
display: inline; display: inline;
font-size: 0.85em; font-size: 0.85em;
} }
@ -285,6 +285,10 @@ input {
color:#ff0; color:#ff0;
} }
.small {
font-size: 80%;
}
/* --- discussion related CSS ------- */ /* --- discussion related CSS ------- */
#discussion { /* Discussion container */ #discussion { /* Discussion container */
@ -298,7 +302,7 @@ h4.title {
font-size: 1.2em; font-size: 1.2em;
color: #94a3b4; color: #94a3b4;
font-style: italic; font-style: italic;
font-weight: bold; font-weight: bold;
position: relative; position: relative;
margin-left: 30px; margin-left: 30px;
} }
@ -356,7 +360,7 @@ h4.title {
background-clip: padding-box; background-clip: padding-box;
} }
.comment button:hover { .comment button:hover {
background-image: linear-gradient(bottom, #ccd 0, #fff 100%); background-image: linear-gradient(bottom, #ccd 0, #fff 100%);
background-image: -o-linear-gradient(bottom, #ccd 0, #fff 100%); background-image: -o-linear-gradient(bottom, #ccd 0, #fff 100%);
background-image: -moz-linear-gradient(bottom, #ccd 0, #fff 100%); background-image: -moz-linear-gradient(bottom, #ccd 0, #fff 100%);

View File

@ -1,5 +1,5 @@
Generating documentation Generating PHP documentation
======================== ============================
In order to generate the documentation, you will need to install the following In order to generate the documentation, you will need to install the following
packages and its dependencies: packages and its dependencies:
@ -12,7 +12,7 @@ can be found in that projects documentation.
Example for Debian and Ubuntu: Example for Debian and Ubuntu:
```console ```console
$ sudo aptitude install php-pear graphviz $ sudo apt install php-pear graphviz
$ sudo pear channel-discover pear.phpdoc.org $ sudo pear channel-discover pear.phpdoc.org
$ sudo pear install phpdoc/phpDocumentor $ sudo pear install phpdoc/phpDocumentor
``` ```
@ -20,10 +20,41 @@ $ sudo pear install phpdoc/phpDocumentor
To generate the documentation, change into the main directory and run phpdoc: To generate the documentation, change into the main directory and run phpdoc:
```console ```console
$ cd PrivateBin $ cd PrivateBin
$ phpdoc -d lib/ -t doc/ $ phpdoc -t doc/phpdoc -d lib/
``` ```
**Note:** When used with PHP 7, the prerelease of phpDocumentator 2.9 needs to be **Note:** When used with PHP 7, the prerelease of phpDocumentator 2.9 needs to be
manually installed by downloading it from manually installed by downloading it from
[GitHub](https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar) [GitHub](https://github.com/phpDocumentor/phpDocumentor2/releases/download/v2.9.0/phpDocumentor.phar)
and then manually moving it to e.g. `/usr/local/bin` and making it executable. and then manually moving it to e.g. `/usr/local/bin` and making it executable.
Generating JS documentation
============================
In order to generate the documentation, you will need to install the following
packages and its dependencies:
* npm
Then you can use the node package manager to install the latest stable release
of jsdoc globally:
```console
$ npm install -g jsdoc
```
Example for Debian and Ubuntu, including steps to allow current user to install
node modules globally:
```console
$ sudo apt install npm
$ sudo mkdir /usr/local/lib/node_modules
$ sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
$ npm install -g jsdoc
$ ln -s /usr/bin/nodejs /usr/local/bin/node
```
To generate the documentation, change into the main directory and run phpdoc:
```console
$ cd PrivateBin
$ jsdoc -d doc/jsdoc js/privatebin.js
```

View File

@ -1,11 +1,16 @@
{ {
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s ist ein minimalistischer, quelloffener \"Pastebin\"-artiger Dienst, bei dem der Server keinerlei Kenntnis der Inhalte hat. Die Daten werden <i>im Browser</i> mit 256 Bit AES ver- und entschlüsselt. Weitere Informationen sind auf der <a href=\"https://privatebin.info/\">Projektseite</a> zu finden.",
"Because ignorance is bliss":
"Unwissenheit ist ein Segen",
"en": "de", "en": "de",
"Paste does not exist, has expired or has been deleted.": "Paste does not exist, has expired or has been deleted.":
"Diesen Text gibt es nicht, er ist abgelaufen oder wurde gelöscht.", "Diesen Text gibt es nicht, er ist abgelaufen oder wurde gelöscht.",
"PrivateBin requires php 5.3.0 or above to work. Sorry.": "%s requires php 5.3.0 or above to work. Sorry.":
"PrivateBin benötigt PHP 5.3.0 oder höher, um zu funktionieren. Sorry.", "%s benötigt PHP 5.3.0 oder höher, um zu funktionieren. Sorry.",
"PrivateBin requires configuration section [%s] to be present in configuration file.": "%s requires configuration section [%s] to be present in configuration file.":
"PrivateBin benötigt den Konfigurationsabschnitt [%s] in der Konfigurationsdatei um zu funktionieren.", "%s benötigt den Konfigurationsabschnitt [%s] in der Konfigurationsdatei um zu funktionieren.",
"Please wait %d seconds between each post.": "Please wait %d seconds between each post.":
"Bitte warte %d Sekunden zwischen dem Absenden.", "Bitte warte %d Sekunden zwischen dem Absenden.",
"Paste is limited to %s of encrypted data.": "Paste is limited to %s of encrypted data.":
@ -26,15 +31,10 @@
"Falscher Lösch-Code. Text wurde nicht gelöscht.", "Falscher Lösch-Code. Text wurde nicht gelöscht.",
"Paste was properly deleted.": "Paste was properly deleted.":
"Text wurde erfolgreich gelöscht.", "Text wurde erfolgreich gelöscht.",
"PrivateBin": "PrivateBin", "JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.": "JavaScript ist eine Voraussetzung, um %s zu nutzen.<br />Bitte entschuldige die Unannehmlichkeiten.",
"PrivateBin ist ein minimalistischer, quelloffener \"Pastebin\"-artiger Dienst, bei dem der Server keinerlei Kenntnis der Inhalte hat. Die Daten werden <i>im Browser</i> mit 256 Bit AES ver- und entschlüsselt. Weitere Informationen sind auf der <a href=\"https://privatebin.info/\">Projektseite</a> zu finden.", "%s requires a modern browser to work.":
"Because ignorance is bliss": "%s setzt einen modernen Browser voraus, um funktionieren zu können.",
"Unwissenheit ist ein Segen",
"Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.":
"Javascript ist eine Voraussetzung, um PrivateBin zu nutzen.<br />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:": "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:", "Du benutzt immer noch den Internet Explorer? Tu Dir einen Gefallen und wechsle zu einem moderneren Browser:",
"New": "New":
@ -67,7 +67,7 @@
"Never": "Never":
"Nie", "Nie",
"Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.": "Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.":
"Hinweis: Dies ist ein Versuchsdienst. Daten können jederzeit gelöscht werden. Kätzchen werden sterben wenn Du diesen Dienst missbrauchst.", "Hinweis: Dies ist ein Versuchsdienst. Daten können jederzeit gelöscht werden. Kätzchen werden sterben wenn du diesen Dienst missbrauchst.",
"This document will expire in %d seconds.": "This document will expire in %d seconds.":
["Dieses Dokument läuft in einer Sekunde ab.", "Dieses Dokument läuft in %d Sekunden ab."], ["Dieses Dokument läuft in einer Sekunde ab.", "Dieses Dokument läuft in %d Sekunden ab."],
"This document will expire in %d minutes.": "This document will expire in %d minutes.":
@ -83,25 +83,25 @@
"Could not decrypt data (Wrong key?)": "Could not decrypt data (Wrong key?)":
"Konnte Daten nicht entschlüsseln (Falscher Schlüssel?)", "Konnte Daten nicht entschlüsseln (Falscher Schlüssel?)",
"Could not delete the paste, it was not stored in burn after reading mode.": "Could not delete the paste, it was not stored in burn after reading mode.":
"Konnte den Text nicht löschen, er wurde nicht im Einmal-Modus gespeichert.", "Konnte das Paste nicht löschen, es wurde nicht im Einmal-Modus gespeichert.",
"FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.": "FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.":
"DIESER TEXT IST NUR FÜR DICH GEDACHT. Schliesse das Fenster nicht, diese Nachricht kann nur einmal geöffnet werden.", "DIESER TEXT IST NUR FÜR DICH GEDACHT. Schließe das Fenster nicht, diese Nachricht kann nur einmal geöffnet werden.",
"Could not decrypt comment; Wrong key?": "Could not decrypt comment; Wrong key?":
"Konnte Kommentar nicht entschlüsseln; Falscher Schlüssel?", "Konnte Kommentar nicht entschlüsseln; Falscher Schlüssel?",
"Reply": "Reply":
"Antworten", "Antworten",
"Anonymous": "Anonymous":
"Anonym", "Anonym",
"Anonymous avatar (Vizhash of the IP address)": "Avatar generated from IP address":
"Anonymer Avatar (Vizhash der IP-Addresse)", "Avatar (generiert aus der IP-Adresse)",
"Add comment": "Add comment":
"Kommentar hinzufügen", "Kommentar hinzufügen",
"Optional nickname...": "Optional nickname":
"Optionales Pseudonym...", "Optionales Pseudonym",
"Post comment": "Post comment":
"Kommentar absenden", "Kommentar absenden",
"Sending comment...": "Sending comment":
"Sende Kommentar...", "Sende Kommentar",
"Comment posted.": "Comment posted.":
"Kommentar gesendet.", "Kommentar gesendet.",
"Could not refresh display: %s": "Could not refresh display: %s":
@ -112,24 +112,25 @@
"Fehler auf dem Server oder keine Antwort vom Server", "Fehler auf dem Server oder keine Antwort vom Server",
"Could not post comment: %s": "Could not post comment: %s":
"Konnte Kommentar nicht senden: %s", "Konnte Kommentar nicht senden: %s",
"Sending paste (Please move your mouse for more entropy)...": "Please move your mouse for more entropy…":
"Sende Text (Bitte bewege Deine Maus um die Entropie zu erhöhen)...", "Bitte bewege Deine Maus um die Entropie zu erhöhen",
"Sending paste...": "Sending paste":
"Sende Text...", "Sende Paste…",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>": "Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Dein Text ist unter <a id=\"pasteurl\" href=\"%s\">%s</a> zu finden <span id=\"copyhint\">(Drücke [Strg]+[c] um den Link zu kopieren)</span>", "Dein Paste ist unter <a id=\"pasteurl\" href=\"%s\">%s</a> zu finden <span id=\"copyhint\">(Drücke [Strg]+[c] um den Link zu kopieren)</span>",
"Delete data": "Delete data":
"Lösche Daten", "Lösche Daten",
"Could not create paste: %s": "Could not create paste: %s":
"Konnte Text nicht erstellen: %s", "Konnte Paste nicht erstellen: %s",
"Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)": "Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)":
"Konnte Text nicht entschlüsseln: Der Schlüssel fehlt in der Adresse (Hast Du eine Umleitung oder einen URL-Verkürzer benutzt, der Teile der Adresse entfernt?)", "Konnte Paste nicht entschlüsseln: Der Schlüssel fehlt in der Adresse (Hast du eine Umleitung oder einen URL-Verkürzer benutzt, der Teile der Adresse entfernt?)",
"Format": "Format", "Format": "Format",
"Plain Text": "Nur Text", "Plain Text": "Nur Text",
"Source Code": "Quellcode", "Source Code": "Quellcode",
"Markdown": "Markdown", "Markdown": "Markdown",
"Download attachment": "Anhang herunterladen", "Download attachment": "Anhang herunterladen",
"Cloned file attached.": "Kopierte Datei angehängt.", "Cloned: '%s'": "Geklont: '%s'",
"The cloned file '%s' was attached to this paste.": "Die geklonte Datei '%s' wurde angehängt.",
"Attach a file": "Datei anhängen", "Attach a file": "Datei anhängen",
"Remove attachment": "Anhang entfernen", "Remove attachment": "Anhang entfernen",
"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.":
@ -139,6 +140,17 @@
"Shorten URL": "URL verkürzen", "Shorten URL": "URL verkürzen",
"Editor": "Bearbeiten", "Editor": "Bearbeiten",
"Preview": "Vorschau", "Preview": "Vorschau",
"PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": "%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"Der PATH muss bei PrivateBin mit einem \"%s\" enden. Bitte passe Deinen PATH in Deiner index.php an." "Der PATH muss bei %s mit einem \"%s\" enden. Bitte passe Deinen PATH in Deiner index.php an.",
"Decrypt":
"Entschlüsseln",
"Enter password":
"Passwort eingeben",
"Loading…": "Lädt…",
"Decrypting paste…": "Entschlüssle Paste…",
"Preparing new paste…": "Bereite neues Paste vor…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"Wenn diese Nachricht nicht mehr verschwindet, schau bitte in <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">die FAQ</a> (englisch), um zu sehen, wie der Fehler behoben werden kann.",
"+++ no paste text +++":
"+++ kein Paste-Text +++"
} }

151
i18n/es.json Normal file
View File

@ -0,0 +1,151 @@
{
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s es un servicio de tipo \"Pastebin\" minimalista de código abierto, donde el servidor no tiene ningún conocimiento de los datos guardados. Los datos son cifrados/descifrados <i>en el navegador</i> usando 256 bits AES. Más información en la <a href=\"https://privatebin.info/\">página del proyecto</a>.",
"Because ignorance is bliss":
"Porque la ignorancia es dicha",
"en": "es",
"Paste does not exist, has expired or has been deleted.":
"El texto no existe, ha caducado o ha sido eliminado.",
"%s requires php 5.3.0 or above to work. Sorry.":
"%s requiere php 5.3.0 o superior para funcionar. Lo siento.",
"%s requires configuration section [%s] to be present in configuration file.":
"%s requiere que la sección de configuración [%s] esté presente en el archivo de configuración.",
"Please wait %d seconds between each post.":
"Por favor espere %d segundos entre cada publicación.",
"Paste is limited to %s of encrypted data.":
"El texto está limitado a %s de datos cifrados.",
"Invalid data.":
"Datos inválidos.",
"You are unlucky. Try again.":
"Tienes mala suerte. Inténtalo de nuevo",
"Error saving comment. Sorry.":
"Error al guardar el comentario. Lo siento.",
"Error saving paste. Sorry.":
"Error al guardar el texto. Lo siento",
"Invalid paste ID.":
"ID del texto inválido.",
"Paste is not of burn-after-reading type.":
"El texto no es del tipo \"destruir despues de leer\".",
"Wrong deletion token. Paste was not deleted.":
"Token de eliminación erróneo. El texto no fue eliminado.",
"Paste was properly deleted.":
"El texto se ha eliminado correctamente.",
"JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"JavaScript es necesario para que %s funcione.<br />Sentimos los inconvenientes ocasionados.",
"%s requires a modern browser to work.":
"%s requiere un navegador moderno para funcionar.",
"Still using Internet Explorer? Do yourself a favor, switch to a modern browser:":
"¿Sigues usando Internet Explorer? Hazte un favor, cambia a un navegador moderno:",
"New":
"Nuevo",
"Send":
"Enviar",
"Clone":
"Clonar",
"Raw text":
"Texto sin formato",
"Expires":
"Caducar en",
"Burn after reading":
"Destruir después de leer",
"Open discussion":
"Discusión abierta",
"Password (recommended)":
"Contraseña (recomendado)",
"Discussion":
"Discusión",
"Toggle navigation":
"Cambiar navegación",
"%d seconds": ["%d segundo", "%d segundos"],
"%d minutes": ["%d minuto", "%d minutos"],
"%d hours": ["%d hora", "%d horas"],
"%d days": ["%d día", "%d días"],
"%d weeks": ["%d semana", "%d semanas"],
"%d months": ["%d mes", "%d meses"],
"%d years": ["%d año", "%d años"],
"Never":
"Nunca",
"Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.":
"Nota: Este es un servicio de prueba. Los datos pueden ser eliminados en cualquier momento. Gatitos morirán si se abusa de este servicio.",
"This document will expire in %d seconds.":
["Este documento caducará en un segundo.", "Este documento caducará en %d segundos."],
"This document will expire in %d minutes.":
["Este documento caducará en un minuto.", "Este documento caducará en %d minutos."],
"This document will expire in %d hours.":
["Este documento caducará en una hora.", "Este documento caducará en %d horas."],
"This document will expire in %d days.":
["Este documento caducará en un día.", "Este documento caducará en %d días."],
"This document will expire in %d months.":
["Este documento caducará en un mes.", "Este documento caducará en %d meses."],
"Please enter the password for this paste:":
"Por favor ingrese la contraseña para este documento:",
"Could not decrypt data (Wrong key?)":
"No fue posible descifrar los datos (¿Clave errónea?)",
"Could not delete the paste, it was not stored in burn after reading mode.":
"No fue posible eliminar el documento, no fue guardado en modo \"destruir despues de leer\".",
"FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.":
"SÓLO PARA TUS OJOS. No cierre esta ventana, este mensaje no se puede volver a mostrar.",
"Could not decrypt comment; Wrong key?":
"No se pudo descifrar el comentario; ¿Llave incorrecta?",
"Reply":
"Responder",
"Anonymous":
"Anónimo",
"Anonymous avatar (Vizhash of the IP address)":
"Avatar anónimo (Vizhash de la dirección IP)",
"Add comment":
"Añadir comentario",
"Optional nickname…":
"Seudónimo opcional…",
"Post comment":
"Publicar comentario",
"Sending comment…":
"Enviando comentario…",
"Comment posted.":
"Comentario publicado.",
"Could not refresh display: %s":
"No se pudo actualizar la vista: %s",
"unknown status":
"Estado desconocido",
"server error or not responding":
"Error del servidor o el servidor no responde",
"Could not post comment: %s":
"No fue posible publicar comentario: %s",
"Sending paste (Please move your mouse for more entropy)…":
"Enviando texto (Por favor, mueva el ratón para mayor entropía)…",
"Sending paste…":
"Enviando texto…",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Su texto está en <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Presione [Ctrl]+[c] para copiar)</span>",
"Delete data":
"Eliminar datos",
"Could not create paste: %s":
"No fue posible crear el archivo: %s",
"Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)":
"No es posible descifrar el documento: Falta la clave de descifrado en la URL (¿Utilizó un redirector o un acortador de URL que quite parte de la URL?)",
"Format": "Formato",
"Plain Text": "Texto sin formato",
"Source Code": "Código fuente",
"Markdown": "Markdown",
"Download attachment": "Descargar adjunto",
"Cloned file attached.": "Archivo clonado adjunto.",
"Attach a file": "Adjuntar archivo",
"Remove attachment": "Remover adjunto",
"Your browser does not support uploading encrypted files. Please use a newer browser.":
"Tu navegador no admite la carga de archivos cifrados. Utilice un navegador más reciente.",
"Invalid attachment.": "Adjunto inválido.",
"Options": "Opciones",
"Shorten URL": "Acortar URL",
"Editor": "Editor",
"Preview": "Previsualización",
"%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"%s requiere que el PATH termine en \"%s\". Por favor, actualice el PATH en su index.php.",
"Decrypt":
"Descifrar",
"Enter password":
"Ingrese contraseña",
"Loading…": "Cargando…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"En caso de que este mensaje nunca desaparezca por favor revise <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">este FAQ para obtener información para solucionar problemas</a>."
}

View File

@ -1,11 +1,16 @@
{ {
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s 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 <i>dans le navigateur</i> par un chiffrage AES 256 bits. Plus d'informations sur <a href=\"https://privatebin.info/\">la page du projet</a>.",
"Because ignorance is bliss":
"Parce que l'ignorance c'est le bonheur",
"en": "fr", "en": "fr",
"Paste does not exist, has expired or has been deleted.": "Paste does not exist, has expired or has been deleted.":
"Le paste n'existe pas, a expiré, ou a été supprimé.", "Le paste n'existe pas, a expiré, ou a été supprimé.",
"PrivateBin requires php 5.3.0 or above to work. Sorry.": "%s requires php 5.3.0 or above to work. Sorry.":
"Désolé, PrivateBin nécessite php 5.3.0 ou supérieur pour fonctionner.", "Désolé, %s nécessite php 5.3.0 ou supérieur pour fonctionner.",
"PrivateBin requires configuration section [%s] to be present in configuration file.": "%s 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.", "%s a besoin de la section de configuration [%s] dans le fichier de configuration pour fonctionner.",
"Please wait %d seconds between each post.": "Please wait %d seconds between each post.":
"Merci d'attendre %d secondes entre chaque publication.", "Merci d'attendre %d secondes entre chaque publication.",
"Paste is limited to %s of encrypted data.": "Paste is limited to %s of encrypted data.":
@ -26,15 +31,10 @@
"Jeton de suppression incorrect. Le paste n'a pas été supprimé.", "Jeton de suppression incorrect. Le paste n'a pas été supprimé.",
"Paste was properly deleted.": "Paste was properly deleted.":
"Le paste a été correctement supprimé.", "Le paste a été correctement supprimé.",
"PrivateBin": "PrivateBin", "JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.": "JavaScript est requis pour faire fonctionner %s. <br />Désolé pour cet inconvénient.",
"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 <i>dans le navigateur</i> par un chiffrage AES 256 bits. Plus d'informations sur <a href=\"https://privatebin.info/\">la page du projet</a>.", "%s requires a modern browser to work.":
"Because ignorance is bliss": "%s nécessite un navigateur moderne pour fonctionner.",
"Parce que l'ignorance c'est le bonheur",
"Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.":
"Javascript est requis pour faire fonctionner PrivateBin. <br />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:": "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 :", "Encore sur Internet Explorer ? Faites-vous une faveur, passez à un navigateur moderne :",
"New": "New":
@ -96,12 +96,12 @@
"Avatar anonyme (Vizhash de l'adresse IP)", "Avatar anonyme (Vizhash de l'adresse IP)",
"Add comment": "Add comment":
"Ajouter un commentaire", "Ajouter un commentaire",
"Optional nickname...": "Optional nickname":
"Pseudonyme optionnel...", "Pseudonyme optionnel",
"Post comment": "Post comment":
"Poster le commentaire", "Poster le commentaire",
"Sending comment...": "Sending comment":
"Envoi du commentaire...", "Envoi du commentaire",
"Comment posted.": "Comment posted.":
"Commentaire posté.", "Commentaire posté.",
"Could not refresh display: %s": "Could not refresh display: %s":
@ -112,10 +112,10 @@
"Le serveur ne répond pas ou a rencontré une erreur", "Le serveur ne répond pas ou a rencontré une erreur",
"Could not post comment: %s": "Could not post comment: %s":
"Impossible de poster le commentaire : %s", "Impossible de poster le commentaire : %s",
"Sending paste (Please move your mouse for more entropy)...": "Sending paste (Please move your mouse for more entropy)":
"Envoi du paste (Merci de bouger votre souris pour plus d'entropie)...", "Envoi du paste (Merci de bouger votre souris pour plus d'entropie)",
"Sending paste...": "Sending paste":
"Envoi du paste...", "Envoi du paste",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>": "Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Votre paste est disponible à l'adresse <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Appuyez sur [Ctrl]+[c] pour copier)</span>", "Votre paste est disponible à l'adresse <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Appuyez sur [Ctrl]+[c] pour copier)</span>",
"Delete data": "Delete data":
@ -148,6 +148,13 @@
"Shorten URL": "Raccourcir URL", "Shorten URL": "Raccourcir URL",
"Editor": "Éditer", "Editor": "Éditer",
"Preview": "Prévisualiser", "Preview": "Prévisualiser",
"PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": "%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php." "%s requiert que le PATH se termine dans un \"%s\". Veuillez mettre à jour le PATH dans votre index.php.",
"Decrypt":
"Déchiffrer",
"Enter password":
"Entrez le mot de passe",
"Loading…": "Chargement…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"Si ce message ne disparaîssait pas, jetez un oeil à <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">cette FAQ pour des idées de résolution</a> (en Anglais)."
} }

151
i18n/it.json Normal file
View File

@ -0,0 +1,151 @@
{
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s è un sistema di tipo \"Pastebin\" online, open source, minimalista. Il server non possiede alcuna conoscenza (\"Zero Knowledge\") del contenuto dei dati inviati. I dati sono cifrati/decifrati <i>nel Browser</i> con algoritmo AES a 256 Bit. Per ulteriori informazioni, vedi <a href=\"https://privatebin.info/\">Sito del progetto</a>.",
"Because ignorance is bliss":
"Perché l'ignoranza è una benedizione (Because ignorance is bliss)",
"en": "it",
"Paste does not exist, has expired or has been deleted.":
"Questo messaggio non esiste, è scaduto o è stato cancellato.",
"%s requires php 5.3.0 or above to work. Sorry.":
"%s richiede PHP 5.3.0 o superiore.",
"%s requires configuration section [%s] to be present in configuration file.":
"%s richiede la presenza della sezione [%s] nei file di configurazione.",
"Please wait %d seconds between each post.":
"Attendi per favore %d secondi prima di ciascun invio.",
"Paste is limited to %s of encrypted data.":
"La dimensione del messaggio è limitata a %s di dati cifrati.",
"Invalid data.":
"Dati non validi.",
"You are unlucky. Try again.":
"Riprova, sarai più fortunato.",
"Error saving comment. Sorry.":
"Errore durante il salvataggio del commento.",
"Error saving paste. Sorry.":
"Errore durante il salvataggio del messaggio.",
"Invalid paste ID.":
"ID-Messaggio non valido.",
"Paste is not of burn-after-reading type.":
"Il messaggio non è di tipo Distruggi-dopo-lettura.",
"Wrong deletion token. Paste was not deleted.":
"Codice cancellazione errato. Il messaggio NON è stato cancellato.",
"Paste was properly deleted.":
"Il messaggio è stato correttamente cancellato.",
"JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"%s funziona solo con JavaScript attivo.<br />Ci dispiace per l'inconveniente.",
"%s requires a modern browser to work.":
"%s richiede un browser moderno e aggiornato per funzionare.",
"Still using Internet Explorer? Do yourself a favor, switch to a modern browser:":
"Usi ancora Internet Explorer? Ti consigliamo di passare ad un browser più sicuro:",
"New":
"Nuovo",
"Send":
"Invia",
"Clone":
"Clona",
"Raw text":
"Testo Raw",
"Expires":
"Scade",
"Burn after reading":
"Distruggi dopo lettura",
"Open discussion":
"Apri discussione",
"Password (recommended)":
"Password (raccomandato)",
"Discussion":
"Discussione",
"Toggle navigation":
"Scambia Navigazione",
"%d seconds": ["%d secondo", "%d secondi"],
"%d minutes": ["%d minuto", "%d minuti"],
"%d hours": ["%d ora", "%d ore"],
"%d days": ["%d giorno", "%d giorni"],
"%d weeks": ["%d settimana", "%d settimane"],
"%d months": ["%d mese", "%d mesi"],
"%d years": ["%d anno", "%d anni"],
"Never":
"Mai",
"Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.":
"Nota: questo è un servizio di prova, i dati possono essere cancellati in qualsiasi momento. Ti preghiamo di non abusare di questo servizio, grazie.",
"This document will expire in %d seconds.":
["Questo documento scadrà tra un secondo.", "Questo documento scadrà in %d secondi."],
"This document will expire in %d minutes.":
["Questo documento scadrà tra un minuto.", "Questo documento scadrà in %d minuti."],
"This document will expire in %d hours.":
["Questo documento scadrà tra un'ora.", "Questo documento scadrà in %d ore."],
"This document will expire in %d days.":
["Questo documento scadrà tra un giorno.", "Questo documento scadrà in %d giorni."],
"This document will expire in %d months.":
["Questo documento scadrà tra un mese.", "Questo documento scadrà in %d mesi."],
"Please enter the password for this paste:":
"Inserisci la password per questo messaggio:",
"Could not decrypt data (Wrong key?)":
"Non riesco a decifrari i dati (Chiave errata?)",
"Could not delete the paste, it was not stored in burn after reading mode.":
"Non riesco a cancellare il messaggio, non è stato salvato in modalità Distruggi-dopo-lettora.",
"FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.":
"FOR YOUR EYES ONLY. Non chiudere questa finestra, il messaggio non può essere visualizzato una seconda volta.",
"Could not decrypt comment; Wrong key?":
"Non riesco a decifrari il commento (Chiave errata?)",
"Reply":
"Rispondi",
"Anonymous":
"Anonimo",
"Anonymous avatar (Vizhash of the IP address)":
"Avatar Anonino (Vizhash dell'indirizzo IP)",
"Add comment":
"Aggiungi un commento",
"Optional nickname…":
"Nickname opzionale…",
"Post comment":
"Invia commento",
"Sending comment…":
"Commento in fase di invio…",
"Comment posted.":
"Commento inviato.",
"Could not refresh display: %s":
"Non riesco ad aggiornare il display: %s",
"unknown status":
"errore sconosciuto",
"server error or not responding":
"errore o mancata risposta dal server",
"Could not post comment: %s":
"Impossibile inviare il commento: %s",
"Sending paste (Please move your mouse for more entropy)…":
"Invio messaggio (Muovi il mouse in modo casuale, per generare maggior entropia)…",
"Sending paste…":
"Messaggio in fase di invio…",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Il tuo messaggio è qui: <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">([CTRL | CMD]+[C] per copiare il link)</span>",
"Delete data":
"Cancella i dati",
"Could not create paste: %s":
"Non rieco a creare il messaggio: %s",
"Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)":
"Non riesco a decifrare il messaggio: manca la chiave di decifrazione nell'URL (La chiave è parte integrante dell'URL. Per caso hai usato un Redirector o un altro servizio che ha rimosso una parte dell'URL?)",
"Format": "Formato",
"Plain Text": "Solo Testo",
"Source Code": "Codice Sorgente",
"Markdown": "Markdown",
"Download attachment": "Scarica Allegato",
"Cloned file attached.": "Copia del file allegata.",
"Attach a file": "Allega un file",
"Remove attachment": "Rimuovi allegato",
"Your browser does not support uploading encrypted files. Please use a newer browser.":
"Il tuo browser non supporta l'invio di file cifrati. Utilizza un browser più recente.",
"Invalid attachment.": "Allegato non valido.",
"Options": "Opzioni",
"Shorten URL": "Accorcia URL",
"Editor": "Editor",
"Preview": "Preview",
"%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"%s necessita che PATH termini con \"%s\". Aggiorna la variabile PATH nel tuo index.php.",
"Decrypt":
"Decrypt",
"Enter password":
"Inserisci la password",
"Loading…": "Loading…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a> (in English)."
}

151
i18n/no.json Normal file
View File

@ -0,0 +1,151 @@
{
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s er en minimalistisk, åpen kildekode, elektronisk tilgjengelig pastebin hvor serveren ikke har kunnskap om dataene som limes inn. Dataene krypteres/dekrypteres <i>i nettleseren</i> ved hjelp av 256 bits AES. Mer informasjon om prosjektet på <a href=\"https://privatebin.info/\">prosjektsiden</a>.",
"Because ignorance is bliss":
"Fordi uvitenhet er lykke",
"en": "no",
"Paste does not exist, has expired or has been deleted.":
"Innlegget eksisterer ikke, er utløpt eller har blitt slettet.",
"%s requires php 5.3.0 or above to work. Sorry.":
"Beklager, %s krever php 5.3.0 eller nyere for å kjøre.",
"%s requires configuration section [%s] to be present in configuration file.":
"%s krever konfigurasjonsdel [%s] å være til stede i konfigurasjonsfilen .",
"Please wait %d seconds between each post.":
"Vennligst vent %d sekunder mellom hvert innlegg.",
"Paste is limited to %s of encrypted data.":
"Innlegg er begrenset til %s av kryptert data.",
"Invalid data.":
"Ugyldige data.",
"You are unlucky. Try again.":
"Du er uheldig. Prøv igjen.",
"Error saving comment. Sorry.":
"Beklager, det oppstod en feil ved lagring kommentar.",
"Error saving paste. Sorry.":
"Beklager, det oppstod en feil ved lagring innlegg.",
"Invalid paste ID.":
"Feil innlegg ID.",
"Paste is not of burn-after-reading type.":
"Innlegg er ikke av type slett-etter-lesing.",
"Wrong deletion token. Paste was not deleted.":
"Feil slettingsnøkkel. Innlegg ble ikke fjernet.",
"Paste was properly deleted.":
"Innlegget er slettet.",
"JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"Javascript kreves for at %s skal fungere<br />Beklager ulempene.",
"%s requires a modern browser to work.":
"%s krever en moderne nettleser for å fungere.",
"Still using Internet Explorer? Do yourself a favor, switch to a modern browser:":
"Fortsatt bruker av Internet Explorer? Gjør deg selv en tjeneste og bytt til en moderne nettleser:",
"New":
"Ny",
"Send":
"Send",
"Clone":
"Kopier",
"Raw text":
"Ren tekst",
"Expires":
"Utgår",
"Burn after reading":
"Slett etter lesing",
"Open discussion":
"Åpen diskusjon",
"Password (recommended)":
"Passord (anbefalt)",
"Discussion":
"Diskusjon",
"Toggle navigation":
"Veksle navigasjon",
"%d seconds": ["%d sekund", "%d sekunder"],
"%d minutes": ["%d minutt", "%d minutter"],
"%d hours": ["%d time", "%d timer"],
"%d days": ["%d dag", "%d dager"],
"%d weeks": ["%d uke", "%d uker"],
"%d months": ["%d måned", "%d måneder"],
"%d years": ["%d år", "%d år"],
"Never":
"Aldri",
"Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.":
"Merk: Dette er en test tjeneste: Data kan slettes når som helst. Kattunger vil dø hvis du misbruker denne tjenesten.",
"This document will expire in %d seconds.":
["Dette dokumentet vil utløpe om %d sekund.", "Dette dokumentet vil utløpe om %d sekunder."],
"This document will expire in %d minutes.":
["Dette dokumentet vil utløpe om %d minutt.", "Dette dokumentet vil utløpe om %d minutter."],
"This document will expire in %d hours.":
["Dette dokumentet vil utløpe om %d time.", "Dette dokumentet vil utløpe om %d timer."],
"This document will expire in %d days.":
["Dette dokumentet vil utløpe om %d dag.", "Dette dokumentet vil utløpe om %d dager."],
"This document will expire in %d months.":
["Dette dokumentet vil utløpe om %d måned.", "Dette dokumentet vil utløpe om %d måneder."],
"Please enter the password for this paste:":
"Vennligst skriv inn passordet for dette innlegget:",
"Could not decrypt data (Wrong key?)":
"Kunne ikke dekryptere data (Feil nøkkel?)",
"Could not delete the paste, it was not stored in burn after reading mode.":
"Kan ikke slette innlegget, det ble ikke lagret i slett-etter-les modus.",
"FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.":
"KUN FOR DINE ØYNE. Ikke lukk dette vinduet, denne meldingen kan ikke bli vist igjen.",
"Could not decrypt comment; Wrong key?":
"Kan ikke dekryptere kommentar; Feil nøkkel?",
"Reply":
"Svar",
"Anonymous":
"Anonym",
"Anonymous avatar (Vizhash of the IP address)":
"Anonym avatar (Vizhash av IP adressen)",
"Add comment":
"Legg til kommentar",
"Optional nickname…":
"Valgfritt kallenavn…",
"Post comment":
"Send kommentar",
"Sending comment…":
"Sender Kommentar…",
"Comment posted.":
"Kommentar sendt.",
"Could not refresh display: %s":
"Kunne ikke oppdatere skjermen: %s",
"unknown status":
"ukjent status",
"server error or not responding":
"server feilet eller svarer ikke",
"Could not post comment: %s":
"Kunne ikke sende kommentar: %s",
"Sending paste (Please move your mouse for more entropy)…":
"Sender innlegg (Flytt musen for mere entropi)…",
"Sending paste…":
"Sender innlegg…",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Ditt innlegg er <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Trykk [Ctrl]+[c] for å kopiere)</span>",
"Delete data":
"Slett data",
"Could not create paste: %s":
"Kunne ikke opprette innlegg: %s",
"Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)":
"Kan ikke dekryptere innlegg: Dekrypteringsnøkkelen mangler i adressen (Har du bruket en redirector eller en URL forkorter som fjerner en del av addressen?)",
"Format": "Format",
"Plain Text": "Ren Tekst",
"Source Code": "Kildekode",
"Markdown": "Oppmerket",
"Download attachment": "Last ned vedlegg",
"Cloned file attached.": "Kopier vedlegg.",
"Attach a file": "Legg til fil",
"Remove attachment": "Slett vedlegg",
"Your browser does not support uploading encrypted files. Please use a newer browser.":
"Nettleseren din støtter ikke å laste opp krypterte filer. Vennligst bruk en nyere nettleser.",
"Invalid attachment.": "Ugyldig vedlegg.",
"Options": "Alternativer",
"Shorten URL": "Adresse-forkorter",
"Editor": "Rediger",
"Preview": "Forhåndsvis",
"%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"%s krever at PATH ender på \"%s\". Vennligst oppdater PATH i index.php.",
"Decrypt":
"Dekrypter",
"Enter password":
"Skriv inn passord",
"Loading…": "Laster…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"Hvis denne meldingen ikke forsvinner kan du ta en titt på siden med <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">ofte stilte spørsmål</a> for informasjon om feilsøking."
}

160
i18n/oc.json Normal file
View File

@ -0,0 +1,160 @@
{
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s es un 'pastebin' (o gestionari d'extrachs de tèxte e còdi font) minimalista e open source, dins lo qual lo servidor a pas cap de coneissença de las donadas mandadas. Las donadas son chifradas/deschifradas <i>dins lo navigator</i> per un chiframent AES 256 bits. Mai informacions sus <a href=\"https://privatebin.info/\">la pagina del projècte</a>.",
"Because ignorance is bliss":
"Perque l'ignorància es bonaür",
"en": "oc",
"Paste does not exist, has expired or has been deleted.":
"Lo tèxte existís pas, a expirat, o es estat suprimit.",
"%s requires php 5.3.0 or above to work. Sorry.":
"O planhèm, %s necessita php 5.3.0 o superior per foncionar.",
"%s requires configuration section [%s] to be present in configuration file.":
"%s fa besonh de la seccion de configuracion [%s] dins lo fichièr de configuracion per foncionar.",
"Please wait %d seconds between each post.":
"Mercés d'esperar %d segondas entre cada publicacion.",
"Paste is limited to %s of encrypted data.":
"Lo tèxte es limitat a %s de donadas chifradas.",
"Invalid data.":
"Donadas invalidas.",
"You are unlucky. Try again.":
"Pas cap de fortuna. Tornatz ensajar.",
"Error saving comment. Sorry.":
"Error al moment de salvagardar lo comentari. O planhèm.",
"Error saving paste. Sorry.":
"Error al moment de salvagardar lo tèxte. O planhèm.",
"Invalid paste ID.":
"ID del tèxte invalid.",
"Paste is not of burn-after-reading type.":
"Lo tèxte es pas del tip \"Escafar aprèp lectura\".",
"Wrong deletion token. Paste was not deleted.":
"Geton de supression incorrècte. Lo tèxte es pas estat suprimit.",
"Paste was properly deleted.":
"Lo tèxte es estat correctament suprimit.",
"JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"JavaScript es requesit per far foncionar %s. <br />O planhèm per l'inconvenient.",
"%s requires a modern browser to work.":
"%s necessita un navigator modèrn per foncionar.",
"Still using Internet Explorer? Do yourself a favor, switch to a modern browser:":
"Encora sus Internet Explorer ? Fasètz-vos una favor, passatz a un navigator modèrn :",
"New":
"Nòu",
"Send":
"Mandar",
"Clone":
"Clonar",
"Raw text":
"Tèxte brut",
"Expires":
"Expira",
"Burn after reading":
"Escafar aprèp lectura",
"Open discussion":
"Autorizar la discussion",
"Password (recommended)":
"Senhal (recomandat)",
"Discussion":
"Discussion",
"Toggle navigation":
"Virar la navigacion",
"%d seconds": ["%d segonda", "%d segondas"],
"%d minutes": ["%d minuta", "%d minutas"],
"%d hours": ["%d ora", "%d oras"],
"%d days": ["%d jorn", "%d jorns"],
"%d weeks": ["%d setmana", "%d setmanas"],
"%d months": ["%d mes", "%d meses"],
"%d years": ["%d an", "%d ans"],
"Never":
"Jamai",
"Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.":
"Nota : Aquò es un servici d'espròva : las donadas pòdon èsser suprimidas a cada moment. De catons moriràn s'abusatz d'aqueste servici.",
"This document will expire in %d seconds.":
["Ce document expirera dans %d seconde.", "Aqueste document expirarà dins %d segondas."],
"This document will expire in %d minutes.":
["Ce document expirera dans %d minute.", "Aqueste document expirarà dins %d minutas."],
"This document will expire in %d hours.":
["Ce document expirera dans %d heure.", "Aqueste document expirarà dins %d oras."],
"This document will expire in %d days.":
["Ce document expirera dans %d jour.", "Aqueste document expirarà dins %d jorns."],
"This document will expire in %d months.":
["Ce document expirera dans %d mois.", "Aqueste document expirarà dins %d meses."],
"Please enter the password for this paste:":
"Picatz lo senhal per aqueste tèxte :",
"Could not decrypt data (Wrong key?)":
"Impossible de deschifrar las donadas (marrida clau ?)",
"Could not delete the paste, it was not stored in burn after reading mode.":
"Impossible de suprimir lo tèxte, perque es pas estat gardat en mòde \"Escafar aprèp lectura\".",
"FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.":
"PER VÒSTRES UÈLHS SOLAMENT. Tampetz pas aquesta fenèstra, aqueste tèxte poirà pas mai èsser afichat.",
"Could not decrypt comment; Wrong key?":
"Impossible de deschifrar lo comentari ; marrida clau ?",
"Reply":
"Respondre",
"Anonymous":
"Anonime",
"Anonymous avatar (Vizhash of the IP address)":
"Avatar anonime (Vizhash de l'adreça IP)",
"Add comment":
"Apondre un comentari",
"Optional nickname…":
"Escais opcional…",
"Post comment":
"Mandar lo comentari",
"Sending comment…":
"Mandadís del comentari…",
"Comment posted.":
"Comentari mandat.",
"Could not refresh display: %s":
"Impossible d'actualizar l'afichatge : %s",
"unknown status":
"Estatut desconegut",
"server error or not responding":
"Lo servidor respond pas o a rencontrat una error",
"Could not post comment: %s":
"Impossible de mandar lo comentari : %s",
"Sending paste (Please move your mouse for more entropy)…":
"Mandadís del tèxte (Mercés de bolegar vòstra mirga per mai entropia)…",
"Sending paste…":
"Mandadís del tèxte…",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Vòstre tèxte es disponible a l'adreça <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Picatz sus [Ctrl]+[c] per copiar)</span>",
"Delete data":
"Supprimir las donadas del tèxte",
"Could not create paste: %s":
"Impossible de crear lo tèxte : %s",
"Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)":
"Impossible de deschifrar lo tèxte : Clau de deschiframent absenta de l'URL (Avètz utilizat un redirector o un site de reduccion d'URL que suprimís una partida de l'URL ?)",
"B": "o",
"KiB": "Kio",
"MiB": "Mio",
"GiB": "Gio",
"TiB": "Tio",
"PiB": "Pio",
"EiB": "Eio",
"ZiB": "Zio",
"YiB": "Yio",
"Format": "Format",
"Plain Text": "Tèxte brut",
"Source Code": "Còdi font",
"Markdown": "Markdown",
"Download attachment": "Telecargar la pèça junta",
"Cloned file attached.": "Clonar lo fichièr junt.",
"Attach a file": "Juntar un fichièr ",
"Remove attachment": "Levar la pèca junta",
"Your browser does not support uploading encrypted files. Please use a newer browser.":
"Vòstre navigator es pas compatible amb lo mandadís de fichièrs chifrats. Mercés d'emplegar un navigator mai recent.",
"Invalid attachment.": "Pèça junta invalida.",
"Options": "Opcions",
"Shorten URL": "Acorchir l'URL",
"Editor": "Editar",
"Preview": "Previsualizar",
"%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"%s demanda que lo PATH termine en \"%s\". Mercés de metre a jorn lo PATH dins vòstre index.php.",
"Decrypt":
"Deschifrar",
"Enter password":
"Picatz lo senhal",
"Loading…": "Cargament…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"Se per cas aqueste messatge quita pas de s'afichar mercés de gaitar <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">aquesta FAQ per las solucions</a> (en Anglés)."
}

View File

@ -1,11 +1,16 @@
{ {
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s 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 <i>w przeglądarce</i> z użyciem 256-bitowego klucza AES. Więcej informacji na <a href=\"https://privatebin.info/\">stronie projektu</a>.",
"Because ignorance is bliss":
"Ponieważ ignorancja jest cnotą",
"en": "pl", "en": "pl",
"Paste does not exist, has expired or has been deleted.": "Paste does not exist, has expired or has been deleted.":
"Wklejka nie istnieje, wygasła albo została usunięta.", "Wklejka nie istnieje, wygasła albo została usunięta.",
"PrivateBin requires php 5.3.0 or above to work. Sorry.": "%s requires php 5.3.0 or above to work. Sorry.":
"PrivateBin wymaga PHP w wersji 5.3.0 lub nowszej, sorry.", "%s wymaga PHP w wersji 5.3.0 lub nowszej, sorry.",
"PrivateBin requires configuration section [%s] to be present in configuration file.": "%s requires configuration section [%s] to be present in configuration file.":
"PrivateBin wymaga obecności sekcji [%s] w pliku konfiguracyjnym.", "%s wymaga obecności sekcji [%s] w pliku konfiguracyjnym.",
"Please wait %d seconds between each post.": "Please wait %d seconds between each post.":
"Poczekaj %d sekund pomiędzy każdą wklejką.", "Poczekaj %d sekund pomiędzy każdą wklejką.",
"Paste is limited to %s of encrypted data.": "Paste is limited to %s of encrypted data.":
@ -26,15 +31,10 @@
"Nieprawidłowy token usuwania. Wklejka nie została usunięta.", "Nieprawidłowy token usuwania. Wklejka nie została usunięta.",
"Paste was properly deleted.": "Paste was properly deleted.":
"Wklejka usunięta poprawnie.", "Wklejka usunięta poprawnie.",
"PrivateBin": "PrivateBin", "JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.": "Do działania %sa jest wymagany JavaScript. Przepraszamy za tę niedogodność.",
"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 <i>w przeglądarce</i> z użyciem 256-bitowego klucza AES. Więcej informacji na <a href=\"https://privatebin.info/\">stronie projektu</a>.", "%s requires a modern browser to work.":
"Because ignorance is bliss": "%s wymaga do działania nowoczesnej przeglądarki.",
"Ponieważ ignorancja jest cnotą",
"Javascript is required for PrivateBin to work.<br />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:": "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ę:", "Cały czas używasz Internet Explorera? Zrób sobie przysługę, przesiądź się na nowoczesną przeglądarkę:",
"New": "New":
@ -59,11 +59,11 @@
"Przełącz nawigację", "Przełącz nawigację",
"%d seconds": ["%d second", "%d second", "%d second"], "%d seconds": ["%d second", "%d second", "%d second"],
"%d minutes": ["%d minut", "%d minut", "%d minut"], "%d minutes": ["%d minut", "%d minut", "%d minut"],
"%d hours": ["%d godzina", "%d godzina", "godzinę"], "%d hours": ["%d godzina", "%d godzina", "%d godzinę"],
"%d days": ["%d dzień", "%d dzień", "%d dzień"], "%d days": ["%d dzień", "%d dzień", "%d dzień"],
"%d weeks": ["%d tydzień", "%d tydzień", "tydzień"], "%d weeks": ["%d tydzień", "%d tydzień", "%d tydzień"],
"%d months": ["%d miesiąc", "%d miesiąc", "miesiąc"], "%d months": ["%d miesiąc", "%d miesiąc", "%d miesiąc"],
"%d years": ["%d rok", "%d rok", "rok"], "%d years": ["%d rok", "%d rok", "%d rok"],
"Never": "Never":
"nigdy", "nigdy",
"Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.": "Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.":
@ -96,12 +96,12 @@
"Anonimowy avatar (Vizhash z adresu IP)", "Anonimowy avatar (Vizhash z adresu IP)",
"Add comment": "Add comment":
"Dodaj komentarz", "Dodaj komentarz",
"Optional nickname...": "Optional nickname":
"Opcjonalny nick...", "Opcjonalny nick",
"Post comment": "Post comment":
"Wyślij komentarz", "Wyślij komentarz",
"Sending comment...": "Sending comment":
"Wysyłanie komentarza...", "Wysyłanie komentarza",
"Comment posted.": "Comment posted.":
"Wysłano komentarz.", "Wysłano komentarz.",
"Could not refresh display: %s": "Could not refresh display: %s":
@ -112,10 +112,10 @@
"bląd serwera lub brak odpowiedzi", "bląd serwera lub brak odpowiedzi",
"Could not post comment: %s": "Could not post comment: %s":
"Nie udało się wysłać komentarza: %s", "Nie udało się wysłać komentarza: %s",
"Sending paste (Please move your mouse for more entropy)...": "Sending paste (Please move your mouse for more entropy)":
"Wysyłanie wklejki (proszę poruszać myszą aby uzyskać większą entropię)...", "Wysyłanie wklejki (proszę poruszać myszą aby uzyskać większą entropię)",
"Sending paste...": "Sending paste":
"Wysyłanie wklejki...", "Wysyłanie wklejki",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>": "Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Twoja wklejka to <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(wciśnij [Ctrl]+[c] aby skopiować)</span>", "Twoja wklejka to <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(wciśnij [Ctrl]+[c] aby skopiować)</span>",
"Delete data": "Delete data":
@ -139,6 +139,13 @@
"Shorten URL": "Skróć adres URL", "Shorten URL": "Skróć adres URL",
"Editor": "Edytować", "Editor": "Edytować",
"Preview": "Zapowiedź", "Preview": "Zapowiedź",
"PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": "%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php." "%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.",
"Decrypt":
"Decrypt",
"Enter password":
"Wpisz hasło",
"Loading…": "Loading…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a> (in English)."
} }

151
i18n/pt.json Normal file
View File

@ -0,0 +1,151 @@
{
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s é um serviço minimalista e de código aberto do tipo \"pastebin\", em que o servidor tem zero conhecimento dos dados copiados. Os dados são cifrados e decifrados <i>no navegador</i> usando 256 bits AES. Mais informações na <a href=\"https://privatebin.info/\">página do projeto</a>.",
"Because ignorance is bliss":
"Porque a ignorância é uma benção",
"en": "pt",
"Paste does not exist, has expired or has been deleted.":
"A cópia não existe, expirou ou já foi excluída.",
"%s requires php 5.3.0 or above to work. Sorry.":
"%s requer php 5.3.0 ou superior para funcionar. Desculpa.",
"%s requires configuration section [%s] to be present in configuration file.":
"%s requer que a seção de configuração [% s] esteja no arquivo de configuração.",
"Please wait %d seconds between each post.":
"Por favor espere %d segundos entre cada publicação.",
"Paste is limited to %s of encrypted data.":
"A cópia está limitada a %s de dados cifrados.",
"Invalid data.":
"Dados inválidos.",
"You are unlucky. Try again.":
"Você é azarado. Tente novamente",
"Error saving comment. Sorry.":
"Erro ao salvar comentário. Desculpa.",
"Error saving paste. Sorry.":
"Erro ao salvar cópia. Desculpa.",
"Invalid paste ID.":
"ID de cópia inválido.",
"Paste is not of burn-after-reading type.":
"Cópia não é do tipo \"queime após ler\".",
"Wrong deletion token. Paste was not deleted.":
"Token de remoção inválido. A cópia não foi excluída.",
"Paste was properly deleted.":
"A cópia foi devidamente excluída.",
"JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"JavaScript é necessário para que %s funcione.<br />Pedimos desculpas pela inconveniência.",
"%s requires a modern browser to work.":
"%s requer um navegador moderno para funcionar.",
"Still using Internet Explorer? Do yourself a favor, switch to a modern browser:":
"Ainda usando Internet Explorer? Faça-se um favor, mude para um navegador moderno:",
"New":
"Novo",
"Send":
"Enviar",
"Clone":
"Clonar",
"Raw text":
"Texto sem formato",
"Expires":
"Expirar em",
"Burn after reading":
"Queime após ler",
"Open discussion":
"Discussão aberta",
"Password (recommended)":
"Senha (recomendada)",
"Discussion":
"Discussão",
"Toggle navigation":
"Mudar navegação",
"%d seconds": ["%d segundo", "%d segundos"],
"%d minutes": ["%d minuto", "%d minutos"],
"%d hours": ["%d hora", "%d horas"],
"%d days": ["%d dia", "%d dias"],
"%d weeks": ["%d semana", "%d semanas"],
"%d months": ["%d mês", "%d meses"],
"%d years": ["%d ano", "%d anos"],
"Never":
"Nunca",
"Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.":
"Nota: Este é um serviço de teste. Dados podem ser perdidos a qualquer momento. Gatinhos morrerão se você abusar desse serviço.",
"This document will expire in %d seconds.":
["Este documento irá expirar em um segundo.", "Este documento irá expirar em %d segundos."],
"This document will expire in %d minutes.":
["Este documento irá expirar em um minuto.", "Este documento irá expirar em %d minutos."],
"This document will expire in %d hours.":
["Este documento irá expirar em uma hora.", "Este documento irá expirar em %d horas."],
"This document will expire in %d days.":
["Este documento irá expirar em um dia.", "Este documento irá expirar em %d dias."],
"This document will expire in %d months.":
["Este documento irá expirar em um mês.", "Este documento irá expirar em %d meses."],
"Please enter the password for this paste:":
"Por favor, digite a senha para essa cópia:",
"Could not decrypt data (Wrong key?)":
"Não foi possível decifrar os dados (Chave errada?)",
"Could not delete the paste, it was not stored in burn after reading mode.":
"Não foi possível excluir a cópia, ela não foi salva no modo de \"queime após ler\".",
"FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.":
"APENAS PARA SEUS OLHOS. Não feche essa janela, essa mensagem não pode ser exibida novamente.",
"Could not decrypt comment; Wrong key?":
"Não foi possível decifrar o comentário; Chave errada?",
"Reply":
"Responder",
"Anonymous":
"Anônimo",
"Avatar generated from IP address":
"Avatar (do endereço IP)",
"Add comment":
"Adicionar comentário",
"Optional nickname…":
"Apelido opcional…",
"Post comment":
"Publicar comentário",
"Sending comment…":
"Enviando comentário…",
"Comment posted.":
"Comentário publicado.",
"Could not refresh display: %s":
"Não foi possível atualizar a tela: %s",
"unknown status":
"Estado desconhecido",
"server error or not responding":
"Servidor em erro ou não responsivo",
"Could not post comment: %s":
"Não foi possível publicar o comentário: %s",
"Please move your mouse for more entropy…":
"Por favor, mova o mouse para maior entropia…",
"Sending paste…":
"Enviando cópia…",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Sua cópia é <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Pressione [Ctrl]+[c] para copiar)</span>",
"Delete data":
"Excluir dados",
"Could not create paste: %s":
"Não foi possível criar cópia: %s",
"Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)":
"Não foi possível decifrar a cópia: chave de decriptografia ausente na URL (Você utilizou um redirecionador ou encurtador de URL que removeu parte dela?)",
"Format": "Formato",
"Plain Text": "Texto sem formato",
"Source Code": "Código fonte",
"Markdown": "Markdown",
"Download attachment": "Baixar anexo",
"Cloned: '%s'": "Clonado: '%s'",
"Attach a file": "Anexar um arquivo",
"Remove attachment": "Remover anexo",
"Your browser does not support uploading encrypted files. Please use a newer browser.":
"Seu navegador não permite subir arquivos cifrados. Por favor, utilize um navegador mais recente.",
"Invalid attachment.": "Anexo inválido.",
"Options": "Opções",
"Shorten URL": "Encurtar URL",
"Editor": "Editor",
"Preview": "Visualizar",
"%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"%s requer que o PATH termine em \"%s\". Por favor, atualize o PATH em seu index.php.",
"Decrypt":
"Decifrar",
"Enter password":
"Digite a senha",
"Loading…": "Carregando…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"Caso essa mensagem nunca desapareça, por favor veja <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">este FAQ para saber como resolver os problemas</a>."
}

159
i18n/ru.json Normal file
View File

@ -0,0 +1,159 @@
{
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s это минималистичный Open Source проект для создания заметок, где сервер не знает ничего о сохраняемых данных. Данные шифруются/расшифровываются <i>в браузере</i> с использованием 256 битного шифрования AES. Подробнее можно узнать на <a href=\"https://privatebin.info/\">сайте проекта</a>.",
"Because ignorance is bliss":
"Потому что неведение - благо",
"en": "ru",
"Paste does not exist, has expired or has been deleted.":
"Запись не существует, просрочена или была удалена.",
"%s requires php 5.3.0 or above to work. Sorry.":
"Для работы %s требуется PHP 5.3.0 или выше. Извините.",
"%s requires configuration section [%s] to be present in configuration file.":
"%s необходимо наличие секции [%s] в конфигурационном файле.",
"Please wait %d seconds between each post.":
["Пожалуйста ожидайте %d секунду между каждыми записями.", "Пожалуйста ожидайте %d секунды между каждыми записями.", "Пожалуйста ожидайте %d секунд между каждыми записями."],
"Paste is limited to %s of encrypted data.":
"Размер записи ограничен %s зашифрованных данных.",
"Invalid data.":
"Неверные данные.",
"You are unlucky. Try again.":
"Вам не повезло. Попробуйте еще раз.",
"Error saving comment. Sorry.":
"Ошибка при сохранении комментария. Извините.",
"Error saving paste. Sorry.":
"Ошибка при сохранении записи. Извините.",
"Invalid paste ID.":
"Неверный ID записи.",
"Paste is not of burn-after-reading type.":
"Тип записи не \"Удалить после прочтения\".",
"Wrong deletion token. Paste was not deleted.":
"Неверный ключ удаления записи. Запись не удалена",
"Paste was properly deleted.":
"Запись была успешно удалена.",
"JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"Для работы %s требуется включенный JavaScript.<br />Приносим извинения за неудобства..",
"%s requires a modern browser to work.":
"Для работы %s требуется более современный браузер.",
"Still using Internet Explorer? Do yourself a favor, switch to a modern browser:":
"До сих пор используете Internet Explorer? Пожалейте себя, перейдите на более современный браузер:",
"New":
"Новая запись",
"Send":
"Отправить",
"Clone":
"Дублировать",
"Raw text":
"Исходный текст",
"Expires":
"Удалить через",
"Burn after reading":
"Удалить после прочтения",
"Open discussion":
"Открыть обсуждение",
"Password (recommended)":
"Пароль (рекомендуется)",
"Discussion":
"Обсуждение",
"Toggle navigation":
"Переключить навигацию",
"%d seconds": ["%d секунду", "%d секунды", "%d секунд"],
"%d minutes": ["%d минуту", "%d минуты", "%d минут"],
"%d hours": ["%d час", "%d часа", "%d часов"],
"%d days": ["%d день", "%d дня", "%d дней"],
"%d weeks": ["%d неделю", "%d недели", "%d недель"],
"%d months": ["%d месяц", "%d месяца", "%d месяцев"],
"%d years": ["%d год", "%d года", "%d лет"],
"Never":
"Никогда",
"Note: This is a test service: Data may be deleted anytime. Kittens will die if you abuse this service.":
"Примечание: Этот сервис тестовый: Данные могут быть удалены в любое время. Котята умрут, если вы будете злоупотреблять серсисом.",
"This document will expire in %d seconds.":
["Документ будет удален через %d секунду.", "Документ будет удален через %d секунды.", "Документ будет удален через %d секунд."],
"This document will expire in %d minutes.":
["Документ будет удален через %d минуту.", "Документ будет удален через %d минуты.", "Документ будет удален через %d минут."],
"This document will expire in %d hours.":
["Документ будет удален через %d час.", "Документ будет удален через %d часа.", "Документ будет удален через %d часов."],
"This document will expire in %d days.":
["Документ будет удален через %d день.", "Документ будет удален через %d дня.", "Документ будет удален через %d дней."],
"This document will expire in %d months.":
["Документ будет удален через %d месяц.", "Документ будет удален через %d месяца.", "Документ будет удален через %d месяцев."],
"Please enter the password for this paste:":
"Пожалуйста введите пароль от записи:",
"Could not decrypt data (Wrong key?)":
"Невозможно расшифровать данные (Неверный ключ?)",
"Could not delete the paste, it was not stored in burn after reading mode.":
"Невозможно удалить запись, она не была сохранена в режиме удаления после прочтения",
"FOR YOUR EYES ONLY. Don't close this window, this message can't be displayed again.":
"ТОЛЬКО ДЛЯ ВАШИХ ГЛАЗ. Не закрывайте это окно, это сообщение не может быть показано снова.",
"Could not decrypt comment; Wrong key?":
"Невозможно расшифровать комментарий; Неверный ключ?",
"Reply":
"Ответить",
"Anonymous":
"Аноним",
"Anonymous avatar (Vizhash of the IP address)":
"Анонимный аватар (Vizhash IP адреса)",
"Add comment":
"Добавить комментарий",
"Optional nickname…":
"Опциональный никнейм…",
"Post comment":
"Отправить комментарий",
"Sending comment…":
"Отправка комментария…",
"Comment posted.":
"Комментарий опубликован.",
"Could not refresh display: %s":
"Невозможно обновить данные: %s",
"unknown status":
"неизвестная причина",
"server error or not responding":
"ошибка сервера или нет ответа",
"Could not post comment: %s":
"Не удалось опубликовать комментарий: %s",
"Sending paste (Please move your mouse for more entropy)…":
"Отправка записи (Пожалуйста двигайте мышкой для большей энтропии)…",
"Sending paste…":
"Отправка записи…",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Ссылка на запись <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Нажмите [Ctrl]+[c] чтобы скопировать ссылку)</span>",
"Delete data":
"Удалить запись",
"Could not create paste: %s":
"Не удалось опубликовать запись: %s",
"Cannot decrypt paste: Decryption key missing in URL (Did you use a redirector or an URL shortener which strips part of the URL?)":
"Невозможно расшифровать запись: Ключ расшифровки отсутствует в ссылке (Может быть вы используете сокращатель ссылок, который удаляет часть ссылки?)",
"B": "байт",
"KiB": "Кбайт",
"MiB": "Мбайт",
"GiB": "Гбайт",
"TiB": "Тбайт",
"PiB": "Пбайт",
"EiB": "Эбайт",
"ZiB": "Збайт",
"YiB": "Йбайт",
"Format": "Формат",
"Plain Text": "Обычный текст",
"Source Code": "Исходный код",
"Markdown": "Язык разметки",
"Download attachment": "Скачать прикрепленный файл",
"Cloned file attached.": "Дубль файла прикреплен.",
"Attach a file": "Прикрепить файл",
"Remove attachment": "Удалить вложение",
"Your browser does not support uploading encrypted files. Please use a newer browser.":
"Ваш браузер не поддерживает отправку зашифрованных файлов. Используйте более новый браузер.",
"Invalid attachment.": "Неизвестное вложение.",
"Options": "Опции",
"Shorten URL": "Короткая ссылка",
"Editor": "Редактор",
"Preview": "Предпросмотр",
"%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"Переменная PATH необходима %s в конце \"%s\". Пожалуйста обновите переменную PATH в вашем index.php.",
"Decrypt":
"Расшифровать",
"Enter password":
"Введите пароль",
"Uploading paste… Please wait.":
"Отправка записи… Пожалуйста подождите."
}

View File

@ -1,11 +1,16 @@
{ {
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s je minimalističen, odprtokodni spletni 'pastebin', kjer server ne ve ničesar o prilepljenih podatkih. Podatki so zakodirani/odkodirani <i>v brskalniku</i> z uporabo 256 bitnega AES. Več informacij na < href=\"https://privatebin.info/\">spletni strani projekta.</a>.",
"Because ignorance is bliss":
"Ker kar ne veš ne boli.",
"en": "sl", "en": "sl",
"Paste does not exist, has expired or has been deleted.": "Paste does not exist, has expired or has been deleted.":
"Prilepek ne obstaja, mu je potekla življenjska doba, ali pa je izbrisan.", "Prilepek ne obstaja, mu je potekla življenjska doba, ali pa je izbrisan.",
"PrivateBin requires php 5.3.0 or above to work. Sorry.": "%s requires php 5.3.0 or above to work. Sorry.":
"Oprosti, PrivateBin za delovanje potrebuje vsaj php 5.3.0.", "Oprosti, %s za delovanje potrebuje vsaj php 5.3.0.",
"PrivateBin requires configuration section [%s] to be present in configuration file.": "%s requires configuration section [%s] to be present in configuration file.":
"PrivateBin potrebuje sekcijo konfiguracij [%s] v konfiguracijski datoteki.", "%s potrebuje sekcijo konfiguracij [%s] v konfiguracijski datoteki.",
"Please wait %d seconds between each post.": "Please wait %d seconds between each post.":
"Prosim počakaj vsaj %d sekund pred vsako naslednjo objavo.", "Prosim počakaj vsaj %d sekund pred vsako naslednjo objavo.",
"Paste is limited to %s of encrypted data.": "Paste is limited to %s of encrypted data.":
@ -26,15 +31,10 @@
"Napačen token za izbris. Prilepek ni bil izbrisan..", "Napačen token za izbris. Prilepek ni bil izbrisan..",
"Paste was properly deleted.": "Paste was properly deleted.":
"Prilepek je uspešno izbrisan.", "Prilepek je uspešno izbrisan.",
"PrivateBin": "PrivateBin", "JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.": "Da %s deluje, moraš vklopiti JavaScript.<br />Oprosti za povročene nevšečnosti.",
"PrivateBin je minimalističen, odprtokodni spletni 'pastebin', kjer server ne ve ničesar o prilepljenih podatkih. Podatki so zakodirani/odkodirani <i>v brskalniku</i> z uporabo 256 bitnega AES. Več informacij na < href=\"https://privatebin.info/\">spletni strani projekta.</a>.", "%s requires a modern browser to work.":
"Because ignorance is bliss": "%s za svoje delovanje potrebuje moderen brskalnik.",
"Ker kar ne veš ne boli.",
"Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.":
"Da PrivateBin deluje, moraš vklopiti Javascript.<br />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:": "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:", "Še vedno uporabljaš Internet Explorer? Naredi si uslugo, preklopi na moderen brskalnik:",
"New": "New":
@ -96,12 +96,12 @@
"Anonimen avatar (Vizhash IP naslova)", "Anonimen avatar (Vizhash IP naslova)",
"Add comment": "Add comment":
"Dodaj komentar", "Dodaj komentar",
"Optional nickname...": "Optional nickname":
"Uporabniško ime (lahko izpustiš)", "Uporabniško ime (lahko izpustiš)",
"Post comment": "Post comment":
"Objavi komentar", "Objavi komentar",
"Sending comment...": "Sending comment":
"Pošiljam komentar ...", "Pošiljam komentar ",
"Comment posted.": "Comment posted.":
"Komentar poslan.", "Komentar poslan.",
"Could not refresh display: %s": "Could not refresh display: %s":
@ -112,10 +112,10 @@
"napaka na strežniku, ali pa se strežnik ne odziva", "napaka na strežniku, ali pa se strežnik ne odziva",
"Could not post comment: %s": "Could not post comment: %s":
"Komentarja ni bilo mogoče objaviti : %s", "Komentarja ni bilo mogoče objaviti : %s",
"Sending paste (Please move your mouse for more entropy)...": "Sending paste (Please move your mouse for more entropy)":
"Pošiljam prilepek (prosim premakni svojo miško za več entropije) ...", "Pošiljam prilepek (prosim premakni svojo miško za več entropije) ",
"Sending paste...": "Sending paste":
"Pošiljam prilepek...", "Pošiljam prilepek",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>": "Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"Tvoj prilepek je dostopen na naslovu: <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Pritisni [Ctrl]+[c] ali [Cmd] + [c] in skopiraj)</span>", "Tvoj prilepek je dostopen na naslovu: <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Pritisni [Ctrl]+[c] ali [Cmd] + [c] in skopiraj)</span>",
"Delete data": "Delete data":
@ -148,6 +148,13 @@
"Shorten URL": "Skrajšajte URL", "Shorten URL": "Skrajšajte URL",
"Editor": "Uredi", "Editor": "Uredi",
"Preview": "Predogled", "Preview": "Predogled",
"PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": "%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php." "%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.",
"Decrypt":
"Decrypt",
"Enter password":
"Prosim vnesi geslo",
"Loading…": "Loading…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a> (in English)."
} }

View File

@ -1,11 +1,16 @@
{ {
"PrivateBin": "PrivateBin",
"%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.":
"%s是一个极简开源对粘贴内容毫不知情的在线粘贴板数据<i>在浏览器内</i>进行AES-256加密。更多信息请查看<a href=\"https://privatebin.info/\">项目主页</a>。",
"Because ignorance is bliss":
"因为无知是福",
"en": "zh", "en": "zh",
"Paste does not exist, has expired or has been deleted.": "Paste does not exist, has expired or has been deleted.":
"粘贴不存在,已过期或者已被删除。", "粘贴不存在,已过期或者已被删除。",
"PrivateBin requires php 5.3.0 or above to work. Sorry.": "%s requires php 5.3.0 or above to work. Sorry.":
"PrivateBin需要工作于PHP 5.3.0及以上版本,抱歉。", "%s需要工作于PHP 5.3.0及以上版本,抱歉。",
"PrivateBin requires configuration section [%s] to be present in configuration file.": "%s requires configuration section [%s] to be present in configuration file.":
"PrivateBin需要设置配置文件中 [%s] 的部分。", "%s需要设置配置文件中 [%s] 的部分。",
"Please wait %d seconds between each post.": "Please wait %d seconds between each post.":
"每 %d 秒只能粘贴一次。", "每 %d 秒只能粘贴一次。",
"Paste is limited to %s of encrypted data.": "Paste is limited to %s of encrypted data.":
@ -26,15 +31,10 @@
"错误的删除token粘贴没有被删除。", "错误的删除token粘贴没有被删除。",
"Paste was properly deleted.": "Paste was properly deleted.":
"粘贴已被正确删除。", "粘贴已被正确删除。",
"PrivateBin": "PrivateBin", "JavaScript is required for %s to work.<br />Sorry for the inconvenience.":
"PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href=\"https://privatebin.info/\">project page</a>.": "%s需要JavaScript来进行加解密。<br />带来的不便敬请谅解。",
"PrivateBin是一个极简开源对粘贴内容毫不知情的在线粘贴板数据<i>在浏览器内</i>进行AES-256加密。更多信息请查看<a href=\"https://privatebin.info/\">项目主页</a>。", "%s requires a modern browser to work.":
"Because ignorance is bliss": "%s需要工作于现代化的浏览器。",
"因为无知是福",
"Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.":
"PrivateBin需要JavaScript来进行加解密。<br />带来的不便敬请谅解。",
"PrivateBin requires a modern browser to work.":
"PrivateBin需要工作于现代化的浏览器。",
"Still using Internet Explorer? Do yourself a favor, switch to a modern browser:": "Still using Internet Explorer? Do yourself a favor, switch to a modern browser:":
"还在使用Internet Explorer帮自己个忙换上一个现代化的浏览器", "还在使用Internet Explorer帮自己个忙换上一个现代化的浏览器",
"New": "New":
@ -96,12 +96,12 @@
"匿名头像 (由IP地址生成Vizhash)", "匿名头像 (由IP地址生成Vizhash)",
"Add comment": "Add comment":
"添加评论", "添加评论",
"Optional nickname...": "Optional nickname":
"可选昵称...", "可选昵称",
"Post comment": "Post comment":
"评论", "评论",
"Sending comment...": "Sending comment":
"评论发送中...", "评论发送中",
"Comment posted.": "Comment posted.":
"评论已发送。", "评论已发送。",
"Could not refresh display: %s": "Could not refresh display: %s":
@ -112,10 +112,10 @@
"服务器错误或无回应", "服务器错误或无回应",
"Could not post comment: %s": "Could not post comment: %s":
"无法发送评论: %s", "无法发送评论: %s",
"Sending paste (Please move your mouse for more entropy)...": "Sending paste (Please move your mouse for more entropy)":
"粘贴提交中 (请移动鼠标以产生更多熵)...", "粘贴提交中 (请移动鼠标以产生更多熵)",
"Sending paste...": "Sending paste":
"粘贴提交中...", "粘贴提交中",
"Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>": "Your paste is <a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(Hit [Ctrl]+[c] to copy)</span>":
"您的粘贴的链接是<a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(按下 [Ctrl]+[c] 以复制)</span>", "您的粘贴的链接是<a id=\"pasteurl\" href=\"%s\">%s</a> <span id=\"copyhint\">(按下 [Ctrl]+[c] 以复制)</span>",
"Delete data": "Delete data":
@ -137,8 +137,15 @@
"Invalid attachment.": "无效的附件", "Invalid attachment.": "无效的附件",
"Options": "选项", "Options": "选项",
"Shorten URL": "缩短链接", "Shorten URL": "缩短链接",
"Editor": "編輯", "Editor": "编辑",
"Preview": "預習", "Preview": "预览",
"PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php.": "%s requires the PATH to end in a \"%s\". Please update the PATH in your index.php.":
"PrivateBin requires the PATH to end in a \"%s\". Please update the PATH in your index.php." "%s 的 PATH 变量必须结束于 \"%s\"。 请修改你的 index.php 中的 PATH 变量。",
"Decrypt":
"解密",
"Enter password":
"输入密码",
"Loading…": "载入中…",
"In case this message never disappears please have a look at <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">this FAQ for information to troubleshoot</a>.":
"如果这个消息一直不消失,请参考 <a href=\"https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away\">这里的 FAQ 进行故障排除</a> (英文版)。"
} }

View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

View File

Before

Width:  |  Height:  |  Size: 22 KiB

After

Width:  |  Height:  |  Size: 22 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

Before

Width:  |  Height:  |  Size: 469 B

After

Width:  |  Height:  |  Size: 469 B

View File

Before

Width:  |  Height:  |  Size: 749 B

After

Width:  |  Height:  |  Size: 749 B

View File

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

View File

Before

Width:  |  Height:  |  Size: 3.6 KiB

After

Width:  |  Height:  |  Size: 3.6 KiB

View File

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 3.5 KiB

View File

Before

Width:  |  Height:  |  Size: 9.0 KiB

After

Width:  |  Height:  |  Size: 9.0 KiB

View File

Before

Width:  |  Height:  |  Size: 2.4 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

View File

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

View File

@ -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.0 * @version 1.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

7
js/.istanbul.yml Normal file
View File

@ -0,0 +1,7 @@
---
instrumentation:
excludes:
- jquery-3.1.1.js
baseline-file: ../tst/log/js-coverage-baseline.json
reporting:
dir: ../tst/log/js-coverage-report

File diff suppressed because one or more lines are too long

7
js/bootstrap-3.3.7.js vendored Normal file

File diff suppressed because one or more lines are too long

5
js/jquery-1.11.3.js vendored

File diff suppressed because one or more lines are too long

4
js/jquery-3.1.1.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

1
js/showdown-1.6.1.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,58 +0,0 @@
"use strict";function q(a){throw a;}var s=void 0,u=!1;var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message};this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message};this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message};this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message};this.message=a}}};
"undefined"!==typeof module&&module.exports&&(module.exports=sjcl);"function"===typeof define&&define([],function(){return sjcl});
sjcl.cipher.aes=function(a){this.l[0][0][0]||this.G();var b,c,d,e,g=this.l[0][4],f=this.l[1];b=a.length;var h=1;4!==b&&(6!==b&&8!==b)&&q(new sjcl.exception.invalid("invalid aes key size"));this.b=[d=a.slice(0),e=[]];for(a=b;a<4*b+28;a++){c=d[a-1];if(0===a%b||8===b&&4===a%b)c=g[c>>>24]<<24^g[c>>16&255]<<16^g[c>>8&255]<<8^g[c&255],0===a%b&&(c=c<<8^c>>>24^h<<24,h=h<<1^283*(h>>7));d[a]=d[a-b]^c}for(b=0;a;b++,a--)c=d[b&3?a:a-4],e[b]=4>=a||4>b?c:f[0][g[c>>>24]]^f[1][g[c>>16&255]]^f[2][g[c>>8&255]]^f[3][g[c&
255]]};
sjcl.cipher.aes.prototype={encrypt:function(a){return w(this,a,0)},decrypt:function(a){return w(this,a,1)},l:[[[],[],[],[],[]],[[],[],[],[],[]]],G:function(){var a=this.l[0],b=this.l[1],c=a[4],d=b[4],e,g,f,h=[],l=[],k,m,n,p;for(e=0;0x100>e;e++)l[(h[e]=e<<1^283*(e>>7))^e]=e;for(g=f=0;!c[g];g^=k||1,f=l[f]||1){n=f^f<<1^f<<2^f<<3^f<<4;n=n>>8^n&255^99;c[g]=n;d[n]=g;m=h[e=h[k=h[g]]];p=0x1010101*m^0x10001*e^0x101*k^0x1010100*g;m=0x101*h[n]^0x1010100*n;for(e=0;4>e;e++)a[e][g]=m=m<<24^m>>>8,b[e][n]=p=p<<24^p>>>8}for(e=
0;5>e;e++)a[e]=a[e].slice(0),b[e]=b[e].slice(0)}};
function w(a,b,c){4!==b.length&&q(new sjcl.exception.invalid("invalid aes block size"));var d=a.b[c],e=b[0]^d[0],g=b[c?3:1]^d[1],f=b[2]^d[2];b=b[c?1:3]^d[3];var h,l,k,m=d.length/4-2,n,p=4,t=[0,0,0,0];h=a.l[c];a=h[0];var r=h[1],v=h[2],y=h[3],z=h[4];for(n=0;n<m;n++)h=a[e>>>24]^r[g>>16&255]^v[f>>8&255]^y[b&255]^d[p],l=a[g>>>24]^r[f>>16&255]^v[b>>8&255]^y[e&255]^d[p+1],k=a[f>>>24]^r[b>>16&255]^v[e>>8&255]^y[g&255]^d[p+2],b=a[b>>>24]^r[e>>16&255]^v[g>>8&255]^y[f&255]^d[p+3],p+=4,e=h,g=l,f=k;for(n=0;4>
n;n++)t[c?3&-n:n]=z[e>>>24]<<24^z[g>>16&255]<<16^z[f>>8&255]<<8^z[b&255]^d[p++],h=e,e=g,g=f,f=b,b=h;return t}
sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.R(a.slice(b/32),32-(b&31)).slice(1);return c===s?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return 32===d?a.concat(b):sjcl.bitArray.R(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===
b?0:32*(b-1)+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;b&=31;0<c&&b&&(a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1));return a},partial:function(a,b,c){return 32===a?b:(c?b|0:b<<32-a)+0x10000000000*a},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return u;var c=0,d;for(d=0;d<a.length;d++)c|=a[d]^b[d];return 0===
c},R:function(a,b,c,d){var e;e=0;for(d===s&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)return d.concat(a);for(e=0;e<a.length;e++)d.push(c|a[e]>>>b),c=a[e]<<32-b;e=a.length?a[a.length-1]:0;a=sjcl.bitArray.getPartial(e);d.push(sjcl.bitArray.partial(b+a&31,32<b+a?c:d.pop(),1));return d},g:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&0xff00|(c&0xff00)<<8|c<<24;return a}};
sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++)0===(d&3)&&(e=a[d/4]),b+=String.fromCharCode(e>>>24),e<<=8;return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++)d=d<<8|a.charCodeAt(c),3===(c&3)&&(b.push(d),d=0);c&3&&b.push(sjcl.bitArray.partial(8*(c&3),d));return b}};
sjcl.codec.hex={fromBits:function(a){var b="",c;for(c=0;c<a.length;c++)b+=((a[c]|0)+0xf00000000000).toString(16).substr(4);return b.substr(0,sjcl.bitArray.bitLength(a)/4)},toBits:function(a){var b,c=[],d;a=a.replace(/\s|0x/g,"");d=a.length;a+="00000000";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl.bitArray.clamp(c,4*d)}};
sjcl.codec.base32={p:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",O:"0123456789ABCDEFGHIJKLMNOPQRSTUV",BITS:32,BASE:5,REMAINING:27,fromBits:function(a,b,c){var d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,g="",f=0,h=sjcl.codec.base32.p,l=0,k=sjcl.bitArray.bitLength(a);c&&(h=sjcl.codec.base32.O);for(c=0;g.length*d<k;)g+=h.charAt((l^a[c]>>>f)>>>e),f<d?(l=a[c]<<d-f,f+=e,c++):(l<<=d,f-=d);for(;g.length&7&&!b;)g+="=";return g},toBits:function(a,b){a=a.replace(/\s|=/g,"").toUpperCase();var c=sjcl.codec.base32.BITS,
d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,g=[],f,h=0,l=sjcl.codec.base32.p,k=0,m,n="base32";b&&(l=sjcl.codec.base32.O,n="base32hex");for(f=0;f<a.length;f++){m=l.indexOf(a.charAt(f));if(0>m){if(!b)try{return sjcl.codec.base32hex.toBits(a)}catch(p){}q(new sjcl.exception.invalid("this isn't "+n+"!"))}h>e?(h-=e,g.push(k^m>>>h),k=m<<c-h):(h+=d,k^=m<<c-h)}h&56&&g.push(sjcl.bitArray.partial(h&56,k,1));return g}};
sjcl.codec.base32hex={fromBits:function(a,b){return sjcl.codec.base32.fromBits(a,b,1)},toBits:function(a){return sjcl.codec.base32.toBits(a,1)}};
sjcl.codec.base64={p:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(a,b,c){var d="",e=0,g=sjcl.codec.base64.p,f=0,h=sjcl.bitArray.bitLength(a);c&&(g=g.substr(0,62)+"-_");for(c=0;6*d.length<h;)d+=g.charAt((f^a[c]>>>e)>>>26),6>e?(f=a[c]<<6-e,e+=26,c++):(f<<=6,e-=6);for(;d.length&3&&!b;)d+="=";return d},toBits:function(a,b){a=a.replace(/\s|=/g,"");var c=[],d,e=0,g=sjcl.codec.base64.p,f=0,h;b&&(g=g.substr(0,62)+"-_");for(d=0;d<a.length;d++)h=g.indexOf(a.charAt(d)),
0>h&&q(new sjcl.exception.invalid("this isn't base64!")),26<e?(e-=26,c.push(f^h>>>e),f=h<<32-e):(e+=6,f^=h<<32-e);e&56&&c.push(sjcl.bitArray.partial(e&56,f,1));return c}};sjcl.codec.base64url={fromBits:function(a){return sjcl.codec.base64.fromBits(a,1,1)},toBits:function(a){return sjcl.codec.base64.toBits(a,1)}};sjcl.hash.sha256=function(a){this.b[0]||this.G();a?(this.s=a.s.slice(0),this.o=a.o.slice(0),this.i=a.i):this.reset()};sjcl.hash.sha256.hash=function(a){return(new sjcl.hash.sha256).update(a).finalize()};
sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.s=this.P.slice(0);this.o=[];this.i=0;return this},update:function(a){"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));var b,c=this.o=sjcl.bitArray.concat(this.o,a);b=this.i;a=this.i=b+sjcl.bitArray.bitLength(a);for(b=512+b&-512;b<=a;b+=512)x(this,c.splice(0,16));return this},finalize:function(){var a,b=this.o,c=this.s,b=sjcl.bitArray.concat(b,[sjcl.bitArray.partial(1,1)]);for(a=b.length+2;a&15;a++)b.push(0);b.push(Math.floor(this.i/
4294967296));for(b.push(this.i|0);b.length;)x(this,b.splice(0,16));this.reset();return c},P:[],b:[],G:function(){function a(a){return 0x100000000*(a-Math.floor(a))|0}var b=0,c=2,d;a:for(;64>b;c++){for(d=2;d*d<=c;d++)if(0===c%d)continue a;8>b&&(this.P[b]=a(Math.pow(c,0.5)));this.b[b]=a(Math.pow(c,1/3));b++}}};
function x(a,b){var c,d,e,g=b.slice(0),f=a.s,h=a.b,l=f[0],k=f[1],m=f[2],n=f[3],p=f[4],t=f[5],r=f[6],v=f[7];for(c=0;64>c;c++)16>c?d=g[c]:(d=g[c+1&15],e=g[c+14&15],d=g[c&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+g[c&15]+g[c+9&15]|0),d=d+v+(p>>>6^p>>>11^p>>>25^p<<26^p<<21^p<<7)+(r^p&(t^r))+h[c],v=r,r=t,t=p,p=n+d|0,n=m,m=k,k=l,l=d+(k&m^n&(k^m))+(k>>>2^k>>>13^k>>>22^k<<30^k<<19^k<<10)|0;f[0]=f[0]+l|0;f[1]=f[1]+k|0;f[2]=f[2]+m|0;f[3]=f[3]+n|0;f[4]=f[4]+p|0;f[5]=f[5]+t|0;f[6]=
f[6]+r|0;f[7]=f[7]+v|0}
sjcl.mode.ccm={name:"ccm",t:[],listenProgress:function(a){sjcl.mode.ccm.t.push(a)},unListenProgress:function(a){a=sjcl.mode.ccm.t.indexOf(a);-1<a&&sjcl.mode.ccm.t.splice(a,1)},X:function(a){var b=sjcl.mode.ccm.t.slice(),c;for(c=0;c<b.length;c+=1)b[c](a)},encrypt:function(a,b,c,d,e){var g,f=b.slice(0),h=sjcl.bitArray,l=h.bitLength(c)/8,k=h.bitLength(f)/8;e=e||64;d=d||[];7>l&&q(new sjcl.exception.invalid("ccm: iv must be at least 7 bytes"));for(g=2;4>g&&k>>>8*g;g++);g<15-l&&(g=15-l);c=h.clamp(c,8*(15-
g));b=sjcl.mode.ccm.M(a,b,c,d,e,g);f=sjcl.mode.ccm.q(a,f,c,b,e,g);return h.concat(f.data,f.tag)},decrypt:function(a,b,c,d,e){e=e||64;d=d||[];var g=sjcl.bitArray,f=g.bitLength(c)/8,h=g.bitLength(b),l=g.clamp(b,h-e),k=g.bitSlice(b,h-e),h=(h-e)/8;7>f&&q(new sjcl.exception.invalid("ccm: iv must be at least 7 bytes"));for(b=2;4>b&&h>>>8*b;b++);b<15-f&&(b=15-f);c=g.clamp(c,8*(15-b));l=sjcl.mode.ccm.q(a,l,c,k,e,b);a=sjcl.mode.ccm.M(a,l.data,c,d,e,b);g.equal(l.tag,a)||q(new sjcl.exception.corrupt("ccm: tag doesn't match"));
return l.data},ea:function(a,b,c,d,e,g){var f=[],h=sjcl.bitArray,l=h.g;d=[h.partial(8,(b.length?64:0)|d-2<<2|g-1)];d=h.concat(d,c);d[3]|=e;d=a.encrypt(d);if(b.length){c=h.bitLength(b)/8;65279>=c?f=[h.partial(16,c)]:0xffffffff>=c&&(f=h.concat([h.partial(16,65534)],[c]));f=h.concat(f,b);for(b=0;b<f.length;b+=4)d=a.encrypt(l(d,f.slice(b,b+4).concat([0,0,0])))}return d},M:function(a,b,c,d,e,g){var f=sjcl.bitArray,h=f.g;e/=8;(e%2||4>e||16<e)&&q(new sjcl.exception.invalid("ccm: invalid tag length"));(0xffffffff<
d.length||0xffffffff<b.length)&&q(new sjcl.exception.bug("ccm: can't deal with 4GiB or more data"));c=sjcl.mode.ccm.ea(a,d,c,e,f.bitLength(b)/8,g);for(d=0;d<b.length;d+=4)c=a.encrypt(h(c,b.slice(d,d+4).concat([0,0,0])));return f.clamp(c,8*e)},q:function(a,b,c,d,e,g){var f,h=sjcl.bitArray;f=h.g;var l=b.length,k=h.bitLength(b),m=l/50,n=m;c=h.concat([h.partial(8,g-1)],c).concat([0,0,0]).slice(0,4);d=h.bitSlice(f(d,a.encrypt(c)),0,e);if(!l)return{tag:d,data:[]};for(f=0;f<l;f+=4)f>m&&(sjcl.mode.ccm.X(f/
l),m+=n),c[3]++,e=a.encrypt(c),b[f]^=e[0],b[f+1]^=e[1],b[f+2]^=e[2],b[f+3]^=e[3];return{tag:d,data:h.clamp(b,k)}}};
sjcl.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,d,e,g){128!==sjcl.bitArray.bitLength(c)&&q(new sjcl.exception.invalid("ocb iv must be 128 bits"));var f,h=sjcl.mode.ocb2.J,l=sjcl.bitArray,k=l.g,m=[0,0,0,0];c=h(a.encrypt(c));var n,p=[];d=d||[];e=e||64;for(f=0;f+4<b.length;f+=4)n=b.slice(f,f+4),m=k(m,n),p=p.concat(k(c,a.encrypt(k(c,n)))),c=h(c);n=b.slice(f);b=l.bitLength(n);f=a.encrypt(k(c,[0,0,0,b]));n=l.clamp(k(n.concat([0,0,0]),f),b);m=k(m,k(n.concat([0,0,0]),f));m=a.encrypt(k(m,k(c,h(c))));d.length&&
(m=k(m,g?d:sjcl.mode.ocb2.pmac(a,d)));return p.concat(l.concat(n,l.clamp(m,e)))},decrypt:function(a,b,c,d,e,g){128!==sjcl.bitArray.bitLength(c)&&q(new sjcl.exception.invalid("ocb iv must be 128 bits"));e=e||64;var f=sjcl.mode.ocb2.J,h=sjcl.bitArray,l=h.g,k=[0,0,0,0],m=f(a.encrypt(c)),n,p,t=sjcl.bitArray.bitLength(b)-e,r=[];d=d||[];for(c=0;c+4<t/32;c+=4)n=l(m,a.decrypt(l(m,b.slice(c,c+4)))),k=l(k,n),r=r.concat(n),m=f(m);p=t-32*c;n=a.encrypt(l(m,[0,0,0,p]));n=l(n,h.clamp(b.slice(c),p).concat([0,0,0]));
k=l(k,n);k=a.encrypt(l(k,l(m,f(m))));d.length&&(k=l(k,g?d:sjcl.mode.ocb2.pmac(a,d)));h.equal(h.clamp(k,e),h.bitSlice(b,t))||q(new sjcl.exception.corrupt("ocb: tag doesn't match"));return r.concat(h.clamp(n,p))},pmac:function(a,b){var c,d=sjcl.mode.ocb2.J,e=sjcl.bitArray,g=e.g,f=[0,0,0,0],h=a.encrypt([0,0,0,0]),h=g(h,d(d(h)));for(c=0;c+4<b.length;c+=4)h=d(h),f=g(f,a.encrypt(g(h,b.slice(c,c+4))));c=b.slice(c);128>e.bitLength(c)&&(h=g(h,d(h)),c=e.concat(c,[-2147483648,0,0,0]));f=g(f,c);return a.encrypt(g(d(g(h,
d(h))),f))},J:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^135*(a[0]>>>31)]}};
sjcl.mode.gcm={name:"gcm",encrypt:function(a,b,c,d,e){var g=b.slice(0);b=sjcl.bitArray;d=d||[];a=sjcl.mode.gcm.q(!0,a,g,d,c,e||128);return b.concat(a.data,a.tag)},decrypt:function(a,b,c,d,e){var g=b.slice(0),f=sjcl.bitArray,h=f.bitLength(g);e=e||128;d=d||[];e<=h?(b=f.bitSlice(g,h-e),g=f.bitSlice(g,0,h-e)):(b=g,g=[]);a=sjcl.mode.gcm.q(u,a,g,d,c,e);f.equal(a.tag,b)||q(new sjcl.exception.corrupt("gcm: tag doesn't match"));return a.data},ba:function(a,b){var c,d,e,g,f,h=sjcl.bitArray.g;e=[0,0,0,0];g=
b.slice(0);for(c=0;128>c;c++){(d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,g));f=0!==(g[3]&1);for(d=3;0<d;d--)g[d]=g[d]>>>1|(g[d-1]&1)<<31;g[0]>>>=1;f&&(g[0]^=-0x1f000000)}return e},h:function(a,b,c){var d,e=c.length;b=b.slice(0);for(d=0;d<e;d+=4)b[0]^=0xffffffff&c[d],b[1]^=0xffffffff&c[d+1],b[2]^=0xffffffff&c[d+2],b[3]^=0xffffffff&c[d+3],b=sjcl.mode.gcm.ba(b,a);return b},q:function(a,b,c,d,e,g){var f,h,l,k,m,n,p,t,r=sjcl.bitArray;n=c.length;p=r.bitLength(c);t=r.bitLength(d);h=r.bitLength(e);f=
b.encrypt([0,0,0,0]);96===h?(e=e.slice(0),e=r.concat(e,[1])):(e=sjcl.mode.gcm.h(f,[0,0,0,0],e),e=sjcl.mode.gcm.h(f,e,[0,0,Math.floor(h/0x100000000),h&0xffffffff]));h=sjcl.mode.gcm.h(f,[0,0,0,0],d);m=e.slice(0);d=h.slice(0);a||(d=sjcl.mode.gcm.h(f,h,c));for(k=0;k<n;k+=4)m[3]++,l=b.encrypt(m),c[k]^=l[0],c[k+1]^=l[1],c[k+2]^=l[2],c[k+3]^=l[3];c=r.clamp(c,p);a&&(d=sjcl.mode.gcm.h(f,h,c));a=[Math.floor(t/0x100000000),t&0xffffffff,Math.floor(p/0x100000000),p&0xffffffff];d=sjcl.mode.gcm.h(f,d,a);l=b.encrypt(e);
d[0]^=l[0];d[1]^=l[1];d[2]^=l[2];d[3]^=l[3];return{tag:r.bitSlice(d,0,g),data:c}}};sjcl.misc.hmac=function(a,b){this.N=b=b||sjcl.hash.sha256;var c=[[],[]],d,e=b.prototype.blockSize/32;this.n=[new b,new b];a.length>e&&(a=b.hash(a));for(d=0;d<e;d++)c[0][d]=a[d]^909522486,c[1][d]=a[d]^1549556828;this.n[0].update(c[0]);this.n[1].update(c[1]);this.I=new b(this.n[0])};
sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(a){this.S&&q(new sjcl.exception.invalid("encrypt on already updated hmac called!"));this.update(a);return this.digest(a)};sjcl.misc.hmac.prototype.reset=function(){this.I=new this.N(this.n[0]);this.S=u};sjcl.misc.hmac.prototype.update=function(a){this.S=!0;this.I.update(a)};sjcl.misc.hmac.prototype.digest=function(){var a=this.I.finalize(),a=(new this.N(this.n[1])).update(a).finalize();this.reset();return a};
sjcl.misc.pbkdf2=function(a,b,c,d,e){c=c||1E3;(0>d||0>c)&&q(sjcl.exception.invalid("invalid params to pbkdf2"));"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));e=e||sjcl.misc.hmac;a=new e(a);var g,f,h,l,k=[],m=sjcl.bitArray;for(l=1;32*k.length<(d||1);l++){e=g=a.encrypt(m.concat(b,[l]));for(f=1;f<c;f++){g=a.encrypt(g);for(h=0;h<g.length;h++)e[h]^=g[h]}k=k.concat(e)}d&&(k=m.clamp(k,d));return k};
sjcl.prng=function(a){this.c=[new sjcl.hash.sha256];this.j=[0];this.H=0;this.u={};this.F=0;this.L={};this.Q=this.d=this.k=this.Z=0;this.b=[0,0,0,0,0,0,0,0];this.f=[0,0,0,0];this.C=s;this.D=a;this.r=u;this.B={progress:{},seeded:{}};this.m=this.Y=0;this.w=1;this.A=2;this.U=0x10000;this.K=[0,48,64,96,128,192,0x100,384,512,768,1024];this.V=3E4;this.T=80};
sjcl.prng.prototype={randomWords:function(a,b){var c=[],d;d=this.isReady(b);var e;d===this.m&&q(new sjcl.exception.notReady("generator isn't seeded"));if(d&this.A){d=!(d&this.w);e=[];var g=0,f;this.Q=e[0]=(new Date).valueOf()+this.V;for(f=0;16>f;f++)e.push(0x100000000*Math.random()|0);for(f=0;f<this.c.length&&!(e=e.concat(this.c[f].finalize()),g+=this.j[f],this.j[f]=0,!d&&this.H&1<<f);f++);this.H>=1<<this.c.length&&(this.c.push(new sjcl.hash.sha256),this.j.push(0));this.d-=g;g>this.k&&(this.k=g);this.H++;
this.b=sjcl.hash.sha256.hash(this.b.concat(e));this.C=new sjcl.cipher.aes(this.b);for(d=0;4>d&&!(this.f[d]=this.f[d]+1|0,this.f[d]);d++);}for(d=0;d<a;d+=4)0===(d+1)%this.U&&A(this),e=B(this),c.push(e[0],e[1],e[2],e[3]);A(this);return c.slice(0,a)},setDefaultParanoia:function(a,b){0===a&&"Setting paranoia=0 will ruin your security; use it only for testing"!==b&&q("Setting paranoia=0 will ruin your security; use it only for testing");this.D=a},addEntropy:function(a,b,c){c=c||"user";var d,e,g=(new Date).valueOf(),
f=this.u[c],h=this.isReady(),l=0;d=this.L[c];d===s&&(d=this.L[c]=this.Z++);f===s&&(f=this.u[c]=0);this.u[c]=(this.u[c]+1)%this.c.length;switch(typeof a){case "number":b===s&&(b=1);this.c[f].update([d,this.F++,1,b,g,1,a|0]);break;case "object":c=Object.prototype.toString.call(a);if("[object Uint32Array]"===c){e=[];for(c=0;c<a.length;c++)e.push(a[c]);a=e}else{"[object Array]"!==c&&(l=1);for(c=0;c<a.length&&!l;c++)"number"!==typeof a[c]&&(l=1)}if(!l){if(b===s)for(c=b=0;c<a.length;c++)for(e=a[c];0<e;)b++,
e>>>=1;this.c[f].update([d,this.F++,2,b,g,a.length].concat(a))}break;case "string":b===s&&(b=a.length);this.c[f].update([d,this.F++,3,b,g,a.length]);this.c[f].update(a);break;default:l=1}l&&q(new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string"));this.j[f]+=b;this.d+=b;h===this.m&&(this.isReady()!==this.m&&C("seeded",Math.max(this.k,this.d)),C("progress",this.getProgress()))},isReady:function(a){a=this.K[a!==s?a:this.D];return this.k&&this.k>=a?this.j[0]>this.T&&
(new Date).valueOf()>this.Q?this.A|this.w:this.w:this.d>=a?this.A|this.m:this.m},getProgress:function(a){a=this.K[a?a:this.D];return this.k>=a?1:this.d>a?1:this.d/a},startCollectors:function(){this.r||(this.a={loadTimeCollector:D(this,this.da),mouseCollector:D(this,this.fa),keyboardCollector:D(this,this.ca),accelerometerCollector:D(this,this.W),touchCollector:D(this,this.ha)},window.addEventListener?(window.addEventListener("load",this.a.loadTimeCollector,u),window.addEventListener("mousemove",this.a.mouseCollector,
u),window.addEventListener("keypress",this.a.keyboardCollector,u),window.addEventListener("devicemotion",this.a.accelerometerCollector,u),window.addEventListener("touchmove",this.a.touchCollector,u)):document.attachEvent?(document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector)):q(new sjcl.exception.bug("can't attach event")),this.r=!0)},stopCollectors:function(){this.r&&(window.removeEventListener?
(window.removeEventListener("load",this.a.loadTimeCollector,u),window.removeEventListener("mousemove",this.a.mouseCollector,u),window.removeEventListener("keypress",this.a.keyboardCollector,u),window.removeEventListener("devicemotion",this.a.accelerometerCollector,u),window.removeEventListener("touchmove",this.a.touchCollector,u)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove",this.a.mouseCollector),document.detachEvent("keypress",
this.a.keyboardCollector)),this.r=u)},addEventListener:function(a,b){this.B[a][this.Y++]=b},removeEventListener:function(a,b){var c,d,e=this.B[a],g=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&g.push(d);for(c=0;c<g.length;c++)d=g[c],delete e[d]},ca:function(){E(1)},fa:function(a){var b,c;try{b=a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(d){c=b=0}0!=b&&0!=c&&sjcl.random.addEntropy([b,c],2,"mouse");E(0)},ha:function(a){a=a.touches[0]||a.changedTouches[0];sjcl.random.addEntropy([a.pageX||
a.clientX,a.pageY||a.clientY],1,"touch");E(0)},da:function(){E(2)},W:function(a){a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z;if(window.orientation){var b=window.orientation;"number"===typeof b&&sjcl.random.addEntropy(b,1,"accelerometer")}a&&sjcl.random.addEntropy(a,2,"accelerometer");E(0)}};function C(a,b){var c,d=sjcl.random.B[a],e=[];for(c in d)d.hasOwnProperty(c)&&e.push(d[c]);for(c=0;c<e.length;c++)e[c](b)}
function E(a){"undefined"!==typeof window&&window.performance&&"function"===typeof window.performance.now?sjcl.random.addEntropy(window.performance.now(),a,"loadtime"):sjcl.random.addEntropy((new Date).valueOf(),a,"loadtime")}function A(a){a.b=B(a).concat(B(a));a.C=new sjcl.cipher.aes(a.b)}function B(a){for(var b=0;4>b&&!(a.f[b]=a.f[b]+1|0,a.f[b]);b++);return a.C.encrypt(a.f)}function D(a,b){return function(){b.apply(a,arguments)}}sjcl.random=new sjcl.prng(6);
a:try{var F,G,H,I;if(I="undefined"!==typeof module){var J;if(J=module.exports){var K;try{K=require("crypto")}catch(L){K=null}J=(G=K)&&G.randomBytes}I=J}if(I)F=G.randomBytes(128),F=new Uint32Array((new Uint8Array(F)).buffer),sjcl.random.addEntropy(F,1024,"crypto['randomBytes']");else if("undefined"!==typeof window&&"undefined"!==typeof Uint32Array){H=new Uint32Array(32);if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(H);else if(window.msCrypto&&window.msCrypto.getRandomValues)window.msCrypto.getRandomValues(H);
else break a;sjcl.random.addEntropy(H,1024,"crypto['getRandomValues']")}}catch(M){"undefined"!==typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(M))}
sjcl.json={defaults:{v:1,iter:1E3,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},aa:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,g=e.e({iv:sjcl.random.randomWords(4,0)},e.defaults),f;e.e(g,c);c=g.adata;"string"===typeof g.salt&&(g.salt=sjcl.codec.base64.toBits(g.salt));"string"===typeof g.iv&&(g.iv=sjcl.codec.base64.toBits(g.iv));(!sjcl.mode[g.mode]||!sjcl.cipher[g.cipher]||"string"===typeof a&&100>=g.iter||64!==g.ts&&96!==g.ts&&128!==g.ts||128!==g.ks&&192!==g.ks&&0x100!==g.ks||2>g.iv.length||
4<g.iv.length)&&q(new sjcl.exception.invalid("json encrypt: invalid parameters"));"string"===typeof a?(f=sjcl.misc.cachedPbkdf2(a,g),a=f.key.slice(0,g.ks/32),g.salt=f.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.publicKey&&(f=a.kem(),g.kemtag=f.tag,a=f.key.slice(0,g.ks/32));"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));"string"===typeof c&&(g.adata=c=sjcl.codec.utf8String.toBits(c));f=new sjcl.cipher[g.cipher](a);e.e(d,g);d.key=a;g.ct="ccm"===g.mode&&sjcl.arrayBuffer&&sjcl.arrayBuffer.ccm&&
b instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.encrypt(f,b,g.iv,c,g.ts):sjcl.mode[g.mode].encrypt(f,b,g.iv,c,g.ts);return g},encrypt:function(a,b,c,d){var e=sjcl.json,g=e.aa.apply(e,arguments);return e.encode(g)},$:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json;b=e.e(e.e(e.e({},e.defaults),b),c,!0);var g,f;g=b.adata;"string"===typeof b.salt&&(b.salt=sjcl.codec.base64.toBits(b.salt));"string"===typeof b.iv&&(b.iv=sjcl.codec.base64.toBits(b.iv));(!sjcl.mode[b.mode]||!sjcl.cipher[b.cipher]||"string"===
typeof a&&100>=b.iter||64!==b.ts&&96!==b.ts&&128!==b.ts||128!==b.ks&&192!==b.ks&&0x100!==b.ks||!b.iv||2>b.iv.length||4<b.iv.length)&&q(new sjcl.exception.invalid("json decrypt: invalid parameters"));"string"===typeof a?(f=sjcl.misc.cachedPbkdf2(a,b),a=f.key.slice(0,b.ks/32),b.salt=f.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.secretKey&&(a=a.unkem(sjcl.codec.base64.toBits(b.kemtag)).slice(0,b.ks/32));"string"===typeof g&&(g=sjcl.codec.utf8String.toBits(g));f=new sjcl.cipher[b.cipher](a);g="ccm"===
b.mode&&sjcl.arrayBuffer&&sjcl.arrayBuffer.ccm&&b.ct instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.decrypt(f,b.ct,b.iv,b.tag,g,b.ts):sjcl.mode[b.mode].decrypt(f,b.ct,b.iv,g,b.ts);e.e(d,b);d.key=a;return 1===c.raw?g:sjcl.codec.utf8String.fromBits(g)},decrypt:function(a,b,c,d){var e=sjcl.json;return e.$(a,e.decode(b),c,d)},encode:function(a){var b,c="{",d="";for(b in a)if(a.hasOwnProperty(b))switch(b.match(/^[a-z0-9]+$/i)||q(new sjcl.exception.invalid("json encode: invalid property name")),c+=d+'"'+b+
'":',d=",",typeof a[b]){case "number":case "boolean":c+=a[b];break;case "string":c+='"'+escape(a[b])+'"';break;case "object":c+='"'+sjcl.codec.base64.fromBits(a[b],0)+'"';break;default:q(new sjcl.exception.bug("json encode: unsupported type"))}return c+"}"},decode:function(a){a=a.replace(/\s/g,"");a.match(/^\{.*\}$/)||q(new sjcl.exception.invalid("json decode: this isn't json!"));a=a.replace(/^\{|\}$/g,"").split(/,/);var b={},c,d;for(c=0;c<a.length;c++)(d=a[c].match(/^\s*(?:(["']?)([a-z][a-z0-9]*)\1)\s*:\s*(?:(-?\d+)|"([a-z0-9+\/%*_.@=\-]*)"|(true|false))$/i))||
q(new sjcl.exception.invalid("json decode: this isn't json!")),null!=d[3]?b[d[2]]=parseInt(d[3],10):null!=d[4]?b[d[2]]=d[2].match(/^(ct|adata|salt|iv)$/)?sjcl.codec.base64.toBits(d[4]):unescape(d[4]):null!=d[5]&&(b[d[2]]="true"===d[5]);return b},e:function(a,b,c){a===s&&(a={});if(b===s)return a;for(var d in b)b.hasOwnProperty(d)&&(c&&(a[d]!==s&&a[d]!==b[d])&&q(new sjcl.exception.invalid("required parameter overridden")),a[d]=b[d]);return a},ja:function(a,b){var c={},d;for(d in a)a.hasOwnProperty(d)&&
a[d]!==b[d]&&(c[d]=a[d]);return c},ia:function(a,b){var c={},d;for(d=0;d<b.length;d++)a[b[d]]!==s&&(c[b[d]]=a[b[d]]);return c}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.ga={};sjcl.misc.cachedPbkdf2=function(a,b){var c=sjcl.misc.ga,d;b=b||{};d=b.iter||1E3;c=c[a]=c[a]||{};d=c[d]=c[d]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):sjcl.random.randomWords(2,0)};c=b.salt===s?d.firstSalt:b.salt;d[c]=d[c]||sjcl.misc.pbkdf2(a,c,b.iter);return{key:d[c].slice(0),salt:c.slice(0)}};

60
js/sjcl-1.0.6.js Normal file
View File

@ -0,0 +1,60 @@
"use strict";var sjcl={cipher:{},hash:{},keyexchange:{},mode:{},misc:{},codec:{},exception:{corrupt:function(a){this.toString=function(){return"CORRUPT: "+this.message};this.message=a},invalid:function(a){this.toString=function(){return"INVALID: "+this.message};this.message=a},bug:function(a){this.toString=function(){return"BUG: "+this.message};this.message=a},notReady:function(a){this.toString=function(){return"NOT READY: "+this.message};this.message=a}}};
sjcl.cipher.aes=function(a){this.s[0][0][0]||this.O();var b,c,d,e,f=this.s[0][4],g=this.s[1];b=a.length;var h=1;if(4!==b&&6!==b&&8!==b)throw new sjcl.exception.invalid("invalid aes key size");this.b=[d=a.slice(0),e=[]];for(a=b;a<4*b+28;a++){c=d[a-1];if(0===a%b||8===b&&4===a%b)c=f[c>>>24]<<24^f[c>>16&255]<<16^f[c>>8&255]<<8^f[c&255],0===a%b&&(c=c<<8^c>>>24^h<<24,h=h<<1^283*(h>>7));d[a]=d[a-b]^c}for(b=0;a;b++,a--)c=d[b&3?a:a-4],e[b]=4>=a||4>b?c:g[0][f[c>>>24]]^g[1][f[c>>16&255]]^g[2][f[c>>8&255]]^g[3][f[c&
255]]};
sjcl.cipher.aes.prototype={encrypt:function(a){return t(this,a,0)},decrypt:function(a){return t(this,a,1)},s:[[[],[],[],[],[]],[[],[],[],[],[]]],O:function(){var a=this.s[0],b=this.s[1],c=a[4],d=b[4],e,f,g,h=[],k=[],l,n,m,p;for(e=0;0x100>e;e++)k[(h[e]=e<<1^283*(e>>7))^e]=e;for(f=g=0;!c[f];f^=l||1,g=k[g]||1)for(m=g^g<<1^g<<2^g<<3^g<<4,m=m>>8^m&255^99,c[f]=m,d[m]=f,n=h[e=h[l=h[f]]],p=0x1010101*n^0x10001*e^0x101*l^0x1010100*f,n=0x101*h[m]^0x1010100*m,e=0;4>e;e++)a[e][f]=n=n<<24^n>>>8,b[e][m]=p=p<<24^p>>>8;for(e=
0;5>e;e++)a[e]=a[e].slice(0),b[e]=b[e].slice(0)}};
function t(a,b,c){if(4!==b.length)throw new sjcl.exception.invalid("invalid aes block size");var d=a.b[c],e=b[0]^d[0],f=b[c?3:1]^d[1],g=b[2]^d[2];b=b[c?1:3]^d[3];var h,k,l,n=d.length/4-2,m,p=4,r=[0,0,0,0];h=a.s[c];a=h[0];var q=h[1],v=h[2],w=h[3],x=h[4];for(m=0;m<n;m++)h=a[e>>>24]^q[f>>16&255]^v[g>>8&255]^w[b&255]^d[p],k=a[f>>>24]^q[g>>16&255]^v[b>>8&255]^w[e&255]^d[p+1],l=a[g>>>24]^q[b>>16&255]^v[e>>8&255]^w[f&255]^d[p+2],b=a[b>>>24]^q[e>>16&255]^v[f>>8&255]^w[g&255]^d[p+3],p+=4,e=h,f=k,g=l;for(m=
0;4>m;m++)r[c?3&-m:m]=x[e>>>24]<<24^x[f>>16&255]<<16^x[g>>8&255]<<8^x[b&255]^d[p++],h=e,e=f,f=g,g=b,b=h;return r}
sjcl.bitArray={bitSlice:function(a,b,c){a=sjcl.bitArray.$(a.slice(b/32),32-(b&31)).slice(1);return void 0===c?a:sjcl.bitArray.clamp(a,c-b)},extract:function(a,b,c){var d=Math.floor(-b-c&31);return((b+c-1^b)&-32?a[b/32|0]<<32-d^a[b/32+1|0]>>>d:a[b/32|0]>>>d)&(1<<c)-1},concat:function(a,b){if(0===a.length||0===b.length)return a.concat(b);var c=a[a.length-1],d=sjcl.bitArray.getPartial(c);return 32===d?a.concat(b):sjcl.bitArray.$(b,d,c|0,a.slice(0,a.length-1))},bitLength:function(a){var b=a.length;return 0===
b?0:32*(b-1)+sjcl.bitArray.getPartial(a[b-1])},clamp:function(a,b){if(32*a.length<b)return a;a=a.slice(0,Math.ceil(b/32));var c=a.length;b=b&31;0<c&&b&&(a[c-1]=sjcl.bitArray.partial(b,a[c-1]&2147483648>>b-1,1));return a},partial:function(a,b,c){return 32===a?b:(c?b|0:b<<32-a)+0x10000000000*a},getPartial:function(a){return Math.round(a/0x10000000000)||32},equal:function(a,b){if(sjcl.bitArray.bitLength(a)!==sjcl.bitArray.bitLength(b))return!1;var c=0,d;for(d=0;d<a.length;d++)c|=a[d]^b[d];return 0===
c},$:function(a,b,c,d){var e;e=0;for(void 0===d&&(d=[]);32<=b;b-=32)d.push(c),c=0;if(0===b)return d.concat(a);for(e=0;e<a.length;e++)d.push(c|a[e]>>>b),c=a[e]<<32-b;e=a.length?a[a.length-1]:0;a=sjcl.bitArray.getPartial(e);d.push(sjcl.bitArray.partial(b+a&31,32<b+a?c:d.pop(),1));return d},i:function(a,b){return[a[0]^b[0],a[1]^b[1],a[2]^b[2],a[3]^b[3]]},byteswapM:function(a){var b,c;for(b=0;b<a.length;++b)c=a[b],a[b]=c>>>24|c>>>8&0xff00|(c&0xff00)<<8|c<<24;return a}};
sjcl.codec.utf8String={fromBits:function(a){var b="",c=sjcl.bitArray.bitLength(a),d,e;for(d=0;d<c/8;d++)0===(d&3)&&(e=a[d/4]),b+=String.fromCharCode(e>>>24),e<<=8;return decodeURIComponent(escape(b))},toBits:function(a){a=unescape(encodeURIComponent(a));var b=[],c,d=0;for(c=0;c<a.length;c++)d=d<<8|a.charCodeAt(c),3===(c&3)&&(b.push(d),d=0);c&3&&b.push(sjcl.bitArray.partial(8*(c&3),d));return b}};
sjcl.codec.hex={fromBits:function(a){var b="",c;for(c=0;c<a.length;c++)b+=((a[c]|0)+0xf00000000000).toString(16).substr(4);return b.substr(0,sjcl.bitArray.bitLength(a)/4)},toBits:function(a){var b,c=[],d;a=a.replace(/\s|0x/g,"");d=a.length;a=a+"00000000";for(b=0;b<a.length;b+=8)c.push(parseInt(a.substr(b,8),16)^0);return sjcl.bitArray.clamp(c,4*d)}};
sjcl.codec.base32={B:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",X:"0123456789ABCDEFGHIJKLMNOPQRSTUV",BITS:32,BASE:5,REMAINING:27,fromBits:function(a,b,c){var d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f="",g=0,h=sjcl.codec.base32.B,k=0,l=sjcl.bitArray.bitLength(a);c&&(h=sjcl.codec.base32.X);for(c=0;f.length*d<l;)f+=h.charAt((k^a[c]>>>g)>>>e),g<d?(k=a[c]<<d-g,g+=e,c++):(k<<=d,g-=d);for(;f.length&7&&!b;)f+="=";return f},toBits:function(a,b){a=a.replace(/\s|=/g,"").toUpperCase();var c=sjcl.codec.base32.BITS,
d=sjcl.codec.base32.BASE,e=sjcl.codec.base32.REMAINING,f=[],g,h=0,k=sjcl.codec.base32.B,l=0,n,m="base32";b&&(k=sjcl.codec.base32.X,m="base32hex");for(g=0;g<a.length;g++){n=k.indexOf(a.charAt(g));if(0>n){if(!b)try{return sjcl.codec.base32hex.toBits(a)}catch(p){}throw new sjcl.exception.invalid("this isn't "+m+"!");}h>e?(h-=e,f.push(l^n>>>h),l=n<<c-h):(h+=d,l^=n<<c-h)}h&56&&f.push(sjcl.bitArray.partial(h&56,l,1));return f}};
sjcl.codec.base32hex={fromBits:function(a,b){return sjcl.codec.base32.fromBits(a,b,1)},toBits:function(a){return sjcl.codec.base32.toBits(a,1)}};
sjcl.codec.base64={B:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",fromBits:function(a,b,c){var d="",e=0,f=sjcl.codec.base64.B,g=0,h=sjcl.bitArray.bitLength(a);c&&(f=f.substr(0,62)+"-_");for(c=0;6*d.length<h;)d+=f.charAt((g^a[c]>>>e)>>>26),6>e?(g=a[c]<<6-e,e+=26,c++):(g<<=6,e-=6);for(;d.length&3&&!b;)d+="=";return d},toBits:function(a,b){a=a.replace(/\s|=/g,"");var c=[],d,e=0,f=sjcl.codec.base64.B,g=0,h;b&&(f=f.substr(0,62)+"-_");for(d=0;d<a.length;d++){h=f.indexOf(a.charAt(d));
if(0>h)throw new sjcl.exception.invalid("this isn't base64!");26<e?(e-=26,c.push(g^h>>>e),g=h<<32-e):(e+=6,g^=h<<32-e)}e&56&&c.push(sjcl.bitArray.partial(e&56,g,1));return c}};sjcl.codec.base64url={fromBits:function(a){return sjcl.codec.base64.fromBits(a,1,1)},toBits:function(a){return sjcl.codec.base64.toBits(a,1)}};sjcl.hash.sha256=function(a){this.b[0]||this.O();a?(this.F=a.F.slice(0),this.A=a.A.slice(0),this.l=a.l):this.reset()};sjcl.hash.sha256.hash=function(a){return(new sjcl.hash.sha256).update(a).finalize()};
sjcl.hash.sha256.prototype={blockSize:512,reset:function(){this.F=this.Y.slice(0);this.A=[];this.l=0;return this},update:function(a){"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));var b,c=this.A=sjcl.bitArray.concat(this.A,a);b=this.l;a=this.l=b+sjcl.bitArray.bitLength(a);if(0x1fffffffffffff<a)throw new sjcl.exception.invalid("Cannot hash more than 2^53 - 1 bits");if("undefined"!==typeof Uint32Array){var d=new Uint32Array(c),e=0;for(b=512+b-(512+b&0x1ff);b<=a;b+=512)u(this,d.subarray(16*e,
16*(e+1))),e+=1;c.splice(0,16*e)}else for(b=512+b-(512+b&0x1ff);b<=a;b+=512)u(this,c.splice(0,16));return this},finalize:function(){var a,b=this.A,c=this.F,b=sjcl.bitArray.concat(b,[sjcl.bitArray.partial(1,1)]);for(a=b.length+2;a&15;a++)b.push(0);b.push(Math.floor(this.l/0x100000000));for(b.push(this.l|0);b.length;)u(this,b.splice(0,16));this.reset();return c},Y:[],b:[],O:function(){function a(a){return 0x100000000*(a-Math.floor(a))|0}for(var b=0,c=2,d,e;64>b;c++){e=!0;for(d=2;d*d<=c;d++)if(0===c%d){e=
!1;break}e&&(8>b&&(this.Y[b]=a(Math.pow(c,.5))),this.b[b]=a(Math.pow(c,1/3)),b++)}}};
function u(a,b){var c,d,e,f=a.F,g=a.b,h=f[0],k=f[1],l=f[2],n=f[3],m=f[4],p=f[5],r=f[6],q=f[7];for(c=0;64>c;c++)16>c?d=b[c]:(d=b[c+1&15],e=b[c+14&15],d=b[c&15]=(d>>>7^d>>>18^d>>>3^d<<25^d<<14)+(e>>>17^e>>>19^e>>>10^e<<15^e<<13)+b[c&15]+b[c+9&15]|0),d=d+q+(m>>>6^m>>>11^m>>>25^m<<26^m<<21^m<<7)+(r^m&(p^r))+g[c],q=r,r=p,p=m,m=n+d|0,n=l,l=k,k=h,h=d+(k&l^n&(k^l))+(k>>>2^k>>>13^k>>>22^k<<30^k<<19^k<<10)|0;f[0]=f[0]+h|0;f[1]=f[1]+k|0;f[2]=f[2]+l|0;f[3]=f[3]+n|0;f[4]=f[4]+m|0;f[5]=f[5]+p|0;f[6]=f[6]+r|0;f[7]=
f[7]+q|0}
sjcl.mode.ccm={name:"ccm",G:[],listenProgress:function(a){sjcl.mode.ccm.G.push(a)},unListenProgress:function(a){a=sjcl.mode.ccm.G.indexOf(a);-1<a&&sjcl.mode.ccm.G.splice(a,1)},fa:function(a){var b=sjcl.mode.ccm.G.slice(),c;for(c=0;c<b.length;c+=1)b[c](a)},encrypt:function(a,b,c,d,e){var f,g=b.slice(0),h=sjcl.bitArray,k=h.bitLength(c)/8,l=h.bitLength(g)/8;e=e||64;d=d||[];if(7>k)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(f=2;4>f&&l>>>8*f;f++);f<15-k&&(f=15-k);c=h.clamp(c,
8*(15-f));b=sjcl.mode.ccm.V(a,b,c,d,e,f);g=sjcl.mode.ccm.C(a,g,c,b,e,f);return h.concat(g.data,g.tag)},decrypt:function(a,b,c,d,e){e=e||64;d=d||[];var f=sjcl.bitArray,g=f.bitLength(c)/8,h=f.bitLength(b),k=f.clamp(b,h-e),l=f.bitSlice(b,h-e),h=(h-e)/8;if(7>g)throw new sjcl.exception.invalid("ccm: iv must be at least 7 bytes");for(b=2;4>b&&h>>>8*b;b++);b<15-g&&(b=15-g);c=f.clamp(c,8*(15-b));k=sjcl.mode.ccm.C(a,k,c,l,e,b);a=sjcl.mode.ccm.V(a,k.data,c,d,e,b);if(!f.equal(k.tag,a))throw new sjcl.exception.corrupt("ccm: tag doesn't match");
return k.data},na:function(a,b,c,d,e,f){var g=[],h=sjcl.bitArray,k=h.i;d=[h.partial(8,(b.length?64:0)|d-2<<2|f-1)];d=h.concat(d,c);d[3]|=e;d=a.encrypt(d);if(b.length)for(c=h.bitLength(b)/8,65279>=c?g=[h.partial(16,c)]:0xffffffff>=c&&(g=h.concat([h.partial(16,65534)],[c])),g=h.concat(g,b),b=0;b<g.length;b+=4)d=a.encrypt(k(d,g.slice(b,b+4).concat([0,0,0])));return d},V:function(a,b,c,d,e,f){var g=sjcl.bitArray,h=g.i;e/=8;if(e%2||4>e||16<e)throw new sjcl.exception.invalid("ccm: invalid tag length");
if(0xffffffff<d.length||0xffffffff<b.length)throw new sjcl.exception.bug("ccm: can't deal with 4GiB or more data");c=sjcl.mode.ccm.na(a,d,c,e,g.bitLength(b)/8,f);for(d=0;d<b.length;d+=4)c=a.encrypt(h(c,b.slice(d,d+4).concat([0,0,0])));return g.clamp(c,8*e)},C:function(a,b,c,d,e,f){var g,h=sjcl.bitArray;g=h.i;var k=b.length,l=h.bitLength(b),n=k/50,m=n;c=h.concat([h.partial(8,f-1)],c).concat([0,0,0]).slice(0,4);d=h.bitSlice(g(d,a.encrypt(c)),0,e);if(!k)return{tag:d,data:[]};for(g=0;g<k;g+=4)g>n&&(sjcl.mode.ccm.fa(g/
k),n+=m),c[3]++,e=a.encrypt(c),b[g]^=e[0],b[g+1]^=e[1],b[g+2]^=e[2],b[g+3]^=e[3];return{tag:d,data:h.clamp(b,l)}}};
sjcl.mode.ocb2={name:"ocb2",encrypt:function(a,b,c,d,e,f){if(128!==sjcl.bitArray.bitLength(c))throw new sjcl.exception.invalid("ocb iv must be 128 bits");var g,h=sjcl.mode.ocb2.S,k=sjcl.bitArray,l=k.i,n=[0,0,0,0];c=h(a.encrypt(c));var m,p=[];d=d||[];e=e||64;for(g=0;g+4<b.length;g+=4)m=b.slice(g,g+4),n=l(n,m),p=p.concat(l(c,a.encrypt(l(c,m)))),c=h(c);m=b.slice(g);b=k.bitLength(m);g=a.encrypt(l(c,[0,0,0,b]));m=k.clamp(l(m.concat([0,0,0]),g),b);n=l(n,l(m.concat([0,0,0]),g));n=a.encrypt(l(n,l(c,h(c))));
d.length&&(n=l(n,f?d:sjcl.mode.ocb2.pmac(a,d)));return p.concat(k.concat(m,k.clamp(n,e)))},decrypt:function(a,b,c,d,e,f){if(128!==sjcl.bitArray.bitLength(c))throw new sjcl.exception.invalid("ocb iv must be 128 bits");e=e||64;var g=sjcl.mode.ocb2.S,h=sjcl.bitArray,k=h.i,l=[0,0,0,0],n=g(a.encrypt(c)),m,p,r=sjcl.bitArray.bitLength(b)-e,q=[];d=d||[];for(c=0;c+4<r/32;c+=4)m=k(n,a.decrypt(k(n,b.slice(c,c+4)))),l=k(l,m),q=q.concat(m),n=g(n);p=r-32*c;m=a.encrypt(k(n,[0,0,0,p]));m=k(m,h.clamp(b.slice(c),p).concat([0,
0,0]));l=k(l,m);l=a.encrypt(k(l,k(n,g(n))));d.length&&(l=k(l,f?d:sjcl.mode.ocb2.pmac(a,d)));if(!h.equal(h.clamp(l,e),h.bitSlice(b,r)))throw new sjcl.exception.corrupt("ocb: tag doesn't match");return q.concat(h.clamp(m,p))},pmac:function(a,b){var c,d=sjcl.mode.ocb2.S,e=sjcl.bitArray,f=e.i,g=[0,0,0,0],h=a.encrypt([0,0,0,0]),h=f(h,d(d(h)));for(c=0;c+4<b.length;c+=4)h=d(h),g=f(g,a.encrypt(f(h,b.slice(c,c+4))));c=b.slice(c);128>e.bitLength(c)&&(h=f(h,d(h)),c=e.concat(c,[-2147483648,0,0,0]));g=f(g,c);
return a.encrypt(f(d(f(h,d(h))),g))},S:function(a){return[a[0]<<1^a[1]>>>31,a[1]<<1^a[2]>>>31,a[2]<<1^a[3]>>>31,a[3]<<1^135*(a[0]>>>31)]}};
sjcl.mode.gcm={name:"gcm",encrypt:function(a,b,c,d,e){var f=b.slice(0);b=sjcl.bitArray;d=d||[];a=sjcl.mode.gcm.C(!0,a,f,d,c,e||128);return b.concat(a.data,a.tag)},decrypt:function(a,b,c,d,e){var f=b.slice(0),g=sjcl.bitArray,h=g.bitLength(f);e=e||128;d=d||[];e<=h?(b=g.bitSlice(f,h-e),f=g.bitSlice(f,0,h-e)):(b=f,f=[]);a=sjcl.mode.gcm.C(!1,a,f,d,c,e);if(!g.equal(a.tag,b))throw new sjcl.exception.corrupt("gcm: tag doesn't match");return a.data},ka:function(a,b){var c,d,e,f,g,h=sjcl.bitArray.i;e=[0,0,
0,0];f=b.slice(0);for(c=0;128>c;c++){(d=0!==(a[Math.floor(c/32)]&1<<31-c%32))&&(e=h(e,f));g=0!==(f[3]&1);for(d=3;0<d;d--)f[d]=f[d]>>>1|(f[d-1]&1)<<31;f[0]>>>=1;g&&(f[0]^=-0x1f000000)}return e},j:function(a,b,c){var d,e=c.length;b=b.slice(0);for(d=0;d<e;d+=4)b[0]^=0xffffffff&c[d],b[1]^=0xffffffff&c[d+1],b[2]^=0xffffffff&c[d+2],b[3]^=0xffffffff&c[d+3],b=sjcl.mode.gcm.ka(b,a);return b},C:function(a,b,c,d,e,f){var g,h,k,l,n,m,p,r,q=sjcl.bitArray;m=c.length;p=q.bitLength(c);r=q.bitLength(d);h=q.bitLength(e);
g=b.encrypt([0,0,0,0]);96===h?(e=e.slice(0),e=q.concat(e,[1])):(e=sjcl.mode.gcm.j(g,[0,0,0,0],e),e=sjcl.mode.gcm.j(g,e,[0,0,Math.floor(h/0x100000000),h&0xffffffff]));h=sjcl.mode.gcm.j(g,[0,0,0,0],d);n=e.slice(0);d=h.slice(0);a||(d=sjcl.mode.gcm.j(g,h,c));for(l=0;l<m;l+=4)n[3]++,k=b.encrypt(n),c[l]^=k[0],c[l+1]^=k[1],c[l+2]^=k[2],c[l+3]^=k[3];c=q.clamp(c,p);a&&(d=sjcl.mode.gcm.j(g,h,c));a=[Math.floor(r/0x100000000),r&0xffffffff,Math.floor(p/0x100000000),p&0xffffffff];d=sjcl.mode.gcm.j(g,d,a);k=b.encrypt(e);
d[0]^=k[0];d[1]^=k[1];d[2]^=k[2];d[3]^=k[3];return{tag:q.bitSlice(d,0,f),data:c}}};sjcl.misc.hmac=function(a,b){this.W=b=b||sjcl.hash.sha256;var c=[[],[]],d,e=b.prototype.blockSize/32;this.w=[new b,new b];a.length>e&&(a=b.hash(a));for(d=0;d<e;d++)c[0][d]=a[d]^909522486,c[1][d]=a[d]^1549556828;this.w[0].update(c[0]);this.w[1].update(c[1]);this.R=new b(this.w[0])};
sjcl.misc.hmac.prototype.encrypt=sjcl.misc.hmac.prototype.mac=function(a){if(this.aa)throw new sjcl.exception.invalid("encrypt on already updated hmac called!");this.update(a);return this.digest(a)};sjcl.misc.hmac.prototype.reset=function(){this.R=new this.W(this.w[0]);this.aa=!1};sjcl.misc.hmac.prototype.update=function(a){this.aa=!0;this.R.update(a)};sjcl.misc.hmac.prototype.digest=function(){var a=this.R.finalize(),a=(new this.W(this.w[1])).update(a).finalize();this.reset();return a};
sjcl.misc.pbkdf2=function(a,b,c,d,e){c=c||1E4;if(0>d||0>c)throw new sjcl.exception.invalid("invalid params to pbkdf2");"string"===typeof a&&(a=sjcl.codec.utf8String.toBits(a));"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));e=e||sjcl.misc.hmac;a=new e(a);var f,g,h,k,l=[],n=sjcl.bitArray;for(k=1;32*l.length<(d||1);k++){e=f=a.encrypt(n.concat(b,[k]));for(g=1;g<c;g++)for(f=a.encrypt(f),h=0;h<f.length;h++)e[h]^=f[h];l=l.concat(e)}d&&(l=n.clamp(l,d));return l};
sjcl.prng=function(a){this.c=[new sjcl.hash.sha256];this.m=[0];this.P=0;this.H={};this.N=0;this.U={};this.Z=this.f=this.o=this.ha=0;this.b=[0,0,0,0,0,0,0,0];this.h=[0,0,0,0];this.L=void 0;this.M=a;this.D=!1;this.K={progress:{},seeded:{}};this.u=this.ga=0;this.I=1;this.J=2;this.ca=0x10000;this.T=[0,48,64,96,128,192,0x100,384,512,768,1024];this.da=3E4;this.ba=80};
sjcl.prng.prototype={randomWords:function(a,b){var c=[],d;d=this.isReady(b);var e;if(d===this.u)throw new sjcl.exception.notReady("generator isn't seeded");if(d&this.J){d=!(d&this.I);e=[];var f=0,g;this.Z=e[0]=(new Date).valueOf()+this.da;for(g=0;16>g;g++)e.push(0x100000000*Math.random()|0);for(g=0;g<this.c.length&&(e=e.concat(this.c[g].finalize()),f+=this.m[g],this.m[g]=0,d||!(this.P&1<<g));g++);this.P>=1<<this.c.length&&(this.c.push(new sjcl.hash.sha256),this.m.push(0));this.f-=f;f>this.o&&(this.o=
f);this.P++;this.b=sjcl.hash.sha256.hash(this.b.concat(e));this.L=new sjcl.cipher.aes(this.b);for(d=0;4>d&&(this.h[d]=this.h[d]+1|0,!this.h[d]);d++);}for(d=0;d<a;d+=4)0===(d+1)%this.ca&&y(this),e=z(this),c.push(e[0],e[1],e[2],e[3]);y(this);return c.slice(0,a)},setDefaultParanoia:function(a,b){if(0===a&&"Setting paranoia=0 will ruin your security; use it only for testing"!==b)throw new sjcl.exception.invalid("Setting paranoia=0 will ruin your security; use it only for testing");this.M=a},addEntropy:function(a,
b,c){c=c||"user";var d,e,f=(new Date).valueOf(),g=this.H[c],h=this.isReady(),k=0;d=this.U[c];void 0===d&&(d=this.U[c]=this.ha++);void 0===g&&(g=this.H[c]=0);this.H[c]=(this.H[c]+1)%this.c.length;switch(typeof a){case "number":void 0===b&&(b=1);this.c[g].update([d,this.N++,1,b,f,1,a|0]);break;case "object":c=Object.prototype.toString.call(a);if("[object Uint32Array]"===c){e=[];for(c=0;c<a.length;c++)e.push(a[c]);a=e}else for("[object Array]"!==c&&(k=1),c=0;c<a.length&&!k;c++)"number"!==typeof a[c]&&
(k=1);if(!k){if(void 0===b)for(c=b=0;c<a.length;c++)for(e=a[c];0<e;)b++,e=e>>>1;this.c[g].update([d,this.N++,2,b,f,a.length].concat(a))}break;case "string":void 0===b&&(b=a.length);this.c[g].update([d,this.N++,3,b,f,a.length]);this.c[g].update(a);break;default:k=1}if(k)throw new sjcl.exception.bug("random: addEntropy only supports number, array of numbers or string");this.m[g]+=b;this.f+=b;h===this.u&&(this.isReady()!==this.u&&A("seeded",Math.max(this.o,this.f)),A("progress",this.getProgress()))},
isReady:function(a){a=this.T[void 0!==a?a:this.M];return this.o&&this.o>=a?this.m[0]>this.ba&&(new Date).valueOf()>this.Z?this.J|this.I:this.I:this.f>=a?this.J|this.u:this.u},getProgress:function(a){a=this.T[a?a:this.M];return this.o>=a?1:this.f>a?1:this.f/a},startCollectors:function(){if(!this.D){this.a={loadTimeCollector:B(this,this.ma),mouseCollector:B(this,this.oa),keyboardCollector:B(this,this.la),accelerometerCollector:B(this,this.ea),touchCollector:B(this,this.qa)};if(window.addEventListener)window.addEventListener("load",
this.a.loadTimeCollector,!1),window.addEventListener("mousemove",this.a.mouseCollector,!1),window.addEventListener("keypress",this.a.keyboardCollector,!1),window.addEventListener("devicemotion",this.a.accelerometerCollector,!1),window.addEventListener("touchmove",this.a.touchCollector,!1);else if(document.attachEvent)document.attachEvent("onload",this.a.loadTimeCollector),document.attachEvent("onmousemove",this.a.mouseCollector),document.attachEvent("keypress",this.a.keyboardCollector);else throw new sjcl.exception.bug("can't attach event");
this.D=!0}},stopCollectors:function(){this.D&&(window.removeEventListener?(window.removeEventListener("load",this.a.loadTimeCollector,!1),window.removeEventListener("mousemove",this.a.mouseCollector,!1),window.removeEventListener("keypress",this.a.keyboardCollector,!1),window.removeEventListener("devicemotion",this.a.accelerometerCollector,!1),window.removeEventListener("touchmove",this.a.touchCollector,!1)):document.detachEvent&&(document.detachEvent("onload",this.a.loadTimeCollector),document.detachEvent("onmousemove",
this.a.mouseCollector),document.detachEvent("keypress",this.a.keyboardCollector)),this.D=!1)},addEventListener:function(a,b){this.K[a][this.ga++]=b},removeEventListener:function(a,b){var c,d,e=this.K[a],f=[];for(d in e)e.hasOwnProperty(d)&&e[d]===b&&f.push(d);for(c=0;c<f.length;c++)d=f[c],delete e[d]},la:function(){C(this,1)},oa:function(a){var b,c;try{b=a.x||a.clientX||a.offsetX||0,c=a.y||a.clientY||a.offsetY||0}catch(d){c=b=0}0!=b&&0!=c&&this.addEntropy([b,c],2,"mouse");C(this,0)},qa:function(a){a=
a.touches[0]||a.changedTouches[0];this.addEntropy([a.pageX||a.clientX,a.pageY||a.clientY],1,"touch");C(this,0)},ma:function(){C(this,2)},ea:function(a){a=a.accelerationIncludingGravity.x||a.accelerationIncludingGravity.y||a.accelerationIncludingGravity.z;if(window.orientation){var b=window.orientation;"number"===typeof b&&this.addEntropy(b,1,"accelerometer")}a&&this.addEntropy(a,2,"accelerometer");C(this,0)}};
function A(a,b){var c,d=sjcl.random.K[a],e=[];for(c in d)d.hasOwnProperty(c)&&e.push(d[c]);for(c=0;c<e.length;c++)e[c](b)}function C(a,b){"undefined"!==typeof window&&window.performance&&"function"===typeof window.performance.now?a.addEntropy(window.performance.now(),b,"loadtime"):a.addEntropy((new Date).valueOf(),b,"loadtime")}function y(a){a.b=z(a).concat(z(a));a.L=new sjcl.cipher.aes(a.b)}function z(a){for(var b=0;4>b&&(a.h[b]=a.h[b]+1|0,!a.h[b]);b++);return a.L.encrypt(a.h)}
function B(a,b){return function(){b.apply(a,arguments)}}sjcl.random=new sjcl.prng(6);
a:try{var D,E,F,G;if(G="undefined"!==typeof module&&module.exports){var H;try{H=require("crypto")}catch(a){H=null}G=E=H}if(G&&E.randomBytes)D=E.randomBytes(128),D=new Uint32Array((new Uint8Array(D)).buffer),sjcl.random.addEntropy(D,1024,"crypto['randomBytes']");else if("undefined"!==typeof window&&"undefined"!==typeof Uint32Array){F=new Uint32Array(32);if(window.crypto&&window.crypto.getRandomValues)window.crypto.getRandomValues(F);else if(window.msCrypto&&window.msCrypto.getRandomValues)window.msCrypto.getRandomValues(F);
else break a;sjcl.random.addEntropy(F,1024,"crypto['getRandomValues']")}}catch(a){"undefined"!==typeof window&&window.console&&(console.log("There was an error collecting entropy from the browser:"),console.log(a))}
sjcl.json={defaults:{v:1,iter:1E4,ks:128,ts:64,mode:"ccm",adata:"",cipher:"aes"},ja:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json,f=e.g({iv:sjcl.random.randomWords(4,0)},e.defaults),g;e.g(f,c);c=f.adata;"string"===typeof f.salt&&(f.salt=sjcl.codec.base64.toBits(f.salt));"string"===typeof f.iv&&(f.iv=sjcl.codec.base64.toBits(f.iv));if(!sjcl.mode[f.mode]||!sjcl.cipher[f.cipher]||"string"===typeof a&&100>=f.iter||64!==f.ts&&96!==f.ts&&128!==f.ts||128!==f.ks&&192!==f.ks&&0x100!==f.ks||2>f.iv.length||
4<f.iv.length)throw new sjcl.exception.invalid("json encrypt: invalid parameters");"string"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,f),a=g.key.slice(0,f.ks/32),f.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.publicKey&&(g=a.kem(),f.kemtag=g.tag,a=g.key.slice(0,f.ks/32));"string"===typeof b&&(b=sjcl.codec.utf8String.toBits(b));"string"===typeof c&&(f.adata=c=sjcl.codec.utf8String.toBits(c));g=new sjcl.cipher[f.cipher](a);e.g(d,f);d.key=a;f.ct="ccm"===f.mode&&sjcl.arrayBuffer&&sjcl.arrayBuffer.ccm&&
b instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.encrypt(g,b,f.iv,c,f.ts):sjcl.mode[f.mode].encrypt(g,b,f.iv,c,f.ts);return f},encrypt:function(a,b,c,d){var e=sjcl.json,f=e.ja.apply(e,arguments);return e.encode(f)},ia:function(a,b,c,d){c=c||{};d=d||{};var e=sjcl.json;b=e.g(e.g(e.g({},e.defaults),b),c,!0);var f,g;f=b.adata;"string"===typeof b.salt&&(b.salt=sjcl.codec.base64.toBits(b.salt));"string"===typeof b.iv&&(b.iv=sjcl.codec.base64.toBits(b.iv));if(!sjcl.mode[b.mode]||!sjcl.cipher[b.cipher]||"string"===
typeof a&&100>=b.iter||64!==b.ts&&96!==b.ts&&128!==b.ts||128!==b.ks&&192!==b.ks&&0x100!==b.ks||!b.iv||2>b.iv.length||4<b.iv.length)throw new sjcl.exception.invalid("json decrypt: invalid parameters");"string"===typeof a?(g=sjcl.misc.cachedPbkdf2(a,b),a=g.key.slice(0,b.ks/32),b.salt=g.salt):sjcl.ecc&&a instanceof sjcl.ecc.elGamal.secretKey&&(a=a.unkem(sjcl.codec.base64.toBits(b.kemtag)).slice(0,b.ks/32));"string"===typeof f&&(f=sjcl.codec.utf8String.toBits(f));g=new sjcl.cipher[b.cipher](a);f="ccm"===
b.mode&&sjcl.arrayBuffer&&sjcl.arrayBuffer.ccm&&b.ct instanceof ArrayBuffer?sjcl.arrayBuffer.ccm.decrypt(g,b.ct,b.iv,b.tag,f,b.ts):sjcl.mode[b.mode].decrypt(g,b.ct,b.iv,f,b.ts);e.g(d,b);d.key=a;return 1===c.raw?f:sjcl.codec.utf8String.fromBits(f)},decrypt:function(a,b,c,d){var e=sjcl.json;return e.ia(a,e.decode(b),c,d)},encode:function(a){var b,c="{",d="";for(b in a)if(a.hasOwnProperty(b)){if(!b.match(/^[a-z0-9]+$/i))throw new sjcl.exception.invalid("json encode: invalid property name");c+=d+'"'+
b+'":';d=",";switch(typeof a[b]){case "number":case "boolean":c+=a[b];break;case "string":c+='"'+escape(a[b])+'"';break;case "object":c+='"'+sjcl.codec.base64.fromBits(a[b],0)+'"';break;default:throw new sjcl.exception.bug("json encode: unsupported type");}}return c+"}"},decode:function(a){a=a.replace(/\s/g,"");if(!a.match(/^\{.*\}$/))throw new sjcl.exception.invalid("json decode: this isn't json!");a=a.replace(/^\{|\}$/g,"").split(/,/);var b={},c,d;for(c=0;c<a.length;c++){if(!(d=a[c].match(/^\s*(?:(["']?)([a-z][a-z0-9]*)\1)\s*:\s*(?:(-?\d+)|"([a-z0-9+\/%*_.@=\-]*)"|(true|false))$/i)))throw new sjcl.exception.invalid("json decode: this isn't json!");
null!=d[3]?b[d[2]]=parseInt(d[3],10):null!=d[4]?b[d[2]]=d[2].match(/^(ct|adata|salt|iv)$/)?sjcl.codec.base64.toBits(d[4]):unescape(d[4]):null!=d[5]&&(b[d[2]]="true"===d[5])}return b},g:function(a,b,c){void 0===a&&(a={});if(void 0===b)return a;for(var d in b)if(b.hasOwnProperty(d)){if(c&&void 0!==a[d]&&a[d]!==b[d])throw new sjcl.exception.invalid("required parameter overridden");a[d]=b[d]}return a},sa:function(a,b){var c={},d;for(d in a)a.hasOwnProperty(d)&&a[d]!==b[d]&&(c[d]=a[d]);return c},ra:function(a,
b){var c={},d;for(d=0;d<b.length;d++)void 0!==a[b[d]]&&(c[b[d]]=a[b[d]]);return c}};sjcl.encrypt=sjcl.json.encrypt;sjcl.decrypt=sjcl.json.decrypt;sjcl.misc.pa={};sjcl.misc.cachedPbkdf2=function(a,b){var c=sjcl.misc.pa,d;b=b||{};d=b.iter||1E3;c=c[a]=c[a]||{};d=c[d]=c[d]||{firstSalt:b.salt&&b.salt.length?b.salt.slice(0):sjcl.random.randomWords(2,0)};c=void 0===b.salt?d.firstSalt:b.salt;d[c]=d[c]||sjcl.misc.pbkdf2(a,c,b.iter);return{key:d[c].slice(0),salt:c.slice(0)}};
"undefined"!==typeof module&&module.exports&&(module.exports=sjcl);"function"===typeof define&&define([],function(){return sjcl});

174
js/test.js Normal file
View File

@ -0,0 +1,174 @@
'use strict';
var jsc = require('jsverify'),
jsdom = require('jsdom-global'),
cleanup = jsdom(),
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'],
alnumString = a2zString.concat(['0','1','2','3','4','5','6','7','8','9']),
queryString = alnumString.concat(['+','%','&','.','*','-','_']),
base64String = alnumString.concat(['+','/','=']).concat(
a2zString.map(function(c) {
return c.toUpperCase();
})
),
// schemas supported by the whatwg-url library
schemas = ['ftp','gopher','http','https','ws','wss'];
global.$ = global.jQuery = require('./jquery-3.1.1');
global.sjcl = require('./sjcl-1.0.6');
global.Base64 = require('./base64-2.1.9');
global.RawDeflate = require('./rawdeflate-0.5');
require('./rawinflate-0.3');
require('./privatebin');
describe('Helper', function () {
describe('secondsToHuman', function () {
after(function () {
cleanup();
});
jsc.property('returns an array with a number and a word', 'integer', function (number) {
var result = $.PrivateBin.Helper.secondsToHuman(number);
return Array.isArray(result) &&
result.length === 2 &&
result[0] === parseInt(result[0], 10) &&
typeof result[1] === 'string';
});
jsc.property('returns seconds on the first array position', 'integer 59', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[0] === number;
});
jsc.property('returns seconds on the second array position', 'integer 59', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[1] === 'second';
});
jsc.property('returns minutes on the first array position', 'integer 60 3599', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[0] === Math.floor(number / 60);
});
jsc.property('returns minutes on the second array position', 'integer 60 3599', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[1] === 'minute';
});
jsc.property('returns hours on the first array position', 'integer 3600 86399', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[0] === Math.floor(number / (60 * 60));
});
jsc.property('returns hours on the second array position', 'integer 3600 86399', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[1] === 'hour';
});
jsc.property('returns days on the first array position', 'integer 86400 5184000', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[0] === Math.floor(number / (60 * 60 * 24));
});
jsc.property('returns days on the second array position', 'integer 86400 5184000', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[1] === 'day';
});
// max safe integer as per http://ecma262-5.com/ELS5_HTML.htm#Section_8.5
jsc.property('returns months on the first array position', 'integer 5184000 9007199254740991', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[0] === Math.floor(number / (60 * 60 * 24 * 30));
});
jsc.property('returns months on the second array position', 'integer 5184000 9007199254740991', function (number) {
return $.PrivateBin.Helper.secondsToHuman(number)[1] === 'month';
});
});
describe('baseUri', function () {
before(function () {
$.PrivateBin.Helper.reset();
});
jsc.property(
'returns the URL without query & fragment',
jsc.elements(schemas),
jsc.nearray(jsc.elements(a2zString)),
jsc.array(jsc.elements(queryString)),
'string',
function (schema, address, query, fragment) {
var expected = schema + '://' + address.join('') + '/',
clean = jsdom('', {url: expected + '?' + query.join('') + '#' + fragment}),
result = $.PrivateBin.Helper.baseUri();
$.PrivateBin.Helper.reset();
clean();
return expected === result;
}
);
});
describe('htmlEntities', function () {
after(function () {
cleanup();
});
jsc.property(
'removes all HTML entities from any given string',
'string',
function (string) {
var result = $.PrivateBin.Helper.htmlEntities(string);
return !(/[<>"'`=\/]/.test(result)) && !(string.indexOf('&') > -1 && !(/&amp;/.test(result)));
}
);
});
});
describe('Model', function () {
describe('getPasteId', function () {
before(function () {
$.PrivateBin.Model.reset();
});
jsc.property(
'returns the query string without separator, if any',
jsc.nearray(jsc.elements(a2zString)),
jsc.nearray(jsc.elements(a2zString)),
jsc.nearray(jsc.elements(queryString)),
'string',
function (schema, address, query, fragment) {
var queryString = query.join(''),
clean = jsdom('', {
url: schema.join('') + '://' + address.join('') +
'/?' + queryString + '#' + fragment
}),
result = $.PrivateBin.Model.getPasteId();
$.PrivateBin.Model.reset();
clean();
return queryString === result;
}
);
});
describe('getPasteKey', function () {
jsc.property(
'returns the fragment of the URL',
jsc.nearray(jsc.elements(a2zString)),
jsc.nearray(jsc.elements(a2zString)),
jsc.array(jsc.elements(queryString)),
jsc.nearray(jsc.elements(base64String)),
function (schema, address, query, fragment) {
var fragmentString = fragment.join(''),
clean = jsdom('', {
url: schema.join('') + '://' + address.join('') +
'/?' + query.join('') + '#' + fragmentString
}),
result = $.PrivateBin.Model.getPasteKey();
$.PrivateBin.Model.reset();
clean();
return fragmentString === result;
}
);
jsc.property(
'returns the fragment stripped of trailing query parts',
jsc.nearray(jsc.elements(a2zString)),
jsc.nearray(jsc.elements(a2zString)),
jsc.array(jsc.elements(queryString)),
jsc.nearray(jsc.elements(base64String)),
jsc.array(jsc.elements(queryString)),
function (schema, address, query, fragment, trail) {
var fragmentString = fragment.join(''),
clean = jsdom('', {
url: schema.join('') + '://' + address.join('') + '/?' +
query.join('') + '#' + fragmentString + '&' + trail.join('')
}),
result = $.PrivateBin.Model.getPasteKey();
$.PrivateBin.Model.reset();
clean();
return fragmentString === result;
}
);
});
});

View File

@ -1,2 +1 @@
Allow from none Require all denied
Deny from all

View File

@ -7,12 +7,11 @@
* @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.0 * @version 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;
use PrivateBin\I18n;
use Exception; use Exception;
use PDO; use PDO;
@ -37,51 +36,52 @@ class Configuration
*/ */
private static $_defaults = array( private static $_defaults = array(
'main' => array( 'main' => array(
'discussion' => true, 'name' => 'PrivateBin',
'opendiscussion' => false, 'discussion' => true,
'password' => true, 'opendiscussion' => false,
'fileupload' => false, 'password' => true,
'fileupload' => false,
'burnafterreadingselected' => false, 'burnafterreadingselected' => false,
'defaultformatter' => 'plaintext', 'defaultformatter' => 'plaintext',
'syntaxhighlightingtheme' => null, 'syntaxhighlightingtheme' => null,
'sizelimit' => 2097152, 'sizelimit' => 2097152,
'template' => 'bootstrap', 'template' => 'bootstrap',
'notice' => '', 'notice' => '',
'languageselection' => false, 'languageselection' => false,
'languagedefault' => '', 'languagedefault' => '',
'urlshortener' => '', 'urlshortener' => '',
'icon' => 'identicon', 'icon' => 'identicon',
'cspheader' => 'default-src \'none\'; manifest-src \'self\'; connect-src *; script-src \'self\'; style-src \'self\'; font-src \'self\'; img-src \'self\' data:; referrer no-referrer;', 'cspheader' => 'default-src \'none\'; manifest-src \'self\'; connect-src *; script-src \'self\'; style-src \'self\'; font-src \'self\'; img-src \'self\' data:; referrer no-referrer; sandbox allow-same-origin allow-scripts allow-forms allow-popups',
'zerobincompatibility' => false, 'zerobincompatibility' => false,
), ),
'expire' => array( 'expire' => array(
'default' => '1week', 'default' => '1week',
'clone' => true, 'clone' => true,
), ),
'expire_options' => array( 'expire_options' => array(
'5min' => 300, '5min' => 300,
'10min' => 600, '10min' => 600,
'1hour' => 3600, '1hour' => 3600,
'1day' => 86400, '1day' => 86400,
'1week' => 604800, '1week' => 604800,
'1month' => 2592000, '1month' => 2592000,
'1year' => 31536000, '1year' => 31536000,
'never' => 0, 'never' => 0,
), ),
'formatter_options' => array( 'formatter_options' => array(
'plaintext' => 'Plain Text', 'plaintext' => 'Plain Text',
'syntaxhighlighting' => 'Source Code', 'syntaxhighlighting' => 'Source Code',
'markdown' => 'Markdown', 'markdown' => 'Markdown',
), ),
'traffic' => array( 'traffic' => array(
'limit' => 10, 'limit' => 10,
'header' => null, 'header' => null,
'dir' => 'data', 'dir' => 'data',
), ),
'purge' => array( 'purge' => array(
'limit' => 300, 'limit' => 300,
'batchsize' => 10, 'batchsize' => 10,
'dir' => 'data', 'dir' => 'data',
), ),
'model' => array( 'model' => array(
'class' => 'Filesystem', 'class' => 'Filesystem',
@ -240,7 +240,7 @@ class Configuration
public function getSection($section) public function getSection($section)
{ {
if (!array_key_exists($section, $this->_configuration)) { if (!array_key_exists($section, $this->_configuration)) {
throw new Exception(I18n::_('PrivateBin requires configuration section [%s] to be present in configuration file.', $section), 3); throw new Exception(I18n::_('%s requires configuration section [%s] to be present in configuration file.', I18n::_($this->getKey('name')), $section), 3);
} }
return $this->_configuration[$section]; return $this->_configuration[$section];
} }

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin\Data; namespace PrivateBin\Data;

View File

@ -7,15 +7,15 @@
* @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.0 * @version 1.1
*/ */
namespace PrivateBin\Data; namespace PrivateBin\Data;
use PrivateBin\PrivateBin;
use Exception; use Exception;
use PDO; use PDO;
use PDOException; use PDOException;
use PrivateBin\PrivateBin;
use stdClass; use stdClass;
/** /**
@ -417,7 +417,7 @@ class Database extends AbstractData
$pastes = array(); $pastes = array();
$rows = self::_select( $rows = self::_select(
'SELECT dataid FROM ' . self::_sanitizeIdentifier('paste') . 'SELECT dataid FROM ' . self::_sanitizeIdentifier('paste') .
' WHERE expiredate < ? LIMIT ?', array(time(), $batchsize) ' WHERE expiredate < ? AND expiredate != ? LIMIT ?', array(time(), 0, $batchsize)
); );
if (count($rows)) { if (count($rows)) {
foreach ($rows as $row) { foreach ($rows as $row) {
@ -701,10 +701,11 @@ class Database extends AbstractData
); );
// no break, continue with updates for 0.22 // no break, continue with updates for 0.22
case '0.22': case '0.22':
case '1.0':
self::_exec( self::_exec(
'UPDATE ' . self::_sanitizeIdentifier('config') . 'UPDATE ' . self::_sanitizeIdentifier('config') .
' SET value = ? WHERE id = ?', ' SET value = ? WHERE id = ?',
array('1.0', 'VERSION') array(PrivateBin::VERSION, 'VERSION')
); );
} }
} }

View File

@ -7,13 +7,13 @@
* @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.0 * @version 1.1
*/ */
namespace PrivateBin\Data; namespace PrivateBin\Data;
use PrivateBin\Model\Paste;
use PrivateBin\Json; use PrivateBin\Json;
use PrivateBin\Model\Paste;
/** /**
* Filesystem * Filesystem

View File

@ -7,12 +7,11 @@
* @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.0 * @version 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;
use PrivateBin\I18n;
use Exception; use Exception;
/** /**
@ -22,21 +21,6 @@ use Exception;
*/ */
class Filter class Filter
{ {
/**
* strips slashes deeply
*
* @access public
* @static
* @param mixed $value
* @return mixed
*/
public static function stripslashesDeep($value)
{
return is_array($value) ?
array_map('self::stripslashesDeep', $value) :
stripslashes($value);
}
/** /**
* format a given time string into a human readable label (localized) * format a given time string into a human readable label (localized)
* *

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;
@ -295,13 +295,18 @@ class I18n
{ {
switch (self::$_language) { switch (self::$_language) {
case 'fr': case 'fr':
case 'oc':
case 'zh': case 'zh':
return ($n > 1 ? 1 : 0); return $n > 1 ? 1 : 0;
case 'pl': case 'pl':
return ($n == 1 ? 0 : $n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2); return $n == 1 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2);
// en, de case 'ru':
return $n % 10 == 1 && $n % 100 != 11 ? 0 : ($n % 10 >= 2 && $n % 10 <= 4 && ($n % 100 < 10 || $n % 100 >= 20) ? 1 : 2);
case 'sl':
return $n % 100 == 1 ? 1 : ($n % 100 == 2 ? 2 : ($n % 100 == 3 || $n % 100 == 4 ? 3 : 0));
// de, en, es, it, no, pt
default: default:
return ($n != 1 ? 1 : 0); return $n != 1 ? 1 : 0;
} }
} }

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;

View File

@ -7,12 +7,11 @@
* @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.0 * @version 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;
use PrivateBin\Data;
use PrivateBin\Model\Paste; use PrivateBin\Model\Paste;
use PrivateBin\Persistence\PurgeLimiter; use PrivateBin\Persistence\PurgeLimiter;

View File

@ -7,15 +7,15 @@
* @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.0 * @version 1.1
*/ */
namespace PrivateBin\Model; namespace PrivateBin\Model;
use Exception;
use PrivateBin\Configuration; use PrivateBin\Configuration;
use PrivateBin\Data\AbstractData; use PrivateBin\Data\AbstractData;
use PrivateBin\Sjcl; use PrivateBin\Sjcl;
use Exception;
use stdClass; use stdClass;
/** /**

View File

@ -7,16 +7,16 @@
* @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.0 * @version 1.1
*/ */
namespace PrivateBin\Model; namespace PrivateBin\Model;
use PrivateBin\Sjcl;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Vizhash16x16;
use Identicon\Identicon;
use Exception; use Exception;
use Identicon\Identicon;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Sjcl;
use PrivateBin\Vizhash16x16;
/** /**
* Comment * Comment

View File

@ -7,15 +7,15 @@
* @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.0 * @version 1.1
*/ */
namespace PrivateBin\Model; namespace PrivateBin\Model;
use PrivateBin\PrivateBin;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Sjcl;
use Exception; use Exception;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\PrivateBin;
use PrivateBin\Sjcl;
/** /**
* Paste * Paste
@ -307,7 +307,6 @@ class Paste extends AbstractModel
$this->_data->meta->burnafterreading === true; $this->_data->meta->burnafterreading === true;
} }
/** /**
* Check if paste has discussions enabled. * Check if paste has discussions enabled.
* *

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin\Persistence; namespace PrivateBin\Persistence;

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin\Persistence; namespace PrivateBin\Persistence;

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin\Persistence; namespace PrivateBin\Persistence;

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin\Persistence; namespace PrivateBin\Persistence;

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Persistence\ServerSalt;
use Exception; use Exception;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter;
/** /**
* PrivateBin * PrivateBin
@ -28,7 +28,7 @@ class PrivateBin
* *
* @const string * @const string
*/ */
const VERSION = '1.0'; const VERSION = '1.1';
/** /**
* show the same error message if the paste expired or does not exist * show the same error message if the paste expired or does not exist
@ -120,11 +120,11 @@ class PrivateBin
*/ */
public function __construct() public function __construct()
{ {
if (version_compare(PHP_VERSION, '5.3.0') < 0) { if (version_compare(PHP_VERSION, '5.4.0') < 0) {
throw new Exception(I18n::_('PrivateBin requires php 5.3.0 or above to work. Sorry.'), 1); throw new Exception(I18n::_('%s requires php 5.4.0 or above to work. Sorry.', I18n::_('PrivateBin')), 1);
} }
if (strlen(PATH) < 0 && substr(PATH, -1) !== DIRECTORY_SEPARATOR) { if (strlen(PATH) < 0 && substr(PATH, -1) !== DIRECTORY_SEPARATOR) {
throw new Exception(I18n::_('PrivateBin requires the PATH to end in a "%s". Please update the PATH in your index.php.', DIRECTORY_SEPARATOR), 5); throw new Exception(I18n::_('%s requires the PATH to end in a "%s". Please update the PATH in your index.php.', I18n::_('PrivateBin'), DIRECTORY_SEPARATOR), 5);
} }
// load config from ini file, initialize required classes // load config from ini file, initialize required classes
@ -334,19 +334,16 @@ class PrivateBin
// accessing this property ensures that the paste would be // accessing this property ensures that the paste would be
// deleted if it has already expired // deleted if it has already expired
$burnafterreading = $paste->isBurnafterreading(); $burnafterreading = $paste->isBurnafterreading();
if ($deletetoken == 'burnafterreading') { if (
if ($burnafterreading) { ($burnafterreading && $deletetoken == 'burnafterreading') ||
$paste->delete(); Filter::slowEquals($deletetoken, $paste->getDeleteToken())
$this->_return_message(0, $dataid); ) {
} else { // Paste exists and deletion token is valid: Delete the paste.
$this->_return_message(1, 'Paste is not of burn-after-reading type.'); $paste->delete();
} $this->_status = 'Paste was properly deleted.';
} else { } else {
// Make sure the token is valid. if (!$burnafterreading && $deletetoken == 'burnafterreading') {
if (Filter::slowEquals($deletetoken, $paste->getDeleteToken())) { $this->_error = 'Paste is not of burn-after-reading type.';
// Paste exists and deletion token is valid: Delete the paste.
$paste->delete();
$this->_status = 'Paste was properly deleted.';
} else { } else {
$this->_error = 'Wrong deletion token. Paste was not deleted.'; $this->_error = 'Wrong deletion token. Paste was not deleted.';
} }
@ -357,6 +354,13 @@ class PrivateBin
} catch (Exception $e) { } catch (Exception $e) {
$this->_error = $e->getMessage(); $this->_error = $e->getMessage();
} }
if ($this->_request->isJsonApiCall()) {
if (strlen($this->_error)) {
$this->_return_message(1, $this->_error);
} else {
$this->_return_message(0, $dataid);
}
}
} }
/** /**
@ -430,6 +434,7 @@ class PrivateBin
} }
$page = new View; $page = new View;
$page->assign('NAME', $this->_conf->getKey('name'));
$page->assign('CIPHERDATA', $this->_data); $page->assign('CIPHERDATA', $this->_data);
$page->assign('ERROR', I18n::_($this->_error)); $page->assign('ERROR', I18n::_($this->_error));
$page->assign('STATUS', I18n::_($this->_status)); $page->assign('STATUS', I18n::_($this->_status));

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;
@ -80,13 +80,6 @@ class Request
*/ */
public function __construct() public function __construct()
{ {
// in case stupid admin has left magic_quotes enabled in php.ini (for PHP < 5.4)
if (version_compare(PHP_VERSION, '5.4.0') < 0 && get_magic_quotes_gpc()) {
$_POST = array_map('PrivateBin\\Filter::stripslashesDeep', $_POST);
$_GET = array_map('PrivateBin\\Filter::stripslashesDeep', $_GET);
$_COOKIE = array_map('PrivateBin\\Filter::stripslashesDeep', $_COOKIE);
}
// decide if we are in JSON API or HTML context // decide if we are in JSON API or HTML context
$this->_isJsonApi = $this->_detectJsonRequest(); $this->_isJsonApi = $this->_detectJsonRequest();

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;
@ -31,7 +31,7 @@ class Sjcl
*/ */
public static function isValid($encoded) public static function isValid($encoded)
{ {
$accepted_keys = array('iv','v','iter','ks','ts','mode','adata','cipher','salt','ct'); $accepted_keys = array('iv', 'v', 'iter', 'ks', 'ts', 'mode', 'adata', 'cipher', 'salt', 'ct');
// Make sure content is valid json // Make sure content is valid json
$decoded = json_decode($encoded); $decoded = json_decode($encoded);

View File

@ -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.0 * @version 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;
@ -52,7 +52,8 @@ class View
*/ */
public function draw($template) public function draw($template)
{ {
$path = PATH . 'tpl' . DIRECTORY_SEPARATOR . $template . '.php'; $file = substr($template, 0, 9) === 'bootstrap' ? 'bootstrap' : $template;
$path = PATH . 'tpl' . DIRECTORY_SEPARATOR . $file . '.php';
if (!file_exists($path)) { if (!file_exists($path)) {
throw new Exception('Template ' . $template . ' not found!', 80); throw new Exception('Template ' . $template . ' not found!', 80);
} }

View File

@ -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.0 * @version 0.0.5 beta PrivateBin 1.1
*/ */
namespace PrivateBin; namespace PrivateBin;
@ -23,7 +23,6 @@ namespace PrivateBin;
* echo $data; * echo $data;
* exit; * exit;
*/ */
class Vizhash16x16 class Vizhash16x16
{ {
/** /**
@ -105,7 +104,7 @@ class Vizhash16x16
$op = 'v'; $op = 'v';
if (($this->getInt() % 2) == 0) { if (($this->getInt() % 2) == 0) {
$op = 'h'; $op = 'h';
}; }
$image = $this->degrade($image, $op, array($r0, $g0, $b0), array(0, 0, 0)); $image = $this->degrade($image, $op, array($r0, $g0, $b0), array(0, 0, 0));
for ($i = 0; $i < 7; ++$i) { for ($i = 0; $i < 7; ++$i) {
@ -189,7 +188,7 @@ class Vizhash16x16
$diffs = array( $diffs = array(
(($color2[0] - $color1[0]) / $size), (($color2[0] - $color1[0]) / $size),
(($color2[1] - $color1[1]) / $size), (($color2[1] - $color1[1]) / $size),
(($color2[2] - $color1[2]) / $size) (($color2[2] - $color1[2]) / $size),
); );
for ($i = 0; $i < $size; ++$i) { for ($i = 0; $i < $size; ++$i) {
$r = $color1[0] + ($diffs[0] * $i); $r = $color1[0] + ($diffs[0] * $i);
@ -217,20 +216,20 @@ class Vizhash16x16
{ {
switch ($action % 7) { switch ($action % 7) {
case 0: case 0:
ImageFilledRectangle($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color); imagefilledrectangle($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color);
break; break;
case 1: case 1:
case 2: case 2:
ImageFilledEllipse($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color); imagefilledellipse($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $color);
break; break;
case 3: case 3:
$points = array($this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY()); $points = array($this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY(), $this->getX(), $this->getY());
ImageFilledPolygon($image, $points, 4, $color); imagefilledpolygon($image, $points, 4, $color);
break; break;
default: default:
$start = $this->getInt() * 360 / 256; $start = $this->getInt() * 360 / 256;
$end = $start + $this->getInt() * 180 / 256; $end = $start + $this->getInt() * 180 / 256;
ImageFilledArc($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $start, $end, $color, IMG_ARC_PIE); imagefilledarc($image, $this->getX(), $this->getY(), $this->getX(), $this->getY(), $start, $end, $color, IMG_ARC_PIE);
} }
} }
} }

View File

@ -2,12 +2,12 @@
"name": "PrivateBin", "name": "PrivateBin",
"icons": [ "icons": [
{ {
"src": "android-chrome-192x192.png", "src": "img/android-chrome-192x192.png",
"sizes": "192x192", "sizes": "192x192",
"type": "image\/png" "type": "image\/png"
}, },
{ {
"src": "android-chrome-512x512.png", "src": "img/android-chrome-512x512.png",
"sizes": "512x512", "sizes": "512x512",
"type": "image\/png" "type": "image\/png"
} }

9
tpl/.editorconfig Normal file
View File

@ -0,0 +1,9 @@
# editorconfig.org
root = false
# special format for PHP templates
[*.php]
indent_style = tab
indent_size = 4

1
tpl/.htaccess Normal file
View File

@ -0,0 +1 @@
Require all denied

View File

@ -1,343 +0,0 @@
<?php
use PrivateBin\I18n;
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex" />
<meta name="referrer" content="no-referrer">
<title><?php echo I18n::_('PrivateBin'); ?></title>
<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-3.3.5.css" />
<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
if ($SYNTAXHIGHLIGHTING):
?>
<link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
if (strlen($SYNTAXHIGHLIGHTINGTHEME)):
?>
<link type="text/css" rel="stylesheet" href="css/prettify/<?php echo rawurlencode($SYNTAXHIGHLIGHTINGTHEME); ?>.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
endif;
endif;
?>
<script type="text/javascript" src="js/jquery-1.11.3.js" integrity="sha512-xAERw8wHVOkM9x9y9/FvQ7g1t+gIQj39mfkN1Rd1OLcC5k/x2e6NO8hq6qEbb3oO+CYYTjVLFiFYg5/7ddF0zA==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/sjcl-1.0.4.js" integrity="sha512-BqVQ8GgWfMCcdsDuP6Ggm1BV7+mmoWH3PC4UqcYpEKSdEq1rthy6NUsa6gu5sydewbi/ilI3E3ohdCxlPPF9ww==" crossorigin="anonymous"></script>
<?php
if ($ZEROBINCOMPATIBILITY):
?>
<script type="text/javascript" src="js/base64-1.7.js" integrity="sha512-JdwsSP3GyHR+jaCkns9CL9NTt4JUJqm/BsODGmYhBcj5EAPKcHYh+OiMfyHbcDLECe17TL0hjXADFkusAqiYgA==" crossorigin="anonymous"></script>
<?php
else:
?>
<script type="text/javascript" src="js/base64-2.1.9.js" integrity="sha512-rbqAby7hObftbEoGQzkhUbEh5YkUn2MtekTLs4btvo2oly4CZ3DxhJzEh0u/rNzS54tcJdqi5Ug1ruugEd2U1g==" crossorigin="anonymous"></script>
<?php
endif;
?>
<script type="text/javascript" src="js/rawdeflate-0.5.js" integrity="sha512-tTdZ7qMr7tt5VQy4iCHu6/aGB12eRwbUy+AEI5rXntfsjcRfBeeqJloMsBU9FrGk1bIYLiuND/FhU42LO1bi0g==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js" integrity="sha512-/W33QnLmSAP1fwINS9iXgB6s/VOIG9GVdIuIYaUtbSvKPMv5S08PtT3PqnT2WjwBgB8DFeDN2nqJroqQYF7SwQ==" crossorigin="anonymous"></script>
<?php
if ($SYNTAXHIGHLIGHTING):
?>
<script type="text/javascript" src="js/prettify.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-m8iHxoN+Fe12xxFwWNdY/TS4KoFntHp29qY0xUzBnPd0bkKMOR/dFhEdTWydpt0b/fIXyhB+znGYUvgjfJ2RzQ==" crossorigin="anonymous"></script>
<?php
endif;
if ($MARKDOWN):
?>
<script type="text/javascript" src="js/showdown-1.4.1.js" integrity="sha512-Kbz1FIlDnqUJu/3yW8H8USzURA3JuUqSKRwz13lM4kWt6C0n6s4tjl81PCfnWtE4gBIzyj5uGePcfUyotk/icw==" crossorigin="anonymous"></script>
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Jx4qD49amdzpNe9FLtxLO84Xt5LZeQ2PGaM0I9UCS2Kr4xhrnFyvP+0hrLIMgDTwjWFDpTSCoDHuj0SHzuqXuQ==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->
<link rel="apple-touch-icon" href="apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
<link rel="icon" type="image/png" href="favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
<link rel="icon" type="image/png" href="favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
<link rel="manifest" href="manifest.json?<?php echo rawurlencode($VERSION); ?>" />
<link rel="mask-icon" href="safari-pinned-tab.svg?<?php echo rawurlencode($VERSION); ?>" color="#ffcc00" />
<link rel="shortcut icon" href="favicon.ico">
<meta name="msapplication-config" content="browserconfig.xml">
<meta name="theme-color" content="#ffe57e" />
</head>
<body role="document" class="navbar-spacing">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only"><?php echo I18n::_('Toggle navigation'); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="reloadlink navbar-brand" href="">
<img alt="<?php echo I18n::_('PrivateBin'); ?>" src="img/icon.svg" width="38" />
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<button id="sendbutton" type="button" class="hidden btn btn-default navbar-btn">
<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?>
</button>
<?php
if ($EXPIRECLONE):
?>
<button id="clonebutton" type="button" class="hidden btn btn-default navbar-btn">
<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo I18n::_('Clone'), PHP_EOL; ?>
</button>
<?php
endif;
?>
<button id="rawtextbutton" type="button" class="hidden btn btn-default navbar-btn">
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button>
</li>
<li class="dropdown">
<select id="pasteExpiration" name="pasteExpiration" class="hidden">
<?php
foreach ($EXPIRE as $key => $value):
?>
<option value="<?php echo $key; ?>"<?php
if ($key == $EXPIREDEFAULT):
?> selected="selected"<?php
endif;
?>><?php echo $value; ?></option>
<?php
endforeach;
?>
</select>
<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($EXPIRE as $key => $value):
?>
<li>
<a href="#" data-expiration="<?php echo $key; ?>">
<?php echo $value, PHP_EOL; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
<li id="formatter" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Options'); ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li id="burnafterreadingoption" class="checkbox hidden">
<label>
<input type="checkbox" id="burnafterreading" name="burnafterreading"<?php
if ($BURNAFTERREADINGSELECTED):
?> checked="checked"<?php
endif;
?> />
<?php echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label>
</li>
<?php
if ($DISCUSSION):
?>
<li id="opendisc" class="checkbox hidden">
<label>
<input type="checkbox" id="opendiscussion" name="opendiscussion"<?php
if ($OPENDISCUSSION):
?> checked="checked"<?php
endif;
?> />
<?php echo I18n::_('Open discussion'), PHP_EOL; ?>
</label>
</li>
<?php
endif;
?>
<li role="separator" class="divider"></li>
<li>
<div>
<?php echo I18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span>
</div>
</li>
<?php
foreach ($FORMATTER as $key => $value):
?>
<li>
<a href="#" data-format="<?php echo $key; ?>">
<?php echo $value, PHP_EOL; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
<select id="pasteFormatter" name="pasteFormatter" class="hidden">
<?php
foreach ($FORMATTER as $key => $value):
?>
<option value="<?php echo $key; ?>"<?php
if ($key == $FORMATTERDEFAULT):
?> selected="selected"<?php
endif;
?>><?php echo $value; ?></option>
<?php
endforeach;
?>
</select>
</li>
<?php
if ($PASSWORD):
?>
<li>
<div id="password" class="navbar-form hidden">
<input type="password" id="passwordinput" placeholder="<?php echo I18n::_('Password (recommended)'); ?>" class="form-control" size="19"/>
</div>
</li>
<?php
endif;
if ($FILEUPLOAD):
?>
<li id="attach" class="hidden dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Attach a file'); ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li id="filewrap">
<div>
<input type="file" id="file" name="file" />
</div>
</li>
<li>
<a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
</a>
</li>
</ul>
</li>
<?php
endif;
?>
</ul>
<ul class="nav navbar-nav pull-right">
<?php
if (strlen($LANGUAGESELECTION)):
?>
<li id="language" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-flag" aria-hidden="true"></span> <?php echo $LANGUAGES[$LANGUAGESELECTION][0]; ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($LANGUAGES as $key => $value):
?>
<li>
<a href="#" data-lang="<?php echo $key; ?>">
<?php echo $value[0]; ?> (<?php echo $value[1]; ?>)
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
<?php
endif;
?>
<li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
</button>
</li>
</ul>
</div>
</div>
</nav>
<header class="container">
<?php
if (strlen($NOTICE)):
?>
<div role="alert" class="alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div>
<?php
endif;
?>
<div id="remainingtime" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</div>
<?php
if ($FILEUPLOAD):
?>
<div id="attachment" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo I18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo I18n::_('Cloned file attached.'); ?></span>
</div>
<?php
endif;
if (strlen($STATUS)):
?>
<div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div>
<?php
endif;
?>
<div id="errormessage" role="alert" class="<?php
if (!strlen($ERROR)):
?>hidden <?php
endif;
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div>
<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo I18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo I18n::_('PrivateBin requires a modern browser to work.'); ?></div>
<div id="ienotice" role="alert" class="hidden alert alert-warning"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo I18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'), PHP_EOL; ?>
<a href="https://www.mozilla.org/firefox/">Firefox</a>,
<a href="https://www.opera.com/">Opera</a>,
<a href="https://www.google.com/chrome">Chrome</a>,
<a href="https://www.apple.com/safari">Safari</a>...
</div>
<div id="pasteresult" role="alert" class="hidden alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
<div id="deletelink"></div>
<div id="pastelink">
<?php
if (strlen($URLSHORTENER)):
?>
<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-primary">
<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button>
<?php
endif;
?>
</div>
</div>
<ul id="preview" class="nav nav-tabs hidden">
<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo I18n::_('Editor'); ?></a></li>
<li role="presentation"><a id="messagepreview" href="#"><?php echo I18n::_('Preview'); ?></a></li>
</ul>
</header>
<section class="container">
<article class="row">
<div id="image" class="col-md-12 text-center hidden"></div>
<div id="prettymessage" class="col-md-12 hidden">
<pre id="prettyprint" class="col-md-12 prettyprint linenums:1"></pre>
</div>
<div id="cleartext" class="col-md-12 hidden"></div>
<p class="col-md-12"><textarea id="message" name="message" cols="80" rows="25" class="form-control hidden"></textarea></p>
</article>
</section>
<section class="container">
<div id="discussion" class="hidden">
<h4><?php echo I18n::_('Discussion'); ?></h4>
<div id="comments"></div>
</div>
</section>
<footer class="container">
<div class="row">
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4>
<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12">
<?php echo I18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://privatebin.info/">project page</a>.'), PHP_EOL; ?>
</p>
</div>
</footer>
<div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
</body>
</html>

View File

@ -1,337 +0,0 @@
<?php
use PrivateBin\I18n;
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex" />
<meta name="referrer" content="no-referrer">
<title><?php echo I18n::_('PrivateBin'); ?></title>
<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
<link type="text/css" rel="stylesheet" href="css/bootstrap/darkstrap-0.9.3.css" />
<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
if ($SYNTAXHIGHLIGHTING):
?>
<link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
if (strlen($SYNTAXHIGHLIGHTINGTHEME)):
?>
<link type="text/css" rel="stylesheet" href="css/prettify/<?php echo rawurlencode($SYNTAXHIGHLIGHTINGTHEME); ?>.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
endif;
endif;
?>
<script type="text/javascript" src="js/jquery-1.11.3.js" integrity="sha512-xAERw8wHVOkM9x9y9/FvQ7g1t+gIQj39mfkN1Rd1OLcC5k/x2e6NO8hq6qEbb3oO+CYYTjVLFiFYg5/7ddF0zA==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/sjcl-1.0.4.js" integrity="sha512-BqVQ8GgWfMCcdsDuP6Ggm1BV7+mmoWH3PC4UqcYpEKSdEq1rthy6NUsa6gu5sydewbi/ilI3E3ohdCxlPPF9ww==" crossorigin="anonymous"></script>
<?php
if ($ZEROBINCOMPATIBILITY):
?>
<script type="text/javascript" src="js/base64-1.7.js" integrity="sha512-JdwsSP3GyHR+jaCkns9CL9NTt4JUJqm/BsODGmYhBcj5EAPKcHYh+OiMfyHbcDLECe17TL0hjXADFkusAqiYgA==" crossorigin="anonymous"></script>
<?php
else:
?>
<script type="text/javascript" src="js/base64-2.1.9.js" integrity="sha512-rbqAby7hObftbEoGQzkhUbEh5YkUn2MtekTLs4btvo2oly4CZ3DxhJzEh0u/rNzS54tcJdqi5Ug1ruugEd2U1g==" crossorigin="anonymous"></script>
<?php
endif;
?>
<script type="text/javascript" src="js/rawdeflate-0.5.js" integrity="sha512-tTdZ7qMr7tt5VQy4iCHu6/aGB12eRwbUy+AEI5rXntfsjcRfBeeqJloMsBU9FrGk1bIYLiuND/FhU42LO1bi0g==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js" integrity="sha512-/W33QnLmSAP1fwINS9iXgB6s/VOIG9GVdIuIYaUtbSvKPMv5S08PtT3PqnT2WjwBgB8DFeDN2nqJroqQYF7SwQ==" crossorigin="anonymous"></script>
<?php
if ($SYNTAXHIGHLIGHTING):
?>
<script type="text/javascript" src="js/prettify.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-m8iHxoN+Fe12xxFwWNdY/TS4KoFntHp29qY0xUzBnPd0bkKMOR/dFhEdTWydpt0b/fIXyhB+znGYUvgjfJ2RzQ==" crossorigin="anonymous"></script>
<?php
endif;
if ($MARKDOWN):
?>
<script type="text/javascript" src="js/showdown-1.4.1.js" integrity="sha512-Kbz1FIlDnqUJu/3yW8H8USzURA3JuUqSKRwz13lM4kWt6C0n6s4tjl81PCfnWtE4gBIzyj5uGePcfUyotk/icw==" crossorigin="anonymous"></script>
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Jx4qD49amdzpNe9FLtxLO84Xt5LZeQ2PGaM0I9UCS2Kr4xhrnFyvP+0hrLIMgDTwjWFDpTSCoDHuj0SHzuqXuQ==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->
<link rel="apple-touch-icon" href="apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
<link rel="icon" type="image/png" href="favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
<link rel="icon" type="image/png" href="favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
<link rel="manifest" href="manifest.json?<?php echo rawurlencode($VERSION); ?>" />
<link rel="mask-icon" href="safari-pinned-tab.svg?<?php echo rawurlencode($VERSION); ?>" color="#ffcc00" />
<link rel="shortcut icon" href="favicon.ico">
<meta name="msapplication-config" content="browserconfig.xml">
<meta name="theme-color" content="#ffe57e" />
</head>
<body role="document">
<nav class="navbar navbar-inverse navbar-static-top">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only"><?php echo I18n::_('Toggle navigation'); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="reloadlink navbar-brand" href="">
<img alt="<?php echo I18n::_('PrivateBin'); ?>" src="img/icon.svg" width="38" />
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<button id="sendbutton" type="button" class="hidden btn btn-warning navbar-btn">
<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?>
</button>
<?php
if ($EXPIRECLONE):
?>
<button id="clonebutton" type="button" class="hidden btn btn-warning navbar-btn">
<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo I18n::_('Clone'), PHP_EOL; ?>
</button>
<?php
endif;
?>
<button id="rawtextbutton" type="button" class="hidden btn btn-warning navbar-btn">
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button>
</li>
<li class="dropdown">
<select id="pasteExpiration" name="pasteExpiration" class="hidden">
<?php
foreach ($EXPIRE as $key => $value):
?>
<option value="<?php echo $key; ?>"<?php
if ($key == $EXPIREDEFAULT):
?> selected="selected"<?php
endif;
?>><?php echo $value; ?></option>
<?php
endforeach;
?>
</select>
<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($EXPIRE as $key => $value):
?>
<li>
<a href="#" data-expiration="<?php echo $key; ?>">
<?php echo $value, PHP_EOL; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
<li>
<div id="burnafterreadingoption" class="navbar-text checkbox hidden">
<label>
<input type="checkbox" id="burnafterreading" name="burnafterreading"<?php
if ($BURNAFTERREADINGSELECTED):
?> checked="checked"<?php
endif;
?> />
<?php echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label>
</div>
</li>
<?php
if ($DISCUSSION):
?>
<li>
<div id="opendisc" class="navbar-text checkbox hidden">
<label>
<input type="checkbox" id="opendiscussion" name="opendiscussion"<?php
if ($OPENDISCUSSION):
?> checked="checked"<?php
endif;
?> />
<?php echo I18n::_('Open discussion'), PHP_EOL; ?>
</label>
</div>
</li>
<?php
endif;
if ($PASSWORD):
?>
<li>
<div id="password" class="navbar-form hidden">
<input type="password" id="passwordinput" placeholder="<?php echo I18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
</div>
</li>
<?php
endif;
if ($FILEUPLOAD):
?>
<li id="attach" class="hidden dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Attach a file'); ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li id="filewrap">
<div>
<input type="file" id="file" name="file" />
</div>
</li>
<li>
<a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
</a>
</li>
</ul>
</li>
<?php
endif;
?>
<li class="dropdown">
<select id="pasteFormatter" name="pasteFormatter" class="hidden">
<?php
foreach ($FORMATTER as $key => $value):
?>
<option value="<?php echo $key; ?>"<?php
if ($key == $FORMATTERDEFAULT):
?> selected="selected"<?php
endif;
?>><?php echo $value; ?></option>
<?php
endforeach;
?>
</select>
<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($FORMATTER as $key => $value):
?>
<li>
<a href="#" data-format="<?php echo $key; ?>">
<?php echo $value, PHP_EOL; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
</ul>
<ul class="nav navbar-nav pull-right">
<?php
if (strlen($LANGUAGESELECTION)):
?>
<li id="language" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-flag" aria-hidden="true"></span> <?php echo $LANGUAGES[$LANGUAGESELECTION][0]; ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($LANGUAGES as $key => $value):
?>
<li>
<a href="#" data-lang="<?php echo $key; ?>">
<?php echo $value[0]; ?> (<?php echo $value[1]; ?>)
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
<?php
endif;
?>
<li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-warning navbar-btn">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
</button>
</li>
</ul>
</div>
</nav>
<header class="container">
<?php
if (strlen($NOTICE)):
?>
<div role="alert" class="alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div>
<?php
endif;
?>
<div id="remainingtime" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</div>
<?php
if ($FILEUPLOAD):
?>
<div id="attachment" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo I18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo I18n::_('Cloned file attached.'); ?></span>
</div>
<?php
endif;
if (strlen($STATUS)):
?>
<div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div>
<?php
endif;
?>
<div id="errormessage" role="alert" class="<?php
if (!strlen($ERROR)):
?>hidden <?php
endif;
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div>
<noscript><div id="noscript" role="alert" class="nonworking alert alert-error"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo I18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo I18n::_('PrivateBin requires a modern browser to work.'); ?></div>
<div id="ienotice" role="alert" class="hidden alert alert-error"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo I18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'), PHP_EOL; ?>
<a href="https://www.mozilla.org/firefox/">Firefox</a>,
<a href="https://www.opera.com/">Opera</a>,
<a href="https://www.google.com/chrome">Chrome</a>,
<a href="https://www.apple.com/safari">Safari</a>...
</div>
<div id="pasteresult" role="alert" class="hidden alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
<div id="deletelink"></div>
<div id="pastelink">
<?php
if (strlen($URLSHORTENER)):
?>
<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-warning">
<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button>
<?php
endif;
?>
</div>
</div>
<ul id="preview" class="nav nav-tabs hidden">
<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo I18n::_('Editor'); ?></a></li>
<li role="presentation"><a id="messagepreview" href="#"><?php echo I18n::_('Preview'); ?></a></li>
</ul>
</header>
<section class="container">
<article class="row">
<div id="image" class="col-md-12 text-center hidden"></div>
<div id="prettymessage" class="col-md-12 hidden">
<pre id="prettyprint" class="col-md-12 prettyprint linenums:1"></pre>
</div>
<div id="cleartext" class="col-md-12 hidden"></div>
<p class="col-md-12"><textarea id="message" name="message" cols="80" rows="25" class="form-control hidden"></textarea></p>
</article>
</section>
<section class="container">
<div id="discussion" class="hidden">
<h4><?php echo I18n::_('Discussion'); ?></h4>
<div id="comments"></div>
</div>
</section>
<footer class="container">
<div class="row">
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4>
<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12">
<?php echo I18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://privatebin.info/">project page</a>.'), PHP_EOL; ?>
</p>
</div>
</footer>
<div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
</body>
</html>

View File

@ -1,337 +0,0 @@
<?php
use PrivateBin\I18n;
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex" />
<meta name="referrer" content="no-referrer">
<title><?php echo I18n::_('PrivateBin'); ?></title>
<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
<link type="text/css" rel="stylesheet" href="css/bootstrap/darkstrap-0.9.3.css" />
<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
if ($SYNTAXHIGHLIGHTING):
?>
<link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
if (strlen($SYNTAXHIGHLIGHTINGTHEME)):
?>
<link type="text/css" rel="stylesheet" href="css/prettify/<?php echo rawurlencode($SYNTAXHIGHLIGHTINGTHEME); ?>.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
endif;
endif;
?>
<script type="text/javascript" src="js/jquery-1.11.3.js" integrity="sha512-xAERw8wHVOkM9x9y9/FvQ7g1t+gIQj39mfkN1Rd1OLcC5k/x2e6NO8hq6qEbb3oO+CYYTjVLFiFYg5/7ddF0zA==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/sjcl-1.0.4.js" integrity="sha512-BqVQ8GgWfMCcdsDuP6Ggm1BV7+mmoWH3PC4UqcYpEKSdEq1rthy6NUsa6gu5sydewbi/ilI3E3ohdCxlPPF9ww==" crossorigin="anonymous"></script>
<?php
if ($ZEROBINCOMPATIBILITY):
?>
<script type="text/javascript" src="js/base64-1.7.js" integrity="sha512-JdwsSP3GyHR+jaCkns9CL9NTt4JUJqm/BsODGmYhBcj5EAPKcHYh+OiMfyHbcDLECe17TL0hjXADFkusAqiYgA==" crossorigin="anonymous"></script>
<?php
else:
?>
<script type="text/javascript" src="js/base64-2.1.9.js" integrity="sha512-rbqAby7hObftbEoGQzkhUbEh5YkUn2MtekTLs4btvo2oly4CZ3DxhJzEh0u/rNzS54tcJdqi5Ug1ruugEd2U1g==" crossorigin="anonymous"></script>
<?php
endif;
?>
<script type="text/javascript" src="js/rawdeflate-0.5.js" integrity="sha512-tTdZ7qMr7tt5VQy4iCHu6/aGB12eRwbUy+AEI5rXntfsjcRfBeeqJloMsBU9FrGk1bIYLiuND/FhU42LO1bi0g==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js" integrity="sha512-/W33QnLmSAP1fwINS9iXgB6s/VOIG9GVdIuIYaUtbSvKPMv5S08PtT3PqnT2WjwBgB8DFeDN2nqJroqQYF7SwQ==" crossorigin="anonymous"></script>
<?php
if ($SYNTAXHIGHLIGHTING):
?>
<script type="text/javascript" src="js/prettify.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-m8iHxoN+Fe12xxFwWNdY/TS4KoFntHp29qY0xUzBnPd0bkKMOR/dFhEdTWydpt0b/fIXyhB+znGYUvgjfJ2RzQ==" crossorigin="anonymous"></script>
<?php
endif;
if ($MARKDOWN):
?>
<script type="text/javascript" src="js/showdown-1.4.1.js" integrity="sha512-Kbz1FIlDnqUJu/3yW8H8USzURA3JuUqSKRwz13lM4kWt6C0n6s4tjl81PCfnWtE4gBIzyj5uGePcfUyotk/icw==" crossorigin="anonymous"></script>
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Jx4qD49amdzpNe9FLtxLO84Xt5LZeQ2PGaM0I9UCS2Kr4xhrnFyvP+0hrLIMgDTwjWFDpTSCoDHuj0SHzuqXuQ==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->
<link rel="apple-touch-icon" href="apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
<link rel="icon" type="image/png" href="favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
<link rel="icon" type="image/png" href="favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
<link rel="manifest" href="manifest.json?<?php echo rawurlencode($VERSION); ?>" />
<link rel="mask-icon" href="safari-pinned-tab.svg?<?php echo rawurlencode($VERSION); ?>" color="#ffcc00" />
<link rel="shortcut icon" href="favicon.ico">
<meta name="msapplication-config" content="browserconfig.xml">
<meta name="theme-color" content="#ffe57e" />
</head>
<body role="document">
<nav class="navbar navbar-inverse navbar-static-top">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only"><?php echo I18n::_('Toggle navigation'); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="reloadlink navbar-brand" href="">
<img alt="<?php echo I18n::_('PrivateBin'); ?>" src="img/icon.svg" width="38" />
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-warning navbar-btn">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
</button>
<?php
if ($EXPIRECLONE):
?>
<button id="clonebutton" type="button" class="hidden btn btn-warning navbar-btn">
<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo I18n::_('Clone'), PHP_EOL; ?>
</button>
<?php
endif;
?>
<button id="rawtextbutton" type="button" class="hidden btn btn-warning navbar-btn">
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button>
</li>
<li class="dropdown">
<select id="pasteExpiration" name="pasteExpiration" class="hidden">
<?php
foreach ($EXPIRE as $key => $value):
?>
<option value="<?php echo $key; ?>"<?php
if ($key == $EXPIREDEFAULT):
?> selected="selected"<?php
endif;
?>><?php echo $value; ?></option>
<?php
endforeach;
?>
</select>
<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($EXPIRE as $key => $value):
?>
<li>
<a href="#" data-expiration="<?php echo $key; ?>">
<?php echo $value, PHP_EOL; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
<li>
<div id="burnafterreadingoption" class="navbar-text checkbox hidden">
<label>
<input type="checkbox" id="burnafterreading" name="burnafterreading"<?php
if ($BURNAFTERREADINGSELECTED):
?> checked<?php
endif;
?> />
<?php echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label>
</div>
</li>
<?php
if ($DISCUSSION):
?>
<li>
<div id="opendisc" class="navbar-text checkbox hidden">
<label>
<input type="checkbox" id="opendiscussion" name="opendiscussion"<?php
if ($OPENDISCUSSION):
?> checked<?php
endif;
?> />
<?php echo I18n::_('Open discussion'), PHP_EOL; ?>
</label>
</div>
</li>
<?php
endif;
if ($PASSWORD):
?>
<li>
<div id="password" class="navbar-form hidden">
<input type="password" id="passwordinput" placeholder="<?php echo I18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
</div>
</li>
<?php
endif;
if ($FILEUPLOAD):
?>
<li id="attach" class="hidden dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Attach a file'); ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li id="filewrap">
<div>
<input type="file" id="file" name="file" />
</div>
</li>
<li>
<a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
</a>
</li>
</ul>
</li>
<?php
endif;
?>
<li class="dropdown">
<select id="pasteFormatter" name="pasteFormatter" class="hidden">
<?php
foreach ($FORMATTER as $key => $value):
?>
<option value="<?php echo $key; ?>"<?php
if ($key == $FORMATTERDEFAULT):
?> selected="selected"<?php
endif;
?>><?php echo $value; ?></option>
<?php
endforeach;
?>
</select>
<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($FORMATTER as $key => $value):
?>
<li>
<a href="#" data-format="<?php echo $key; ?>">
<?php echo $value, PHP_EOL; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
</ul>
<ul class="nav navbar-nav pull-right">
<?php
if (strlen($LANGUAGESELECTION)):
?>
<li id="language" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-flag" aria-hidden="true"></span> <?php echo $LANGUAGES[$LANGUAGESELECTION][0]; ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($LANGUAGES as $key => $value):
?>
<li>
<a href="#" data-lang="<?php echo $key; ?>">
<?php echo $value[0]; ?> (<?php echo $value[1]; ?>)
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
<?php
endif;
?>
<li>
<button id="sendbutton" type="button" class="hidden btn btn-warning navbar-btn">
<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?>
</button>
</li>
</ul>
</div>
</nav>
<header class="container">
<?php
if (strlen($NOTICE)):
?>
<div role="alert" class="alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div>
<?php
endif;
?>
<div id="remainingtime" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</div>
<?php
if ($FILEUPLOAD):
?>
<div id="attachment" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo I18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo I18n::_('Cloned file attached.'); ?></span>
</div>
<?php
endif;
if (strlen($STATUS)):
?>
<div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div>
<?php
endif;
?>
<div id="errormessage" role="alert" class="<?php
if (!strlen($ERROR)):
?>hidden <?php
endif;
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div>
<noscript><div id="noscript" role="alert" class="nonworking alert alert-error"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo I18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo I18n::_('PrivateBin requires a modern browser to work.'); ?></div>
<div id="ienotice" role="alert" class="hidden alert alert-error"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo I18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'), PHP_EOL; ?>
<a href="https://www.mozilla.org/firefox/">Firefox</a>,
<a href="https://www.opera.com/">Opera</a>,
<a href="https://www.google.com/chrome">Chrome</a>,
<a href="https://www.apple.com/safari">Safari</a>...
</div>
<div id="pasteresult" role="alert" class="hidden alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
<div id="deletelink"></div>
<div id="pastelink">
<?php
if (strlen($URLSHORTENER)):
?>
<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-warning">
<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button>
<?php
endif;
?>
</div>
</div>
<ul id="preview" class="nav nav-tabs hidden">
<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo I18n::_('Editor'); ?></a></li>
<li role="presentation"><a id="messagepreview" href="#"><?php echo I18n::_('Preview'); ?></a></li>
</ul>
</header>
<section class="container">
<article class="row">
<div id="image" class="col-md-12 text-center hidden"></div>
<div id="prettymessage" class="col-md-12 hidden">
<pre id="prettyprint" class="col-md-12 prettyprint linenums:1"></pre>
</div>
<div id="cleartext" class="col-md-12 hidden"></div>
<p class="col-md-12"><textarea id="message" name="message" cols="80" rows="25" class="form-control hidden"></textarea></p>
</article>
</section>
<section class="container">
<div id="discussion" class="hidden">
<h4><?php echo I18n::_('Discussion'); ?></h4>
<div id="comments"></div>
</div>
</section>
<footer class="container">
<div class="row">
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4>
<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12">
<?php echo I18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://privatebin.info/">project page</a>.'), PHP_EOL; ?>
</p>
</div>
</footer>
<div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
</body>
</html>

View File

@ -1,337 +0,0 @@
<?php
use PrivateBin\I18n;
?><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex" />
<meta name="referrer" content="no-referrer">
<title><?php echo I18n::_('PrivateBin'); ?></title>
<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-3.3.5.css" />
<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
if ($SYNTAXHIGHLIGHTING):
?>
<link type="text/css" rel="stylesheet" href="css/prettify/prettify.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
if (strlen($SYNTAXHIGHLIGHTINGTHEME)):
?>
<link type="text/css" rel="stylesheet" href="css/prettify/<?php echo rawurlencode($SYNTAXHIGHLIGHTINGTHEME); ?>.css?<?php echo rawurlencode($VERSION); ?>" />
<?php
endif;
endif;
?>
<script type="text/javascript" src="js/jquery-1.11.3.js" integrity="sha512-xAERw8wHVOkM9x9y9/FvQ7g1t+gIQj39mfkN1Rd1OLcC5k/x2e6NO8hq6qEbb3oO+CYYTjVLFiFYg5/7ddF0zA==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/sjcl-1.0.4.js" integrity="sha512-BqVQ8GgWfMCcdsDuP6Ggm1BV7+mmoWH3PC4UqcYpEKSdEq1rthy6NUsa6gu5sydewbi/ilI3E3ohdCxlPPF9ww==" crossorigin="anonymous"></script>
<?php
if ($ZEROBINCOMPATIBILITY):
?>
<script type="text/javascript" src="js/base64-1.7.js" integrity="sha512-JdwsSP3GyHR+jaCkns9CL9NTt4JUJqm/BsODGmYhBcj5EAPKcHYh+OiMfyHbcDLECe17TL0hjXADFkusAqiYgA==" crossorigin="anonymous"></script>
<?php
else:
?>
<script type="text/javascript" src="js/base64-2.1.9.js" integrity="sha512-rbqAby7hObftbEoGQzkhUbEh5YkUn2MtekTLs4btvo2oly4CZ3DxhJzEh0u/rNzS54tcJdqi5Ug1ruugEd2U1g==" crossorigin="anonymous"></script>
<?php
endif;
?>
<script type="text/javascript" src="js/rawdeflate-0.5.js" integrity="sha512-tTdZ7qMr7tt5VQy4iCHu6/aGB12eRwbUy+AEI5rXntfsjcRfBeeqJloMsBU9FrGk1bIYLiuND/FhU42LO1bi0g==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js" integrity="sha512-/W33QnLmSAP1fwINS9iXgB6s/VOIG9GVdIuIYaUtbSvKPMv5S08PtT3PqnT2WjwBgB8DFeDN2nqJroqQYF7SwQ==" crossorigin="anonymous"></script>
<?php
if ($SYNTAXHIGHLIGHTING):
?>
<script type="text/javascript" src="js/prettify.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-m8iHxoN+Fe12xxFwWNdY/TS4KoFntHp29qY0xUzBnPd0bkKMOR/dFhEdTWydpt0b/fIXyhB+znGYUvgjfJ2RzQ==" crossorigin="anonymous"></script>
<?php
endif;
if ($MARKDOWN):
?>
<script type="text/javascript" src="js/showdown-1.4.1.js" integrity="sha512-Kbz1FIlDnqUJu/3yW8H8USzURA3JuUqSKRwz13lM4kWt6C0n6s4tjl81PCfnWtE4gBIzyj5uGePcfUyotk/icw==" crossorigin="anonymous"></script>
<?php
endif;
?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Jx4qD49amdzpNe9FLtxLO84Xt5LZeQ2PGaM0I9UCS2Kr4xhrnFyvP+0hrLIMgDTwjWFDpTSCoDHuj0SHzuqXuQ==" crossorigin="anonymous"></script>
<!--[if lt IE 10]>
<style type="text/css">body {padding-left:60px;padding-right:60px;} #ienotice {display:block;} #oldienotice {display:block;}</style>
<![endif]-->
<link rel="apple-touch-icon" href="apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
<link rel="icon" type="image/png" href="favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
<link rel="icon" type="image/png" href="favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
<link rel="manifest" href="manifest.json?<?php echo rawurlencode($VERSION); ?>" />
<link rel="mask-icon" href="safari-pinned-tab.svg?<?php echo rawurlencode($VERSION); ?>" color="#ffcc00" />
<link rel="shortcut icon" href="favicon.ico">
<meta name="msapplication-config" content="browserconfig.xml">
<meta name="theme-color" content="#ffe57e" />
</head>
<body role="document">
<nav class="navbar navbar-default navbar-static-top">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only"><?php echo I18n::_('Toggle navigation'); ?></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
</button>
<a class="reloadlink navbar-brand" href="">
<img alt="<?php echo I18n::_('PrivateBin'); ?>" src="img/icon.svg" width="38" />
</a>
</div>
<div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li>
<button id="sendbutton" type="button" class="hidden btn btn-primary navbar-btn">
<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?>
</button>
<?php
if ($EXPIRECLONE):
?>
<button id="clonebutton" type="button" class="hidden btn btn-default navbar-btn">
<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo I18n::_('Clone'), PHP_EOL; ?>
</button>
<?php
endif;
?>
<button id="rawtextbutton" type="button" class="hidden btn btn-default navbar-btn">
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button>
</li>
<li class="dropdown">
<select id="pasteExpiration" name="pasteExpiration" class="hidden">
<?php
foreach ($EXPIRE as $key => $value):
?>
<option value="<?php echo $key; ?>"<?php
if ($key == $EXPIREDEFAULT):
?> selected="selected"<?php
endif;
?>><?php echo $value; ?></option>
<?php
endforeach;
?>
</select>
<a id="expiration" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Expires'); ?>: <span id="pasteExpirationDisplay"><?php echo $EXPIRE[$EXPIREDEFAULT]; ?></span> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($EXPIRE as $key => $value):
?>
<li>
<a href="#" data-expiration="<?php echo $key; ?>">
<?php echo $value, PHP_EOL; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
<li>
<div id="burnafterreadingoption" class="navbar-text checkbox hidden">
<label>
<input type="checkbox" id="burnafterreading" name="burnafterreading"<?php
if ($BURNAFTERREADINGSELECTED):
?> checked="checked"<?php
endif;
?> />
<?php echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label>
</div>
</li>
<?php
if ($DISCUSSION):
?>
<li>
<div id="opendisc" class="navbar-text checkbox hidden">
<label>
<input type="checkbox" id="opendiscussion" name="opendiscussion"<?php
if ($OPENDISCUSSION):
?> checked="checked"<?php
endif;
?> />
<?php echo I18n::_('Open discussion'), PHP_EOL; ?>
</label>
</div>
</li>
<?php
endif;
if ($PASSWORD):
?>
<li>
<div id="password" class="navbar-form hidden">
<input type="password" id="passwordinput" placeholder="<?php echo I18n::_('Password (recommended)'); ?>" class="form-control" size="19" />
</div>
</li>
<?php
endif;
if ($FILEUPLOAD):
?>
<li id="attach" class="hidden dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Attach a file'); ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li id="filewrap">
<div>
<input type="file" id="file" name="file" />
</div>
</li>
<li>
<a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
</a>
</li>
</ul>
</li>
<?php
endif;
?>
<li class="dropdown">
<select id="pasteFormatter" name="pasteFormatter" class="hidden">
<?php
foreach ($FORMATTER as $key => $value):
?>
<option value="<?php echo $key; ?>"<?php
if ($key == $FORMATTERDEFAULT):
?> selected="selected"<?php
endif;
?>><?php echo $value; ?></option>
<?php
endforeach;
?>
</select>
<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($FORMATTER as $key => $value):
?>
<li>
<a href="#" data-format="<?php echo $key; ?>">
<?php echo $value, PHP_EOL; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
</ul>
<ul class="nav navbar-nav pull-right">
<?php
if (strlen($LANGUAGESELECTION)):
?>
<li id="language" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><span class="glyphicon glyphicon-flag" aria-hidden="true"></span> <?php echo $LANGUAGES[$LANGUAGESELECTION][0]; ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<?php
foreach ($LANGUAGES as $key => $value):
?>
<li>
<a href="#" data-lang="<?php echo $key; ?>">
<?php echo $value[0]; ?> (<?php echo $value[1]; ?>)
</a>
</li>
<?php
endforeach;
?>
</ul>
</li>
<?php
endif;
?>
<li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
</button>
</li>
</ul>
</div>
</nav>
<header class="container">
<?php
if (strlen($NOTICE)):
?>
<div role="alert" class="alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div>
<?php
endif;
?>
<div id="remainingtime" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</div>
<?php
if ($FILEUPLOAD):
?>
<div id="attachment" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo I18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo I18n::_('Cloned file attached.'); ?></span>
</div>
<?php
endif;
if (strlen($STATUS)):
?>
<div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div>
<?php
endif;
?>
<div id="errormessage" role="alert" class="<?php
if (!strlen($ERROR)):
?>hidden <?php
endif;
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div>
<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo I18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript>
<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo I18n::_('PrivateBin requires a modern browser to work.'); ?></div>
<div id="ienotice" role="alert" class="hidden alert alert-warning"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo I18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'), PHP_EOL; ?>
<a href="https://www.mozilla.org/firefox/">Firefox</a>,
<a href="https://www.opera.com/">Opera</a>,
<a href="https://www.google.com/chrome">Chrome</a>,
<a href="https://www.apple.com/safari">Safari</a>...
</div>
<div id="pasteresult" role="alert" class="hidden alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
<div id="deletelink"></div>
<div id="pastelink">
<?php
if (strlen($URLSHORTENER)):
?>
<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-primary">
<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button>
<?php
endif;
?>
</div>
</div>
<ul id="preview" class="nav nav-tabs hidden">
<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo I18n::_('Editor'); ?></a></li>
<li role="presentation"><a id="messagepreview" href="#"><?php echo I18n::_('Preview'); ?></a></li>
</ul>
</header>
<section class="container">
<article class="row">
<div id="image" class="col-md-12 text-center hidden"></div>
<div id="prettymessage" class="col-md-12 hidden">
<pre id="prettyprint" class="col-md-12 prettyprint linenums:1"></pre>
</div>
<div id="cleartext" class="col-md-12 hidden"></div>
<p class="col-md-12"><textarea id="message" name="message" cols="80" rows="25" class="form-control hidden"></textarea></p>
</article>
</section>
<section class="container">
<div id="discussion" class="hidden">
<h4><?php echo I18n::_('Discussion'); ?></h4>
<div id="comments"></div>
</div>
</section>
<footer class="container">
<div class="row">
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4>
<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12">
<?php echo I18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://privatebin.info/">project page</a>.'), PHP_EOL; ?>
</p>
</div>
</footer>
<div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
</body>
</html>

View File

@ -1,16 +1,32 @@
<?php <?php
use PrivateBin\I18n; use PrivateBin\I18n;
$isCpct = substr($template, 9, 8) === '-compact';
$isDark = substr($template, 9, 5) === '-dark';
$isPage = substr($template, -5) === '-page';
?><!DOCTYPE html> ?><!DOCTYPE html>
<html lang="en"> <html>
<head> <head>
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="robots" content="noindex" /> <meta name="robots" content="noindex" />
<meta name="referrer" content="no-referrer"> <meta name="referrer" content="no-referrer">
<title><?php echo I18n::_('PrivateBin'); ?></title> <title><?php echo I18n::_($NAME); ?></title>
<?php
if (!$isDark):
?>
<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-3.3.5.css" /> <link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-3.3.5.css" />
<?php
endif;
?>
<link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" /> <link type="text/css" rel="stylesheet" href="css/bootstrap/bootstrap-theme-3.3.5.css" />
<?php
if ($isDark):
?>
<link type="text/css" rel="stylesheet" href="css/bootstrap/darkstrap-0.9.3.css" />
<?php
endif;
?>
<link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /> <link type="text/css" rel="stylesheet" href="css/bootstrap/privatebin.css?<?php echo rawurlencode($VERSION); ?>" />
<?php <?php
if ($SYNTAXHIGHLIGHTING): if ($SYNTAXHIGHLIGHTING):
@ -24,8 +40,9 @@ if ($SYNTAXHIGHLIGHTING):
endif; endif;
endif; endif;
?> ?>
<script type="text/javascript" src="js/jquery-1.11.3.js" integrity="sha512-xAERw8wHVOkM9x9y9/FvQ7g1t+gIQj39mfkN1Rd1OLcC5k/x2e6NO8hq6qEbb3oO+CYYTjVLFiFYg5/7ddF0zA==" crossorigin="anonymous"></script> <noscript><link type="text/css" rel="stylesheet" href="css/noscript.css" /></noscript>
<script type="text/javascript" src="js/sjcl-1.0.4.js" integrity="sha512-BqVQ8GgWfMCcdsDuP6Ggm1BV7+mmoWH3PC4UqcYpEKSdEq1rthy6NUsa6gu5sydewbi/ilI3E3ohdCxlPPF9ww==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/jquery-3.1.1.js" integrity="sha512-U6K1YLIFUWcvuw5ucmMtT9HH4t0uz3M366qrF5y4vnyH6dgDzndlcGvH/Lz5k8NFh80SN95aJ5rqGZEdaQZ7ZQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/sjcl-1.0.6.js" integrity="sha512-DsyxLV/uBoQlRTJmW5Gb2SxXUXB+aYeZ6zk+NuXy8LuLyi8oGti9AGn6He5fUY2DtgQ2//RjfaZog8exFuunUQ==" crossorigin="anonymous"></script>
<?php <?php
if ($ZEROBINCOMPATIBILITY): if ($ZEROBINCOMPATIBILITY):
?> ?>
@ -39,7 +56,7 @@ endif;
?> ?>
<script type="text/javascript" src="js/rawdeflate-0.5.js" integrity="sha512-tTdZ7qMr7tt5VQy4iCHu6/aGB12eRwbUy+AEI5rXntfsjcRfBeeqJloMsBU9FrGk1bIYLiuND/FhU42LO1bi0g==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/rawdeflate-0.5.js" integrity="sha512-tTdZ7qMr7tt5VQy4iCHu6/aGB12eRwbUy+AEI5rXntfsjcRfBeeqJloMsBU9FrGk1bIYLiuND/FhU42LO1bi0g==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/rawinflate-0.3.js" integrity="sha512-g8uelGgJW9A/Z1tB6Izxab++oj5kdD7B4qC7DHwZkB6DGMXKyzx7v5mvap2HXueI2IIn08YlRYM56jwWdm2ucQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/bootstrap-3.3.5.js" integrity="sha512-/W33QnLmSAP1fwINS9iXgB6s/VOIG9GVdIuIYaUtbSvKPMv5S08PtT3PqnT2WjwBgB8DFeDN2nqJroqQYF7SwQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/bootstrap-3.3.7.js" integrity="sha512-iztkobsvnjKfAtTNdHkGVjAYTrrtlC7mGp/54c40wowO7LhURYl3gVzzcEqGl/qKXQltJ2HwMrdLcNUdo+N/RQ==" crossorigin="anonymous"></script>
<?php <?php
if ($SYNTAXHIGHLIGHTING): if ($SYNTAXHIGHLIGHTING):
?> ?>
@ -48,25 +65,48 @@ if ($SYNTAXHIGHLIGHTING):
endif; endif;
if ($MARKDOWN): if ($MARKDOWN):
?> ?>
<script type="text/javascript" src="js/showdown-1.4.1.js" integrity="sha512-Kbz1FIlDnqUJu/3yW8H8USzURA3JuUqSKRwz13lM4kWt6C0n6s4tjl81PCfnWtE4gBIzyj5uGePcfUyotk/icw==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/showdown-1.6.1.js" integrity="sha512-e6kAsBTgFnTBnEQXrq8BV6+XFwxb3kyWHeEPOl+KhxaWt3xImE2zAW2+yP3E2CQ7F9yoJl1poVU9qxkOEtVsTQ==" crossorigin="anonymous"></script>
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Jx4qD49amdzpNe9FLtxLO84Xt5LZeQ2PGaM0I9UCS2Kr4xhrnFyvP+0hrLIMgDTwjWFDpTSCoDHuj0SHzuqXuQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-7/bLmiTErcH3lMJi1JxXk/lb20NUO7TCqasWeFybnNhnfOUnJ9GQGqPVJxPf+7fnw9dgLa1s18FXQuRanLD8Hw==" 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]-->
<link rel="apple-touch-icon" href="apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" /> <link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
<link rel="icon" type="image/png" href="favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" /> <link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
<link rel="icon" type="image/png" href="favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" /> <link rel="icon" type="image/png" href="img/favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
<link rel="manifest" href="manifest.json?<?php echo rawurlencode($VERSION); ?>" /> <link rel="manifest" href="manifest.json?<?php echo rawurlencode($VERSION); ?>" />
<link rel="mask-icon" href="safari-pinned-tab.svg?<?php echo rawurlencode($VERSION); ?>" color="#ffcc00" /> <link rel="mask-icon" href="img/safari-pinned-tab.svg?<?php echo rawurlencode($VERSION); ?>" color="#ffcc00" />
<link rel="shortcut icon" href="favicon.ico"> <link rel="shortcut icon" href="img/favicon.ico">
<meta name="msapplication-config" content="browserconfig.xml"> <meta name="msapplication-config" content="browserconfig.xml">
<meta name="theme-color" content="#ffe57e" /> <meta name="theme-color" content="#ffe57e" />
</head> </head>
<body role="document"> <body role="document"<?php
<nav class="navbar navbar-default navbar-static-top"> if ($isCpct):
?> class="navbar-spacing"<?php
endif;
?>>
<div id="passwordmodal" class="modal fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<form id="passwordform" role="form">
<div class="form-group">
<label for="passworddecrypt"><span class="glyphicon glyphicon-eye-open"></span> <?php echo I18n::_('Please enter the password for this paste:') ?></label>
<input id="passworddecrypt" type="password" class="form-control" placeholder="<?php echo I18n::_('Enter password') ?>">
</div>
<button type="submit" class="btn btn-success btn-block"><span class="glyphicon glyphicon-off"></span> <?php echo I18n::_('Decrypt') ?></button>
</form>
</div>
</div>
</div>
</div>
<nav class="navbar navbar-<?php echo $isDark ? 'inverse' : 'default'; ?> navbar-<?php echo $isCpct ? 'fixed' : 'static'; ?>-top"><?php
if ($isCpct):
?><div class="container"><?php
endif;
?>
<div class="navbar-header"> <div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar"> <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
<span class="sr-only"><?php echo I18n::_('Toggle navigation'); ?></span> <span class="sr-only"><?php echo I18n::_('Toggle navigation'); ?></span>
@ -75,25 +115,38 @@ endif;
<span class="icon-bar"></span> <span class="icon-bar"></span>
</button> </button>
<a class="reloadlink navbar-brand" href=""> <a class="reloadlink navbar-brand" href="">
<img alt="<?php echo I18n::_('PrivateBin'); ?>" src="img/icon.svg" width="38" /> <img alt="<?php echo I18n::_($NAME); ?>" src="img/icon.svg" width="38" />
</a> </a>
</div> </div>
<div id="navbar" class="navbar-collapse collapse"> <div id="navbar" class="navbar-collapse collapse">
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li id="loadingindicator" class="navbar-text hidden">
<span class="glyphicon glyphicon-time" aria-hidden="true"></span>
<?php echo I18n::_('Loading…'), PHP_EOL; ?>
</li>
<li> <li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn"> <?php
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?> if ($isPage):
?>
<button id="sendbutton" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'primary'; ?> navbar-btn">
<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL;
else:
?>
<button id="newbutton" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL;
endif;
?>
</button> </button>
<?php <?php
if ($EXPIRECLONE): if ($EXPIRECLONE):
?> ?>
<button id="clonebutton" type="button" class="hidden btn btn-default navbar-btn"> <button id="clonebutton" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo I18n::_('Clone'), PHP_EOL; ?> <span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo I18n::_('Clone'), PHP_EOL; ?>
</button> </button>
<?php <?php
endif; endif;
?> ?>
<button id="rawtextbutton" type="button" class="hidden btn btn-default navbar-btn"> <button id="rawtextbutton" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?> <span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button> </button>
</li> </li>
@ -126,34 +179,91 @@ endforeach;
?> ?>
</ul> </ul>
</li> </li>
<?php
if ($isCpct):
?>
<li id="formatter" class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Options'); ?> <span class="caret"></span></a>
<ul class="dropdown-menu">
<li id="burnafterreadingoption" class="checkbox hidden">
<label>
<input type="checkbox" id="burnafterreading" name="burnafterreading"<?php
if ($BURNAFTERREADINGSELECTED):
?> checked="checked"<?php
endif;
?> />
<?php echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label>
</li>
<?php
if ($DISCUSSION):
?>
<li id="opendiscussionoption" class="checkbox hidden">
<label>
<input type="checkbox" id="opendiscussion" name="opendiscussion"<?php
if ($OPENDISCUSSION):
?> checked="checked"<?php
endif;
?> />
<?php echo I18n::_('Open discussion'), PHP_EOL; ?>
</label>
</li>
<?php
endif;
?>
<li role="separator" class="divider"></li>
<li>
<div>
<?php echo I18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span>
</div>
</li>
<?php
foreach ($FORMATTER as $key => $value):
?>
<li>
<a href="#" data-format="<?php echo $key; ?>">
<?php echo $value, PHP_EOL; ?>
</a>
</li>
<?php
endforeach;
?>
</ul>
<select id="pasteFormatter" name="pasteFormatter" class="hidden">
</select>
</li>
<?php
else:
?>
<li> <li>
<div id="burnafterreadingoption" class="navbar-text checkbox hidden"> <div id="burnafterreadingoption" class="navbar-text checkbox hidden">
<label> <label>
<input type="checkbox" id="burnafterreading" name="burnafterreading"<?php <input type="checkbox" id="burnafterreading" name="burnafterreading"<?php
if ($BURNAFTERREADINGSELECTED): if ($BURNAFTERREADINGSELECTED):
?> checked="checked"<?php ?> checked="checked"<?php
endif; endif;
?> /> ?> />
<?php echo I18n::_('Burn after reading'), PHP_EOL; ?> <?php echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
<?php <?php
if ($DISCUSSION): if ($DISCUSSION):
?> ?>
<li> <li>
<div id="opendisc" class="navbar-text checkbox hidden"> <div id="opendiscussionoption" class="navbar-text checkbox hidden">
<label> <label>
<input type="checkbox" id="opendiscussion" name="opendiscussion"<?php <input type="checkbox" id="opendiscussion" name="opendiscussion"<?php
if ($OPENDISCUSSION): if ($OPENDISCUSSION):
?> checked="checked"<?php ?> checked="checked"<?php
endif; endif;
?> /> ?> />
<?php echo I18n::_('Open discussion'), PHP_EOL; ?> <?php echo I18n::_('Open discussion'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
<?php <?php
endif;
endif; endif;
if ($PASSWORD): if ($PASSWORD):
?> ?>
@ -174,6 +284,7 @@ if ($FILEUPLOAD):
<input type="file" id="file" name="file" /> <input type="file" id="file" name="file" />
</div> </div>
</li> </li>
<li id="customattachment" class="hidden"></li>
<li> <li>
<a id="fileremovebutton" href="#"> <a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'), PHP_EOL; ?> <?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
@ -183,25 +294,26 @@ if ($FILEUPLOAD):
</li> </li>
<?php <?php
endif; endif;
if (!$isCpct):
?> ?>
<li class="dropdown"> <li class="dropdown">
<select id="pasteFormatter" name="pasteFormatter" class="hidden"> <select id="pasteFormatter" name="pasteFormatter" class="hidden">
<?php <?php
foreach ($FORMATTER as $key => $value): foreach ($FORMATTER as $key => $value):
?> ?>
<option value="<?php echo $key; ?>"<?php <option value="<?php echo $key; ?>"<?php
if ($key == $FORMATTERDEFAULT): if ($key == $FORMATTERDEFAULT):
?> selected="selected"<?php ?> selected="selected"<?php
endif; endif;
?>><?php echo $value; ?></option> ?>><?php echo $value; ?></option>
<?php <?php
endforeach; endforeach;
?> ?>
</select> </select>
<a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a> <a id="formatter" href="#" class="hidden dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false"><?php echo I18n::_('Format'); ?>: <span id="pasteFormatterDisplay"><?php echo $FORMATTER[$FORMATTERDEFAULT]; ?></span> <span class="caret"></span></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<?php <?php
foreach ($FORMATTER as $key => $value): foreach ($FORMATTER as $key => $value):
?> ?>
<li> <li>
<a href="#" data-format="<?php echo $key; ?>"> <a href="#" data-format="<?php echo $key; ?>">
@ -209,10 +321,13 @@ foreach ($FORMATTER as $key => $value):
</a> </a>
</li> </li>
<?php <?php
endforeach; endforeach;
?> ?>
</ul> </ul>
</li> </li>
<?php
endif;
?>
</ul> </ul>
<ul class="nav navbar-nav pull-right"> <ul class="nav navbar-nav pull-right">
<?php <?php
@ -238,100 +353,144 @@ if (strlen($LANGUAGESELECTION)):
endif; endif;
?> ?>
<li> <li>
<button id="sendbutton" type="button" class="hidden btn btn-primary navbar-btn"> <?php
<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?> if ($isPage):
?>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-<?php echo $isDark ? 'warning' : 'default'; ?> navbar-btn">
<span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL;
else:
?>
<button id="sendbutton" type="button" class="hidden btn btn-<?php echo $isDark ? 'warning' : 'primary'; ?> navbar-btn">
<span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL;
endif;
?>
</button> </button>
</li> </li>
</ul> </ul>
</div> </div>
</nav> <?php
<header class="container"> if ($isCpct):
?></div><?php
endif;
?></nav>
<main>
<section class="container">
<?php <?php
if (strlen($NOTICE)): if (strlen($NOTICE)):
?> ?>
<div role="alert" class="alert alert-info"> <div role="alert" class="alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
</div> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div>
<?php <?php
endif; endif;
?> ?>
<div id="remainingtime" role="alert" class="hidden alert alert-info"> <div id="remainingtime" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <span class="glyphicon glyphicon-fire" aria-hidden="true"></span>
</div> </div>
<?php <?php
if ($FILEUPLOAD): if ($FILEUPLOAD):
?> ?>
<div id="attachment" role="alert" class="hidden alert alert-info"> <div id="attachment" role="alert" class="hidden alert alert-info">
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <a><?php echo I18n::_('Download attachment'); ?></a> <span id="clonedfile" class="hidden"><?php echo I18n::_('Cloned file attached.'); ?></span> <span class="glyphicon glyphicon-download-alt" aria-hidden="true"></span>
</div> <a class="alert-link"><?php echo I18n::_('Download attachment'), PHP_EOL; ?></a>
<?php </div>
endif;
if (strlen($STATUS)):
?>
<div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div>
<?php <?php
endif; endif;
?> ?>
<div id="errormessage" role="alert" class="<?php <div id="status" role="alert" class="statusmessage alert alert-info<?php echo empty($STATUS) ? ' hidden' : '' ?>">
if (!strlen($ERROR)): <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
?>hidden <?php <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
endif; </div>
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div> <div id="errormessage" role="alert" class="statusmessage<?php echo empty($ERROR) ? ' hidden' : '' ?> alert alert-danger">
<noscript><div id="noscript" role="alert" class="nonworking alert alert-warning"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span> <?php echo I18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript> <span class="glyphicon glyphicon-alert" aria-hidden="true"></span>
<div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo I18n::_('PrivateBin requires a modern browser to work.'); ?></div> <?php echo htmlspecialchars($ERROR), PHP_EOL; ?>
<div id="ienotice" role="alert" class="hidden alert alert-warning"><span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span> <?php echo I18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'), PHP_EOL; ?> </div>
<a href="https://www.mozilla.org/firefox/">Firefox</a>, <noscript>
<a href="https://www.opera.com/">Opera</a>, <div id="noscript" role="alert" class="nonworking alert alert-<?php echo $isDark ? 'error' : 'warning'; ?>">
<a href="https://www.google.com/chrome">Chrome</a>, <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<a href="https://www.apple.com/safari">Safari</a>... <?php echo I18n::_('JavaScript is required for %s to work.<br />Sorry for the inconvenience.', I18n::_($NAME)), PHP_EOL; ?>
</div> </div>
<div id="pasteresult" role="alert" class="hidden alert alert-success"> </noscript>
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <div id="oldienotice" role="alert" class="hidden nonworking alert alert-danger">
<div id="deletelink"></div> <span class="glyphicon glyphicon-alert" aria-hidden="true"></span>
<div id="pastelink"> <?php echo I18n::_('%s requires a modern browser to work.', I18n::_($NAME)), PHP_EOL; ?>
</div>
<div id="ienotice" role="alert" class="hidden alert alert-<?php echo $isDark ? 'error' : 'warning'; ?>">
<span class="glyphicon glyphicon-question-sign" aria-hidden="true"></span>
<?php echo I18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'), PHP_EOL; ?>
<a href="https://www.mozilla.org/firefox/">Firefox</a>,
<a href="https://www.opera.com/">Opera</a>,
<a href="https://www.google.com/chrome">Chrome</a>
</div>
<div id="pasteSuccess" role="alert" class="hidden alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span>
<div id="deletelink"></div>
<div id="pastelink">
<?php <?php
if (strlen($URLSHORTENER)): if (strlen($URLSHORTENER)):
?> ?>
<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-primary"> <button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-<?php echo $isDark ? 'warning' : 'primary'; ?>">
<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?> <span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button> </button>
<?php <?php
endif; endif;
?> ?>
</div>
</div> </div>
</div> <ul id="editorTabs" class="nav nav-tabs hidden">
<ul id="preview" class="nav nav-tabs hidden"> <li role="presentation" class="active"><a id="messageedit" href="#"><?php echo I18n::_('Editor'); ?></a></li>
<li role="presentation" class="active"><a id="messageedit" href="#"><?php echo I18n::_('Editor'); ?></a></li> <li role="presentation"><a id="messagepreview" href="#"><?php echo I18n::_('Preview'); ?></a></li>
<li role="presentation"><a id="messagepreview" href="#"><?php echo I18n::_('Preview'); ?></a></li> </ul>
</ul> </section>
</header> <section class="container">
<section class="container"> <article class="row">
<article class="row"> <div id="placeholder" class="col-md-12 hidden"><?php echo I18n::_('+++ no paste text +++'); ?></div>
<div id="image" class="col-md-12 text-center hidden"></div> <div id="attachmentPreview" class="col-md-12 text-center hidden"></div>
<div id="prettymessage" class="col-md-12 hidden"> <div id="prettymessage" class="col-md-12 hidden">
<pre id="prettyprint" class="col-md-12 prettyprint linenums:1"></pre> <pre id="prettyprint" class="col-md-12 prettyprint linenums:1"></pre>
</div>
<div id="plaintext" class="col-md-12 hidden"></div>
<p class="col-md-12"><textarea id="message" name="message" cols="80" rows="25" class="form-control hidden"></textarea></p>
</article>
</section>
<section class="container">
<div id="discussion" class="hidden">
<h4><?php echo I18n::_('Discussion'); ?></h4>
<div id="commentcontainer"></div>
</div> </div>
<div id="cleartext" class="col-md-12 hidden"></div> </section>
<p class="col-md-12"><textarea id="message" name="message" cols="80" rows="25" class="form-control hidden"></textarea></p> <section class="container">
</article> <div id="noscript" role="alert" class="nonworking alert alert-info noscript-hide">
</section> <span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span>
<section class="container"> <?php echo I18n::_('Loading…'); ?><br />
<div id="discussion" class="hidden"> <span class="small"><?php echo I18n::_('In case this message never disappears please have a look at <a href="https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away">this FAQ for information to troubleshoot</a>.'); ?></span>
<h4><?php echo I18n::_('Discussion'); ?></h4> </div>
<div id="comments"></div> </section>
<footer class="container">
<div class="row">
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_($NAME); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4>
<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12">
<?php echo I18n::_('%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://privatebin.info/">project page</a>.', I18n::_($NAME)), PHP_EOL; ?>
</p>
</div>
</footer>
</main>
<div id="serverdata" class="hidden" aria-hidden="true">
<div id="cipherdata"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
<?php
if ($DISCUSSION):
?>
<div id="templates">
<!-- @TODO: when I intend/structure this corrrectly Firefox adds whitespaces everywhere which completly destroy the layout. (same possible when you remove the template data below and show this area in the browser) -->
<article id="commenttemplate" class="comment"><div class="commentmeta"><span class="nickname">name</span><span class="commentdate">0000-00-00</span></div><div class="commentdata">c</div><button class="btn btn-default btn-sm"><?php echo I18n::_('Reply'); ?></button></article>
<p id="commenttailtemplate" class="comment"><button class="btn btn-default btn-sm"><?php echo I18n::_('Add comment'); ?></button></p>
<div id="replytemplate" class="reply hidden"><input type="text" id="nickname" class="form-control" title="<?php echo I18n::_('Optional nickname…'); ?>" placeholder="<?php echo I18n::_('Optional nickname…'); ?>" /><textarea id="replymessage" class="replymessage form-control" cols="80" rows="7"></textarea><br /><div id="replystatus" role="alert" class="statusmessage hidden alert"><span class="glyphicon" aria-hidden="true"></span> </div><button id="replybutton" class="btn btn-default btn-sm"><?php echo I18n::_('Post comment'); ?></button></div>
</div> </div>
</section> <?php
<footer class="container"> endif;
<div class="row"> ?>
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4> </div>
<p class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12">
<?php echo I18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://privatebin.info/">project page</a>.'), PHP_EOL; ?>
</p>
</div>
</footer>
<div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
</body> </body>
</html> </html>

View File

@ -6,7 +6,7 @@ use PrivateBin\I18n;
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="robots" content="noindex" /> <meta name="robots" content="noindex" />
<meta name="referrer" content="no-referrer"> <meta name="referrer" content="no-referrer">
<title><?php echo I18n::_('PrivateBin'); ?></title> <title><?php echo I18n::_($NAME); ?></title>
<link type="text/css" rel="stylesheet" href="css/privatebin.css?<?php echo rawurlencode($VERSION); ?>" /> <link type="text/css" rel="stylesheet" href="css/privatebin.css?<?php echo rawurlencode($VERSION); ?>" />
<?php <?php
if ($SYNTAXHIGHLIGHTING): if ($SYNTAXHIGHLIGHTING):
@ -20,8 +20,8 @@ if ($SYNTAXHIGHLIGHTING):
endif; endif;
endif; endif;
?> ?>
<script type="text/javascript" src="js/jquery-1.11.3.js" integrity="sha512-xAERw8wHVOkM9x9y9/FvQ7g1t+gIQj39mfkN1Rd1OLcC5k/x2e6NO8hq6qEbb3oO+CYYTjVLFiFYg5/7ddF0zA==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/jquery-3.1.1.js" integrity="sha512-U6K1YLIFUWcvuw5ucmMtT9HH4t0uz3M366qrF5y4vnyH6dgDzndlcGvH/Lz5k8NFh80SN95aJ5rqGZEdaQZ7ZQ==" crossorigin="anonymous"></script>
<script type="text/javascript" src="js/sjcl-1.0.4.js" integrity="sha512-BqVQ8GgWfMCcdsDuP6Ggm1BV7+mmoWH3PC4UqcYpEKSdEq1rthy6NUsa6gu5sydewbi/ilI3E3ohdCxlPPF9ww==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/sjcl-1.0.6.js" integrity="sha512-DsyxLV/uBoQlRTJmW5Gb2SxXUXB+aYeZ6zk+NuXy8LuLyi8oGti9AGn6He5fUY2DtgQ2//RjfaZog8exFuunUQ==" crossorigin="anonymous"></script>
<?php <?php
if ($ZEROBINCOMPATIBILITY): if ($ZEROBINCOMPATIBILITY):
?> ?>
@ -43,27 +43,27 @@ if ($SYNTAXHIGHLIGHTING):
endif; endif;
if ($MARKDOWN): if ($MARKDOWN):
?> ?>
<script type="text/javascript" src="js/showdown-1.4.1.js" integrity="sha512-Kbz1FIlDnqUJu/3yW8H8USzURA3JuUqSKRwz13lM4kWt6C0n6s4tjl81PCfnWtE4gBIzyj5uGePcfUyotk/icw==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/showdown-1.6.1.js" integrity="sha512-e6kAsBTgFnTBnEQXrq8BV6+XFwxb3kyWHeEPOl+KhxaWt3xImE2zAW2+yP3E2CQ7F9yoJl1poVU9qxkOEtVsTQ==" crossorigin="anonymous"></script>
<?php <?php
endif; endif;
?> ?>
<script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-Jx4qD49amdzpNe9FLtxLO84Xt5LZeQ2PGaM0I9UCS2Kr4xhrnFyvP+0hrLIMgDTwjWFDpTSCoDHuj0SHzuqXuQ==" crossorigin="anonymous"></script> <script type="text/javascript" src="js/privatebin.js?<?php echo rawurlencode($VERSION); ?>" integrity="sha512-7/bLmiTErcH3lMJi1JxXk/lb20NUO7TCqasWeFybnNhnfOUnJ9GQGqPVJxPf+7fnw9dgLa1s18FXQuRanLD8Hw==" 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]-->
<link rel="apple-touch-icon" href="apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" /> <link rel="apple-touch-icon" href="img/apple-touch-icon.png?<?php echo rawurlencode($VERSION); ?>" sizes="180x180" />
<link rel="icon" type="image/png" href="favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" /> <link rel="icon" type="image/png" href="img/favicon-32x32.png?<?php echo rawurlencode($VERSION); ?>" sizes="32x32" />
<link rel="icon" type="image/png" href="favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" /> <link rel="icon" type="image/png" href="img/favicon-16x16.png?<?php echo rawurlencode($VERSION); ?>" sizes="16x16" />
<link rel="manifest" href="manifest.json?<?php echo rawurlencode($VERSION); ?>" /> <link rel="manifest" href="manifest.json?<?php echo rawurlencode($VERSION); ?>" />
<link rel="mask-icon" href="safari-pinned-tab.svg?<?php echo rawurlencode($VERSION); ?>" color="#ffcc00" /> <link rel="mask-icon" href="img/safari-pinned-tab.svg?<?php echo rawurlencode($VERSION); ?>" color="#ffcc00" />
<link rel="shortcut icon" href="favicon.ico"> <link rel="shortcut icon" href="img/favicon.ico">
<meta name="msapplication-config" content="browserconfig.xml"> <meta name="msapplication-config" content="browserconfig.xml">
<meta name="theme-color" content="#ffe57e" /> <meta name="theme-color" content="#ffe57e" />
</head> </head>
<body> <body>
<header> <header>
<div id="aboutbox"> <div id="aboutbox">
<?php echo I18n::_('PrivateBin is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://privatebin.info/">project page</a>.'); ?><br /> <?php echo I18n::_('%s is a minimalist, open source online pastebin where the server has zero knowledge of pasted data. Data is encrypted/decrypted <i>in the browser</i> using 256 bits AES. More information on the <a href="https://privatebin.info/">project page</a>.', I18n::_($NAME)); ?><br />
<?php <?php
if (strlen($NOTICE)): if (strlen($NOTICE)):
?> ?>
@ -71,20 +71,20 @@ if (strlen($NOTICE)):
endif; endif;
?> ?>
</div> </div>
<h1 class="title reloadlink"><?php echo I18n::_('PrivateBin'); ?></h1><br /> <h1 class="title reloadlink"><?php echo I18n::_($NAME); ?></h1><br />
<h2 class="title"><?php echo I18n::_('Because ignorance is bliss'); ?></h2><br /> <h2 class="title"><?php echo I18n::_('Because ignorance is bliss'); ?></h2><br />
<h3 class="title"><?php echo $VERSION; ?></h3> <h3 class="title"><?php echo $VERSION; ?></h3>
<noscript><div id="noscript" class="nonworking"><?php echo I18n::_('Javascript is required for PrivateBin to work.<br />Sorry for the inconvenience.'); ?></div></noscript> <noscript><div id="noscript" class="nonworking"><?php echo I18n::_('JavaScript is required for %s to work.<br />Sorry for the inconvenience.', I18n::_($NAME)); ?></div></noscript>
<div id="oldienotice" class="nonworking"><?php echo I18n::_('PrivateBin requires a modern browser to work.'); ?></div> <div id="oldienotice" class="nonworking"><?php echo I18n::_('%s requires a modern browser to work.', I18n::_($NAME)); ?></div>
<div id="ienotice"><?php echo I18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'), PHP_EOL; ?> <div id="ienotice"><?php echo I18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'), PHP_EOL; ?>
<a href="https://www.mozilla.org/firefox/">Firefox</a>, <a href="https://www.mozilla.org/firefox/">Firefox</a>,
<a href="https://www.opera.com/">Opera</a>, <a href="https://www.opera.com/">Opera</a>,
<a href="https://www.google.com/chrome">Chrome</a>, <a href="https://www.google.com/chrome">Chrome</a>
<a href="https://www.apple.com/safari">Safari</a>...
</div> </div>
</header> </header>
<section> <section>
<article> <article>
<div id="loadingindicator" class="hidden"><?php echo I18n::_('Loading…'); ?></div>
<div id="status"><?php echo htmlspecialchars($STATUS); ?></div> <div id="status"><?php echo htmlspecialchars($STATUS); ?></div>
<div id="errormessage" class="hidden"><?php echo htmlspecialchars($ERROR); ?></div> <div id="errormessage" class="hidden"><?php echo htmlspecialchars($ERROR); ?></div>
<div id="toolbar"> <div id="toolbar">
@ -125,7 +125,7 @@ endif;
<?php <?php
if ($DISCUSSION): if ($DISCUSSION):
?> ?>
<div id="opendisc" class="button hidden"> <div id="opendiscussionoption" class="button hidden">
<input type="checkbox" id="opendiscussion" name="opendiscussion"<?php <input type="checkbox" id="opendiscussion" name="opendiscussion"<?php
if ($OPENDISCUSSION): if ($OPENDISCUSSION):
?> checked="checked"<?php ?> checked="checked"<?php
@ -216,16 +216,36 @@ endif;
<div id="prettymessage" class="hidden"> <div id="prettymessage" class="hidden">
<pre id="prettyprint" class="prettyprint linenums:1"></pre> <pre id="prettyprint" class="prettyprint linenums:1"></pre>
</div> </div>
<div id="cleartext" class="hidden"></div> <div id="plaintext" class="hidden"></div>
<textarea id="message" name="message" cols="80" rows="25" class="hidden"></textarea> <textarea id="message" name="message" cols="80" rows="25" class="hidden"></textarea>
</article> </article>
</section> </section>
<section> <section>
<div id="discussion" class="hidden"> <div id="discussion" class="hidden">
<h4 class="title"><?php echo I18n::_('Discussion'); ?></h4> <h4 class="title"><?php echo I18n::_('Discussion'); ?></h4>
<div id="comments"></div> <div id="commentcontainer"></div>
</div>
</section>
<div id="serverdata" class="hidden" aria-hidden="true">
<div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
<?php
if ($DISCUSSION):
?>
<div id="templates">
<!-- @TODO: when I intend/structure this corrrectly Firefox adds whitespaces everywhere which completly destroy the layout. (same possible when you remove the template data below and show this area in the browser) -->
<article id="commenttemplate" class="comment"><div class="commentmeta"><span class="nickname">name</span><span class="commentdate">0000-00-00</span></div><div class="commentdata">c</div><button class="btn btn-default btn-sm"><?php echo I18n::_('Reply'); ?></button></article>
<div id="commenttailtemplate" class="comment"><button class="btn btn-default btn-sm"><?php echo I18n::_('Add comment'); ?></button></div>
<div id="replytemplate" class="reply hidden"><input type="text" id="nickname" class="form-control" title="<?php echo I18n::_('Optional nickname…'); ?>" placeholder="<?php echo I18n::_('Optional nickname…'); ?>" /><textarea id="replymessage" class="replymessage form-control" cols="80" rows="7"></textarea><br /><div id="replystatus" role="alert" class="statusmessage hidden alert"><span class="glyphicon" aria-hidden="true"></span> </div><button id="replybutton" class="btn btn-default btn-sm"><?php echo I18n::_('Post comment'); ?></button></div>
</div>
<?php
endif;
?>
</div>
<section class="container">
<div id="noscript" role="alert" class="nonworking alert alert-info noscript-hide"><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true">
<span> <?php echo I18n::_('Loading…'); ?></span><br>
<span class="small"><?php echo I18n::_('In case this message never disappears please have a look at <a href="https://github.com/PrivateBin/PrivateBin/wiki/FAQ#why-does-not-the-loading-message-go-away">this FAQ for information to troubleshoot</a>.'); ?></span>
</div> </div>
</section> </section>
<div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?></div>
</body> </body>
</html> </html>

View File

@ -36,12 +36,12 @@ class Helper
* @var array * @var array
*/ */
private static $paste = array( private static $paste = array(
'data' => '{"iv":"EN39/wd5Nk8HAiSG2K5AsQ","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"QKN1DBXe5PI","ct":"8hA83xDdXjD7K2qfmw5NdA"}', 'data' => '{"iv":"EN39/wd5Nk8HAiSG2K5AsQ","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"QKN1DBXe5PI","ct":"8hA83xDdXjD7K2qfmw5NdA"}',
'attachment' => '{"iv":"Pd4pOKWkmDTT9uPwVwd5Ag","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"6nOCU3peNDclDDpFtJEBKA"}', 'attachment' => '{"iv":"Pd4pOKWkmDTT9uPwVwd5Ag","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"6nOCU3peNDclDDpFtJEBKA"}',
'attachmentname' => '{"iv":"76MkAtOGC4oFogX/aSMxRA","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"b6Ae/U1xJdsX/+lATud4sQ"}', 'attachmentname' => '{"iv":"76MkAtOGC4oFogX/aSMxRA","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"b6Ae/U1xJdsX/+lATud4sQ"}',
'meta' => array( 'meta' => array(
'formatter' => 'plaintext', 'formatter' => 'plaintext',
'postdate' => 1344803344, 'postdate' => 1344803344,
'opendiscussion' => true, 'opendiscussion' => true,
), ),
); );
@ -62,7 +62,7 @@ class Helper
'data' => '{"iv":"Pd4pOKWkmDTT9uPwVwd5Ag","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"6nOCU3peNDclDDpFtJEBKA"}', 'data' => '{"iv":"Pd4pOKWkmDTT9uPwVwd5Ag","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"6nOCU3peNDclDDpFtJEBKA"}',
'meta' => array( 'meta' => array(
'nickname' => '{"iv":"76MkAtOGC4oFogX/aSMxRA","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"b6Ae/U1xJdsX/+lATud4sQ"}', 'nickname' => '{"iv":"76MkAtOGC4oFogX/aSMxRA","v":1,"iter":1000,"ks":128,"ts":64,"mode":"ccm","adata":"","cipher":"aes","salt":"ZIUhFTliVz4","ct":"b6Ae/U1xJdsX/+lATud4sQ"}',
'vizhash' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGUlEQVQokWOsl5/94983CNKQMjnxaOePf98MeKwPfNjkLZ3AgARab6b9+PeNEVnDj3/ff/z7ZiHnzsDA8Pv7H2TVPJw8EAYLAwb48OaVgIgYKycLsrYv378wMDB8//qdCVMDRA9EKSsnCwRBxNsepaLboMFlyMDAICAi9uHNK24GITQ/MDAwoNhgIGMLtwGrzegaLjw5jMz9+vUdnN17uwDCQDhJgk0O07yvX9+teDX1x79v6DYIsIjgcgMaYGFgYOBg4kJx2JejkAiBxAw+PzAwMNz4dp6wDXDw4MdNNOl0rWYsNkD89OLXI/xmo9sgzatJjAYmBgYGDiauD3/ePP18nVgb4MF89+M5ZX6js293wUMpnr8KTQMAxsCJnJ30apMAAAAASUVORK5CYII=', 'vizhash' => 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAABGUlEQVQokWOsl5/94983CNKQMjnxaOePf98MeKwPfNjkLZ3AgARab6b9+PeNEVnDj3/ff/z7ZiHnzsDA8Pv7H2TVPJw8EAYLAwb48OaVgIgYKycLsrYv378wMDB8//qdCVMDRA9EKSsnCwRBxNsepaLboMFlyMDAICAi9uHNK24GITQ/MDAwoNhgIGMLtwGrzegaLjw5jMz9+vUdnN17uwDCQDhJgk0O07yvX9+teDX1x79v6DYIsIjgcgMaYGFgYOBg4kJx2JejkAiBxAw+PzAwMNz4dp6wDXDw4MdNNOl0rWYsNkD89OLXI/xmo9sgzatJjAYmBgYGDiauD3/ePP18nVgb4MF89+M5ZX6js293wUMpnr8KTQMAxsCJnJ30apMAAAAASUVORK5CYII=',
'postdate' => 1344803528, 'postdate' => 1344803528,
), ),
); );
@ -103,9 +103,9 @@ class Helper
*/ */
public static function getPasteWithAttachment($meta = array()) public static function getPasteWithAttachment($meta = array())
{ {
$example = self::$paste; $example = self::$paste;
$example['meta']['salt'] = ServerSalt::generate(); $example['meta']['salt'] = ServerSalt::generate();
$example['meta'] = array_merge($example['meta'], $meta); $example['meta'] = array_merge($example['meta'], $meta);
return $example; return $example;
} }
@ -122,10 +122,10 @@ class Helper
if (count($meta)) { if (count($meta)) {
$example['meta'] = $meta; $example['meta'] = $meta;
} }
$example['comments'] = array(); $example['comments'] = array();
$example['comment_count'] = 0; $example['comment_count'] = 0;
$example['comment_offset'] = 0; $example['comment_offset'] = 0;
$example['@context'] = 'js/paste.jsonld'; $example['@context'] = 'js/paste.jsonld';
return json_encode($example); return json_encode($example);
} }
@ -146,7 +146,7 @@ class Helper
*/ */
public static function getComment($meta = array()) public static function getComment($meta = array())
{ {
$example = self::$comment; $example = self::$comment;
$example['meta'] = array_merge($example['meta'], $meta); $example['meta'] = array_merge($example['meta'], $meta);
return $example; return $example;
} }
@ -158,7 +158,7 @@ class Helper
*/ */
public static function getCommentPost($meta = array()) public static function getCommentPost($meta = array())
{ {
$example = self::getComment($meta); $example = self::getComment($meta);
$example['nickname'] = $example['meta']['nickname']; $example['nickname'] = $example['meta']['nickname'];
unset($example['meta']['nickname']); unset($example['meta']['nickname']);
return $example; return $example;

View File

@ -12,11 +12,11 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
{ {
/* Setup Routine */ /* Setup Routine */
Helper::confBackup(); Helper::confBackup();
$this->_options = configuration::getDefaults(); $this->_options = configuration::getDefaults();
$this->_options['model_options']['dir'] = PATH . $this->_options['model_options']['dir']; $this->_options['model_options']['dir'] = PATH . $this->_options['model_options']['dir'];
$this->_options['traffic']['dir'] = PATH . $this->_options['traffic']['dir']; $this->_options['traffic']['dir'] = PATH . $this->_options['traffic']['dir'];
$this->_options['purge']['dir'] = PATH . $this->_options['purge']['dir']; $this->_options['purge']['dir'] = PATH . $this->_options['purge']['dir'];
$this->_minimalConfig = '[main]' . PHP_EOL . '[model]' . PHP_EOL . '[model_options]'; $this->_minimalConfig = '[main]' . PHP_EOL . '[model]' . PHP_EOL . '[model_options]';
} }
public function tearDown() public function tearDown()
@ -94,19 +94,19 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
public function testHandleWrongTypes() public function testHandleWrongTypes()
{ {
$original_options = $this->_options; $original_options = $this->_options;
$original_options['main']['syntaxhighlightingtheme'] = 'foo'; $original_options['main']['syntaxhighlightingtheme'] = 'foo';
$options = $original_options; $options = $original_options;
$options['main']['discussion'] = 'true'; $options['main']['discussion'] = 'true';
$options['main']['opendiscussion'] = 0; $options['main']['opendiscussion'] = 0;
$options['main']['password'] = -1; // evaluates to TRUE $options['main']['password'] = -1; // evaluates to TRUE
$options['main']['fileupload'] = 'false'; $options['main']['fileupload'] = 'false';
$options['expire_options']['foo'] = 'bar'; $options['expire_options']['foo'] = 'bar';
$options['formatter_options'][] = 'foo'; $options['formatter_options'][] = 'foo';
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$conf = new Configuration; $conf = new Configuration;
$original_options['expire_options']['foo'] = intval('bar'); $original_options['expire_options']['foo'] = intval('bar');
$original_options['formatter_options'][0] = 'foo'; $original_options['formatter_options'][0] = 'foo';
$this->assertEquals($original_options, $conf->get(), 'incorrect types are corrected'); $this->assertEquals($original_options, $conf->get(), 'incorrect types are corrected');
} }
@ -117,14 +117,14 @@ class ConfigurationTest extends PHPUnit_Framework_TestCase
unset($options['expire_options']['1year']); unset($options['expire_options']['1year']);
unset($options['expire_options']['never']); unset($options['expire_options']['never']);
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$conf = new Configuration; $conf = new Configuration;
$options['expire']['default'] = '5min'; $options['expire']['default'] = '5min';
$this->assertEquals($options, $conf->get(), 'not overriding "missing" subkeys'); $this->assertEquals($options, $conf->get(), 'not overriding "missing" subkeys');
} }
public function testHandlePreRenameConfig() public function testHandlePreRenameConfig()
{ {
$options = $this->_options; $options = $this->_options;
$options['model']['class'] = 'zerobin_data'; $options['model']['class'] = 'zerobin_data';
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$conf = new Configuration; $conf = new Configuration;

View File

@ -9,7 +9,6 @@
* DANGER: Too many options/settings and too high max iteration setting may trigger * DANGER: Too many options/settings and too high max iteration setting may trigger
* a fork bomb. Please save your work before executing this script. * a fork bomb. Please save your work before executing this script.
*/ */
include 'Bootstrap.php'; include 'Bootstrap.php';
$vrd = array('view', 'read', 'delete'); $vrd = array('view', 'read', 'delete');
@ -19,85 +18,85 @@ new ConfigurationTestGenerator(array(
'main/discussion' => array( 'main/discussion' => array(
array( array(
'setting' => true, 'setting' => true,
'tests' => array( 'tests' => array(
array( array(
'conditions' => array('steps' => $vrd), 'conditions' => array('steps' => $vrd),
'type' => 'RegExp', 'type' => 'RegExp',
'args' => array( 'args' => array(
'#<div[^>]*id="opendisc"[^>]*>#', '#<div[^>]*id="opendisc"[^>]*>#',
'$content', '$content',
'outputs enabled discussion correctly' 'outputs enabled discussion correctly',
), ),
), array( ), array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 10), 'conditions' => array('steps' => array('create'), 'traffic/limit' => 10),
'settings' => array('$_POST["opendiscussion"] = "neither 1 nor 0"'), 'settings' => array('$_POST["opendiscussion"] = "neither 1 nor 0"'),
'type' => 'Equals', 'type' => 'Equals',
'args' => array( 'args' => array(
1, 1,
'$response["status"]', '$response["status"]',
'when discussions are enabled, but invalid flag posted, fail to create paste' 'when discussions are enabled, but invalid flag posted, fail to create paste',
), ),
), array( ), array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 10), 'conditions' => array('steps' => array('create'), 'traffic/limit' => 10),
'settings' => array('$_POST["opendiscussion"] = "neither 1 nor 0"'), 'settings' => array('$_POST["opendiscussion"] = "neither 1 nor 0"'),
'type' => 'False', 'type' => 'False',
'args' => array( 'args' => array(
'$this->_model->exists(Helper::getPasteId())', '$this->_model->exists(Helper::getPasteId())',
'when discussions are enabled, but invalid flag posted, paste is not created' 'when discussions are enabled, but invalid flag posted, paste is not created',
), ),
), ),
), ),
'affects' => $vcud 'affects' => $vcud,
), array( ), array(
'setting' => false, 'setting' => false,
'tests' => array( 'tests' => array(
array( array(
'type' => 'NotRegExp', 'type' => 'NotRegExp',
'args' => array( 'args' => array(
'#<div[^>]*id="opendisc"[^>]*>#', '#<div[^>]*id="opendisc"[^>]*>#',
'$content', '$content',
'outputs disabled discussion correctly' 'outputs disabled discussion correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), ),
), ),
'main/opendiscussion' => array( 'main/opendiscussion' => array(
array( array(
'setting' => true, 'setting' => true,
'tests' => array( 'tests' => array(
array( array(
'conditions' => array('main/discussion' => true), 'conditions' => array('main/discussion' => true),
'type' => 'RegExp', 'type' => 'RegExp',
'args' => array( 'args' => array(
'#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#', '#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
'$content', '$content',
'outputs checked discussion correctly' 'outputs checked discussion correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), array( ), array(
'setting' => false, 'setting' => false,
'tests' => array( 'tests' => array(
array( array(
'conditions' => array('main/discussion' => true), 'conditions' => array('main/discussion' => true),
'type' => 'NotRegExp', 'type' => 'NotRegExp',
'args' => array( 'args' => array(
'#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#', '#<input[^>]+id="opendiscussion"[^>]*checked="checked"[^>]*>#',
'$content', '$content',
'outputs unchecked discussion correctly' 'outputs unchecked discussion correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), ),
), ),
'main/burnafterreadingselected' => array( 'main/burnafterreadingselected' => array(
array( array(
'setting' => true, 'setting' => true,
'tests' => array( 'tests' => array(
array( array(
'type' => 'RegExp', 'type' => 'RegExp',
'args' => array( 'args' => array(
@ -110,7 +109,7 @@ new ConfigurationTestGenerator(array(
'affects' => array('view'), 'affects' => array('view'),
), array( ), array(
'setting' => false, 'setting' => false,
'tests' => array( 'tests' => array(
array( array(
'type' => 'NotRegExp', 'type' => 'NotRegExp',
'args' => array( 'args' => array(
@ -126,37 +125,37 @@ new ConfigurationTestGenerator(array(
'main/password' => array( 'main/password' => array(
array( array(
'setting' => true, 'setting' => true,
'tests' => array( 'tests' => array(
array( array(
'type' => 'RegExp', 'type' => 'RegExp',
'args' => array( 'args' => array(
'#<div[^>]*id="password"[^>]*>#', '#<div[^>]*id="password"[^>]*>#',
'$content', '$content',
'outputs password input correctly' 'outputs password input correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), array( ), array(
'setting' => false, 'setting' => false,
'tests' => array( 'tests' => array(
array( array(
'conditions' => array('main/discussion' => true), 'conditions' => array('main/discussion' => true),
'type' => 'NotRegExp', 'type' => 'NotRegExp',
'args' => array( 'args' => array(
'#<div[^>]*id="password"[^>]*>#', '#<div[^>]*id="password"[^>]*>#',
'$content', '$content',
'removes password input correctly' 'removes password input correctly',
), ),
), ),
), ),
'affects' => $vrd 'affects' => $vrd,
), ),
), ),
'main/template' => array( 'main/template' => array(
array( array(
'setting' => 'page', 'setting' => 'page',
'tests' => array( 'tests' => array(
array( array(
'type' => 'RegExp', 'type' => 'RegExp',
'args' => array( 'args' => array(
@ -176,7 +175,7 @@ new ConfigurationTestGenerator(array(
'affects' => $vrd, 'affects' => $vrd,
), array( ), array(
'setting' => 'bootstrap', 'setting' => 'bootstrap',
'tests' => array( 'tests' => array(
array( array(
'type' => 'NotRegExp', 'type' => 'NotRegExp',
'args' => array( 'args' => array(
@ -199,102 +198,102 @@ new ConfigurationTestGenerator(array(
'main/sizelimit' => array( 'main/sizelimit' => array(
array( array(
'setting' => 10, 'setting' => 10,
'tests' => array( 'tests' => array(
array( array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 10), 'conditions' => array('steps' => array('create'), 'traffic/limit' => 10),
'type' => 'Equals', 'type' => 'Equals',
'args' => array( 'args' => array(
1, 1,
'$response["status"]', '$response["status"]',
'when sizelimit limit exceeded, fail to create paste' 'when sizelimit limit exceeded, fail to create paste',
), ),
), ),
), ),
'affects' => array('create') 'affects' => array('create'),
), array( ), array(
'setting' => 2097152, 'setting' => 2097152,
'tests' => array( 'tests' => array(
array( array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true), 'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true),
'settings' => array('sleep(3)'), 'settings' => array('sleep(3)'),
'type' => 'Equals', 'type' => 'Equals',
'args' => array( 'args' => array(
0, 0,
'$response["status"]', '$response["status"]',
'when sizelimit limit is not reached, successfully create paste' 'when sizelimit limit is not reached, successfully create paste',
), ),
), array( ), array(
'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true), 'conditions' => array('steps' => array('create'), 'traffic/limit' => 0, 'main/burnafterreadingselected' => true),
'settings' => array('sleep(3)'), 'settings' => array('sleep(3)'),
'type' => 'True', 'type' => 'True',
'args' => array( 'args' => array(
'$this->_model->exists($response["id"])', '$this->_model->exists($response["id"])',
'when sizelimit limit is not reached, paste exists after posting data' 'when sizelimit limit is not reached, paste exists after posting data',
), ),
), ),
), ),
'affects' => array('create') 'affects' => array('create'),
), ),
), ),
'traffic/limit' => array( 'traffic/limit' => array(
array( array(
'setting' => 0, 'setting' => 0,
'tests' => array( 'tests' => array(
array( array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152), 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
'type' => 'Equals', 'type' => 'Equals',
'args' => array( 'args' => array(
0, 0,
'$response["status"]', '$response["status"]',
'when traffic limit is disabled, successfully create paste' 'when traffic limit is disabled, successfully create paste',
), ),
), array( ), array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152), 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
'type' => 'True', 'type' => 'True',
'args' => array( 'args' => array(
'$this->_model->exists($response["id"])', '$this->_model->exists($response["id"])',
'when traffic limit is disabled, paste exists after posting data' 'when traffic limit is disabled, paste exists after posting data',
), ),
), ),
), ),
'affects' => array('create') 'affects' => array('create'),
), array( ), array(
'setting' => 10, 'setting' => 10,
'tests' => array( 'tests' => array(
array( array(
'conditions' => array('steps' => array('create')), 'conditions' => array('steps' => array('create')),
'type' => 'Equals', 'type' => 'Equals',
'args' => array( 'args' => array(
1, 1,
'$response["status"]', '$response["status"]',
'when traffic limit is on and we do not wait, fail to create paste' 'when traffic limit is on and we do not wait, fail to create paste',
), ),
), ),
), ),
'affects' => array('create') 'affects' => array('create'),
), array( ), array(
'setting' => 2, 'setting' => 2,
'tests' => array( 'tests' => array(
array( array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152), 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
'settings' => array('sleep(3)'), 'settings' => array('sleep(3)'),
'type' => 'Equals', 'type' => 'Equals',
'args' => array( 'args' => array(
0, 0,
'$response["status"]', '$response["status"]',
'when traffic limit is on and we wait, successfully create paste' 'when traffic limit is on and we wait, successfully create paste',
), ),
), array( ), array(
'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152), 'conditions' => array('steps' => array('create'), 'main/sizelimit' => 2097152),
'settings' => array('sleep(3)'), 'settings' => array('sleep(3)'),
'type' => 'True', 'type' => 'True',
'args' => array( 'args' => array(
'$this->_model->exists($response["id"])', '$this->_model->exists($response["id"])',
'when traffic limit is on and we wait, paste exists after posting data' 'when traffic limit is on and we wait, paste exists after posting data',
), ),
), ),
), ),
'affects' => array('create') 'affects' => array('create'),
), ),
), ),
)); ));
@ -325,7 +324,7 @@ class ConfigurationTestGenerator
* @var array * @var array
*/ */
private $_configurations = array( private $_configurations = array(
array('options' => array(), 'tests' => array(), 'affects' => array()) array('options' => array(), 'tests' => array(), 'affects' => array()),
); );
/** /**
@ -346,10 +345,10 @@ class ConfigurationTestGenerator
private function _writeConfigurationTest() private function _writeConfigurationTest()
{ {
$defaultOptions = parse_ini_file(CONF, true); $defaultOptions = parse_ini_file(CONF, true);
$code = $this->_getHeader(); $code = $this->_getHeader();
foreach ($this->_configurations as $key => $conf) { foreach ($this->_configurations as $key => $conf) {
$fullOptions = array_replace_recursive($defaultOptions, $conf['options']); $fullOptions = array_replace_recursive($defaultOptions, $conf['options']);
$options = Helper::varExportMin($fullOptions, true); $options = Helper::varExportMin($fullOptions, true);
foreach ($conf['affects'] as $step) { foreach ($conf['affects'] as $step) {
$testCode = $preCode = array(); $testCode = $preCode = array();
foreach ($conf['tests'] as $tests) { foreach ($conf['tests'] as $tests) {
@ -470,7 +469,7 @@ EOT;
private function _getFunction($step, $key, &$options, $preCode, $testCode) private function _getFunction($step, $key, &$options, $preCode, $testCode)
{ {
if (count($testCode) == 0) { if (count($testCode) == 0) {
echo "skipping creation of test$step$key, no valid tests found for configuration: $options". PHP_EOL; echo "skipping creation of test$step$key, no valid tests found for configuration: $options" . PHP_EOL;
return ''; return '';
} }
@ -593,7 +592,7 @@ EOT;
// create clones for each of the other settings // create clones for each of the other settings
while ($setting = next($settings)) { while ($setting = next($settings)) {
$clone = $this->_configurations[$c]; $clone = $this->_configurations[$c];
$this->_configurations[] = $this->_addSetting($clone, $setting, $section, $option); $this->_configurations[] = $this->_addSetting($clone, $setting, $section, $option);
} }
reset($settings); reset($settings);
@ -626,7 +625,7 @@ EOT;
throw new Exception("Endless loop or error in options detected: option '$option' already exists with setting '$val' in one of the configurations!"); throw new Exception("Endless loop or error in options detected: option '$option' already exists with setting '$val' in one of the configurations!");
} }
$configuration['options'][$section][$option] = $setting['setting']; $configuration['options'][$section][$option] = $setting['setting'];
$configuration['tests'][$option] = array($setting['tests'], $setting['affects']); $configuration['tests'][$option] = array($setting['tests'], $setting['affects']);
foreach ($setting['affects'] as $affects) { foreach ($setting['affects'] as $affects) {
if (!in_array($affects, $configuration['affects'])) { if (!in_array($affects, $configuration['affects'])) {
$configuration['affects'][] = $affects; $configuration['affects'][] = $affects;

View File

@ -19,7 +19,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
/* Setup Routine */ /* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = Database::getInstance($this->_options); $this->_model = Database::getInstance($this->_options);
} }
@ -47,8 +47,8 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
$this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment does not yet exist'); $this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment does not yet exist');
$this->assertTrue($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment()) !== false, 'store comment'); $this->assertTrue($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment()) !== false, 'store comment');
$this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists after storing it'); $this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists after storing it');
$comment = json_decode(json_encode(Helper::getComment())); $comment = json_decode(json_encode(Helper::getComment()));
$comment->id = Helper::getCommentId(); $comment->id = Helper::getCommentId();
$comment->parentid = Helper::getPasteId(); $comment->parentid = Helper::getPasteId();
$this->assertEquals( $this->assertEquals(
array($comment->meta->postdate => $comment), array($comment->meta->postdate => $comment),
@ -65,10 +65,10 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
public function testDatabaseBasedAttachmentStoreWorks() public function testDatabaseBasedAttachmentStoreWorks()
{ {
$this->_model->delete(Helper::getPasteId()); $this->_model->delete(Helper::getPasteId());
$original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344)); $original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344));
$paste['meta']['burnafterreading'] = $original['meta']['burnafterreading'] = true; $paste['meta']['burnafterreading'] = $original['meta']['burnafterreading'] = true;
$paste['meta']['attachment'] = $paste['attachment']; $paste['meta']['attachment'] = $paste['attachment'];
$paste['meta']['attachmentname'] = $paste['attachmentname']; $paste['meta']['attachmentname'] = $paste['attachmentname'];
unset($paste['attachment'], $paste['attachmentname']); unset($paste['attachment'], $paste['attachmentname']);
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not yet exist'); $this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not yet exist');
$this->assertTrue($this->_model->create(Helper::getPasteId(), $paste), 'store new paste'); $this->assertTrue($this->_model->create(Helper::getPasteId(), $paste), 'store new paste');
@ -77,19 +77,24 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
$this->assertEquals(json_decode(json_encode($original)), $this->_model->read(Helper::getPasteId())); $this->assertEquals(json_decode(json_encode($original)), $this->_model->read(Helper::getPasteId()));
} }
/**
* pastes a-g are expired and should get deleted, x never expires and y-z expire in an hour
*/
public function testPurge() public function testPurge()
{ {
$this->_model->delete(Helper::getPasteId()); $this->_model->delete(Helper::getPasteId());
$expired = Helper::getPaste(array('expire_date' => 1344803344)); $expired = Helper::getPaste(array('expire_date' => 1344803344));
$paste = Helper::getPaste(array('expire_date' => time() + 3600)); $paste = Helper::getPaste(array('expire_date' => time() + 3600));
$keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z'); $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'x', 'y', 'z');
$ids = array(); $ids = array();
foreach ($keys as $key) { foreach ($keys as $key) {
$ids[$key] = substr(md5($key), 0, 16); $ids[$key] = substr(md5($key), 0, 16);
$this->_model->delete($ids[$key]); $this->_model->delete($ids[$key]);
$this->assertFalse($this->_model->exists($ids[$key]), "paste $key does not yet exist"); $this->assertFalse($this->_model->exists($ids[$key]), "paste $key does not yet exist");
if (in_array($key, array('x', 'y', 'z'))) { if (in_array($key, array('y', 'z'))) {
$this->assertTrue($this->_model->create($ids[$key], $paste), "store $key paste"); $this->assertTrue($this->_model->create($ids[$key], $paste), "store $key paste");
} elseif ($key === 'x') {
$this->assertTrue($this->_model->create($ids[$key], Helper::getPaste()), "store $key paste");
} else { } else {
$this->assertTrue($this->_model->create($ids[$key], $expired), "store $key paste"); $this->assertTrue($this->_model->create($ids[$key], $expired), "store $key paste");
} }
@ -113,7 +118,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
Database::getInstance(array( Database::getInstance(array(
'dsn' => 'ibm:', 'usr' => null, 'pwd' => null, 'dsn' => 'ibm:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
)); ));
} }
@ -124,7 +129,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
Database::getInstance(array( Database::getInstance(array(
'dsn' => 'informix:', 'usr' => null, 'pwd' => null, 'dsn' => 'informix:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
)); ));
} }
@ -135,7 +140,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
Database::getInstance(array( Database::getInstance(array(
'dsn' => 'mssql:', 'usr' => null, 'pwd' => null, 'dsn' => 'mssql:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
)); ));
} }
@ -146,7 +151,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
Database::getInstance(array( Database::getInstance(array(
'dsn' => 'mysql:', 'usr' => null, 'pwd' => null, 'dsn' => 'mysql:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
)); ));
} }
@ -157,7 +162,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
Database::getInstance(array( Database::getInstance(array(
'dsn' => 'oci:', 'usr' => null, 'pwd' => null, 'dsn' => 'oci:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
)); ));
} }
@ -168,7 +173,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
Database::getInstance(array( Database::getInstance(array(
'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null, 'dsn' => 'pgsql:', 'usr' => null, 'pwd' => null,
'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION) 'opt' => array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION),
)); ));
} }
@ -179,7 +184,7 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
public function testGetFooInstance() public function testGetFooInstance()
{ {
Database::getInstance(array( Database::getInstance(array(
'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null 'dsn' => 'foo:', 'usr' => null, 'pwd' => null, 'opt' => null,
)); ));
} }
@ -231,13 +236,15 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
mkdir($this->_path); mkdir($this->_path);
$path = $this->_path . DIRECTORY_SEPARATOR . 'attachement-test.sq3'; $path = $this->_path . DIRECTORY_SEPARATOR . 'attachement-test.sq3';
if (is_file($path)) unlink($path); if (is_file($path)) {
unlink($path);
}
$this->_options['dsn'] = 'sqlite:' . $path; $this->_options['dsn'] = 'sqlite:' . $path;
$this->_options['tbl'] = 'bar_'; $this->_options['tbl'] = 'bar_';
$model = Database::getInstance($this->_options); $model = Database::getInstance($this->_options);
$original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344)); $original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344));
$paste['meta']['attachment'] = $paste['attachment']; $paste['meta']['attachment'] = $paste['attachment'];
$paste['meta']['attachmentname'] = $paste['attachmentname']; $paste['meta']['attachmentname'] = $paste['attachmentname'];
unset($paste['attachment'], $paste['attachmentname']); unset($paste['attachment'], $paste['attachmentname']);
$meta = $paste['meta']; $meta = $paste['meta'];
@ -274,10 +281,12 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
{ {
mkdir($this->_path); mkdir($this->_path);
$path = $this->_path . DIRECTORY_SEPARATOR . 'db-test.sq3'; $path = $this->_path . DIRECTORY_SEPARATOR . 'db-test.sq3';
if (is_file($path)) unlink($path); if (is_file($path)) {
unlink($path);
}
$this->_options['dsn'] = 'sqlite:' . $path; $this->_options['dsn'] = 'sqlite:' . $path;
$this->_options['tbl'] = 'foo_'; $this->_options['tbl'] = 'foo_';
$db = new PDO( $db = new PDO(
$this->_options['dsn'], $this->_options['dsn'],
$this->_options['usr'], $this->_options['usr'],
$this->_options['pwd'], $this->_options['pwd'],
@ -294,13 +303,13 @@ class DatabaseTest extends PHPUnit_Framework_TestCase
); );
$db->exec( $db->exec(
'CREATE TABLE foo_comment ( ' . 'CREATE TABLE foo_comment ( ' .
"dataid CHAR(16) NOT NULL, " . 'dataid CHAR(16) NOT NULL, ' .
'pasteid CHAR(16), ' . 'pasteid CHAR(16), ' .
'parentid CHAR(16), ' . 'parentid CHAR(16), ' .
'data BLOB, ' . 'data BLOB, ' .
'nickname BLOB, ' . 'nickname BLOB, ' .
'vizhash BLOB, ' . 'vizhash BLOB, ' .
"postdate INT );" 'postdate INT );'
); );
$this->assertInstanceOf(Database::class, Database::getInstance($this->_options)); $this->assertInstanceOf(Database::class, Database::getInstance($this->_options));

View File

@ -11,7 +11,7 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
/* Setup Routine */ /* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = Filesystem::getInstance(array('dir' => $this->_path)); $this->_model = Filesystem::getInstance(array('dir' => $this->_path));
} }
@ -37,8 +37,8 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
$this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment does not yet exist'); $this->assertFalse($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment does not yet exist');
$this->assertTrue($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment()), 'store comment'); $this->assertTrue($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment()), 'store comment');
$this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists after storing it'); $this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists after storing it');
$comment = json_decode(json_encode(Helper::getComment())); $comment = json_decode(json_encode(Helper::getComment()));
$comment->id = Helper::getCommentId(); $comment->id = Helper::getCommentId();
$comment->parentid = Helper::getPasteId(); $comment->parentid = Helper::getPasteId();
$this->assertEquals( $this->assertEquals(
array($comment->meta->postdate => $comment), array($comment->meta->postdate => $comment),
@ -55,8 +55,8 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
public function testFileBasedAttachmentStoreWorks() public function testFileBasedAttachmentStoreWorks()
{ {
$this->_model->delete(Helper::getPasteId()); $this->_model->delete(Helper::getPasteId());
$original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344)); $original = $paste = Helper::getPasteWithAttachment(array('expire_date' => 1344803344));
$paste['meta']['attachment'] = $paste['attachment']; $paste['meta']['attachment'] = $paste['attachment'];
$paste['meta']['attachmentname'] = $paste['attachmentname']; $paste['meta']['attachmentname'] = $paste['attachmentname'];
unset($paste['attachment'], $paste['attachmentname']); unset($paste['attachment'], $paste['attachmentname']);
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not yet exist'); $this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not yet exist');
@ -66,18 +66,23 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
$this->assertEquals(json_decode(json_encode($original)), $this->_model->read(Helper::getPasteId())); $this->assertEquals(json_decode(json_encode($original)), $this->_model->read(Helper::getPasteId()));
} }
/**
* pastes a-g are expired and should get deleted, x never expires and y-z expire in an hour
*/
public function testPurge() public function testPurge()
{ {
mkdir($this->_path . DIRECTORY_SEPARATOR . '00', 0777, true); mkdir($this->_path . DIRECTORY_SEPARATOR . '00', 0777, true);
$expired = Helper::getPaste(array('expire_date' => 1344803344)); $expired = Helper::getPaste(array('expire_date' => 1344803344));
$paste = Helper::getPaste(array('expire_date' => time() + 3600)); $paste = Helper::getPaste(array('expire_date' => time() + 3600));
$keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z'); $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'x', 'y', 'z');
$ids = array(); $ids = array();
foreach ($keys as $key) { foreach ($keys as $key) {
$ids[$key] = substr(md5($key), 0, 16); $ids[$key] = substr(md5($key), 0, 16);
$this->assertFalse($this->_model->exists($ids[$key]), "paste $key does not yet exist"); $this->assertFalse($this->_model->exists($ids[$key]), "paste $key does not yet exist");
if (in_array($key, array('x', 'y', 'z'))) { if (in_array($key, array('x', 'y', 'z'))) {
$this->assertTrue($this->_model->create($ids[$key], $paste), "store $key paste"); $this->assertTrue($this->_model->create($ids[$key], $paste), "store $key paste");
} elseif ($key === 'x') {
$this->assertTrue($this->_model->create($ids[$key], Helper::getPaste()), "store $key paste");
} else { } else {
$this->assertTrue($this->_model->create($ids[$key], $expired), "store $key paste"); $this->assertTrue($this->_model->create($ids[$key], $expired), "store $key paste");
} }

View File

@ -4,14 +4,6 @@ use PrivateBin\Filter;
class FilterTest extends PHPUnit_Framework_TestCase class FilterTest extends PHPUnit_Framework_TestCase
{ {
public function testFilterStripsSlashesDeeply()
{
$this->assertEquals(
array("f'oo", "b'ar", array("fo'o", "b'ar")),
Filter::stripslashesDeep(array("f\\'oo", "b\\'ar", array("fo\\'o", "b\\'ar")))
);
}
public function testFilterMakesTimesHumanlyReadable() public function testFilterMakesTimesHumanlyReadable()
{ {
$this->assertEquals('5 minutes', Filter::formatHumanReadableTime('5min')); $this->assertEquals('5 minutes', Filter::formatHumanReadableTime('5min'));

View File

@ -23,7 +23,7 @@ class I18nTest extends PHPUnit_Framework_TestCase
public function testTranslationFallback() public function testTranslationFallback()
{ {
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'foobar'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'foobar';
$messageId = 'It does not matter if the message ID exists'; $messageId = 'It does not matter if the message ID exists';
I18n::loadTranslations(); I18n::loadTranslations();
$this->assertEquals($messageId, I18n::_($messageId), 'fallback to en'); $this->assertEquals($messageId, I18n::_($messageId), 'fallback to en');
} }
@ -33,9 +33,9 @@ class I18nTest extends PHPUnit_Framework_TestCase
$_COOKIE['lang'] = 'de'; $_COOKIE['lang'] = 'de';
I18n::loadTranslations(); I18n::loadTranslations();
$this->assertEquals($this->_translations['en'], I18n::_('en'), 'browser language de'); $this->assertEquals($this->_translations['en'], I18n::_('en'), 'browser language de');
$this->assertEquals('0 Stunden', I18n::_('%d hours', 0), '0 hours in german'); $this->assertEquals('0 Stunden', I18n::_('%d hours', 0), '0 hours in German');
$this->assertEquals('1 Stunde', I18n::_('%d hours', 1), '1 hour in german'); $this->assertEquals('1 Stunde', I18n::_('%d hours', 1), '1 hour in German');
$this->assertEquals('2 Stunden', I18n::_('%d hours', 2), '2 hours in french'); $this->assertEquals('2 Stunden', I18n::_('%d hours', 2), '2 hours in German');
} }
public function testBrowserLanguageDeDetection() public function testBrowserLanguageDeDetection()
@ -43,9 +43,9 @@ class I18nTest extends PHPUnit_Framework_TestCase
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-CH,de;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'de-CH,de;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations(); I18n::loadTranslations();
$this->assertEquals($this->_translations['en'], I18n::_('en'), 'browser language de'); $this->assertEquals($this->_translations['en'], I18n::_('en'), 'browser language de');
$this->assertEquals('0 Stunden', I18n::_('%d hours', 0), '0 hours in german'); $this->assertEquals('0 Stunden', I18n::_('%d hours', 0), '0 hours in German');
$this->assertEquals('1 Stunde', I18n::_('%d hours', 1), '1 hour in german'); $this->assertEquals('1 Stunde', I18n::_('%d hours', 1), '1 hour in German');
$this->assertEquals('2 Stunden', I18n::_('%d hours', 2), '2 hours in french'); $this->assertEquals('2 Stunden', I18n::_('%d hours', 2), '2 hours in German');
} }
public function testBrowserLanguageFrDetection() public function testBrowserLanguageFrDetection()
@ -53,9 +53,39 @@ class I18nTest extends PHPUnit_Framework_TestCase
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr-CH,fr;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'fr-CH,fr;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations(); I18n::loadTranslations();
$this->assertEquals('fr', I18n::_('en'), 'browser language fr'); $this->assertEquals('fr', I18n::_('en'), 'browser language fr');
$this->assertEquals('0 heure', I18n::_('%d hours', 0), '0 hours in french'); $this->assertEquals('0 heure', I18n::_('%d hours', 0), '0 hours in French');
$this->assertEquals('1 heure', I18n::_('%d hours', 1), '1 hour in french'); $this->assertEquals('1 heure', I18n::_('%d hours', 1), '1 hour in French');
$this->assertEquals('2 heures', I18n::_('%d hours', 2), '2 hours in french'); $this->assertEquals('2 heures', I18n::_('%d hours', 2), '2 hours in French');
}
public function testBrowserLanguageNoDetection()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'no;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations();
$this->assertEquals('no', I18n::_('en'), 'browser language no');
$this->assertEquals('0 timer', I18n::_('%d hours', 0), '0 hours in Norwegian');
$this->assertEquals('1 time', I18n::_('%d hours', 1), '1 hour in Norwegian');
$this->assertEquals('2 timer', I18n::_('%d hours', 2), '2 hours in Norwegian');
}
public function testBrowserLanguageOcDetection()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'oc;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations();
$this->assertEquals('oc', I18n::_('en'), 'browser language oc');
$this->assertEquals('0 ora', I18n::_('%d hours', 0), '0 hours in Occitan');
$this->assertEquals('1 ora', I18n::_('%d hours', 1), '1 hour in Occitan');
$this->assertEquals('2 oras', I18n::_('%d hours', 2), '2 hours in Occitan');
}
public function testBrowserLanguageZhDetection()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'zh;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations();
$this->assertEquals('zh', I18n::_('en'), 'browser language zh');
$this->assertEquals('0 小时', I18n::_('%d hours', 0), '0 hours in Chinese');
$this->assertEquals('1 小时', I18n::_('%d hours', 1), '1 hour in Chinese');
$this->assertEquals('2 小时', I18n::_('%d hours', 2), '2 hours in Chinese');
} }
public function testBrowserLanguagePlDetection() public function testBrowserLanguagePlDetection()
@ -63,7 +93,40 @@ class I18nTest extends PHPUnit_Framework_TestCase
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'pl;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2'; $_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'pl;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations(); I18n::loadTranslations();
$this->assertEquals('pl', I18n::_('en'), 'browser language pl'); $this->assertEquals('pl', I18n::_('en'), 'browser language pl');
$this->assertEquals('2 godzina', I18n::_('%d hours', 2), 'hours in polish'); $this->assertEquals('1 godzina', I18n::_('%d hours', 1), '1 hour in Polish');
$this->assertEquals('2 godzina', I18n::_('%d hours', 2), '2 hours in Polish');
$this->assertEquals('12 godzinę', I18n::_('%d hours', 12), '12 hours in Polish');
$this->assertEquals('22 godzina', I18n::_('%d hours', 22), '22 hours in Polish');
$this->assertEquals('1 minut', I18n::_('%d minutes', 1), '1 minute in Polish');
$this->assertEquals('3 minut', I18n::_('%d minutes', 3), '3 minutes in Polish');
$this->assertEquals('13 minut', I18n::_('%d minutes', 13), '13 minutes in Polish');
$this->assertEquals('23 minut', I18n::_('%d minutes', 23), '23 minutes in Polish');
}
public function testBrowserLanguageRuDetection()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'ru;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations();
$this->assertEquals('ru', I18n::_('en'), 'browser language ru');
$this->assertEquals('1 минуту', I18n::_('%d minutes', 1), '1 minute in Russian');
$this->assertEquals('3 минуты', I18n::_('%d minutes', 3), '3 minutes in Russian');
$this->assertEquals('10 минут', I18n::_('%d minutes', 10), '10 minutes in Russian');
$this->assertEquals('21 минуту', I18n::_('%d minutes', 21), '21 minutes in Russian');
}
public function testBrowserLanguageSlDetection()
{
$_SERVER['HTTP_ACCEPT_LANGUAGE'] = 'sl;q=0.8,en-GB;q=0.6,en-US;q=0.4,en;q=0.2';
I18n::loadTranslations();
$this->assertEquals('sl', I18n::_('en'), 'browser language sl');
$this->assertEquals('0 ura', I18n::_('%d hours', 0), '0 hours in Slowene');
$this->assertEquals('1 uri', I18n::_('%d hours', 1), '1 hour in Slowene');
$this->assertEquals('2 ure', I18n::_('%d hours', 2), '2 hours in Slowene');
$this->assertEquals('3 ur', I18n::_('%d hours', 3), '3 hours in Slowene');
$this->assertEquals('11 ura', I18n::_('%d hours', 11), '11 hours in Slowene');
$this->assertEquals('101 uri', I18n::_('%d hours', 101), '101 hours in Slowene');
$this->assertEquals('102 ure', I18n::_('%d hours', 102), '102 hours in Slowene');
$this->assertEquals('104 ur', I18n::_('%d hours', 104), '104 hours in Slowene');
} }
public function testBrowserLanguageAnyDetection() public function testBrowserLanguageAnyDetection()

View File

@ -1,9 +1,9 @@
<?php <?php
use PrivateBin\Data\Filesystem; use PrivateBin\Data\Filesystem;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\PrivateBin; use PrivateBin\PrivateBin;
use PrivateBin\Request; use PrivateBin\Request;
use PrivateBin\Persistence\ServerSalt;
class JsonApiTest extends PHPUnit_Framework_TestCase class JsonApiTest extends PHPUnit_Framework_TestCase
{ {
@ -15,7 +15,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
{ {
/* Setup Routine */ /* Setup Routine */
Helper::confBackup(); Helper::confBackup();
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = Filesystem::getInstance(array('dir' => $this->_path)); $this->_model = Filesystem::getInstance(array('dir' => $this->_path));
ServerSalt::setPath($this->_path); ServerSalt::setPath($this->_path);
$this->reset(); $this->reset();
@ -30,16 +30,16 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
public function reset() public function reset()
{ {
$_POST = array(); $_POST = array();
$_GET = array(); $_GET = array();
$_SERVER = array(); $_SERVER = array();
if ($this->_model->exists(Helper::getPasteId())) { if ($this->_model->exists(Helper::getPasteId())) {
$this->_model->delete(Helper::getPasteId()); $this->_model->delete(Helper::getPasteId());
} }
Helper::confRestore(); Helper::confRestore();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['purge']['dir'] = $this->_path; $options['purge']['dir'] = $this->_path;
$options['traffic']['dir'] = $this->_path; $options['traffic']['dir'] = $this->_path;
$options['model_options']['dir'] = $this->_path; $options['model_options']['dir'] = $this->_path;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
@ -51,14 +51,14 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
public function testCreate() public function testCreate()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -81,7 +81,7 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
public function testPut() public function testPut()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
@ -90,10 +90,10 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
$file = tempnam(sys_get_temp_dir(), 'FOO'); $file = tempnam(sys_get_temp_dir(), 'FOO');
file_put_contents($file, http_build_query($paste)); file_put_contents($file, http_build_query($paste));
Request::setInputStream($file); Request::setInputStream($file);
$_SERVER['QUERY_STRING'] = Helper::getPasteId(); $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'PUT'; $_SERVER['REQUEST_METHOD'] = 'PUT';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -120,14 +120,14 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
$this->_model->create(Helper::getPasteId(), Helper::getPaste()); $this->_model->create(Helper::getPasteId(), Helper::getPaste());
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data'); $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
$paste = $this->_model->read(Helper::getPasteId()); $paste = $this->_model->read(Helper::getPasteId());
$file = tempnam(sys_get_temp_dir(), 'FOO'); $file = tempnam(sys_get_temp_dir(), 'FOO');
file_put_contents($file, http_build_query(array( file_put_contents($file, http_build_query(array(
'deletetoken' => hash_hmac('sha256', Helper::getPasteId(), $paste->meta->salt), 'deletetoken' => hash_hmac('sha256', Helper::getPasteId(), $paste->meta->salt),
))); )));
Request::setInputStream($file); Request::setInputStream($file);
$_SERVER['QUERY_STRING'] = Helper::getPasteId(); $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_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 PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -147,12 +147,11 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data'); $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
$paste = $this->_model->read(Helper::getPasteId()); $paste = $this->_model->read(Helper::getPasteId());
$_POST = array( $_POST = array(
'action' => 'delete', 'pasteid' => Helper::getPasteId(),
'deletetoken' => hash_hmac('sha256', Helper::getPasteId(), $paste->meta->salt), 'deletetoken' => hash_hmac('sha256', Helper::getPasteId(), $paste->meta->salt),
); );
$_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_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 PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -168,13 +167,13 @@ class JsonApiTest extends PHPUnit_Framework_TestCase
public function testRead() public function testRead()
{ {
$this->reset(); $this->reset();
$paste = Helper::getPasteWithAttachment(); $paste = Helper::getPasteWithAttachment();
$paste['meta']['attachment'] = $paste['attachment']; $paste['meta']['attachment'] = $paste['attachment'];
$paste['meta']['attachmentname'] = $paste['attachmentname']; $paste['meta']['attachmentname'] = $paste['attachmentname'];
unset($paste['attachment']); unset($paste['attachment']);
unset($paste['attachmentname']); unset($paste['attachmentname']);
$this->_model->create(Helper::getPasteId(), $paste); $this->_model->create(Helper::getPasteId(), $paste);
$_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 PrivateBin;

View File

@ -1,5 +1,6 @@
<?php <?php
use Identicon\Identicon;
use PrivateBin\Configuration; use PrivateBin\Configuration;
use PrivateBin\Data\Database; use PrivateBin\Data\Database;
use PrivateBin\Model; use PrivateBin\Model;
@ -7,7 +8,6 @@ use PrivateBin\Model\Paste;
use PrivateBin\Persistence\ServerSalt; use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter; use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Vizhash16x16; use PrivateBin\Vizhash16x16;
use Identicon\Identicon;
class ModelTest extends PHPUnit_Framework_TestCase class ModelTest extends PHPUnit_Framework_TestCase
{ {
@ -22,11 +22,13 @@ class ModelTest extends PHPUnit_Framework_TestCase
/* Setup Routine */ /* Setup Routine */
Helper::confRestore(); Helper::confRestore();
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
if (!is_dir($this->_path)) mkdir($this->_path); if (!is_dir($this->_path)) {
mkdir($this->_path);
}
ServerSalt::setPath($this->_path); ServerSalt::setPath($this->_path);
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['purge']['limit'] = 0; $options['purge']['limit'] = 0;
$options['model'] = array( $options['model'] = array(
'class' => 'Database', 'class' => 'Database',
); );
$options['model_options'] = array( $options['model_options'] = array(
@ -37,8 +39,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
); );
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$this->_conf = new Configuration; $this->_conf = new Configuration;
$this->_model = new Model($this->_conf); $this->_model = new Model($this->_conf);
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
} }
@ -73,8 +75,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
// storing comments // storing comments
$commentData = Helper::getComment(); $commentData = Helper::getComment();
$paste = $this->_model->getPaste(Helper::getPasteId()); $paste = $this->_model->getPaste(Helper::getPasteId());
$comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId()); $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId());
$this->assertFalse($comment->exists(), 'comment does not yet exist'); $this->assertFalse($comment->exists(), 'comment does not yet exist');
$comment = $paste->getComment(Helper::getPasteId()); $comment = $paste->getComment(Helper::getPasteId());
@ -123,7 +125,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
*/ */
public function testCommentDuplicate() public function testCommentDuplicate()
{ {
$pasteData = Helper::getPaste(); $pasteData = Helper::getPaste();
$commentData = Helper::getComment(); $commentData = Helper::getComment();
$this->_model->getPaste(Helper::getPasteId())->delete(); $this->_model->getPaste(Helper::getPasteId())->delete();
@ -146,7 +148,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
public function testImplicitDefaults() public function testImplicitDefaults()
{ {
$pasteData = Helper::getPaste(); $pasteData = Helper::getPaste();
$commentData = Helper::getComment(); $commentData = Helper::getComment();
$this->_model->getPaste(Helper::getPasteId())->delete(); $this->_model->getPaste(Helper::getPasteId())->delete();
@ -175,8 +177,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
$comment->store(); $comment->store();
$identicon = new Identicon(); $identicon = new Identicon();
$pngdata = $identicon->getImageDataUri(TrafficLimiter::getHash(), 16); $pngdata = $identicon->getImageDataUri(TrafficLimiter::getHash(), 16);
$comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get(); $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get();
$this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set'); $this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set');
} }
@ -230,13 +232,13 @@ class ModelTest extends PHPUnit_Framework_TestCase
public function testPurge() public function testPurge()
{ {
$conf = new Configuration; $conf = new Configuration;
$store = Database::getInstance($conf->getSection('model_options')); $store = Database::getInstance($conf->getSection('model_options'));
$store->delete(Helper::getPasteId()); $store->delete(Helper::getPasteId());
$expired = Helper::getPaste(array('expire_date' => 1344803344)); $expired = Helper::getPaste(array('expire_date' => 1344803344));
$paste = Helper::getPaste(array('expire_date' => time() + 3600)); $paste = Helper::getPaste(array('expire_date' => time() + 3600));
$keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z'); $keys = array('a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'x', 'y', 'z');
$ids = array(); $ids = array();
foreach ($keys as $key) { foreach ($keys as $key) {
$ids[$key] = substr(md5($key), 0, 16); $ids[$key] = substr(md5($key), 0, 16);
$store->delete($ids[$key]); $store->delete($ids[$key]);
@ -261,9 +263,9 @@ class ModelTest extends PHPUnit_Framework_TestCase
public function testCommentWithDisabledVizhash() public function testCommentWithDisabledVizhash()
{ {
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['main']['icon'] = 'none'; $options['main']['icon'] = 'none';
$options['model'] = array( $options['model'] = array(
'class' => 'Database', 'class' => 'Database',
); );
$options['model_options'] = array( $options['model_options'] = array(
@ -297,8 +299,8 @@ class ModelTest extends PHPUnit_Framework_TestCase
// storing comments // storing comments
$commentData = Helper::getComment(); $commentData = Helper::getComment();
$paste = $model->getPaste(Helper::getPasteId()); $paste = $model->getPaste(Helper::getPasteId());
$comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId()); $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId());
$this->assertFalse($comment->exists(), 'comment does not yet exist'); $this->assertFalse($comment->exists(), 'comment does not yet exist');
$comment = $paste->getComment(Helper::getPasteId()); $comment = $paste->getComment(Helper::getPasteId());
@ -316,9 +318,9 @@ class ModelTest extends PHPUnit_Framework_TestCase
public function testCommentIdenticon() public function testCommentIdenticon()
{ {
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['main']['icon'] = 'identicon'; $options['main']['icon'] = 'identicon';
$options['model'] = array( $options['model'] = array(
'class' => 'Database', 'class' => 'Database',
); );
$options['model_options'] = array( $options['model_options'] = array(
@ -331,7 +333,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$model = new Model(new Configuration); $model = new Model(new Configuration);
$pasteData = Helper::getPaste(); $pasteData = Helper::getPaste();
$commentData = Helper::getComment(); $commentData = Helper::getComment();
$model->getPaste(Helper::getPasteId())->delete(); $model->getPaste(Helper::getPasteId())->delete();
@ -347,16 +349,16 @@ class ModelTest extends PHPUnit_Framework_TestCase
$comment->store(); $comment->store();
$identicon = new Identicon(); $identicon = new Identicon();
$pngdata = $identicon->getImageDataUri(TrafficLimiter::getHash(), 16); $pngdata = $identicon->getImageDataUri(TrafficLimiter::getHash(), 16);
$comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get(); $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get();
$this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set'); $this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set');
} }
public function testCommentVizhash() public function testCommentVizhash()
{ {
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['main']['icon'] = 'vizhash'; $options['main']['icon'] = 'vizhash';
$options['model'] = array( $options['model'] = array(
'class' => 'Database', 'class' => 'Database',
); );
$options['model_options'] = array( $options['model_options'] = array(
@ -369,7 +371,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$model = new Model(new Configuration); $model = new Model(new Configuration);
$pasteData = Helper::getPaste(); $pasteData = Helper::getPaste();
$commentData = Helper::getComment(); $commentData = Helper::getComment();
$model->getPaste(Helper::getPasteId())->delete(); $model->getPaste(Helper::getPasteId())->delete();
@ -384,7 +386,7 @@ class ModelTest extends PHPUnit_Framework_TestCase
$comment->setNickname($commentData['meta']['nickname']); $comment->setNickname($commentData['meta']['nickname']);
$comment->store(); $comment->store();
$vz = new Vizhash16x16(); $vz = new Vizhash16x16();
$pngdata = 'data:image/png;base64,' . base64_encode($vz->generate(TrafficLimiter::getHash())); $pngdata = 'data:image/png;base64,' . base64_encode($vz->generate(TrafficLimiter::getHash()));
$comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get(); $comment = $paste->getComment(Helper::getPasteId(), Helper::getCommentId())->get();
$this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set'); $this->assertEquals($pngdata, $comment->meta->vizhash, 'nickname triggers vizhash to be set');

View File

@ -1,9 +1,9 @@
<?php <?php
use PrivateBin\Data\Filesystem; use PrivateBin\Data\Filesystem;
use PrivateBin\PrivateBin;
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 PrivateBinTest extends PHPUnit_Framework_TestCase
{ {
@ -14,7 +14,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function setUp() public function setUp()
{ {
/* Setup Routine */ /* Setup Routine */
$this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data'; $this->_path = sys_get_temp_dir() . DIRECTORY_SEPARATOR . 'privatebin_data';
$this->_model = Filesystem::getInstance(array('dir' => $this->_path)); $this->_model = Filesystem::getInstance(array('dir' => $this->_path));
ServerSalt::setPath($this->_path); ServerSalt::setPath($this->_path);
$this->reset(); $this->reset();
@ -29,16 +29,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function reset() public function reset()
{ {
$_POST = array(); $_POST = array();
$_GET = array(); $_GET = array();
$_SERVER = array(); $_SERVER = array();
if ($this->_model->exists(Helper::getPasteId())) { if ($this->_model->exists(Helper::getPasteId())) {
$this->_model->delete(Helper::getPasteId()); $this->_model->delete(Helper::getPasteId());
} }
Helper::confRestore(); Helper::confRestore();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['purge']['dir'] = $this->_path; $options['purge']['dir'] = $this->_path;
$options['traffic']['dir'] = $this->_path; $options['traffic']['dir'] = $this->_path;
$options['model_options']['dir'] = $this->_path; $options['model_options']['dir'] = $this->_path;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
@ -72,7 +72,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testViewLanguageSelection() public function testViewLanguageSelection()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['main']['languageselection'] = true; $options['main']['languageselection'] = true;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
@ -94,9 +94,9 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testViewForceLanguageDefault() public function testViewForceLanguageDefault()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['main']['languageselection'] = false; $options['main']['languageselection'] = false;
$options['main']['languagedefault'] = 'fr'; $options['main']['languagedefault'] = 'fr';
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_COOKIE['lang'] = 'de'; $_COOKIE['lang'] = 'de';
@ -118,7 +118,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
{ {
$shortener = 'https://shortener.example.com/api?link='; $shortener = 'https://shortener.example.com/api?link=';
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['main']['urlshortener'] = $shortener; $options['main']['urlshortener'] = $shortener;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
@ -175,14 +175,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreate() public function testCreate()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -204,14 +204,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidTimelimit() public function testCreateInvalidTimelimit()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(array('expire' => 25)); $_POST = Helper::getPaste(array('expire' => 25));
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
TrafficLimiter::canPass(); TrafficLimiter::canPass();
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
@ -234,15 +234,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidSize() public function testCreateInvalidSize()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['main']['sizelimit'] = 10; $options['main']['sizelimit'] = 10;
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -258,15 +258,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateProxyHeader() public function testCreateProxyHeader()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['header'] = 'X_FORWARDED_FOR'; $options['traffic']['header'] = 'X_FORWARDED_FOR';
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_SERVER['HTTP_X_FORWARDED_FOR'] = '::2'; $_SERVER['HTTP_X_FORWARDED_FOR'] = '::2';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -288,15 +288,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateDuplicateId() public function testCreateDuplicateId()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$this->_model->create(Helper::getPasteId(), Helper::getPaste()); $this->_model->create(Helper::getPasteId(), Helper::getPaste());
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -312,17 +312,17 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateValidExpire() public function testCreateValidExpire()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_POST['expire'] = '5min'; $_POST['expire'] = '5min';
$_POST['formatter'] = 'foo'; $_POST['formatter'] = 'foo';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
$time = time(); $time = time();
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -345,17 +345,17 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateValidExpireWithDiscussion() public function testCreateValidExpireWithDiscussion()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_POST['expire'] = '5min'; $_POST['expire'] = '5min';
$_POST['opendiscussion'] = '1'; $_POST['opendiscussion'] = '1';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
$time = time(); $time = time();
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -379,15 +379,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidExpire() public function testCreateInvalidExpire()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_POST['expire'] = 'foo'; $_POST['expire'] = 'foo';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -409,15 +409,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidBurn() public function testCreateInvalidBurn()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_POST['burnafterreading'] = 'neither 1 nor 0'; $_POST['burnafterreading'] = 'neither 1 nor 0';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -433,15 +433,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidOpenDiscussion() public function testCreateInvalidOpenDiscussion()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_POST['opendiscussion'] = 'neither 1 nor 0'; $_POST['opendiscussion'] = 'neither 1 nor 0';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -457,15 +457,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateAttachment() public function testCreateAttachment()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
$options['main']['fileupload'] = true; $options['main']['fileupload'] = true;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPasteWithAttachment(); $_POST = Helper::getPasteWithAttachment();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_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 PrivateBin;
@ -475,7 +475,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->assertEquals(0, $response['status'], 'outputs status'); $this->assertEquals(0, $response['status'], 'outputs status');
$this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data'); $this->assertTrue($this->_model->exists($response['id']), 'paste exists after posting data');
$original = json_decode(json_encode($_POST)); $original = json_decode(json_encode($_POST));
$stored = $this->_model->read($response['id']); $stored = $this->_model->read($response['id']);
foreach (array('data', 'attachment', 'attachmentname') as $key) { foreach (array('data', 'attachment', 'attachmentname') as $key) {
$this->assertEquals($original->$key, $stored->$key); $this->assertEquals($original->$key, $stored->$key);
} }
@ -495,16 +495,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateBrokenAttachmentUpload() public function testCreateBrokenAttachmentUpload()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
$options['main']['fileupload'] = true; $options['main']['fileupload'] = true;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPasteWithAttachment(); $_POST = Helper::getPasteWithAttachment();
unset($_POST['attachment']); unset($_POST['attachment']);
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_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 PrivateBin;
@ -521,10 +521,10 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateTooSoon() public function testCreateTooSoon()
{ {
$this->reset(); $this->reset();
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
ob_end_clean(); ob_end_clean();
@ -544,15 +544,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateValidNick() public function testCreateValidNick()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getPaste(); $_POST = Helper::getPaste();
$_POST['nickname'] = Helper::getComment()['meta']['nickname']; $_POST['nickname'] = Helper::getComment()['meta']['nickname'];
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -574,17 +574,17 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidNick() public function testCreateInvalidNick()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getCommentPost(); $_POST = Helper::getCommentPost();
$_POST['pasteid'] = Helper::getPasteId(); $_POST['pasteid'] = Helper::getPasteId();
$_POST['parentid'] = Helper::getPasteId(); $_POST['parentid'] = Helper::getPasteId();
$_POST['nickname'] = 'foo'; $_POST['nickname'] = 'foo';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_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 PrivateBin;
@ -601,16 +601,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateComment() public function testCreateComment()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getCommentPost(); $_POST = Helper::getCommentPost();
$_POST['pasteid'] = Helper::getPasteId(); $_POST['pasteid'] = Helper::getPasteId();
$_POST['parentid'] = Helper::getPasteId(); $_POST['parentid'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_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 PrivateBin;
@ -627,16 +627,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateInvalidComment() public function testCreateInvalidComment()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getCommentPost(); $_POST = Helper::getCommentPost();
$_POST['pasteid'] = Helper::getPasteId(); $_POST['pasteid'] = Helper::getPasteId();
$_POST['parentid'] = 'foo'; $_POST['parentid'] = 'foo';
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_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 PrivateBin;
@ -653,17 +653,17 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateCommentDiscussionDisabled() public function testCreateCommentDiscussionDisabled()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getCommentPost(); $_POST = Helper::getCommentPost();
$_POST['pasteid'] = Helper::getPasteId(); $_POST['pasteid'] = Helper::getPasteId();
$_POST['parentid'] = Helper::getPasteId(); $_POST['parentid'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
$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 PrivateBin;
@ -680,16 +680,16 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateCommentInvalidPaste() public function testCreateCommentInvalidPaste()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$_POST = Helper::getCommentPost(); $_POST = Helper::getCommentPost();
$_POST['pasteid'] = Helper::getPasteId(); $_POST['pasteid'] = Helper::getPasteId();
$_POST['parentid'] = Helper::getPasteId(); $_POST['parentid'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -705,19 +705,19 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testCreateDuplicateComment() public function testCreateDuplicateComment()
{ {
$this->reset(); $this->reset();
$options = parse_ini_file(CONF, true); $options = parse_ini_file(CONF, true);
$options['traffic']['limit'] = 0; $options['traffic']['limit'] = 0;
Helper::confBackup(); Helper::confBackup();
Helper::createIniFile(CONF, $options); Helper::createIniFile(CONF, $options);
$this->_model->create(Helper::getPasteId(), Helper::getPaste()); $this->_model->create(Helper::getPasteId(), Helper::getPaste());
$this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment()); $this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), Helper::getComment());
$this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists before posting data'); $this->assertTrue($this->_model->existsComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId()), 'comment exists before posting data');
$_POST = Helper::getCommentPost(); $_POST = Helper::getCommentPost();
$_POST['pasteid'] = Helper::getPasteId(); $_POST['pasteid'] = Helper::getPasteId();
$_POST['parentid'] = Helper::getPasteId(); $_POST['parentid'] = Helper::getPasteId();
$_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest'; $_SERVER['HTTP_X_REQUESTED_WITH'] = 'JSONHttpRequest';
$_SERVER['REQUEST_METHOD'] = 'POST'; $_SERVER['REQUEST_METHOD'] = 'POST';
$_SERVER['REMOTE_ADDR'] = '::1'; $_SERVER['REMOTE_ADDR'] = '::1';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -739,10 +739,10 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertContains( $this->assertRegExp(
'<div id="cipherdata" class="hidden">' . '#<div id="cipherdata"[^>]*>' .
htmlspecialchars(Helper::getPasteAsJson(), ENT_NOQUOTES) . preg_quote(htmlspecialchars(Helper::getPasteAsJson(), ENT_NOQUOTES)) .
'</div>', '</div>#',
$content, $content,
'outputs data correctly' 'outputs data correctly'
); );
@ -760,7 +760,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertRegExp( $this->assertRegExp(
'#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.</div>#', '#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.#s',
$content, $content,
'outputs error correctly' 'outputs error correctly'
); );
@ -778,7 +778,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertRegExp( $this->assertRegExp(
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist[^<]*</div>#', '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
$content, $content,
'outputs error correctly' 'outputs error correctly'
); );
@ -798,7 +798,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertRegExp( $this->assertRegExp(
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist[^<]*</div>#', '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
$content, $content,
'outputs error correctly' 'outputs error correctly'
); );
@ -818,10 +818,10 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
unset($burnPaste['meta']['salt']); unset($burnPaste['meta']['salt']);
$this->assertContains( $this->assertRegExp(
'<div id="cipherdata" class="hidden">' . '#<div id="cipherdata"[^>]*>' .
htmlspecialchars(Helper::getPasteAsJson($burnPaste['meta']), ENT_NOQUOTES) . preg_quote(htmlspecialchars(Helper::getPasteAsJson($burnPaste['meta']), ENT_NOQUOTES)) .
'</div>', '</div>#',
$content, $content,
'outputs data correctly' 'outputs data correctly'
); );
@ -835,7 +835,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->reset(); $this->reset();
$paste = Helper::getPaste(); $paste = Helper::getPaste();
$this->_model->create(Helper::getPasteId(), $paste); $this->_model->create(Helper::getPasteId(), $paste);
$_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 PrivateBin;
@ -859,7 +859,7 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testReadInvalidJson() public function testReadInvalidJson()
{ {
$this->reset(); $this->reset();
$_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 PrivateBin;
@ -876,9 +876,9 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
{ {
$this->reset(); $this->reset();
$oldPaste = Helper::getPaste(); $oldPaste = Helper::getPaste();
$meta = array( $meta = array(
'syntaxcoloring' => true, 'syntaxcoloring' => true,
'postdate' => $oldPaste['meta']['postdate'], 'postdate' => $oldPaste['meta']['postdate'],
'opendiscussion' => $oldPaste['meta']['opendiscussion'], 'opendiscussion' => $oldPaste['meta']['opendiscussion'],
); );
$oldPaste['meta'] = $meta; $oldPaste['meta'] = $meta;
@ -889,10 +889,10 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$meta['formatter'] = 'syntaxhighlighting'; $meta['formatter'] = 'syntaxhighlighting';
$this->assertContains( $this->assertRegExp(
'<div id="cipherdata" class="hidden">' . '#<div id="cipherdata"[^>]*>' .
htmlspecialchars(Helper::getPasteAsJson($meta), ENT_NOQUOTES) . preg_quote(htmlspecialchars(Helper::getPasteAsJson($meta), ENT_NOQUOTES)) .
'</div>', '</div>#',
$content, $content,
'outputs data correctly' 'outputs data correctly'
); );
@ -914,10 +914,10 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
ob_end_clean(); ob_end_clean();
$oldPaste['meta']['formatter'] = 'plaintext'; $oldPaste['meta']['formatter'] = 'plaintext';
unset($oldPaste['meta']['salt']); unset($oldPaste['meta']['salt']);
$this->assertContains( $this->assertRegExp(
'<div id="cipherdata" class="hidden">' . '#<div id="cipherdata"[^>]*>' .
htmlspecialchars(Helper::getPasteAsJson($oldPaste['meta']), ENT_NOQUOTES) . preg_quote(htmlspecialchars(Helper::getPasteAsJson($oldPaste['meta']), ENT_NOQUOTES)) .
'</div>', '</div>#',
$content, $content,
'outputs data correctly' 'outputs data correctly'
); );
@ -931,15 +931,15 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->reset(); $this->reset();
$this->_model->create(Helper::getPasteId(), Helper::getPaste()); $this->_model->create(Helper::getPasteId(), Helper::getPaste());
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data'); $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
$paste = $this->_model->read(Helper::getPasteId()); $paste = $this->_model->read(Helper::getPasteId());
$_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 PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertRegExp( $this->assertRegExp(
'#<div[^>]*id="status"[^>]*>.*Paste was properly deleted[^<]*</div>#s', '#<div[^>]*id="status"[^>]*>.*Paste was properly deleted\.#s',
$content, $content,
'outputs deleted status correctly' 'outputs deleted status correctly'
); );
@ -953,14 +953,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
{ {
$this->reset(); $this->reset();
$this->_model->create(Helper::getPasteId(), Helper::getPaste()); $this->_model->create(Helper::getPasteId(), Helper::getPaste());
$_GET['pasteid'] = 'foo'; $_GET['pasteid'] = 'foo';
$_GET['deletetoken'] = 'bar'; $_GET['deletetoken'] = 'bar';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertRegExp( $this->assertRegExp(
'#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.</div>#', '#<div[^>]*id="errormessage"[^>]*>.*Invalid paste ID\.#s',
$content, $content,
'outputs delete error correctly' 'outputs delete error correctly'
); );
@ -973,14 +973,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
public function testDeleteInexistantId() public function testDeleteInexistantId()
{ {
$this->reset(); $this->reset();
$_GET['pasteid'] = Helper::getPasteId(); $_GET['pasteid'] = Helper::getPasteId();
$_GET['deletetoken'] = 'bar'; $_GET['deletetoken'] = 'bar';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertRegExp( $this->assertRegExp(
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist[^<]*</div>#', '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
$content, $content,
'outputs delete error correctly' 'outputs delete error correctly'
); );
@ -993,14 +993,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
{ {
$this->reset(); $this->reset();
$this->_model->create(Helper::getPasteId(), Helper::getPaste()); $this->_model->create(Helper::getPasteId(), Helper::getPaste());
$_GET['pasteid'] = Helper::getPasteId(); $_GET['pasteid'] = Helper::getPasteId();
$_GET['deletetoken'] = 'bar'; $_GET['deletetoken'] = 'bar';
ob_start(); ob_start();
new PrivateBin; new PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertRegExp( $this->assertRegExp(
'#<div[^>]*id="errormessage"[^>]*>.*Wrong deletion token[^<]*</div>#', '#<div[^>]*id="errormessage"[^>]*>.*Wrong deletion token\. Paste was not deleted\.#s',
$content, $content,
'outputs delete error correctly' 'outputs delete error correctly'
); );
@ -1016,10 +1016,10 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$burnPaste = Helper::getPaste(array('burnafterreading' => true)); $burnPaste = Helper::getPaste(array('burnafterreading' => true));
$this->_model->create(Helper::getPasteId(), $burnPaste); $this->_model->create(Helper::getPasteId(), $burnPaste);
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data'); $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
$_POST['deletetoken'] = 'burnafterreading'; $_POST['deletetoken'] = 'burnafterreading';
$_SERVER['QUERY_STRING'] = Helper::getPasteId(); $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_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 PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
@ -1037,17 +1037,17 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->reset(); $this->reset();
$this->_model->create(Helper::getPasteId(), Helper::getPaste()); $this->_model->create(Helper::getPasteId(), Helper::getPaste());
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data'); $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
$_POST['deletetoken'] = 'burnafterreading'; $_POST['deletetoken'] = 'burnafterreading';
$_SERVER['QUERY_STRING'] = Helper::getPasteId(); $_SERVER['QUERY_STRING'] = Helper::getPasteId();
$_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 PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$response = json_decode($content, true); $response = json_decode($content, true);
$this->assertEquals(1, $response['status'], 'outputs status'); $this->assertEquals(1, $response['status'], 'outputs status');
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste successfully deleted'); $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists after failing to delete data');
} }
/** /**
@ -1060,14 +1060,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
$this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exist before being created'); $this->assertFalse($this->_model->exists(Helper::getPasteId()), 'paste does not exist before being created');
$this->_model->create(Helper::getPasteId(), $expiredPaste); $this->_model->create(Helper::getPasteId(), $expiredPaste);
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data'); $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
$_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 PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertRegExp( $this->assertRegExp(
'#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist[^<]*</div>#', '#<div[^>]*id="errormessage"[^>]*>.*Paste does not exist, has expired or has been deleted\.#s',
$content, $content,
'outputs error correctly' 'outputs error correctly'
); );
@ -1084,14 +1084,14 @@ class PrivateBinTest extends PHPUnit_Framework_TestCase
unset($paste['meta']['salt']); unset($paste['meta']['salt']);
$this->_model->create(Helper::getPasteId(), $paste); $this->_model->create(Helper::getPasteId(), $paste);
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data'); $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists before deleting data');
$_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 PrivateBin;
$content = ob_get_contents(); $content = ob_get_contents();
ob_end_clean(); ob_end_clean();
$this->assertRegExp( $this->assertRegExp(
'#<div[^>]*id="status"[^>]*>.*Paste was properly deleted[^<]*</div>#s', '#<div[^>]*id="status"[^>]*>.*Paste was properly deleted\.#s',
$content, $content,
'outputs deleted status correctly' 'outputs deleted status correctly'
); );

Some files were not shown because too many files have changed in this diff Show More