applying patch based on StyleCI ruleset

This commit is contained in:
El RIDO
2016-10-29 10:24:08 +02:00
parent c8b1296929
commit 1f46823942
33 changed files with 430 additions and 452 deletions

View File

@@ -9,10 +9,8 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin;
use PrivateBin\I18n;
use Exception;
use PDO;
@@ -37,51 +35,51 @@ class Configuration
*/
private static $_defaults = array(
'main' => array(
'discussion' => true,
'opendiscussion' => false,
'password' => true,
'fileupload' => false,
'discussion' => true,
'opendiscussion' => false,
'password' => true,
'fileupload' => false,
'burnafterreadingselected' => false,
'defaultformatter' => 'plaintext',
'syntaxhighlightingtheme' => null,
'sizelimit' => 2097152,
'template' => 'bootstrap',
'notice' => '',
'languageselection' => false,
'languagedefault' => '',
'urlshortener' => '',
'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;',
'zerobincompatibility' => false,
'defaultformatter' => 'plaintext',
'syntaxhighlightingtheme' => null,
'sizelimit' => 2097152,
'template' => 'bootstrap',
'notice' => '',
'languageselection' => false,
'languagedefault' => '',
'urlshortener' => '',
'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;',
'zerobincompatibility' => false,
),
'expire' => array(
'default' => '1week',
'clone' => true,
'clone' => true,
),
'expire_options' => array(
'5min' => 300,
'10min' => 600,
'1hour' => 3600,
'1day' => 86400,
'1week' => 604800,
'5min' => 300,
'10min' => 600,
'1hour' => 3600,
'1day' => 86400,
'1week' => 604800,
'1month' => 2592000,
'1year' => 31536000,
'never' => 0,
'1year' => 31536000,
'never' => 0,
),
'formatter_options' => array(
'plaintext' => 'Plain Text',
'plaintext' => 'Plain Text',
'syntaxhighlighting' => 'Source Code',
'markdown' => 'Markdown',
'markdown' => 'Markdown',
),
'traffic' => array(
'limit' => 10,
'limit' => 10,
'header' => null,
'dir' => 'data',
'dir' => 'data',
),
'purge' => array(
'limit' => 300,
'limit' => 300,
'batchsize' => 10,
'dir' => 'data',
'dir' => 'data',
),
'model' => array(
'class' => 'Filesystem',

View File

@@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Data;
use stdClass;

View File

@@ -9,13 +9,12 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Data;
use PrivateBin\PrivateBin;
use Exception;
use PDO;
use PDOException;
use PrivateBin\PrivateBin;
use stdClass;
/**

View File

@@ -9,11 +9,10 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Data;
use PrivateBin\Model\Paste;
use PrivateBin\Json;
use PrivateBin\Model\Paste;
/**
* Filesystem

View File

@@ -9,10 +9,8 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin;
use PrivateBin\I18n;
use Exception;
/**

View File

@@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin;
/**
@@ -296,12 +295,12 @@ class I18n
switch (self::$_language) {
case 'fr':
case 'zh':
return ($n > 1 ? 1 : 0);
return $n > 1 ? 1 : 0;
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
default:
return ($n != 1 ? 1 : 0);
return $n != 1 ? 1 : 0;
}
}

View File

@@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin;
use Exception;

View File

@@ -9,10 +9,8 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin;
use PrivateBin\Data;
use PrivateBin\Model\Paste;
use PrivateBin\Persistence\PurgeLimiter;

View File

@@ -9,13 +9,12 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Model;
use Exception;
use PrivateBin\Configuration;
use PrivateBin\Data\AbstractData;
use PrivateBin\Sjcl;
use Exception;
use stdClass;
/**

View File

@@ -9,14 +9,13 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Model;
use PrivateBin\Sjcl;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Vizhash16x16;
use Identicon\Identicon;
use Exception;
use Identicon\Identicon;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Sjcl;
use PrivateBin\Vizhash16x16;
/**
* Comment

View File

@@ -9,13 +9,12 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Model;
use PrivateBin\PrivateBin;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Sjcl;
use Exception;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\PrivateBin;
use PrivateBin\Sjcl;
/**
* Paste
@@ -307,7 +306,6 @@ class Paste extends AbstractModel
$this->_data->meta->burnafterreading === true;
}
/**
* Check if paste has discussions enabled.
*

View File

@@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Persistence;
use Exception;

View File

@@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Persistence;
use PrivateBin\Configuration;

View File

@@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Persistence;
use Exception;

View File

@@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin\Persistence;
use PrivateBin\Configuration;

View File

@@ -9,12 +9,11 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin;
use PrivateBin\Persistence\TrafficLimiter;
use PrivateBin\Persistence\ServerSalt;
use Exception;
use PrivateBin\Persistence\ServerSalt;
use PrivateBin\Persistence\TrafficLimiter;
/**
* PrivateBin

View File

@@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin;
/**

View File

@@ -9,7 +9,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin;
/**
@@ -31,7 +30,7 @@ class Sjcl
*/
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
$decoded = json_decode($encoded);

View File

@@ -9,7 +9,6 @@
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 1.0
*/
namespace PrivateBin;
use Exception;

View File

@@ -10,7 +10,6 @@
* @license https://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
* @version 0.0.5 beta PrivateBin 1.0
*/
namespace PrivateBin;
/**
@@ -23,7 +22,6 @@ namespace PrivateBin;
* echo $data;
* exit;
*/
class Vizhash16x16
{
/**
@@ -105,7 +103,7 @@ class Vizhash16x16
$op = 'v';
if (($this->getInt() % 2) == 0) {
$op = 'h';
};
}
$image = $this->degrade($image, $op, array($r0, $g0, $b0), array(0, 0, 0));
for ($i = 0; $i < 7; ++$i) {
@@ -189,7 +187,7 @@ class Vizhash16x16
$diffs = array(
(($color2[0] - $color1[0]) / $size),
(($color2[1] - $color1[1]) / $size),
(($color2[2] - $color1[2]) / $size)
(($color2[2] - $color1[2]) / $size),
);
for ($i = 0; $i < $size; ++$i) {
$r = $color1[0] + ($diffs[0] * $i);
@@ -217,20 +215,20 @@ class Vizhash16x16
{
switch ($action % 7) {
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;
case 1:
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;
case 3:
$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;
default:
$start = $this->getInt() * 360 / 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);
}
}
}