summaryrefslogtreecommitdiff
path: root/inc/display.php
diff options
context:
space:
mode:
authorSavetheinternet <savetheinternet@n0v4.com>2010-12-17 02:20:16 +1100
committerSavetheinternet <savetheinternet@n0v4.com>2010-12-17 02:20:16 +1100
commit9554291802cb8ac712ba25d1a59ced31d20b07f0 (patch)
tree6861b6ebffe4e2f54573907cc789b34648d59c24 /inc/display.php
parent4052d6350214e5384cfe15823e29197d2eaf7326 (diff)
Mod controls and permissions
Diffstat (limited to 'inc/display.php')
-rw-r--r--inc/display.php116
1 files changed, 70 insertions, 46 deletions
diff --git a/inc/display.php b/inc/display.php
index 8cf4a18e..5dbccc8f 100644
--- a/inc/display.php
+++ b/inc/display.php
@@ -48,50 +48,6 @@
)));
}
- function postControls($id, $thread=false) {
- global $mod;
-
- $built = '';
- if($mod) {
- // Mod controls (on posts)
- if($thread) {
- $built .= '<span class="controls op">';
- } else {
- $built .= '<span class="controls">';
- }
-
- // Delete
- if($mod['type'] >= MOD_DELETE)
- $built .= ' <a title="Delete" href="?/b/delete/' . $id . '">' . MOD_LINK_DELETE . '</a>';
-
- // Delete all posts by IP
- if($mod['type'] >= MOD_DELETEBYIP)
- $built .= ' <a title="Delete all posts by IP" href="?/b/deletebyip/' . $id . '">' . MOD_LINK_DELETEBYIP . '</a>';
-
- // Ban
- if($mod['type'] >= MOD_BAN)
- $built .= ' <a title="Ban" href="?/b/ban/' . $id . '">' . MOD_LINK_BAN . '</a>';
-
- // Ban & Delete
- if($mod['type'] >= MOD_BANDELETE)
- $built .= ' <a title="Ban & Delete" href="?/b/ban&amp;delete/' . $id . '">' . MOD_LINK_BANDELETE . '</a>';
-
- // Delete file (keep post)
- if(!$thread && $mod['type'] >= MOD_DELETEFILE)
- $built .= ' <a title="Remove file" href="?/b/file/' . $id . '">' . MOD_LINK_DELETEFILE . '</a>';
-
- if($thread) {
- // Delete file (keep post)
- if($mod['type'] >= MOD_STICKY)
- $built .= ' <a title="Make thread sticky" href="?/b/sticky/' . $id . '">' . MOD_LINK_STICKY . '</a>';
-
- }
-
- $built .= '</span>';
- }
- 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;
@@ -113,6 +69,39 @@
$this->ip = $ip;
$this->root = $root;
}
+ public function postControls() {
+ global $mod;
+
+ $built = '';
+ if($mod) {
+ // Mod controls (on posts)
+ $built .= '<span class="controls">';
+
+ // Delete
+ if($mod['type'] >= MOD_DELETE)
+ $built .= ' <a title="Delete" href="?/b/delete/' . $this->id . '">' . MOD_LINK_DELETE . '</a>';
+
+ // Delete all posts by IP
+ if($mod['type'] >= MOD_DELETEBYIP)
+ $built .= ' <a title="Delete all posts by IP" href="?/b/deletebyip/' . $this->id . '">' . MOD_LINK_DELETEBYIP . '</a>';
+
+ // Ban
+ if($mod['type'] >= MOD_BAN)
+ $built .= ' <a title="Ban" href="?/b/ban/' . $this->id . '">' . MOD_LINK_BAN . '</a>';
+
+ // Ban & Delete
+ if($mod['type'] >= MOD_BANDELETE)
+ $built .= ' <a title="Ban & Delete" href="?/b/ban&amp;delete/' . $this->id . '">' . MOD_LINK_BANDELETE . '</a>';
+
+ // Delete file (keep post)
+ if($mod['type'] >= MOD_DELETEFILE)
+ $built .= ' <a title="Remove file" href="?/b/file/' . $this->id . '">' . MOD_LINK_DELETEFILE . '</a>';
+
+ $built .= '</span>';
+ }
+ return $built;
+ }
+
public function build($index=false) {
global $board, $mod;
@@ -169,7 +158,7 @@
'<a href="' . ROOT . $board['dir'] . DIR_IMG . $this->file.'"><img src="' . ROOT . $board['dir'] . DIR_THUMB . $this->thumb.'" style="width:'.$this->thumbx.'px;height:'.$this->thumby.'px;" /></a>';
}
- $built .= postControls($this->id);
+ $built .= $this->postControls();
// Body
$built .= '<p class="body">' . $this->body . '</p></div><br class="clear"/>';
@@ -205,6 +194,41 @@
public function add(Post $post) {
$this->posts[] = $post;
}
+ public function postControls() {
+ global $mod;
+
+ $built = '';
+ if($mod) {
+ // Mod controls (on posts)
+ $built .= '<span class="controls op">';
+
+ // Delete
+ if($mod['type'] >= MOD_DELETE)
+ $built .= ' <a title="Delete" href="?/b/delete/' . $this->id . '">' . MOD_LINK_DELETE . '</a>';
+
+ // Delete all posts by IP
+ if($mod['type'] >= MOD_DELETEBYIP)
+ $built .= ' <a title="Delete all posts by IP" href="?/b/deletebyip/' . $this->id . '">' . MOD_LINK_DELETEBYIP . '</a>';
+
+ // Ban
+ if($mod['type'] >= MOD_BAN)
+ $built .= ' <a title="Ban" href="?/b/ban/' . $this->id . '">' . MOD_LINK_BAN . '</a>';
+
+ // Ban & Delete
+ if($mod['type'] >= MOD_BANDELETE)
+ $built .= ' <a title="Ban & Delete" href="?/b/ban&amp;delete/' . $this->id . '">' . MOD_LINK_BANDELETE . '</a>';
+
+ // Delete file (keep post)
+ if($mod['type'] >= MOD_STICKY)
+ if($this->sticky)
+ $built .= ' <a title="Make thread not sticky" href="?/b/unsticky/' . $this->id . '">' . MOD_LINK_DESTICKY . '</a>';
+ else
+ $built .= ' <a title="Make thread sticky" href="?/b/sticky/' . $this->id . '">' . MOD_LINK_STICKY . '</a>';
+
+ $built .= '</span>';
+ }
+ return $built;
+ }
public function build($index=false) {
global $board, $mod;
@@ -261,7 +285,7 @@
($index ? '<a href="' . $this->root . $board['dir'] . DIR_RES . $this->id . '.html">[Reply]</a>' : '') .
// Mod controls
- postControls($this->id, true) .
+ $this->postControls() .
'</p>';
// Body