From be1f1192279772f83454d5c543ecc51b242dd08d Mon Sep 17 00:00:00 2001 From: Savetheinternet Date: Thu, 16 Dec 2010 17:04:10 +1100 Subject: [PATCH] Mod controls for OP --- inc/display.php | 76 ++++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 48 insertions(+), 28 deletions(-) diff --git a/inc/display.php b/inc/display.php index b8a58e2b..b0980fa3 100644 --- a/inc/display.php +++ b/inc/display.php @@ -48,6 +48,50 @@ ))); } + function postControls($id, $thread=false) { + global $mod; + + $built = ''; + if($mod) { + // Mod controls (on posts) + if($thread) { + $built .= ''; + } else { + $built .= ''; + } + + // Delete + if($mod['type'] >= MOD_DELETE) + $built .= ' ' . MOD_LINK_DELETE . ''; + + // Delete all posts by IP + if($mod['type'] >= MOD_DELETEBYIP) + $built .= ' ' . MOD_LINK_DELETEBYIP . ''; + + // Ban + if($mod['type'] >= MOD_BAN) + $built .= ' ' . MOD_LINK_BAN . ''; + + // Ban & Delete + if($mod['type'] >= MOD_BANDELETE) + $built .= ' ' . MOD_LINK_BANDELETE . ''; + + // Delete file (keep post) + if(!$thread && $mod['type'] >= MOD_DELETEFILE) + $built .= ' ' . MOD_LINK_DELETEFILE . ''; + + if($thread) { + // Delete file (keep post) + if($mod['type'] >= MOD_STICKY) + $built .= ' ' . MOD_LINK_STICKY . ''; + + } + + $built .= ''; + } + return $built; + } + class Post { public function __construct($id, $thread, $subject, $email, $name, $trip, $body, $time, $thumb, $thumbx, $thumby, $file, $filex, $filey, $filesize, $filename, $ip, $root=ROOT) { $this->id = $id; @@ -125,33 +169,7 @@ ''; } - if($mod) { - // Mod controls (on posts) - $built .= '

'; - - // Delete - if($mod['type'] >= MOD_DELETE) - $built .= ' ' . MOD_LINK_DELETE . ''; - - // Delete all posts by IP - if($mod['type'] >= MOD_DELETEBYIP) - $built .= ' ' . MOD_LINK_DELETEBYIP . ''; - - // Ban - if($mod['type'] >= MOD_BAN) - $built .= ' ' . MOD_LINK_BAN . ''; - - // Ban & Delete - if($mod['type'] >= MOD_BANDELETE) - $built .= ' ' . MOD_LINK_BANDELETE . ''; - - // Delete file (keep post) - if($mod['type'] >= MOD_DELETEFILE) - $built .= ' ' . MOD_LINK_DELETEFILE . ''; - - - $built .= '

'; - } + $built .= postControls($this->id); // Body $built .= '

' . $this->body . '


'; @@ -239,8 +257,10 @@ ''.$this->id.'' . // [Reply] ($index ? '[Reply]' : '') . + // Mod controls + postControls($this->id, true) . '

'; - + // Body $built .= $this->body .