From e4016687321770054d134f13f3275fc0523588e8 Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Sat, 1 Jan 2011 22:12:31 +1100 Subject: Fixed major security bug and image deleting --- inc/display.php | 50 +++++++++++++++++++++++++------------------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'inc/display.php') diff --git a/inc/display.php b/inc/display.php index a5bfcf7b..32eb9cb2 100644 --- a/inc/display.php +++ b/inc/display.php @@ -49,7 +49,7 @@ } class Post { - public function __construct($id, $thread, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $root=ROOT) { + public function __construct($id, $thread, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $root=ROOT, $mod=false) { $this->id = $id; $this->thread = $thread; $this->subject = utf8tohtml($subject); @@ -68,34 +68,33 @@ $this->filename = $filename; $this->ip = $ip; $this->root = $root; + $this->mod = $mod; } public function postControls() { - global $mod; - $built = ''; - if($mod) { + if($this->mod) { // Mod controls (on posts) $built .= ''; // Delete - if($mod['type'] >= MOD_DELETE) + if($this->mod['type'] >= MOD_DELETE) $built .= ' ' . MOD_LINK_DELETE . ''; // Delete all posts by IP - if($mod['type'] >= MOD_DELETEBYIP) + if($this->mod['type'] >= MOD_DELETEBYIP) $built .= ' ' . MOD_LINK_DELETEBYIP . ''; // Ban - if($mod['type'] >= MOD_BAN) + if($this->mod['type'] >= MOD_BAN) $built .= ' ' . MOD_LINK_BAN . ''; // Ban & Delete - if($mod['type'] >= MOD_BANDELETE) + if($this->mod['type'] >= MOD_BANDELETE) $built .= ' ' . MOD_LINK_BANDELETE . ''; // Delete file (keep post) - if(!empty($this->file) && $mod['type'] >= MOD_DELETEFILE) - $built .= ' ' . MOD_LINK_DELETEFILE . ''; + if(!empty($this->file) && $this->mod['type'] >= MOD_DELETEFILE) + $built .= ' ' . MOD_LINK_DELETEFILE . ''; $built .= ''; } @@ -103,7 +102,7 @@ } public function build($index=false) { - global $board, $mod; + global $board; $built = '
' . '

'; @@ -120,7 +119,7 @@ . (!empty($this->trip) ? ' '.$this->trip.'':''); // IP Address - if($mod && $mod['type'] >= MOD_SHOW_IP) { + if($this->mod && $this->mod['type'] >= MOD_SHOW_IP) { $built .= ' [' . $this->ip . ']'; } @@ -140,7 +139,7 @@ '

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

File: ' . $this->file . ' (' . // Filesize format_bytes($this->filesize) . ', ' . @@ -156,6 +155,8 @@ // Thumbnail ''; + } elseif($this->file == 'deleted') { + $built .= ''; } $built .= $this->postControls(); @@ -169,7 +170,7 @@ class Thread { public $omitted = 0; - public function __construct($id, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $root=ROOT) { + public function __construct($id, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $sticky, $root=ROOT, $mod=false) { $this->id = $id; $this->subject = utf8tohtml($subject); $this->email = $email; @@ -190,36 +191,35 @@ $this->ip = $ip; $this->sticky = $sticky; $this->root = $root; + $this->mod = $mod; } public function add(Post $post) { $this->posts[] = $post; } - public function postControls() { - global $mod; - + public function postControls() { $built = ''; - if($mod) { + if($this->mod) { // Mod controls (on posts) $built .= ''; // Delete - if($mod['type'] >= MOD_DELETE) + if($this->mod['type'] >= MOD_DELETE) $built .= ' ' . MOD_LINK_DELETE . ''; // Delete all posts by IP - if($mod['type'] >= MOD_DELETEBYIP) + if($this->mod['type'] >= MOD_DELETEBYIP) $built .= ' ' . MOD_LINK_DELETEBYIP . ''; // Ban - if($mod['type'] >= MOD_BAN) + if($this->mod['type'] >= MOD_BAN) $built .= ' ' . MOD_LINK_BAN . ''; // Ban & Delete - if($mod['type'] >= MOD_BANDELETE) + if($this->mod['type'] >= MOD_BANDELETE) $built .= ' ' . MOD_LINK_BANDELETE . ''; // Delete file (keep post) - if($mod['type'] >= MOD_STICKY) + if($this->mod['type'] >= MOD_STICKY) if($this->sticky) $built .= ' ' . MOD_LINK_DESTICKY . ''; else @@ -231,7 +231,7 @@ } public function build($index=false) { - global $board, $mod; + global $board; $built = '

File: ' . $this->file . ' (' . // Filesize @@ -262,7 +262,7 @@ . (!empty($this->trip) ? ' '.$this->trip.'':''); // IP Address - if($mod && $mod['type'] >= MOD_SHOW_IP) { + if($this->mod && $this->mod['type'] >= MOD_SHOW_IP) { $built .= ' [' . $this->ip . ']'; } -- cgit v1.3