diff options
| author | czaks <marcin@6irc.net> | 2013-08-16 10:07:24 -0400 |
|---|---|---|
| committer | czaks <marcin@6irc.net> | 2013-08-16 10:07:24 -0400 |
| commit | 146243c473f24e6b86e711dd1afeebfcdd711af7 (patch) | |
| tree | 9b50f4b5bf76ada14b29cd9b672758f37522bd03 /inc/display.php | |
| parent | c2ffd324369dc8db4f67e6f035ccc335b3b20be7 (diff) | |
| parent | 0565e2119d54cb4be8c6931ee42acfb586188893 (diff) | |
Merge branch 'master' of https://github.com/savetheinternet/Tinyboard
Conflicts:
inc/config.php
inc/display.php
inc/functions.php
Diffstat (limited to 'inc/display.php')
| -rw-r--r-- | inc/display.php | 77 |
1 files changed, 25 insertions, 52 deletions
diff --git a/inc/display.php b/inc/display.php index 68fb1803..d4aa303b 100644 --- a/inc/display.php +++ b/inc/display.php @@ -271,36 +271,25 @@ function embed_html($link) { } class Post { - 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) { + public function __construct($post, $root=null, $mod=false) { global $config; if (!isset($root)) $root = &$config['root']; - $this->id = $id; - $this->thread = $thread; - $this->subject = utf8tohtml($subject); - $this->email = $email; - $this->name = utf8tohtml($name); - $this->trip = $trip; - $this->capcode = $capcode; - $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->ip = $ip; - $this->embed = $embed; - $this->root = $root; + foreach ($post as $key => $value) { + $this->{$key} = $value; + } + + $this->subject = utf8tohtml($this->subject); + $this->name = utf8tohtml($this->name); $this->mod = $mod; + $this->root = $root; if ($this->embed) $this->embed = embed_html($this->embed); + $this->modifiers = extract_modifiers($this->body_nomarkup); + if ($this->mod) // Fix internal links // Very complicated regex @@ -373,42 +362,30 @@ class Post { }; class Thread { - public function __construct($id, $subject, $email, $name, $trip, $capcode, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $locked, $bumplocked, $embed, $root=null, $mod=false, $hr=true) { + public function __construct($post, $root = null, $mod = false, $hr = true) { global $config; if (!isset($root)) $root = &$config['root']; - $this->id = $id; - $this->subject = utf8tohtml($subject); - $this->email = $email; - $this->name = utf8tohtml($name); - $this->trip = $trip; - $this->capcode = $capcode; - $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->omitted_images = 0; - $this->posts = array(); - $this->ip = $ip; - $this->sticky = $sticky; - $this->locked = $locked; - $this->bumplocked = $bumplocked; - $this->embed = $embed; - $this->root = $root; + foreach ($post as $key => $value) { + $this->{$key} = $value; + } + + $this->subject = utf8tohtml($this->subject); + $this->name = utf8tohtml($this->name); $this->mod = $mod; + $this->root = $root; $this->hr = $hr; + + $this->posts = array(); + $this->omitted = 0; + $this->omitted_images = 0; if ($this->embed) $this->embed = embed_html($this->embed); + $this->modifiers = extract_modifiers($this->body_nomarkup); + if ($this->mod) // Fix internal links // Very complicated regex @@ -471,7 +448,7 @@ class Thread { $built .= ' <a title="'._('Make thread sticky').'" href="?/' . secure_link($board['dir'] . 'sticky/' . $this->id) . '">' . $config['mod']['link_sticky'] . '</a>'; if (hasPermission($config['mod']['bumplock'], $board['uri'], $this->mod)) - if ($this->bumplocked) + if ($this->sage) $built .= ' <a title="'._('Allow thread to be bumped').'" href="?/' . secure_link($board['dir'] . 'bumpunlock/' . $this->id) . '">' . $config['mod']['link_bumpunlock'] . '</a>'; else $built .= ' <a title="'._('Prevent thread from being bumped').'" href="?/' . secure_link($board['dir'] . 'bumplock/' . $this->id) . '">' . $config['mod']['link_bumplock'] . '</a>'; @@ -496,10 +473,6 @@ class Thread { return $built; } - public function ratio() { - return fraction($this->filex, $this->filey, ':'); - } - public function build($index=false, $isnoko50=false) { global $board, $config, $debug; |
