From 3d92990b1817ac20935274682764711080e8b254 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Tue, 2 Nov 2010 21:57:33 +1100 Subject: first commit --- inc/display.php | 121 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 121 insertions(+) create mode 100644 inc/display.php (limited to 'inc/display.php') diff --git a/inc/display.php b/inc/display.php new file mode 100644 index 00000000..f107462e --- /dev/null +++ b/inc/display.php @@ -0,0 +1,121 @@ += 1024 && $i < 4; $i++) $size /= 1024; + return round($size, 2).$units[$i]; + } + + function error($message) { + 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 = $subject; + $this->email = $email; + $this->name = $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) { + $built = ' +
+

+ + '.$this->subject.' + + ' . ( !empty($this->email) ? '':'') + . ' ' . date('m/d/y (D) H:i:s', $this->time).' + No.'.$this->id.' +

+ '.(!empty($this->file)?'

+ File: '.basename($this->file).' ('.format_bytes($this->filesize).', '.$this->filex.'x'.$this->filey.', '.$this->filename.') +

+ ':'').' +

+ '.$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 = $subject; + $this->email = $email; + $this->name = $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) { + $built = '

+ File: '.basename($this->file).' ('.format_bytes($this->filesize).', '.$this->filex.'x'.$this->filey.', '.$this->filename.') +

+ +
+

+ + '.$this->subject.' + + ' . ( !empty($this->email) ? '':'') + . ' ' . date('m/d/y (D) H:i:s', $this->time). ' + No.'.$this->id.'' . ($index ? '[Reply]' : '') . + '

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

'; + return $built; + } + }; +?> \ No newline at end of file -- cgit v1.3