This commit is contained in:
rugk 2016-08-15 18:03:23 +02:00
commit bb7fb2054a
25 changed files with 230 additions and 186 deletions

1
.gitattributes vendored
View file

@ -8,4 +8,5 @@ tst/ export-ignore
.gitattributes export-ignore .gitattributes export-ignore
.github export-ignore .github export-ignore
.gitignore export-ignore .gitignore export-ignore
.php_cs export-ignore
.travis.yml export-ignore .travis.yml export-ignore

23
.php_cs Normal file
View file

@ -0,0 +1,23 @@
<?php
/**
* Configuration file for PHP Coding Standards Fixer (php-cs-fixer).
*
* On GitHub: https://github.com/FriendsOfPhp/php-cs-fixer
* More information: http://cs.sensiolabs.org/
*/
$finder = Symfony\CS\Finder\DefaultFinder::create()
->in('lib')
;
return Symfony\CS\Config\Config::create()
->level(Symfony\CS\FixerInterface::PSR2_LEVEL)
->fixers(['concat_with_spaces', 'long_array_syntax', 'standardize_not_equal',
'operators_spaces', 'duplicate_semicolon',
'remove_leading_slash_use', 'align_equals',
'single_array_no_trailing_comma', 'phpdoc_indent', 'phpdoc_scalar',
'phpdoc_to_comment', 'phpdoc_trim',
'phpdoc_types', 'print_to_echo', 'self_accessor', 'single_quote',
'spaces_cast', 'ternary_spaces', 'phpdoc_order'])
->finder($finder)
;

View file

