From 797fd8ad131e909d4dcc436e6bfa73921d8ea1dd Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Wed, 18 May 2011 17:05:48 +1000 Subject: Embedding field --- inc/display.php | 93 ++++++++++++++++++++++++++++++++++----------------------- 1 file changed, 55 insertions(+), 38 deletions(-) (limited to 'inc/display.php') diff --git a/inc/display.php b/inc/display.php index 2f0c15a2..7ec95ef3 100644 --- a/inc/display.php +++ b/inc/display.php @@ -186,7 +186,7 @@ } class Post { - public function __construct($id, $thread, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $root=null, $mod=false) { + public function __construct($id, $thread, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $embed, $root=null, $mod=false) { global $config; if(!isset($root)) $root = $config['root']; @@ -208,6 +208,7 @@ $this->filesize = $filesize; $this->filename = $filename; $this->ip = $ip; + $this->embed = $embed; $this->root = $root; $this->mod = $mod; @@ -312,28 +313,33 @@ // JavaScript cite ''.$this->id.'' . '

'; - - // File info - if(!empty($this->file) && $this->file != 'deleted') { + + 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; - } - // Filename - $built .= ', ' . $this->filename . ')

' . - - // Thumbnail - ''; - } elseif($this->file == 'deleted') { - $built .= ''; + // 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; + } + // Filename + $built .= ', ' . $this->filename . ')

' . + + // Thumbnail + ''; + } elseif($this->file == 'deleted') { + $built .= ''; } $built .= $this->postControls(); @@ -346,7 +352,7 @@ }; class Thread { - public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $root=null, $mod=false, $hr=true) { + public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $embed, $root=null, $mod=false, $hr=true) { global $config; if(!isset($root)) $root = $config['root']; @@ -372,6 +378,7 @@ $this->ip = $ip; $this->sticky = $sticky; $this->locked = $locked; + $this->embed = $embed; $this->root = $root; $this->mod = $mod; $this->hr = $hr; @@ -440,22 +447,32 @@ public function build($index=false) { global $board, $config; - $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($this->embed) { + // Embedded video (or something else; doesn't have to be a video really) + $built = + // Actual embedding + $this->embed; + } else { + // Image, not embedded shit + $built = + // File link + '

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; + } + // Filename + $built .= ', ' . $this->filename . ')

' . + // Thumbnail + ''; } - // Filename - $built .= ', ' . $this->filename . ')

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

'; -- cgit v1.3