/** * format a given number of bytes in IEC 80000-13:2008 notation (localized) * * @access public * @static * @param int $size * @return string */ public static function formatHumanReadableSize($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, '.', ' ') . ' ' . I18n::_($iec[$i]); }
</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>
?> </button> <button id="messagepreview"><?php echo I18n::_('Preview'); ?> </button> </div> <div id="image" class="hidden"></div> <div id="prettymessage" class="hidden"> <pre id="prettyprint" class="prettyprint linenums:1"></pre> </div> <div id="cleartext" class="hidden"></div> <textarea id="message" name="message" cols="80" rows="25" class="hidden"></textarea> </article> </section> <section> <div id="discussion" class="hidden"> <h4 class="title"><?php echo I18n::_('Discussion'); ?> </h4> <div id="comments"></div> </div> </section> <div id="cipherdata" class="hidden"><?php echo htmlspecialchars($CIPHERDATA, ENT_NOQUOTES); ?> </div> </body> </html>
/** * get a section from the configuration, must exist * * @param string $section * @throws Exception * return mixed */ public function getSection($section) { if (!array_key_exists($section, $this->_configuration)) { throw new Exception(I18n::_('PrivateBin requires configuration section [%s] to be present in configuration file.', $section), 3); } return $this->_configuration[$section]; }
/** * prepares JSON encoded status message * * @access private * @param int $status * @param string $message * @param array $other * @return void */ private function _return_message($status, $message, $other = array()) { $result = array('status' => $status); if ($status) { $result['message'] = I18n::_($message); } else { $result['id'] = $message; $result['url'] = $this->_urlBase . '?' . $message; } $result += $other; $this->_json = json_encode($result); }