= 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 error($message) { global $board; die(Element('page.html', Array( 'index'=>ROOT, 'title'=>'Error', 'subtitle'=>'An error has occured.', 'body'=>"
" . "

$message

" . "

Go back.

" . "
" ))); } class Post { public function __construct($id, $thread, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename) { $this->id = $id; $this->thread = $thread; $this->subject = utf8tohtml($subject); $this->email = $email; $this->name = utf8tohtml($name); $this->trip = $trip; $this->body = $body; $this->time = $time; $this->thumb = $thumb; $this->thumbx = $thumbx; $this->thumby = $thumby; $this->file = $file; $this->filex = $filex; $this->filey = $filey; $this->filesize = $filesize; $this->filename = $filename; } public function build($index=false) { global $board; $built = '
' . '

'; // Subject if(!empty($this->subject)) $built .= '' . $this->subject . ' '; // Email if(!empty($this->email)) $built .= ''; // Date/time $built .= ' ' . date('m/d/y (D) H:i:s', $this->time); $built .= ' No.' . // JavaScript cite ''.$this->id.'' . '

'; // File info if(!empty($this->file)) { $built .= '

File: ' . $this->file . ' (' . // Filesize format_bytes($this->filesize) . ', ' . // File dimensions $this->filex . 'x' . $this->filey; // Aspect Ratio if(SHOW_RATIO) { $fraction = fraction($this->filex, $this->filey, ':'); $built .= ', ' . $fraction; } // Filename $built .= ', ' . $this->filename . ')

' . // Thumbnail ''; } // Body $built .= '

' . $this->body . '


'; return $built; } }; class Thread { public $omitted = 0; public function __construct($id, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename) { $this->id = $id; $this->subject = utf8tohtml($subject); $this->email = $email; $this->name = utf8tohtml($name); $this->trip = $trip; $this->body = $body; $this->time = $time; $this->thumb = $thumb; $this->thumbx = $thumbx; $this->thumby = $thumby; $this->file = $file; $this->filex = $filex; $this->filey = $filey; $this->filesize = $filesize; $this->filename = $filename; $this->omitted = 0; $this->posts = Array(); } public function add(Post $post) { $this->posts[] = $post; } public function build($index=false) { global $board; $built = '

File: ' . $this->file . ' (' . // Filesize format_bytes($this->filesize) . ', ' . // File dimensions $this->filex . 'x' . $this->filey; // Aspect Ratio if(SHOW_RATIO) { $fraction = fraction($this->filex, $this->filey, ':'); $built .= ', ' . $fraction; } // Filename $built .= ', ' . $this->filename . ')

' . // Thumbnail ''; $built .= '

'; // Subject if(!empty($this->subject)) $built .= '' . $this->subject . ' '; // Email if(!empty($this->email)) $built .= ''; // Date/time $built .= ' ' . date('m/d/y (D) H:i:s', $this->time); $built .= ' No.' . // JavaScript cite ''.$this->id.'' . // [Reply] ($index ? '[Reply]' : '') . '

'; // Body $built .= $this->body . // Omitted posts ($this->omitted ? '' . $this->omitted . ' post' . ($this->omitted==1?'':'s') . ' omitted. Click reply to view.':'') . // End '
'; // Replies foreach($this->posts as &$post) { $built .= $post->build($index); } $built .= '

'; return $built; } }; ?>