forked from GithubBackups/vichan
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'
|
'default' => 'Catalog'
|
||||||
);
|
);
|
||||||
|
|
||||||
$__boards = listBoards();
|
|
||||||
$__default_boards = Array();
|
|
||||||
foreach ($__boards as $__board)
|
|
||||||
$__default_boards[] = $__board['uri'];
|
|
||||||
|
|
||||||
$theme['config'][] = Array(
|
$theme['config'][] = Array(
|
||||||
'title' => 'Included boards',
|
'title' => 'Included boards',
|
||||||
'name' => 'boards',
|
'name' => 'boards',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'comment' => '(space seperated)',
|
'comment' => '(space seperated)',
|
||||||
'default' => implode(' ', $__default_boards)
|
'default' => '*'
|
||||||
);
|
);
|
||||||
|
|
||||||
$theme['config'][] = Array(
|
$theme['config'][] = Array(
|
||||||
|
@ -1,6 +1,15 @@
|
|||||||
<?php
|
<?php
|
||||||
require 'info.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) {
|
function catalog_build($action, $settings, $board) {
|
||||||
global $config;
|
global $config;
|
||||||
|
|
||||||
@ -13,6 +22,11 @@
|
|||||||
|
|
||||||
$boards = explode(' ', $settings['boards']);
|
$boards = explode(' ', $settings['boards']);
|
||||||
|
|
||||||
|
if (in_array('*', $boards)) {
|
||||||
|
$boards = get_all_boards();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if ($action == 'all') {
|
if ($action == 'all') {
|
||||||
foreach ($boards as $board) {
|
foreach ($boards as $board) {
|
||||||
$b = new Catalog();
|
$b = new Catalog();
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
<div class="box-wrap">
|
<div class="box-wrap">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Boards</legend>
|
<legend>Boards</legend>
|
||||||
<ul>
|
<ul style="columns: 2;">
|
||||||
{% for board in boards %}
|
{% for board in boards %}
|
||||||
<li class="boardlinksurl">
|
<li class="boardlinksurl">
|
||||||
<a href="{{ config.board_path|sprintf(board.uri) }}">
|
<a href="{{ config.board_path|sprintf(board.uri) }}">
|
||||||
@ -34,17 +34,28 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
<br>
|
<br>
|
||||||
<div class="mainBox">
|
{% if settings.description or settings.imageofnow or settings.quoteofnow or settings.videoofnow %}
|
||||||
<br>
|
<div class="mainBox">
|
||||||
<div class="description">{{ settings.description }}</div>
|
<br>
|
||||||
<br>
|
{% if settings.description %}
|
||||||
<img class="imageofnow" src="{{ settings.imageofnow }}">
|
<div class="description">{{ settings.description }}</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="quoteofnow">{{ settings.quoteofnow }}</div>
|
{% endif %}
|
||||||
<br>
|
{% if settings.imageofnow %}
|
||||||
<iframe class ="videoofnow" width="560" height="315" src="{{ settings.videoofnow }}"></iframe>
|
<img class="imageofnow" src="{{ settings.imageofnow }}">
|
||||||
<br>
|
<br>
|
||||||
</div>
|
{% 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">
|
<div class="ban">
|
||||||
{% if news|length == 0 %}
|
{% if news|length == 0 %}
|
||||||
<p style="text-align:center" class="unimportant">(No news to show.)</p>
|
<p style="text-align:center" class="unimportant">(No news to show.)</p>
|
||||||
|
@ -74,12 +74,19 @@
|
|||||||
);
|
);
|
||||||
|
|
||||||
$theme['config'][] = Array(
|
$theme['config'][] = Array(
|
||||||
'title' => 'Excluded boards',
|
'title' => 'Excluded boards (recent posts)',
|
||||||
'name' => 'exclude',
|
'name' => 'exclude',
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'comment' => '(space seperated)'
|
'comment' => '(space seperated)'
|
||||||
);
|
);
|
||||||
|
|
||||||
|
$theme['config'][] = Array(
|
||||||
|
'title' => 'Excluded boards (boardlist)',
|
||||||
|
'name' => 'excludeboardlist',
|
||||||
|
'type' => 'text',
|
||||||
|
'comment' => '(space seperated)'
|
||||||
|
);
|
||||||
|
|
||||||
$theme['config'][] = Array(
|
$theme['config'][] = Array(
|
||||||
'title' => '# of recent images',
|
'title' => '# of recent images',
|
||||||
'name' => 'limit_images',
|
'name' => 'limit_images',
|
||||||
|
@ -159,6 +159,13 @@
|
|||||||
$query = query("SELECT * FROM ``news`` ORDER BY `time` DESC" . ($settings['no_recent'] ? ' LIMIT ' . $settings['no_recent'] : '')) or error(db_error());
|
$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);
|
$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(
|
return Element('themes/index/index.html', Array(
|
||||||
'settings' => $settings,
|
'settings' => $settings,
|
||||||
'config' => $config,
|
'config' => $config,
|
||||||
@ -167,7 +174,7 @@
|
|||||||
'recent_posts' => $recent_posts,
|
'recent_posts' => $recent_posts,
|
||||||
'stats' => $stats,
|
'stats' => $stats,
|
||||||
'news' => $news,
|
'news' => $news,
|
||||||
'boards' => listBoards()
|
'boards' => $boardlist
|
||||||
));
|
));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user