mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2024-10-01 01:26:10 -04:00
bc8b23d35e
With a client IE < 10 there was a XSS security flaw. Other browsers were not affected. Also corrected spacing display with IE<10. (cherry picked from commit 28813cd82ae47e556b610da3c7302a6709e27431) Conflicts: CHANGELOG.md index.php js/zerobin.js lib/vizhash16x16.php
54 lines
1.2 KiB
PHP
54 lines
1.2 KiB
PHP
<?php
|
|
/**
|
|
* ZeroBin
|
|
*
|
|
* a zero-knowledge paste bin
|
|
*
|
|
* @link http://sebsauvage.net/wiki/doku.php?id=php:zerobin
|
|
* @copyright 2012 Sébastien SAUVAGE (sebsauvage.net)
|
|
* @license http://www.opensource.org/licenses/zlib-license.php The zlib/libpng License
|
|
* @version 0.19
|
|
*/
|
|
|
|
/**
|
|
* filter
|
|
*
|
|
* Provides data filtering functions.
|
|
*/
|
|
class filter
|
|
{
|
|
/**
|
|
* strips slashes deeply
|
|
*
|
|
* @access public
|
|
* @static
|
|
* @param mixed $value
|
|
* @return mixed
|
|
*/
|
|
public static function stripslashes_deep($value)
|
|
{
|
|
return is_array($value) ?
|
|
array_map('filter::stripslashes_deep', $value) :
|
|
stripslashes($value);
|
|
}
|
|
|
|
/**
|
|
* format a given number of bytes
|
|
*
|
|
* @access public
|
|
* @static
|
|
* @param int $size
|
|
* @return string
|
|
*/
|
|
public static function size_humanreadable($size)
|
|
{
|
|
$iec = array('B', 'kiB', 'MiB', 'GiB', 'TiB', 'PiB', 'EiB', 'ZiB', 'YiB');
|
|
$i = 0;
|
|
while ( ( $size / 1024 ) >= 1 ) {
|
|
$size = $size / 1024;
|
|
$i++;
|
|
}
|
|
return number_format($size, ($i ? 2 : 0), '.', ' ') . ' ' . $iec[$i];
|
|
}
|
|
}
|