+ $u = array('B', 'KB', 'MB', 'GB', 'TB');
+ $o = max($octets, 0);
+ $p = min(floor(($o ? log($o) : 0) / log(1024)), count($u) - 1);
+ $o /= pow(1024, $p);
+ return round($o, 1) . $u[$p];
+}
+
+// Convert UTC timestamp to a datetime field
+function jirafeau_get_datetimefield($timestamp)
+{
+ $content = '<span class="datetime" data-datetime="' . strftime('%Y-%m-%d %H:%M', $timestamp) . '">'
+ . strftime('%Y-%m-%d %H:%M', $timestamp) . ' (GMT)</span>';
+ return $content;
+}
+
+function jirafeau_fatal_error($errorText, $cfg = array())
+{
+ echo '<div class="error"><h2>Error</h2><p>' . $errorText . '</p></div>';
+ require(JIRAFEAU_ROOT . 'lib/template/footer.php');
+ exit;
+}
+
+function jirafeau_clean_rm_link($link)
+{
+ $p = s2p("$link");
+ if (file_exists(VAR_LINKS . $p . $link)) {
+ unlink(VAR_LINKS . $p . $link);
+ }