mirror of
https://github.com/vichan-devel/vichan.git
synced 2025-01-31 12:23:48 +01:00
Merge pull request #772 from vichan-devel/RealAngeleno-templateupdates
Update catalog and the index: Wildcard and excluding boards
This commit is contained in:
commit
d7468bb93b
@ -17,17 +17,12 @@
|
||||
'default' => 'Catalog'
|
||||
);
|
||||
|
||||
$__boards = listBoards();
|
||||
$__default_boards = Array();
|
||||
foreach ($__boards as $__board)
|
||||
$__default_boards[] = $__board['uri'];
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Included boards',
|
||||
'name' => 'boards',
|
||||
'type' => 'text',
|
||||
'comment' => '(space seperated)',
|
||||
'default' => implode(' ', $__default_boards)
|
||||
'default' => '*'
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
|
@ -1,6 +1,15 @@
|
||||
<?php
|
||||
require 'info.php';
|
||||
|
||||
function get_all_boards() {
|
||||
$boards = [];
|
||||
$query = query("SELECT uri FROM ``boards``") or error(db_error());
|
||||
while ($board = $query->fetch(PDO::FETCH_ASSOC)) {
|
||||
$boards[] = $board['uri'];
|
||||
}
|
||||
return $boards;
|
||||
}
|
||||
|
||||
function catalog_build($action, $settings, $board) {
|
||||
global $config;
|
||||
|
||||
@ -13,6 +22,11 @@
|
||||
|
||||
$boards = explode(' ', $settings['boards']);
|
||||
|
||||
if (in_array('*', $boards)) {
|
||||
$boards = get_all_boards();
|
||||
}
|
||||
|
||||
|
||||
if ($action == 'all') {
|
||||
foreach ($boards as $board) {
|
||||
$b = new Catalog();
|
||||
|
@ -23,7 +23,7 @@
|
||||
<div class="box-wrap">
|
||||
<fieldset>
|
||||
<legend>Boards</legend>
|
||||
<ul>
|
||||
<ul style="columns: 2;">
|
||||
{% for board in boards %}
|
||||
<li class="boardlinksurl">
|
||||
<a href="{{ config.board_path|sprintf(board.uri) }}">
|
||||
@ -34,17 +34,28 @@
|
||||
</ul>
|
||||
</fieldset>
|
||||
<br>
|
||||
<div class="mainBox">
|
||||
<br>
|
||||
<div class="description">{{ settings.description }}</div>
|
||||
<br>
|
||||
<img class="imageofnow" src="{{ settings.imageofnow }}">
|
||||
<br>
|
||||
<div class="quoteofnow">{{ settings.quoteofnow }}</div>
|
||||
<br>
|
||||
<iframe class ="videoofnow" width="560" height="315" src="{{ settings.videoofnow }}"></iframe>
|
||||
<br>
|
||||
</div>
|
||||
{% if settings.description or settings.imageofnow or settings.quoteofnow or settings.videoofnow %}
|
||||
<div class="mainBox">
|
||||
<br>
|
||||
{% if settings.description %}
|
||||
<div class="description">{{ settings.description }}</div>
|
||||
<br>
|
||||
{% endif %}
|
||||
{% if settings.imageofnow %}
|
||||
<img class="imageofnow" src="{{ settings.imageofnow }}">
|
||||
<br>
|
||||
{% endif %}
|
||||
{% if settings.quoteofnow %}
|
||||
<div class="quoteofnow">{{ settings.quoteofnow }}</div>
|
||||
<br>
|
||||
{% endif %}
|
||||
{% if settings.videoofnow %}
|
||||
<iframe class="videoofnow" width="560" height="315" src="{{ settings.videoofnow }}"></iframe>
|
||||
<br>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="ban">
|
||||
{% if news|length == 0 %}
|
||||
<p style="text-align:center" class="unimportant">(No news to show.)</p>
|
||||
|
@ -74,12 +74,19 @@
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Excluded boards',
|
||||
'title' => 'Excluded boards (recent posts)',
|
||||
'name' => 'exclude',
|
||||
'type' => 'text',
|
||||
'comment' => '(space seperated)'
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => 'Excluded boards (boardlist)',
|
||||
'name' => 'excludeboardlist',
|
||||
'type' => 'text',
|
||||
'comment' => '(space seperated)'
|
||||
);
|
||||
|
||||
$theme['config'][] = Array(
|
||||
'title' => '# of recent images',
|
||||
'name' => 'limit_images',
|
||||
|
@ -158,6 +158,13 @@
|
||||
$settings['no_recent'] = (int) $settings['no_recent'];
|
||||
$query = query("SELECT * FROM ``news`` ORDER BY `time` DESC" . ($settings['no_recent'] ? ' LIMIT ' . $settings['no_recent'] : '')) or error(db_error());
|
||||
$news = $query->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
// Excluded boards for the boardlist
|
||||
$excluded_boards = isset($settings['excludeboardlist']) ? explode(' ', $settings['excludeboardlist']) : [];
|
||||
$boardlist = array_filter($boards, function($board) use ($excluded_boards) {
|
||||
return !in_array($board['uri'], $excluded_boards);
|
||||
});
|
||||
|
||||
|
||||
return Element('themes/index/index.html', Array(
|
||||
'settings' => $settings,
|
||||
@ -167,7 +174,7 @@
|
||||
'recent_posts' => $recent_posts,
|
||||
'stats' => $stats,
|
||||
'news' => $news,
|
||||
'boards' => listBoards()
|
||||
'boards' => $boardlist
|
||||
));
|
||||
}
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user