From b9af41126a597eed758e1ef08448bc1250b7668d Mon Sep 17 00:00:00 2001 From: Harrison Date: Tue, 26 Jul 2011 18:13:28 +0000 Subject: [PATCH] Fix template errors Fixed broken no-read bans (Hopefully) Better fix for the "exploit" Finally fixed upload boards not showing the number of replies git-svn-id: http://kusabax.cultnet.net/svn/repo/stable@308 73d99b7e-4f53-4972-b7b7-2ecd3c4d89ee --- dwoo/templates/img_post_box.tpl | 8 ++++---- dwoo/templates/oek_post_box.tpl | 1 - dwoo/templates/upl_post_box.tpl | 1 - inc/classes/board-post.class.php | 11 +++++++++-- inc/classes/manage.class.php | 8 +++----- inc/classes/upload.class.php | 7 ++++++- 6 files changed, 22 insertions(+), 14 deletions(-) diff --git a/dwoo/templates/img_post_box.tpl b/dwoo/templates/img_post_box.tpl index ea474dc..7a101b1 100644 --- a/dwoo/templates/img_post_box.tpl +++ b/dwoo/templates/img_post_box.tpl @@ -27,12 +27,12 @@ {t}Email{/t} - - - {/if} + + - {t}Subject{/t} + {t}Subject{/t} + {strip}  - {/if} {t}Subject{/t} diff --git a/dwoo/templates/upl_post_box.tpl b/dwoo/templates/upl_post_box.tpl index ac6a471..e95ad06 100644 --- a/dwoo/templates/upl_post_box.tpl +++ b/dwoo/templates/upl_post_box.tpl @@ -29,7 +29,6 @@ - {/if} {t}Subject{/t} diff --git a/inc/classes/board-post.class.php b/inc/classes/board-post.class.php index 8b49007..a0167d2 100644 --- a/inc/classes/board-post.class.php +++ b/inc/classes/board-post.class.php @@ -191,8 +191,14 @@ class Board { } else { $replycount = $tc_db->GetAll("SELECT COUNT(`id`) AS replies, SUM(CASE WHEN `file_md5` = '' THEN 0 ELSE 1 END) AS files FROM `" . KU_DBPREFIX . "posts` WHERE `boardid` = " . $this->board['id']." AND `parentid` = ".$thread['id']." AND `is_deleted` = 0 AND `id` NOT IN (" . $omitids . ")"); } - $newposts[$k][0]['replies'] = $replycount[0][0]; - $newposts[$k][0]['images'] = (isset($replycount[0][1]) ? $replycount[0][1] : ''); + // Workaround for upload boards + if ($this->board['type'] == 3) { + $newposts[$k]['replies'] = $replycount[0][0]; + $newposts[$k]['images'] = (isset($replycount[0][1]) ? $replycount[0][1] : ''); + } else { + $newposts[$k][0]['replies'] = $replycount[0][0]; + $newposts[$k][0]['images'] = (isset($replycount[0][1]) ? $replycount[0][1] : ''); + } } if ($this->board['type'] == 0 && !isset($embeds)) { $embeds = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "embeds`"); @@ -208,6 +214,7 @@ class Board { } $this->dwoo_data->assign('posts', $newposts); $this->dwoo_data->assign('file_path', getCLBoardPath($this->board['name'], $this->board['loadbalanceurl_formatted'], '')); + $content = $this->dwoo->get(KU_TEMPLATEDIR . '/' . $this->board['text_readable'] . '_board_page.tpl', $this->dwoo_data); $footer = $this->Footer(false, (microtime_float() - $executiontime_start_page), (($this->board['type'] == 1) ? (true) : (false))); $content = $header.$postbox.$content.$footer; diff --git a/inc/classes/manage.class.php b/inc/classes/manage.class.php index bde0a8b..e55dd5b 100644 --- a/inc/classes/manage.class.php +++ b/inc/classes/manage.class.php @@ -2083,9 +2083,7 @@ class Manage { function editfiletypes() { global $tc_db, $tpl_page; $this->AdministratorsOnly(); - if ($_POST['filetype'] == "htaccess") { - exitWithErrorPage(_gettext('Invalid filetype.')); - } + $tpl_page .= '

'. _gettext('Edit filetypes') . '


'; if (isset($_GET['do'])) { if ($_GET['do'] == 'addfiletype') { @@ -2181,7 +2179,7 @@ class Manage { if (count($results) > 0) { $tpl_page .= ''; foreach ($results as $line) { - $tpl_page .= ''; + $tpl_page .= ''; } $tpl_page .= '
'. _gettext('ID') .''. _gettext('Filetype') .''. _gettext('Image') .''. _gettext('Edit/Delete') .'
'. $line['id'] . ''. $line['filetype'] . ''. $line['image'] . '['. _gettext('Edit') .'] ['. _gettext('Delete') .'
'. $line['id'] . ''. $line['filetype'] . ''. $line['image'] . '['. _gettext('Edit') .'] ['. _gettext('Delete') .']
'; } else { @@ -3228,7 +3226,7 @@ class Manage { $ban_boards = implode('|', $_POST['bannedfrom']); } $ban_globalban = (isset($_POST['banfromall']) || $instantban) ? 1 : 0; - $ban_allowread = ($_POST['allowread'] = 0 || $instantban) ? 0 : 1; + $ban_allowread = ($_POST['allowread'] == 0 || $instantban) ? 0 : 1; if (isset($_POST['quickbanboardid'])) { $ban_board_id = $_POST['quickbanboardid']; } diff --git a/inc/classes/upload.class.php b/inc/classes/upload.class.php index fc27fac..e5b1a11 100644 --- a/inc/classes/upload.class.php +++ b/inc/classes/upload.class.php @@ -216,7 +216,12 @@ class Upload { /* Otherwise, use this script alone */ } else { $this->file_location = KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . $this->file_type; - + + if (file_exists($this->file_location)) { + exitWithErrorPage(_gettext('A file by that name already exists')); + die(); + } + if($this->file_type == '.mp3') { require_once(KU_ROOTDIR . 'lib/getid3/getid3.php');