@ -741,6 +741,7 @@ $(function() {
this.passwordInput.val(password); this.passwordInput.val(password);
if (cleartext.length > 0) if (cleartext.length > 0)
{ {
$('#pasteFormatter').val(paste.meta.formatter);
this.formatPaste(paste.meta.formatter, cleartext); this.formatPaste(paste.meta.formatter, cleartext);
} }
} }
@ -870,12 +871,12 @@ $(function() {
'<div class="reply">' + '<div class="reply">' +
'<input type="text" id="nickname" class="form-control" title="' + hint + '" placeholder="' + hint + '" />' + '<input type="text" id="nickname" class="form-control" title="' + hint + '" placeholder="' + hint + '" />' +
'<textarea id="replymessage" class="replymessage form-control" cols="80" rows="7"></textarea>' + '<textarea id="replymessage" class="replymessage form-control" cols="80" rows="7"></textarea>' +
'<br /><button id="replybutton" class="btn btn-default btn-sm">' + i18n._('Post comment') + '</button>' + '<br /><div id="replystatus"></div><button id="replybutton" class="btn btn-default btn-sm">' +
'<div id="replystatus"> </div>' + i18n._('Post comment') + '</button></div>'
'</div>'
); );
reply.find('button').click({parentid: commentid}, $.proxy(this.sendComment, this)); reply.find('button').click({parentid: commentid}, $.proxy(this.sendComment, this));
source.after(reply); source.after(reply);
this.replyStatus = $('#replystatus');
$('#replymessage').focus(); $('#replymessage').focus();
}, },
@ -1237,7 +1238,8 @@ $(function() {
rawText: function(event) rawText: function(event)
{ {
event.preventDefault(); event.preventDefault();
var paste = this.clearText.html(); var paste = $('#pasteFormatter').val() === 'markdown' ?
this.prettyPrint.text() : this.clearText.text();
var newDoc = document.open('text/html', 'replace'); var newDoc = document.open('text/html', 'replace');
newDoc.write('<pre>' + paste + '</pre>'); newDoc.write('<pre>' + paste + '</pre>');
newDoc.close(); newDoc.close();
@ -1262,7 +1264,10 @@ $(function() {
this.clonedFile.removeClass('hidden'); this.clonedFile.removeClass('hidden');
this.fileWrap.addClass('hidden'); this.fileWrap.addClass('hidden');
} }
this.message.text(this.clearText.text()); this.message.text(
$('#pasteFormatter').val() === 'markdown' ?
this.prettyPrint.text() : this.clearText.text()
);
$('.navbar-toggle').click(); $('.navbar-toggle').click();
}, },
@ -1370,6 +1375,8 @@ $(function() {
this.stateNewPaste(); this.stateNewPaste();
this.showStatus('', false); this.showStatus('', false);
this.message.text(''); this.message.text('');
this.changeBurnAfterReading();
this.changeOpenDisc();
}, },
/** /**
@ -1402,7 +1409,18 @@ $(function() {
this.errorMessage.removeClass('hidden'); this.errorMessage.removeClass('hidden');
helper.setMessage(this.errorMessage, message); helper.setMessage(this.errorMessage, message);
} }
this.replyStatus.addClass('errorMessage').text(message); if (typeof this.replyStatus !== 'undefined') {
this.replyStatus.addClass('errorMessage');
this.replyStatus.addClass(this.errorMessage.attr('class'));
if (this.status.length)
{
this.replyStatus.html(this.status.html());
}
else
{
this.replyStatus.html(this.errorMessage.html());
}
}
}, },
/** /**
@ -1414,7 +1432,9 @@ $(function() {
*/ */
showStatus: function(message, spin) showStatus: function(message, spin)
{ {
this.replyStatus.removeClass('errorMessage').text(message); if (typeof this.replyStatus !== 'undefined') {
this.replyStatus.removeClass('errorMessage').text(message);
}
if (!message) if (!message)
{ {
this.status.html(' '); this.status.html(' ');
@ -1430,7 +1450,9 @@ $(function() {
{ {
var img = '<img src="img/busy.gif" style="width:16px;height:9px;margin:0 4px 0 0;" />'; var img = '<img src="img/busy.gif" style="width:16px;height:9px;margin:0 4px 0 0;" />';
this.status.prepend(img); this.status.prepend(img);
this.replyStatus.prepend(img); if (typeof this.replyStatus !== 'undefined') {
this.replyStatus.prepend(img);
}
} }
}, },
@ -1499,7 +1521,6 @@ $(function() {
this.preview = $('#preview'); this.preview = $('#preview');
this.rawTextButton = $('#rawtextbutton'); this.rawTextButton = $('#rawtextbutton');
this.remainingTime = $('#remainingtime'); this.remainingTime = $('#remainingtime');
this.replyStatus = $('#replystatus');
this.sendButton = $('#sendbutton'); this.sendButton = $('#sendbutton');
this.status = $('#status'); this.status = $('#status');
this.bindEvents(); this.bindEvents();

View file

@ -98,7 +98,7 @@ class Configuration
*/ */
public function __construct() public function __construct()
{ {
$config = array(); $config = array();
$configFile = PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini'; $configFile = PATH . 'cfg' . DIRECTORY_SEPARATOR . 'conf.ini';
if (is_readable($configFile)) { if (is_readable($configFile)) {
$config = parse_ini_file($configFile, true); $config = parse_ini_file($configFile, true);

View file

@ -71,7 +71,7 @@ class Database extends AbstractData
public static function getInstance($options = null) public static function getInstance($options = null)
{ {
// if needed initialize the singleton // if needed initialize the singleton
if (!(self::$_instance instanceof Database)) { if (!(self::$_instance instanceof self)) {
self::$_instance = new self; self::$_instance = new self;
} }
@ -89,17 +89,17 @@ class Database extends AbstractData
array_key_exists('opt', $options) array_key_exists('opt', $options)
) { ) {
// set default options // set default options
$options['opt'][PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION; $options['opt'][PDO::ATTR_ERRMODE] = PDO::ERRMODE_EXCEPTION;
$options['opt'][PDO::ATTR_EMULATE_PREPARES] = false; $options['opt'][PDO::ATTR_EMULATE_PREPARES] = false;
$options['opt'][PDO::ATTR_PERSISTENT] = true; $options['opt'][PDO::ATTR_PERSISTENT] = true;
$db_tables_exist = true; $db_tables_exist = true;
// setup type and dabase connection // setup type and dabase connection
self::$_type = strtolower( self::$_type = strtolower(
substr($options['dsn'], 0, strpos($options['dsn'], ':')) substr($options['dsn'], 0, strpos($options['dsn'], ':'))
); );
$tableQuery = self::_getTableQuery(self::$_type); $tableQuery = self::_getTableQuery(self::$_type);
self::$_db = new PDO( self::$_db = new PDO(
$options['dsn'], $options['dsn'],
$options['usr'], $options['usr'],
$options['pwd'], $options['pwd'],
@ -168,8 +168,8 @@ class Database extends AbstractData
} }
$opendiscussion = $burnafterreading = false; $opendiscussion = $burnafterreading = false;
$attachment = $attachmentname = ''; $attachment = $attachmentname = '';
$meta = $paste['meta']; $meta = $paste['meta'];
unset($meta['postdate']); unset($meta['postdate']);
$expire_date = 0; $expire_date = 0;
if (array_key_exists('expire_date', $paste['meta'])) { if (array_key_exists('expire_date', $paste['meta'])) {
@ -222,14 +222,14 @@ class Database extends AbstractData
!array_key_exists($pasteid, self::$_cache) !array_key_exists($pasteid, self::$_cache)
) { ) {
self::$_cache[$pasteid] = false; self::$_cache[$pasteid] = false;
$paste = self::_select( $paste = self::_select(
'SELECT * FROM ' . self::_sanitizeIdentifier('paste') . 'SELECT * FROM ' . self::_sanitizeIdentifier('paste') .
' WHERE dataid = ?', array($pasteid), true ' WHERE dataid = ?', array($pasteid), true
); );
if (false !== $paste) { if (false !== $paste) {
// create object // create object
self::$_cache[$pasteid] = new stdClass; self::$_cache[$pasteid] = new stdClass;
self::$_cache[$pasteid]->data = $paste['data']; self::$_cache[$pasteid]->data = $paste['data'];
$meta = json_decode($paste['meta']); $meta = json_decode($paste['meta']);
@ -253,9 +253,9 @@ class Database extends AbstractData
self::$_cache[$pasteid]->attachmentname = $paste['attachmentname']; self::$_cache[$pasteid]->attachmentname = $paste['attachmentname'];
} }
} }
self::$_cache[$pasteid]->meta = $meta; self::$_cache[$pasteid]->meta = $meta;
self::$_cache[$pasteid]->meta->postdate = (int) $paste['postdate']; self::$_cache[$pasteid]->meta->postdate = (int) $paste['postdate'];
$expire_date = (int) $paste['expiredate']; $expire_date = (int) $paste['expiredate'];
if ( if (
$expire_date > 0 $expire_date > 0
) { ) {
@ -368,12 +368,12 @@ class Database extends AbstractData
$comments = array(); $comments = array();
if (count($rows)) { if (count($rows)) {
foreach ($rows as $row) { foreach ($rows as $row) {
$i = $this->getOpenSlot($comments, (int) $row['postdate']); $i = $this->getOpenSlot($comments, (int) $row['postdate']);
$comments[$i] = new stdClass; $comments[$i] = new stdClass;
$comments[$i]->id = $row['dataid']; $comments[$i]->id = $row['dataid'];
$comments[$i]->parentid = $row['parentid']; $comments[$i]->parentid = $row['parentid'];
$comments[$i]->data = $row['data']; $comments[$i]->data = $row['data'];
$comments[$i]->meta = new stdClass; $comments[$i]->meta = new stdClass;
$comments[$i]->meta->postdate = (int) $row['postdate']; $comments[$i]->meta->postdate = (int) $row['postdate'];
if (array_key_exists('nickname', $row) && !empty($row['nickname'])) { if (array_key_exists('nickname', $row) && !empty($row['nickname'])) {
$comments[$i]->meta->nickname = $row['nickname']; $comments[$i]->meta->nickname = $row['nickname'];
@ -415,7 +415,7 @@ class Database extends AbstractData
protected function _getExpiredPastes($batchsize) protected function _getExpiredPastes($batchsize)
{ {
$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 < ? LIMIT ?', array(time(), $batchsize)
); );
@ -440,7 +440,7 @@ class Database extends AbstractData
private static function _exec($sql, array $params) private static function _exec($sql, array $params)
{ {
$statement = self::$_db->prepare($sql); $statement = self::$_db->prepare($sql);
$result = $statement->execute($params); $result = $statement->execute($params);
$statement->closeCursor(); $statement->closeCursor();
return $result; return $result;
} }
@ -486,7 +486,7 @@ class Database extends AbstractData
$sql = 'SELECT tabname FROM systables '; $sql = 'SELECT tabname FROM systables ';
break; break;
case 'mssql': case 'mssql':
$sql = "SELECT name FROM sysobjects " $sql = 'SELECT name FROM sysobjects '
. "WHERE type = 'U' ORDER BY name"; . "WHERE type = 'U' ORDER BY name";
break; break;
case 'mysql': case 'mysql':
@ -496,22 +496,22 @@ class Database extends AbstractData
$sql = 'SELECT table_name FROM all_tables'; $sql = 'SELECT table_name FROM all_tables';
break; break;
case 'pgsql': case 'pgsql':
$sql = "SELECT c.relname AS table_name " $sql = 'SELECT c.relname AS table_name '
. "FROM pg_class c, pg_user u " . 'FROM pg_class c, pg_user u '
. "WHERE c.relowner = u.usesysid AND c.relkind = 'r' " . "WHERE c.relowner = u.usesysid AND c.relkind = 'r' "
. "AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) " . 'AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) '
. "AND c.relname !~ '^(pg_|sql_)' " . "AND c.relname !~ '^(pg_|sql_)' "
. "UNION " . 'UNION '
. "SELECT c.relname AS table_name " . 'SELECT c.relname AS table_name '
. "FROM pg_class c " . 'FROM pg_class c '
. "WHERE c.relkind = 'r' " . "WHERE c.relkind = 'r' "
. "AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) " . 'AND NOT EXISTS (SELECT 1 FROM pg_views WHERE viewname = c.relname) '
. "AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) " . 'AND NOT EXISTS (SELECT 1 FROM pg_user WHERE usesysid = c.relowner) '
. "AND c.relname !~ '^pg_'"; . "AND c.relname !~ '^pg_'";
break; break;
case 'sqlite': case 'sqlite':
$sql = "SELECT name FROM sqlite_master WHERE type='table' " $sql = "SELECT name FROM sqlite_master WHERE type='table' "
. "UNION ALL SELECT name FROM sqlite_temp_master " . 'UNION ALL SELECT name FROM sqlite_temp_master '
. "WHERE type='table' ORDER BY name"; . "WHERE type='table' ORDER BY name";
break; break;
default: default:
@ -569,7 +569,7 @@ class Database extends AbstractData
private static function _createPasteTable() private static function _createPasteTable()
{ {
list($main_key, $after_key) = self::_getPrimaryKeyClauses(); list($main_key, $after_key) = self::_getPrimaryKeyClauses();
$dataType = self::$_type === 'pgsql' ? 'TEXT' : 'BLOB'; $dataType = self::$_type === 'pgsql' ? 'TEXT' : 'BLOB';
self::$_db->exec( self::$_db->exec(
'CREATE TABLE ' . self::_sanitizeIdentifier('paste') . ' ( ' . 'CREATE TABLE ' . self::_sanitizeIdentifier('paste') . ' ( ' .
"dataid CHAR(16) NOT NULL$main_key, " . "dataid CHAR(16) NOT NULL$main_key, " .
@ -594,7 +594,7 @@ class Database extends AbstractData
private static function _createCommentTable() private static function _createCommentTable()
{ {
list($main_key, $after_key) = self::_getPrimaryKeyClauses(); list($main_key, $after_key) = self::_getPrimaryKeyClauses();
$dataType = self::$_type === 'pgsql' ? 'text' : 'BLOB'; $dataType = self::$_type === 'pgsql' ? 'text' : 'BLOB';
self::$_db->exec( self::$_db->exec(
'CREATE TABLE ' . self::_sanitizeIdentifier('comment') . ' ( ' . 'CREATE TABLE ' . self::_sanitizeIdentifier('comment') . ' ( ' .
"dataid CHAR(16) NOT NULL$main_key, " . "dataid CHAR(16) NOT NULL$main_key, " .

View file

@ -49,7 +49,7 @@ class Filesystem extends AbstractData
self::$_dir = $options['dir'] . DIRECTORY_SEPARATOR; self::$_dir = $options['dir'] . DIRECTORY_SEPARATOR;
} }
// if needed initialize the singleton // if needed initialize the singleton
if (!(self::$_instance instanceof Filesystem)) { if (!(self::$_instance instanceof self)) {
self::$_instance = new self; self::$_instance = new self;
self::_init(); self::_init();
} }
@ -161,7 +161,7 @@ class Filesystem extends AbstractData
public function createComment($pasteid, $parentid, $commentid, $comment) public function createComment($pasteid, $parentid, $commentid, $comment)
{ {
$storagedir = self::_dataid2discussionpath($pasteid); $storagedir = self::_dataid2discussionpath($pasteid);
$filename = $pasteid . '.' . $commentid . '.' . $parentid; $filename = $pasteid . '.' . $commentid . '.' . $parentid;
if (is_file($storagedir . $filename)) { if (is_file($storagedir . $filename)) {
return false; return false;
} }
@ -181,7 +181,7 @@ class Filesystem extends AbstractData
public function readComments($pasteid) public function readComments($pasteid)
{ {
$comments = array(); $comments = array();
$discdir = self::_dataid2discussionpath($pasteid); $discdir = self::_dataid2discussionpath($pasteid);
if (is_dir($discdir)) { if (is_dir($discdir)) {
// Delete all files in discussion directory // Delete all files in discussion directory
$dir = dir($discdir); $dir = dir($discdir);
@ -192,13 +192,13 @@ class Filesystem extends AbstractData
// - parentid is the comment this comment replies to (It can be pasteid) // - parentid is the comment this comment replies to (It can be pasteid)
if (is_file($discdir . $filename)) { if (is_file($discdir . $filename)) {
$comment = json_decode(file_get_contents($discdir . $filename)); $comment = json_decode(file_get_contents($discdir . $filename));
$items = explode('.', $filename); $items = explode('.', $filename);
// Add some meta information not contained in file. // Add some meta information not contained in file.
$comment->id = $items[1]; $comment->id = $items[1];
$comment->parentid = $items[2]; $comment->parentid = $items[2];
// Store in array // Store in array
$key = $this->getOpenSlot($comments, (int) $comment->meta->postdate); $key = $this->getOpenSlot($comments, (int) $comment->meta->postdate);
$comments[$key] = $comment; $comments[$key] = $comment;
} }
} }
@ -236,7 +236,7 @@ class Filesystem extends AbstractData
*/ */
protected function _getExpiredPastes($batchsize) protected function _getExpiredPastes($batchsize)
{ {
$pastes = array(); $pastes = array();
$firstLevel = array_filter( $firstLevel = array_filter(
scandir(self::$_dir), scandir(self::$_dir),
'self::_isFirstLevelDir' 'self::_isFirstLevelDir'
@ -244,7 +244,7 @@ class Filesystem extends AbstractData
if (count($firstLevel) > 0) { if (count($firstLevel) > 0) {
// try at most 10 times the $batchsize pastes before giving up // try at most 10 times the $batchsize pastes before giving up
for ($i = 0, $max = $batchsize * 10; $i < $max; ++$i) { for ($i = 0, $max = $batchsize * 10; $i < $max; ++$i) {
$firstKey = array_rand($firstLevel); $firstKey = array_rand($firstLevel);
$secondLevel = array_filter( $secondLevel = array_filter(
scandir(self::$_dir . $firstLevel[$firstKey]), scandir(self::$_dir . $firstLevel[$firstKey]),
'self::_isSecondLevelDir' 'self::_isSecondLevelDir'
@ -257,7 +257,7 @@ class Filesystem extends AbstractData
} }
$secondKey = array_rand($secondLevel); $secondKey = array_rand($secondLevel);
$path = self::$_dir . $firstLevel[$firstKey] . $path = self::$_dir . $firstLevel[$firstKey] .
DIRECTORY_SEPARATOR . $secondLevel[$secondKey]; DIRECTORY_SEPARATOR . $secondLevel[$secondKey];
if (!is_dir($path)) { if (!is_dir($path)) {
continue; continue;
@ -270,7 +270,7 @@ class Filesystem extends AbstractData
continue; continue;
} }
$thirdKey = array_rand($thirdLevel); $thirdKey = array_rand($thirdLevel);
$pasteid = $thirdLevel[$thirdKey]; $pasteid = $thirdLevel[$thirdKey];
if (in_array($pasteid, $pastes)) { if (in_array($pasteid, $pastes)) {
continue; continue;
} }

View file

@ -77,7 +77,7 @@ class Filter
public static function formatHumanReadableSize($size) public static function formatHumanReadableSize($size)
{ {
$iec = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB'); $iec = array('B', 'KiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
$i = 0; $i = 0;
while (($size / 1024) >= 1) { while (($size / 1024) >= 1) {
$size = $size / 1024; $size = $size / 1024;
$i++; $i++;

View file

@ -114,8 +114,8 @@ class I18n
$args = func_get_args(); $args = func_get_args();
if (is_array(self::$_translations[$messageId])) { if (is_array(self::$_translations[$messageId])) {
$number = (int) $args[1]; $number = (int) $args[1];
$key = self::_getPluralForm($number); $key = self::_getPluralForm($number);
$max = count(self::$_translations[$messageId]) - 1; $max = count(self::$_translations[$messageId]) - 1;
if ($key > $max) { if ($key > $max) {
$key = $max; $key = $max;
} }
@ -143,7 +143,7 @@ class I18n
// check if the lang cookie was set and that language exists // check if the lang cookie was set and that language exists
if (array_key_exists('lang', $_COOKIE) && in_array($_COOKIE['lang'], $availableLanguages)) { if (array_key_exists('lang', $_COOKIE) && in_array($_COOKIE['lang'], $availableLanguages)) {
$match = $_COOKIE['lang']; $match = $_COOKIE['lang'];
} }
// find a translation file matching the browsers language preferences // find a translation file matching the browsers language preferences
else { else {
@ -153,7 +153,7 @@ class I18n
} }
// load translations // load translations
self::$_language = $match; self::$_language = $match;
self::$_translations = ($match == 'en') ? array() : json_decode( self::$_translations = ($match == 'en') ? array() : json_decode(
file_get_contents(self::_getPath($match . '.json')), file_get_contents(self::_getPath($match . '.json')),
true true
@ -319,7 +319,7 @@ class I18n
protected static function _getMatchingLanguage($acceptedLanguages, $availableLanguages) protected static function _getMatchingLanguage($acceptedLanguages, $availableLanguages)
{ {
$matches = array(); $matches = array();
$any = false; $any = false;
foreach ($acceptedLanguages as $acceptedQuality => $acceptedValues) { foreach ($acceptedLanguages as $acceptedQuality => $acceptedValues) {
$acceptedQuality = floatval($acceptedQuality); $acceptedQuality = floatval($acceptedQuality);
if ($acceptedQuality === 0.0) { if ($acceptedQuality === 0.0) {
@ -372,7 +372,7 @@ class I18n
{ {
$a = explode('-', $a); $a = explode('-', $a);
$b = explode('-', $b); $b = explode('-', $b);
for ($i=0, $n = min(count($a), count($b)); $i < $n; ++$i) { for ($i = 0, $n = min(count($a), count($b)); $i < $n; ++$i) {
if ($a[$i] !== $b[$i]) { if ($a[$i] !== $b[$i]) {
break; break;
} }

View file

@ -33,7 +33,7 @@ class Json
public static function encode($input) public static function encode($input)
{ {
$jsonString = json_encode($input); $jsonString = json_encode($input);
$errorCode = json_last_error(); $errorCode = json_last_error();
if ($errorCode === JSON_ERROR_NONE) { if ($errorCode === JSON_ERROR_NONE) {
return $jsonString; return $jsonString;
} }

View file

@ -67,9 +67,9 @@ abstract class AbstractModel
*/ */
public function __construct(Configuration $configuration, AbstractData $storage) public function __construct(Configuration $configuration, AbstractData $storage)
{ {
$this->_conf = $configuration; $this->_conf = $configuration;
$this->_store = $storage; $this->_store = $storage;
$this->_data = new stdClass; $this->_data = new stdClass;
$this->_data->meta = new stdClass; $this->_data->meta = new stdClass;
} }

View file

@ -133,7 +133,7 @@ class Comment extends AbstractModel
*/ */
public function setPaste(Paste $paste) public function setPaste(Paste $paste)
{ {
$this->_paste = $paste; $this->_paste = $paste;
$this->_data->meta->pasteid = $paste->getId(); $this->_data->meta->pasteid = $paste->getId();
} }
@ -199,12 +199,12 @@ class Comment extends AbstractModel
$icon = $this->_conf->getKey('icon'); $icon = $this->_conf->getKey('icon');
if ($icon != 'none') { if ($icon != 'none') {
$pngdata = ''; $pngdata = '';
$hmac = TrafficLimiter::getHash(); $hmac = TrafficLimiter::getHash();
if ($icon == 'identicon') { if ($icon == 'identicon') {
$identicon = new Identicon(); $identicon = new Identicon();
$pngdata = $identicon->getImageDataUri($hmac, 16); $pngdata = $identicon->getImageDataUri($hmac, 16);
} elseif ($icon == 'vizhash') { } elseif ($icon == 'vizhash') {
$vh = new Vizhash16x16(); $vh = new Vizhash16x16();
$pngdata = 'data:image/png;base64,' . base64_encode( $pngdata = 'data:image/png;base64,' . base64_encode(
$vh->generate($hmac) $vh->generate($hmac)
); );

View file

@ -62,11 +62,11 @@ class Paste extends AbstractModel
if (!property_exists($data->meta, 'salt')) { if (!property_exists($data->meta, 'salt')) {
$data->meta->salt = ServerSalt::get(); $data->meta->salt = ServerSalt::get();
} }
$data->comments = array_values($this->getComments()); $data->comments = array_values($this->getComments());
$data->comment_count = count($data->comments); $data->comment_count = count($data->comments);
$data->comment_offset = 0; $data->comment_offset = 0;
$data->{'@context'} = 'js/paste.jsonld'; $data->{'@context'} = 'js/paste.jsonld';
$this->_data = $data; $this->_data = $data;
return $this->_data; return $this->_data;
} }
@ -85,7 +85,7 @@ class Paste extends AbstractModel
} }
$this->_data->meta->postdate = time(); $this->_data->meta->postdate = time();
$this->_data->meta->salt = serversalt::generate(); $this->_data->meta->salt = serversalt::generate();
// store paste // store paste
if ( if (
@ -247,7 +247,7 @@ class Paste extends AbstractModel
throw new Exception('Invalid data.', 73); throw new Exception('Invalid data.', 73);
} }
$this->_data->meta->burnafterreading = true; $this->_data->meta->burnafterreading = true;
$this->_data->meta->opendiscussion = false; $this->_data->meta->opendiscussion = false;
} }
} }
@ -296,7 +296,7 @@ class Paste extends AbstractModel
* *
* @access public * @access public
* @throws Exception * @throws Exception
* @return boolean * @return bool
*/ */
public function isBurnafterreading() public function isBurnafterreading()
{ {
@ -313,7 +313,7 @@ class Paste extends AbstractModel
* *
* @access public * @access public
* @throws Exception * @throws Exception
* @return boolean * @return bool
*/ */
public function isOpendiscussion() public function isOpendiscussion()
{ {

View file

@ -119,7 +119,7 @@ abstract class AbstractPersistence
protected static function _store($filename, $data) protected static function _store($filename, $data)
{ {
self::_initialize(); self::_initialize();
$file = self::$_path . DIRECTORY_SEPARATOR . $filename; $file = self::$_path . DIRECTORY_SEPARATOR . $filename;
$writtenBytes = @file_put_contents($file, $data, LOCK_EX); $writtenBytes = @file_put_contents($file, $data, LOCK_EX);
if ($writtenBytes === false || $writtenBytes < strlen($data)) { if ($writtenBytes === false || $writtenBytes < strlen($data)) {
throw new Exception('unable to write to file ' . $file, 13); throw new Exception('unable to write to file ' . $file, 13);

View file

@ -72,8 +72,8 @@ class PurgeLimiter extends AbstractPersistence
return true; return true;
} }
$file = 'purge_limiter.php'; $file = 'purge_limiter.php';
$now = time(); $now = time();
$content = '<?php' . PHP_EOL . '$GLOBALS[\'purge_limiter\'] = ' . $now . ';' . PHP_EOL; $content = '<?php' . PHP_EOL . '$GLOBALS[\'purge_limiter\'] = ' . $now . ';' . PHP_EOL;
if (!self::_exists($file)) { if (!self::_exists($file)) {
self::_store($file, $content); self::_store($file, $content);

View file

@ -114,7 +114,7 @@ class TrafficLimiter extends AbstractPersistence
$path = self::getPath($file); $path = self::getPath($file);
require $path; require $path;
$now = time(); $now = time();
$tl = $GLOBALS['traffic_limiter']; $tl = $GLOBALS['traffic_limiter'];
// purge file of expired hashes to keep it small // purge file of expired hashes to keep it small
foreach ($tl as $key => $time) { foreach ($tl as $key => $time) {
@ -129,7 +129,7 @@ class TrafficLimiter extends AbstractPersistence
$result = false; $result = false;
} else { } else {
$tl[$hash] = time(); $tl[$hash] = time();
$result = true; $result = true;
} }
self::_store( self::_store(
$file, $file,

View file

@ -168,14 +168,14 @@ class PrivateBin
file_put_contents( file_put_contents(
PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess', PATH . $dir . DIRECTORY_SEPARATOR . '.htaccess',
'Allow from none' . PHP_EOL . 'Allow from none' . PHP_EOL .
'Deny from all'. PHP_EOL, 'Deny from all' . PHP_EOL,
LOCK_EX LOCK_EX
); );
} }
} }
$this->_conf = new Configuration; $this->_conf = new Configuration;
$this->_model = new Model($this->_conf); $this->_model = new Model($this->_conf);
$this->_request = new Request; $this->_request = new Request;
$this->_urlBase = array_key_exists('REQUEST_URI', $_SERVER) ? $this->_urlBase = array_key_exists('REQUEST_URI', $_SERVER) ?
htmlspecialchars($_SERVER['REQUEST_URI']) : '/'; htmlspecialchars($_SERVER['REQUEST_URI']) : '/';
@ -223,8 +223,8 @@ class PrivateBin
); );
} }
$data = $this->_request->getParam('data'); $data = $this->_request->getParam('data');
$attachment = $this->_request->getParam('attachment'); $attachment = $this->_request->getParam('attachment');
$attachmentname = $this->_request->getParam('attachmentname'); $attachmentname = $this->_request->getParam('attachmentname');
// Ensure content is not too big. // Ensure content is not too big.
@ -247,7 +247,7 @@ class PrivateBin
} }
// The user posts a comment. // The user posts a comment.
$pasteid = $this->_request->getParam('pasteid'); $pasteid = $this->_request->getParam('pasteid');
$parentid = $this->_request->getParam('parentid'); $parentid = $this->_request->getParam('parentid');
if (!empty($pasteid) && !empty($parentid)) { if (!empty($pasteid) && !empty($parentid)) {
$paste = $this->_model->getPaste($pasteid); $paste = $this->_model->getPaste($pasteid);
@ -365,7 +365,7 @@ class PrivateBin
try { try {
$paste = $this->_model->getPaste($dataid); $paste = $this->_model->getPaste($dataid);
if ($paste->exists()) { if ($paste->exists()) {
$data = $paste->get(); $data = $paste->get();
$this->_doesExpire = property_exists($data, 'meta') && property_exists($data->meta, 'expire_date'); $this->_doesExpire = property_exists($data, 'meta') && property_exists($data->meta, 'expire_date');
if (property_exists($data->meta, 'salt')) { if (property_exists($data->meta, 'salt')) {
unset($data->meta->salt); unset($data->meta->salt);
@ -407,7 +407,7 @@ class PrivateBin
// label all the expiration options // label all the expiration options
$expire = array(); $expire = array();
foreach ($this->_conf->getSection('expire_options') as $time => $seconds) { foreach ($this->_conf->getSection('expire_options') as $time => $seconds) {
$expire[$time] = ($seconds == 0) ? I18n::_(ucfirst($time)): Filter::formatHumanReadableTime($time); $expire[$time] = ($seconds == 0) ? I18n::_(ucfirst($time)) : Filter::formatHumanReadableTime($time);
} }
// translate all the formatter options // translate all the formatter options
@ -462,7 +462,7 @@ class PrivateBin
$type = ''; $type = '';
} }
$content = '{}'; $content = '{}';
$file = PUBLIC_PATH . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . $type . '.jsonld'; $file = PUBLIC_PATH . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . $type . '.jsonld';
if (is_readable($file)) { if (is_readable($file)) {
$content = str_replace( $content = str_replace(
'?jsonld=', '?jsonld=',
@ -492,7 +492,7 @@ class PrivateBin
if ($status) { if ($status) {
$result['message'] = I18n::_($message); $result['message'] = I18n::_($message);
} else { } else {
$result['id'] = $message; $result['id'] = $message;
$result['url'] = $this->_urlBase . '?' . $message; $result['url'] = $this->_urlBase . '?' . $message;
} }
$result += $other; $result += $other;

View file

@ -16,7 +16,7 @@ namespace PrivateBin;
* Request * Request
* *
* parses request parameters and provides helper functions for routing * parses request parameters and provides helper functions for routing
*/ */
class Request class Request
{ {
/** /**
@ -184,7 +184,7 @@ class Request
private function _detectJsonRequest() private function _detectJsonRequest()
{ {
$hasAcceptHeader = array_key_exists('HTTP_ACCEPT', $_SERVER); $hasAcceptHeader = array_key_exists('HTTP_ACCEPT', $_SERVER);
$acceptHeader = $hasAcceptHeader ? $_SERVER['HTTP_ACCEPT'] : ''; $acceptHeader = $hasAcceptHeader ? $_SERVER['HTTP_ACCEPT'] : '';
// simple cases // simple cases
if ( if (

View file

@ -110,10 +110,10 @@ class Vizhash16x16
for ($i = 0; $i < 7; ++$i) { for ($i = 0; $i < 7; ++$i) {
$action = $this->getInt(); $action = $this->getInt();
$color = imagecolorallocate($image, $r, $g, $b); $color = imagecolorallocate($image, $r, $g, $b);
$r = $r0 = ($r0 + $this->getInt() / 25) % 256; $r = $r0 = ($r0 + $this->getInt() / 25) % 256;
$g = $g0 = ($g0 + $this->getInt() / 25) % 256; $g = $g0 = ($g0 + $this->getInt() / 25) % 256;
$b = $b0 = ($b0 + $this->getInt() / 25) % 256; $b = $b0 = ($b0 + $this->getInt() / 25) % 256;
$this->drawshape($image, $action, $color); $this->drawshape($image, $action, $color);
} }
@ -180,10 +180,10 @@ class Vizhash16x16
private function degrade($img, $direction, $color1, $color2) private function degrade($img, $direction, $color1, $color2)
{ {
if ($direction == 'h') { if ($direction == 'h') {
$size = imagesx($img); $size = imagesx($img);
$sizeinv = imagesy($img); $sizeinv = imagesy($img);
} else { } else {
$size = imagesy($img); $size = imagesy($img);
$sizeinv = imagesx($img); $sizeinv = imagesx($img);
} }
$diffs = array( $diffs = array(
@ -228,8 +228,8 @@ class Vizhash16x16
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

@ -72,19 +72,19 @@ endif;
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<button id="sendbutton" type="button" class="hidden btn btn-default navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?>
</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-default navbar-btn">
<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo I18n::_('Clone'); ?> <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-default navbar-btn">
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'); ?> <span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button> </button>
</li> </li>
<li class="dropdown"> <li class="dropdown">
@ -108,7 +108,7 @@ foreach ($EXPIRE as $key => $value):
?> ?>
<li> <li>
<a href="#" data-expiration="<?php echo $key; ?>"> <a href="#" data-expiration="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -121,12 +121,12 @@ endforeach;
<ul class="dropdown-menu"> <ul class="dropdown-menu">
<li id="burnafterreadingoption" class="checkbox hidden"> <li id="burnafterreadingoption" class="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 echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label> </label>
</li> </li>
<?php <?php
@ -134,12 +134,12 @@ if ($DISCUSSION):
?> ?>
<li id="opendisc" class="checkbox hidden"> <li id="opendisc" class="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 echo I18n::_('Open discussion'), PHP_EOL; ?>
</label> </label>
</li> </li>
<?php <?php
@ -156,7 +156,7 @@ foreach ($FORMATTER as $key => $value):
?> ?>
<li> <li>
<a href="#" data-format="<?php echo $key; ?>"> <a href="#" data-format="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -199,7 +199,7 @@ if ($FILEUPLOAD):
</li> </li>
<li> <li>
<a id="fileremovebutton" href="#"> <a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'); ?> <?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
</a> </a>
</li> </li>
</ul> </ul>
@ -233,7 +233,7 @@ endif;
?> ?>
<li> <li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
</button> </button>
</li> </li>
</ul> </ul>
@ -245,7 +245,7 @@ endif;
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); ?> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -264,7 +264,7 @@ endif;
if (strlen($STATUS)): if (strlen($STATUS)):
?> ?>
<div id="status" role="alert" class="alert alert-success"> <div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS); ?> <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -276,7 +276,7 @@ endif;
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div> ?>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> <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="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:'); ?> <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.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>,
@ -290,7 +290,7 @@ endif;
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-primary">
<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'); ?> <span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button> </button>
<?php <?php
endif; endif;
@ -323,7 +323,7 @@ endif;
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4> <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 class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12"> <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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?> <?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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'), PHP_EOL; ?>
</p> </p>
</div> </div>
</footer> </footer>

View file

@ -71,19 +71,19 @@ endif;
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<button id="sendbutton" type="button" class="hidden btn btn-warning navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?>
</button> </button>
<?php <?php
if ($EXPIRECLONE): if ($EXPIRECLONE):
?> ?>
<button id="clonebutton" type="button" class="hidden btn btn-warning navbar-btn"> <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'); ?> <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-warning navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button> </button>
</li> </li>
<li class="dropdown"> <li class="dropdown">
@ -107,7 +107,7 @@ foreach ($EXPIRE as $key => $value):
?> ?>
<li> <li>
<a href="#" data-expiration="<?php echo $key; ?>"> <a href="#" data-expiration="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -118,12 +118,12 @@ endforeach;
<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 echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
@ -133,12 +133,12 @@ if ($DISCUSSION):
<li> <li>
<div id="opendisc" class="navbar-text checkbox hidden"> <div id="opendisc" 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 echo I18n::_('Open discussion'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
@ -165,7 +165,7 @@ if ($FILEUPLOAD):
</li> </li>
<li> <li>
<a id="fileremovebutton" href="#"> <a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'); ?> <?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
</a> </a>
</li> </li>
</ul> </ul>
@ -194,7 +194,7 @@ foreach ($FORMATTER as $key => $value):
?> ?>
<li> <li>
<a href="#" data-format="<?php echo $key; ?>"> <a href="#" data-format="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -228,7 +228,7 @@ endif;
?> ?>
<li> <li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-warning navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
</button> </button>
</li> </li>
</ul> </ul>
@ -239,7 +239,7 @@ endif;
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); ?> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -258,7 +258,7 @@ endif;
if (strlen($STATUS)): if (strlen($STATUS)):
?> ?>
<div id="status" role="alert" class="alert alert-success"> <div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS); ?> <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -270,7 +270,7 @@ endif;
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div> ?>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> <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="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:'); ?> <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.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>,
@ -284,7 +284,7 @@ endif;
if (strlen($URLSHORTENER)): if (strlen($URLSHORTENER)):
?> ?>
<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-warning"> <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'); ?> <span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button> </button>
<?php <?php
endif; endif;
@ -317,7 +317,7 @@ endif;
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4> <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 class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12"> <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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?> <?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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'), PHP_EOL; ?>
</p> </p>
</div> </div>
</footer> </footer>

View file

@ -71,19 +71,19 @@ endif;
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-warning navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
</button> </button>
<?php <?php
if ($EXPIRECLONE): if ($EXPIRECLONE):
?> ?>
<button id="clonebutton" type="button" class="hidden btn btn-warning navbar-btn"> <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'); ?> <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-warning navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button> </button>
</li> </li>
<li class="dropdown"> <li class="dropdown">
@ -107,7 +107,7 @@ foreach ($EXPIRE as $key => $value):
?> ?>
<li> <li>
<a href="#" data-expiration="<?php echo $key; ?>"> <a href="#" data-expiration="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -118,12 +118,12 @@ endforeach;
<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<?php
endif; endif;
?> /> ?> />
<?php echo I18n::_('Burn after reading'); ?> <?php echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
@ -133,12 +133,12 @@ if ($DISCUSSION):
<li> <li>
<div id="opendisc" class="navbar-text checkbox hidden"> <div id="opendisc" 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<?php
endif; endif;
?> /> ?> />
<?php echo I18n::_('Open discussion'); ?> <?php echo I18n::_('Open discussion'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
@ -165,7 +165,7 @@ if ($FILEUPLOAD):
</li> </li>
<li> <li>
<a id="fileremovebutton" href="#"> <a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'); ?> <?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
</a> </a>
</li> </li>
</ul> </ul>
@ -194,7 +194,7 @@ foreach ($FORMATTER as $key => $value):
?> ?>
<li> <li>
<a href="#" data-format="<?php echo $key; ?>"> <a href="#" data-format="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -228,7 +228,7 @@ endif;
?> ?>
<li> <li>
<button id="sendbutton" type="button" class="hidden btn btn-warning navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?>
</button> </button>
</li> </li>
</ul> </ul>
@ -239,7 +239,7 @@ endif;
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); ?> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -258,7 +258,7 @@ endif;
if (strlen($STATUS)): if (strlen($STATUS)):
?> ?>
<div id="status" role="alert" class="alert alert-success"> <div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS); ?> <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -270,7 +270,7 @@ endif;
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div> ?>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> <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="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:'); ?> <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.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>,
@ -284,7 +284,7 @@ endif;
if (strlen($URLSHORTENER)): if (strlen($URLSHORTENER)):
?> ?>
<button id="shortenbutton" data-shortener="<?php echo htmlspecialchars($URLSHORTENER); ?>" type="button" class="btn btn-warning"> <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'); ?> <span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button> </button>
<?php <?php
endif; endif;
@ -317,7 +317,7 @@ endif;
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4> <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 class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12"> <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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?> <?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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'), PHP_EOL; ?>
</p> </p>
</div> </div>
</footer> </footer>

View file

@ -71,19 +71,19 @@ endif;
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<button id="sendbutton" type="button" class="hidden btn btn-primary navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?>
</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-default navbar-btn">
<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo I18n::_('Clone'); ?> <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-default navbar-btn">
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'); ?> <span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button> </button>
</li> </li>
<li class="dropdown"> <li class="dropdown">
@ -107,7 +107,7 @@ foreach ($EXPIRE as $key => $value):
?> ?>
<li> <li>
<a href="#" data-expiration="<?php echo $key; ?>"> <a href="#" data-expiration="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -118,12 +118,12 @@ endforeach;
<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 echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
@ -133,12 +133,12 @@ if ($DISCUSSION):
<li> <li>
<div id="opendisc" class="navbar-text checkbox hidden"> <div id="opendisc" 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 echo I18n::_('Open discussion'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
@ -165,7 +165,7 @@ if ($FILEUPLOAD):
</li> </li>
<li> <li>
<a id="fileremovebutton" href="#"> <a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'); ?> <?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
</a> </a>
</li> </li>
</ul> </ul>
@ -194,7 +194,7 @@ foreach ($FORMATTER as $key => $value):
?> ?>
<li> <li>
<a href="#" data-format="<?php echo $key; ?>"> <a href="#" data-format="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -228,7 +228,7 @@ endif;
?> ?>
<li> <li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
</button> </button>
</li> </li>
</ul> </ul>
@ -239,7 +239,7 @@ endif;
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); ?> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -258,7 +258,7 @@ endif;
if (strlen($STATUS)): if (strlen($STATUS)):
?> ?>
<div id="status" role="alert" class="alert alert-success"> <div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS); ?> <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -270,7 +270,7 @@ endif;
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div> ?>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> <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="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:'); ?> <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.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>,
@ -284,7 +284,7 @@ endif;
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-primary">
<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'); ?> <span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button> </button>
<?php <?php
endif; endif;
@ -317,7 +317,7 @@ endif;
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4> <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 class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12"> <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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?> <?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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'), PHP_EOL; ?>
</p> </p>
</div> </div>
</footer> </footer>

View file

@ -71,19 +71,19 @@ endif;
<ul class="nav navbar-nav"> <ul class="nav navbar-nav">
<li> <li>
<button id="newbutton" type="button" class="reloadlink hidden btn btn-default navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-file" aria-hidden="true"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
</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-default navbar-btn">
<span class="glyphicon glyphicon-duplicate" aria-hidden="true"></span> <?php echo I18n::_('Clone'); ?> <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-default navbar-btn">
<span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'); ?> <span class="glyphicon glyphicon-text-background" aria-hidden="true"></span> <?php echo I18n::_('Raw text'), PHP_EOL; ?>
</button> </button>
</li> </li>
<li class="dropdown"> <li class="dropdown">
@ -107,7 +107,7 @@ foreach ($EXPIRE as $key => $value):
?> ?>
<li> <li>
<a href="#" data-expiration="<?php echo $key; ?>"> <a href="#" data-expiration="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -118,12 +118,12 @@ endforeach;
<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 echo I18n::_('Burn after reading'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
@ -133,12 +133,12 @@ if ($DISCUSSION):
<li> <li>
<div id="opendisc" class="navbar-text checkbox hidden"> <div id="opendisc" 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 echo I18n::_('Open discussion'), PHP_EOL; ?>
</label> </label>
</div> </div>
</li> </li>
@ -165,7 +165,7 @@ if ($FILEUPLOAD):
</li> </li>
<li> <li>
<a id="fileremovebutton" href="#"> <a id="fileremovebutton" href="#">
<?php echo I18n::_('Remove attachment'); ?> <?php echo I18n::_('Remove attachment'), PHP_EOL; ?>
</a> </a>
</li> </li>
</ul> </ul>
@ -194,7 +194,7 @@ foreach ($FORMATTER as $key => $value):
?> ?>
<li> <li>
<a href="#" data-format="<?php echo $key; ?>"> <a href="#" data-format="<?php echo $key; ?>">
<?php echo $value; ?> <?php echo $value, PHP_EOL; ?>
</a> </a>
</li> </li>
<?php <?php
@ -228,7 +228,7 @@ endif;
?> ?>
<li> <li>
<button id="sendbutton" type="button" class="hidden btn btn-primary navbar-btn"> <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'); ?> <span class="glyphicon glyphicon-upload" aria-hidden="true"></span> <?php echo I18n::_('Send'), PHP_EOL; ?>
</button> </button>
</li> </li>
</ul> </ul>
@ -239,7 +239,7 @@ endif;
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); ?> <span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span> <?php echo htmlspecialchars($NOTICE), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -258,7 +258,7 @@ endif;
if (strlen($STATUS)): if (strlen($STATUS)):
?> ?>
<div id="status" role="alert" class="alert alert-success"> <div id="status" role="alert" class="alert alert-success">
<span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS); ?> <span class="glyphicon glyphicon-ok" aria-hidden="true"></span> <?php echo htmlspecialchars($STATUS), PHP_EOL; ?>
</div> </div>
<?php <?php
endif; endif;
@ -270,7 +270,7 @@ endif;
?>alert alert-danger"><span class="glyphicon glyphicon-alert" aria-hidden="true"></span> <?php echo htmlspecialchars($ERROR); ?></div> ?>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> <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="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:'); ?> <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.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>,
@ -284,7 +284,7 @@ endif;
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-primary">
<span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'); ?> <span class="glyphicon glyphicon-send" aria-hidden="true"></span> <?php echo I18n::_('Shorten URL'), PHP_EOL; ?>
</button> </button>
<?php <?php
endif; endif;
@ -317,7 +317,7 @@ endif;
<h4 class="col-md-5 col-xs-8"><?php echo I18n::_('PrivateBin'); ?> <small>- <?php echo I18n::_('Because ignorance is bliss'); ?></small></h4> <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 class="col-md-1 col-xs-4 text-center"><?php echo $VERSION; ?></p>
<p id="aboutbox" class="col-md-6 col-xs-12"> <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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'); ?> <?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://github.com/PrivateBin/PrivateBin/wiki">project page</a>.'), PHP_EOL; ?>
</p> </p>
</div> </div>
</footer> </footer>

View file

@ -65,7 +65,7 @@ endif;
<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 PrivateBin to work.<br />Sorry for the inconvenience.'); ?></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::_('PrivateBin requires a modern browser to work.'); ?></div>
<div id="ienotice"><?php echo I18n::_('Still using Internet Explorer? Do yourself a favor, switch to a modern browser:'); ?> <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>,
@ -104,7 +104,7 @@ endforeach;
</div> </div>
<div id="remainingtime" class="hidden"></div> <div id="remainingtime" class="hidden"></div>
<div id="burnafterreadingoption" class="button hidden"> <div id="burnafterreadingoption" class="button hidden">
<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;
@ -115,7 +115,7 @@ endif;
if ($DISCUSSION): if ($DISCUSSION):
?> ?>
<div id="opendisc" class="button hidden"> <div id="opendisc" 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
endif; endif;

View file

@ -114,10 +114,9 @@ class FilesystemTest extends PHPUnit_Framework_TestCase
public function testCommentErrorDetection() public function testCommentErrorDetection()
{ {
$this->_model->delete(Helper::getPasteId()); $this->_model->delete(Helper::getPasteId());
$paste = Helper::getPaste();
$comment = Helper::getComment(array('formatter' => "Invalid UTF-8 sequence: \xB1\x31")); $comment = Helper::getComment(array('formatter' => "Invalid UTF-8 sequence: \xB1\x31"));
$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(), Helper::getPaste()) === true, 'store new paste'); $this->assertTrue($this->_model->create(Helper::getPasteId(), Helper::getPaste()), 'store new paste');
$this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists after storing it'); $this->assertTrue($this->_model->exists(Helper::getPasteId()), 'paste exists after storing it');
$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->assertFalse($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), $comment), 'unable to store broken comment'); $this->assertFalse($this->_model->createComment(Helper::getPasteId(), Helper::getPasteId(), Helper::getCommentId(), $comment), 'unable to store broken comment');