= 1024 && $i < 4; $i++) $size /= 1024; return round($size, 2).$units[$i]; } function commaize($n) { $n = strval($n); return (intval($n) < 1000) ? $n : commaize(substr($n, 0, -3)) . ',' . substr($n, -3); } function doBoardListPart($list, $root) { global $config; $body = ''; foreach($list as $board) { if(is_array($board)) $body .= ' [' . doBoardListPart($board, $root) . '] '; else { if(($key = array_search($board, $list)) && gettype($key) == 'string') { $body .= ' ' . $key . ' /'; } else { $body .= ' ' . $board . ' /'; } } } $body = preg_replace('/\/$/', '', $body); return $body; } function createBoardlist($mod=false) { global $config; if(!isset($config['boards'])) return Array('top'=>'','bottom'=>''); $body = doBoardListPart($config['boards'], $mod?'?/':$config['root']); if(!preg_match('/\] $/', $body)) $body = '[' . $body . ']'; $body = trim($body); return Array( 'top' => '
' . // Delete '' // Poster ID . ($config['poster_ids'] ? ' ID: ' . poster_id($this->ip, $this->thread) : '') . ' No.' . // JavaScript cite ''.$this->id.'' . '
'; if($this->embed) { // Embedded video (or something else; doesn't have to be a video really) $built .= // Actual embedding $this->embed; } elseif(!empty($this->file) && $this->file != 'deleted') { // File info $built .= 'File: ' . $this->file . ' (' . // Filesize format_bytes($this->filesize) . // File dimensions ($this->filex && $this->filey ? ', ' . $this->filex . 'x' . $this->filey : '' ); // Aspect Ratio if($config['show_ratio'] && $this->filex && $this->filey) { $fraction = fraction($this->filex, $this->filey, ':'); $built .= ', ' . $fraction; } if($config['show_filename']) { // Filename $built .= ', ' . $this->filename; } $built .= ')
' . // Thumbnail ''; } elseif($this->file == 'deleted') { $built .= ''; } $built .= $this->postControls(); // Body $built .= '' . ($index ? truncate($this->body, $this->link()) : $this->body) . '
File: ' . $this->file . ' (' . // Filesize format_bytes($this->filesize) . // File dimensions ($this->filex && $this->filey ? ', ' . $this->filex . 'x' . $this->filey : '' ); // Aspect Ratio if($config['show_ratio'] && $this->filex && $this->filey) { $fraction = fraction($this->filex, $this->filey, ':'); $built .= ', ' . $fraction; } if($config['show_filename']) { // Filename $built .= ', ' . $this->filename; } $built .= ')
' . // Thumbnail ''; } elseif($this->file == 'deleted') { $built = ''; } $built .= ''; // Delete $built .= '' // Poster ID . ($config['poster_ids'] ? ' ID: ' . poster_id($this->ip, $this->id) : '') . ' No.' . // JavaScript cite ''.$this->id.'' . // Sticky ($this->sticky ? '' : '') . // Locked ($this->locked ? '' : '') . // [Reply] ($index ? '[Reply]' : '') . // Mod controls $this->postControls() . '
'; // Body $built .= '' . ($index ? truncate($this->body, $this->link()) : $this->body) . '
' . // Omitted posts ($this->omitted || $this->omitted_images? '' . ($this->omitted ? $this->omitted . ' post' . ($this->omitted==1?'':'s') . ($this->omitted_images ? ' and ' : '') :'') . ($this->omitted_images ? $this->omitted_images . ' image repl' . ($this->omitted_images==1?'y':'ies') :'') . ' omitted. Click reply to view.':'') . // End '