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
This commit is contained in:
Harrison committed 2011-07-26 18:13:28 +00:00
1 parent a4e5942b55
commit b9af41126a
6 files changed
+22 -14

No files matched your search

+4 -4
View File
@@ -27,12 +27,12 @@
{t}Email{/t}</td> {t}Email{/t}</td>
<td> <td>
<input type="text" name="em" size="28" maxlength="75" accesskey="e" /> <input type="text" name="em" size="28" maxlength="75" accesskey="e" />
</td> </td>
</tr> </tr>
{/if}
<tr> <tr>
<td class="postblock"> <td class="postblock">
{t}Subject{/t}</td> {t}Subject{/t}
</td>
<td> <td>
{strip}<input type="text" name="subject" size="35" maxlength="75" accesskey="s" />&nbsp;<input type="submit" value=" {strip}<input type="text" name="subject" size="35" maxlength="75" accesskey="s" />&nbsp;<input type="submit" value="
{if %KU_QUICKREPLY && $replythread eq 0} {if %KU_QUICKREPLY && $replythread eq 0}
-1
View File
@@ -56,7 +56,6 @@
<input type="text" name="em" size="28" maxlength="75" accesskey="e" /> <input type="text" name="em" size="28" maxlength="75" accesskey="e" />
</td> </td>
</tr> </tr>
{/if}
<tr> <tr>
<td class="postblock"> <td class="postblock">
{t}Subject{/t}</td> {t}Subject{/t}</td>
-1
View File
@@ -29,7 +29,6 @@
<input type="text" name="em" size="28" maxlength="75" accesskey="e" /> <input type="text" name="em" size="28" maxlength="75" accesskey="e" />
</td> </td>
</tr> </tr>
{/if}
<tr> <tr>
<td class="postblock"> <td class="postblock">
{t}Subject{/t}</td> {t}Subject{/t}</td>
+9 -2
View File
@@ -191,8 +191,14 @@ class Board {
} else { } 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 . ")"); $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]; // Workaround for upload boards
$newposts[$k][0]['images'] = (isset($replycount[0][1]) ? $replycount[0][1] : ''); 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)) { if ($this->board['type'] == 0 && !isset($embeds)) {
$embeds = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "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('posts', $newposts);
$this->dwoo_data->assign('file_path', getCLBoardPath($this->board['name'], $this->board['loadbalanceurl_formatted'], '')); $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); $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))); $footer = $this->Footer(false, (microtime_float() - $executiontime_start_page), (($this->board['type'] == 1) ? (true) : (false)));
$content = $header.$postbox.$content.$footer; $content = $header.$postbox.$content.$footer;
+3 -5
View File
@@ -2083,9 +2083,7 @@ class Manage {
function editfiletypes() { function editfiletypes() {
global $tc_db, $tpl_page; global $tc_db, $tpl_page;
$this->AdministratorsOnly(); $this->AdministratorsOnly();
if ($_POST['filetype'] == "htaccess") {
exitWithErrorPage(_gettext('Invalid filetype.'));
}
$tpl_page .= '<h2>'. _gettext('Edit filetypes') . '</h2><br />'; $tpl_page .= '<h2>'. _gettext('Edit filetypes') . '</h2><br />';
if (isset($_GET['do'])) { if (isset($_GET['do'])) {
if ($_GET['do'] == 'addfiletype') { if ($_GET['do'] == 'addfiletype') {
@@ -2181,7 +2179,7 @@ class Manage {
if (count($results) > 0) { if (count($results) > 0) {
$tpl_page .= '<table border="1" width="100%"><tr><th>'. _gettext('ID') .'</th><th>'. _gettext('Filetype') .'</th><th>'. _gettext('Image') .'</th><th>'. _gettext('Edit/Delete') .'</th></tr>'; $tpl_page .= '<table border="1" width="100%"><tr><th>'. _gettext('ID') .'</th><th>'. _gettext('Filetype') .'</th><th>'. _gettext('Image') .'</th><th>'. _gettext('Edit/Delete') .'</th></tr>';
foreach ($results as $line) { foreach ($results as $line) {
$tpl_page .= '<tr><td>'. $line['id'] . '</td><td>'. $line['filetype'] . '</td><td>'. $line['image'] . '</td><td>[<a href="?action=editfiletypes&do=editfiletype&filetypeid='. $line['id'] . '">'. _gettext('Edit') .'</a>] [<a href="?action=editfiletypes&do=deletefiletype&filetypeid='. $line['id'] . '">'. _gettext('Delete') .'</a></td></tr>'; $tpl_page .= '<tr><td>'. $line['id'] . '</td><td>'. $line['filetype'] . '</td><td>'. $line['image'] . '</td><td>[<a href="?action=editfiletypes&do=editfiletype&filetypeid='. $line['id'] . '">'. _gettext('Edit') .'</a>] [<a href="?action=editfiletypes&do=deletefiletype&filetypeid='. $line['id'] . '">'. _gettext('Delete') .'</a>]</td></tr>';
} }
$tpl_page .= '</table>'; $tpl_page .= '</table>';
} else { } else {
@@ -3228,7 +3226,7 @@ class Manage {
$ban_boards = implode('|', $_POST['bannedfrom']); $ban_boards = implode('|', $_POST['bannedfrom']);
} }
$ban_globalban = (isset($_POST['banfromall']) || $instantban) ? 1 : 0; $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'])) { if (isset($_POST['quickbanboardid'])) {
$ban_board_id = $_POST['quickbanboardid']; $ban_board_id = $_POST['quickbanboardid'];
} }
+6 -1
View File
@@ -216,7 +216,12 @@ class Upload {
/* Otherwise, use this script alone */ /* Otherwise, use this script alone */
} else { } else {
$this->file_location = KU_BOARDSDIR . $board_class->board['name'] . '/src/' . $this->file_name . $this->file_type; $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') { if($this->file_type == '.mp3') {
require_once(KU_ROOTDIR . 'lib/getid3/getid3.php'); require_once(KU_ROOTDIR . 'lib/getid3/getid3.php');