From 042e7b9c598975f876d8a86c8e4242dbf17f7bdf Mon Sep 17 00:00:00 2001 From: Fredrick Brennan Date: Wed, 30 Apr 2014 17:18:35 -0400 Subject: Deprecate postControls(), per-file deletion and spoilering --- inc/display.php | 121 +------------------------------------------------------- 1 file changed, 2 insertions(+), 119 deletions(-) (limited to 'inc/display.php') diff --git a/inc/display.php b/inc/display.php index 6772e77d..c836247e 100644 --- a/inc/display.php +++ b/inc/display.php @@ -373,61 +373,11 @@ class Post { return $this->root . $board['dir'] . $config['dir']['res'] . sprintf($config['file_page'], $this->thread) . '#' . $pre . $this->id; } - public function postControls() { - global $board, $config; - - $built = ''; - if ($this->mod) { - // Mod controls (on posts) - - // Delete - if (hasPermission($config['mod']['delete'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], 'Delete', 'Are you sure you want to delete this?', $board['dir'] . 'delete/' . $this->id); - - // Delete all posts by IP - if (hasPermission($config['mod']['deletebyip'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], 'Delete all posts by IP', 'Are you sure you want to delete all posts by this IP address?', $board['dir'] . 'deletebyip/' . $this->id); - - // Delete all posts by IP (global) - if (hasPermission($config['mod']['deletebyip_global'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], 'Delete all posts by IP across all boards', 'Are you sure you want to delete all posts by this IP address, across all boards?', $board['dir'] . 'deletebyip/' . $this->id . '/global'); - - // Ban - if (hasPermission($config['mod']['ban'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_ban'] . ''; - - // Ban & Delete - if (hasPermission($config['mod']['bandelete'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_bandelete'] . ''; - - // Delete file (keep post) - if (!empty($this->files) && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['dir'] . 'deletefile/' . $this->id); - - // Spoiler file (keep post) - if (!empty($this->file) && $this->file != "deleted" && $this->file != null && $this->thumb != 'spoiler' && hasPermission($config['mod']['spoilerimage'], $board['uri'], $this->mod) && $config['spoiler_images']) - $built .= ' ' . secure_link_confirm($config['mod']['link_spoilerimage'], _('Spoiler File'), _('Are you sure you want to spoiler this file?'), $board['uri'] . '/spoiler/' . $this->id); - - // Move post - if (hasPermission($config['mod']['move'], $board['uri'], $this->mod) && $config['move_replies']) - $built .= ' ' . $config['mod']['link_move'] . ''; - - // Edit post - if (hasPermission($config['mod']['editpost'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_editpost'] . ''; - - - if (!empty($built)) - $built = '' . $built . ''; - } - return $built; - } - public function build($index=false) { global $board, $config; - return Element('post_reply.html', array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index)); + return Element('post_reply.html', array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index, 'mod' => $this->mod)); } }; @@ -484,73 +434,6 @@ class Thread { public function postCount() { return count($this->posts) + $this->omitted; } - public function postControls() { - global $board, $config; - - $built = ''; - if ($this->mod) { - // Mod controls (on posts) - // Delete - if (hasPermission($config['mod']['delete'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_delete'], _('Delete'), _('Are you sure you want to delete this?'), $board['dir'] . 'delete/' . $this->id); - - // Delete all posts by IP - if (hasPermission($config['mod']['deletebyip'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip'], _('Delete all posts by IP'), _('Are you sure you want to delete all posts by this IP address?'), $board['dir'] . 'deletebyip/' . $this->id); - - // Delete all posts by IP (global) - if (hasPermission($config['mod']['deletebyip_global'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletebyip_global'], _('Delete all posts by IP across all boards'), _('Are you sure you want to delete all posts by this IP address, across all boards?'), $board['dir'] . 'deletebyip/' . $this->id . '/global'); - - // Ban - if (hasPermission($config['mod']['ban'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_ban'] . ''; - - // Ban & Delete - if (hasPermission($config['mod']['bandelete'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_bandelete'] . ''; - - // Delete file (keep post) - if (!empty($this->files) && $this->files[0]->file != 'deleted' && hasPermission($config['mod']['deletefile'], $board['uri'], $this->mod)) - $built .= ' ' . secure_link_confirm($config['mod']['link_deletefile'], _('Delete file'), _('Are you sure you want to delete this file?'), $board['dir'] . 'deletefile/' . $this->id); - - // Spoiler file (keep post) - if (!empty($this->file) && $this->file != "deleted" && $this->file != null && $this->thumb != 'spoiler' && hasPermission($config['mod']['spoilerimage'], $board['uri'], $this->mod) && $config['spoiler_images']) - $built .= ' ' . secure_link_confirm($config['mod']['link_spoilerimage'], _('Spoiler File'), _('Are you sure you want to spoiler this file?'), $board['uri'] . '/spoiler/' . $this->id); - - // Sticky - if (hasPermission($config['mod']['sticky'], $board['uri'], $this->mod)) - if ($this->sticky) - $built .= ' ' . $config['mod']['link_desticky'] . ''; - else - $built .= ' ' . $config['mod']['link_sticky'] . ''; - - if (hasPermission($config['mod']['bumplock'], $board['uri'], $this->mod)) - if ($this->sage) - $built .= ' ' . $config['mod']['link_bumpunlock'] . ''; - else - $built .= ' ' . $config['mod']['link_bumplock'] . ''; - - // Lock - if (hasPermission($config['mod']['lock'], $board['uri'], $this->mod)) - if ($this->locked) - $built .= ' ' . $config['mod']['link_unlock'] . ''; - else - $built .= ' ' . $config['mod']['link_lock'] . ''; - - if (hasPermission($config['mod']['move'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_move'] . ''; - - // Edit post - if (hasPermission($config['mod']['editpost'], $board['uri'], $this->mod)) - $built .= ' ' . $config['mod']['link_editpost'] . ''; - - if (!empty($built)) - $built = '' . $built . ''; - } - return $built; - } - public function build($index=false, $isnoko50=false) { global $board, $config, $debug; @@ -558,7 +441,7 @@ class Thread { event('show-thread', $this); - $built = Element('post_thread.html', array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index, 'hasnoko50' => $hasnoko50, 'isnoko50' => $isnoko50)); + $built = Element('post_thread.html', array('config' => $config, 'board' => $board, 'post' => &$this, 'index' => $index, 'hasnoko50' => $hasnoko50, 'isnoko50' => $isnoko50, 'mod' => $this->mod)); return $built; } -- cgit v1.3