Explicit board hiding

This commit is contained in:
Juribiyan 2020-05-26 23:59:29 +05:00
parent 352929dc1a
commit 584c36057c
6 changed files with 51 additions and 11 deletions

View File

@ -0,0 +1,2 @@
ALTER TABLE `boards`
ADD COLUMN `hidden` TINYINT(1) NOT NULL DEFAULT '0' AFTER `opmod`;

View File

@ -764,7 +764,7 @@ class Board {
$boards[$line['id']]['is_20'] = $line['is_20'];
$boards[$line['id']]['nick'] = htmlspecialchars($line['name']);
$boards[$line['id']]['abbreviation'] = htmlspecialchars($line['abbreviation']);
$results2 = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "boards` WHERE `section` = '" . $line['id'] . "' ORDER BY `order` ASC, `name` ASC");
$results2 = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "boards` WHERE `section` = '" . $line['id'] . "' AND `hidden` != 1 ORDER BY `order` ASC, `name` ASC");
foreach($results2 AS $line2) {
$boards[$line['id']][$line2['id']]['name'] = htmlspecialchars($line2['name']);
$boards[$line['id']][$line2['id']]['desc'] = htmlspecialchars($line2['desc']);

View File

@ -4,7 +4,7 @@ class Cloud20 {
global $tc_db;
$sections = $tc_db->GetAll('SELECT * FROM `'. KU_DBPREFIX .'sections` ORDER BY `order`');
$allboards = $tc_db->GetAll('SELECT `id`, `name`, `desc`, `section`, `order` FROM `'. KU_DBPREFIX .'boards`');
$allboards = $tc_db->GetAll('SELECT `id`, `name`, `desc`, `section`, `order` FROM `'. KU_DBPREFIX .'boards` WHERE `hidden` != 1');
$section20 = $tc_db->GetOne('SELECT `id` FROM `'. KU_DBPREFIX .'sections` WHERE `abbreviation`="20"');
foreach($sections as &$sect) {

View File

@ -1292,13 +1292,15 @@ class Manage {
$this->BoardOwnersOnly();
if (isset($_POST['directory'])) {
$this->CheckToken($_POST['token']);
$this->CheckToken($_POST['token']);
if (isset($_POST['add'])) {
$tpl_page .= $this->addBoard_mod($_POST['directory'], $_POST['desc']);
} elseif (isset($_POST['del'])) {
$tpl_page .= $this->addBoard_mod($_POST['directory'], $_POST['desc'], isset($_POST['hidden']) ? '1' : '0');
}
elseif (isset($_POST['del'])) {
if (isset($_POST['confirmation'])) {
$tpl_page .= $this->delBoard_mod($_POST['directory'], $_POST['confirmation']);
} else {
}
else {
$tpl_page .= $this->delBoard_mod($_POST['directory']);
}
}
@ -1316,6 +1318,10 @@ class Manage {
<input type="text" name="desc" id="desc" />
<div class="desc">'. _gettext('The name of the board.') . '</div><br />
<label for="hidden">'. _gettext('Hidden') .':</label>
<input type="checkbox" name="hidden">
<div class="desc">'. _gettext('If enabled, this board will not appear in the menu') .'</div><br>
<input type="submit" value="'. _gettext('Add Board') .'" />
</form><br /><hr />
@ -1390,7 +1396,7 @@ class Manage {
return $output;
}
function addBoard_mod($dir, $desc) {
function addBoard_mod($dir, $desc, $hidden=0) {
global $tc_db;
$this->BoardOwnersOnly();
@ -1420,7 +1426,7 @@ class Manage {
file_put_contents(KU_BOARDSDIR . $dir . '/src/.htaccess', 'AddType text/plain .ASM .C .CPP .CSS .JAVA .JS .LSP .PHP .PL .PY .RAR .SCM .TXT'. "\n" . 'SetHandler default-handler');
$_POST['firstpostid'] = 1;
$sect20 = $tc_db->GetOne('SELECT `id` FROM `'. KU_DBPREFIX .'sections` WHERE `abbreviation`="20"');
$tc_db->Execute("INSERT INTO `" . KU_DBPREFIX . "boards` ( `name` , `desc` , `createdon`, `start`, `image`, `includeheader`,`section` ) VALUES ( " . $tc_db->qstr($dir) . " , " . $tc_db->qstr($desc) . " , '" . time() . "', " . $_POST['firstpostid'] . ", '', '', ".$sect20." )");
$tc_db->Execute("INSERT INTO `" . KU_DBPREFIX . "boards` ( `name` , `desc` , `createdon`, `start`, `image`, `includeheader`,`section`,`hidden`) VALUES ( " . $tc_db->qstr($dir) . " , " . $tc_db->qstr($desc) . " , '" . time() . "', " . $_POST['firstpostid'] . ", '', '', " . $sect20 . ", " . $tc_db->qstr($hidden) . " )");
$boardid = $tc_db->Insert_Id();
$filetypes = $tc_db->GetAll("SELECT " . KU_DBPREFIX . "filetypes.id FROM " . KU_DBPREFIX . "filetypes WHERE " . KU_DBPREFIX . "filetypes.filetype = 'JPG' OR " . KU_DBPREFIX . "filetypes.filetype = 'GIF' OR " . KU_DBPREFIX . "filetypes.filetype = 'PNG';");
foreach ($filetypes AS $filetype) {
@ -3066,7 +3072,8 @@ class Manage {
'dice',
'useragent',
'duplication',
'opmod'
'opmod',
'hidden'
) as $prop) {
$set []= "`$prop` = ".$tc_db->qstr(isset($_POST[$prop]) ? '1' : '0');
}
@ -3252,6 +3259,15 @@ class Manage {
$tpl_page .= '<label for="anonymous">'. _gettext('Anonymous') .':</label>
<input type="text" name="anonymous" value="'. $lineboard['anonymous'] . '" />
<div class="desc">'. _gettext('Name to display when a name is not attached to a post.') . ' '. _gettext('Default') .': <strong>'. _gettext('Anonymous') .'</strong></div><br />';
/* Hidden */
$tpl_page .= '<label for="hidden">'. _gettext('Hidden') .':</label>
<input type="checkbox" name="hidden" ';
if ($lineboard['hidden'] == '1') {
$tpl_page .= 'checked ';
}
$tpl_page .= ' />
<div class="desc">'. _gettext('If enabled, this board will not appear in the menu') .'</div><br />';
/* Locked */
$tpl_page .= '<label for="locked">'. _gettext('Locked') .':</label>
@ -3510,7 +3526,8 @@ class Manage {
'dice',
'useragent',
'duplication',
'opmod'
'opmod',
'hidden'
) as $prop) {
$set []= "`$prop` = ".$tc_db->qstr(isset($_POST[$prop]) ? '1' : '0');
}
@ -3611,6 +3628,15 @@ class Manage {
$tpl_page .= '<label for="anonymous">'. _gettext('Anonymous') .':</label>
<input type="text" name="anonymous" value="'. $lineboard['anonymous'] . '" />
<div class="desc">'. _gettext('Name to display when a name is not attached to a post.') . ' '. _gettext('Default') .': <strong>'. _gettext('Anonymous') .'</strong></div><br />';
/* Hidden */
$tpl_page .= '<label for="hidden">'. _gettext('Hidden') .':</label>
<input type="checkbox" name="hidden" ';
if ($lineboard['hidden'] == '1') {
$tpl_page .= 'checked ';
}
$tpl_page .= ' />
<div class="desc">'. _gettext('If enabled, this board will not appear in the menu') .'</div><br />';
/* Locked */
$tpl_page .= '<label for="locked">'. _gettext('Locked') .':</label>

View File

@ -47,7 +47,7 @@ class Menu {
if (count($results_boardsexist) > 0) {
$sections = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "sections` ORDER BY `order` ASC");
foreach($sections AS $key=>$section) {
$results = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "boards` WHERE `section` = '" . $section['id'] . "' ORDER BY `order` ASC, `name` ASC /* MENU.CLASS.PHP */");
$results = $tc_db->GetAll("SELECT * FROM `" . KU_DBPREFIX . "boards` WHERE `section` = '" . $section['id'] . "' AND `hidden` != 1 ORDER BY `order` ASC, `name` ASC /* MENU.CLASS.PHP */");
foreach($results AS $line) {
$sections[$key]['boards'][] = $line;
}

View File

@ -2151,3 +2151,15 @@ msgstr "как ОП"
msgid "Insert captcha."
msgstr "Введите капчу."
msgid "Old thread to be deleted in two hours"
msgstr "Старый тред (будет удален в течение двух часов)"
msgid "Hidden"
msgstr "Скрыто"
msgid "If enabled, this board will not appear in the menu"
msgstr "Если отмечено, доска не будет присутствовать в меню"
msgid "Click to edit board options"
msgstr "Перейти к настройкам доски"