parent
3b4e486160
commit
d705edda91
5 changed files with 67 additions and 4 deletions
|
@ -115,6 +115,17 @@ hr {
|
|||
clear: both;
|
||||
}
|
||||
|
||||
.catalogpost {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-align: center;
|
||||
text-overflow: ellipsis;
|
||||
min-width: 100px;
|
||||
padding: 0px 3px 3px;
|
||||
}
|
||||
|
||||
.login {
|
||||
text-align: center;
|
||||
}
|
||||
|
|
|
@ -43,6 +43,9 @@ if (!defined('TINYIB_WORDBREAK')) {
|
|||
if (!defined('TINYIB_TIMEZONE')) {
|
||||
define('TINYIB_TIMEZONE', '');
|
||||
}
|
||||
if (!defined('TINYIB_CATALOG')) {
|
||||
define('TINYIB_CATALOG', true);
|
||||
}
|
||||
if (!defined('TINYIB_DBMIGRATE')) {
|
||||
define('TINYIB_DBMIGRATE', false);
|
||||
}
|
||||
|
|
|
@ -240,8 +240,8 @@ function writePage($filename, $contents) {
|
|||
}
|
||||
|
||||
function fixLinksInRes($html) {
|
||||
$search = array(' href="css/', ' src="js/', ' href="src/', ' href="thumb/', ' href="res/', ' href="imgboard.php', ' href="favicon.ico', 'src="thumb/', 'src="inc/', 'src="sticky.png', 'src="lock.png', ' action="imgboard.php');
|
||||
$replace = array(' href="../css/', ' src="../js/', ' href="../src/', ' href="../thumb/', ' href="../res/', ' href="../imgboard.php', ' href="../favicon.ico', 'src="../thumb/', 'src="../inc/', 'src="../sticky.png', 'src="../lock.png', ' action="../imgboard.php');
|
||||
$search = array(' href="css/', ' src="js/', ' href="src/', ' href="thumb/', ' href="res/', ' href="imgboard.php', ' href="catalog.html', ' href="favicon.ico', 'src="thumb/', 'src="inc/', 'src="sticky.png', 'src="lock.png', ' action="imgboard.php', ' action="catalog.html');
|
||||
$replace = array(' href="../css/', ' src="../js/', ' href="../src/', ' href="../thumb/', ' href="../res/', ' href="../imgboard.php', ' href="../catalog.html', ' href="../favicon.ico', 'src="../thumb/', 'src="../inc/', 'src="../sticky.png', 'src="../lock.png', ' action="../imgboard.php', ' action="../catalog.html');
|
||||
|
||||
return str_replace($search, $replace, $html);
|
||||
}
|
||||
|
|
52
inc/html.php
52
inc/html.php
|
@ -503,7 +503,7 @@ function buildPage($htmlposts, $parent, $pages = 0, $thispage = 0) {
|
|||
$pagelinks .= ($pages <= $thispage) ? "<td>Next</td>" : '<td><form method="get" action="' . $next . '.html"><input value="Next" type="submit"></form></td>';
|
||||
|
||||
$pagenavigator = <<<EOF
|
||||
<table border="1">
|
||||
<table border="1" style="display: inline-block;">
|
||||
<tbody>
|
||||
<tr>
|
||||
$pagelinks
|
||||
|
@ -511,15 +511,32 @@ function buildPage($htmlposts, $parent, $pages = 0, $thispage = 0) {
|
|||
</tbody>
|
||||
</table>
|
||||
EOF;
|
||||
if (TINYIB_CATALOG) {
|
||||
$pagenavigator .= <<<EOF
|
||||
<table border="1" style="display: inline-block;margin-left: 21px;">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><form method="get" action="catalog.html"><input value="Catalog" type="submit"></form></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
EOF;
|
||||
}
|
||||
} else if ($parent == -1) {
|
||||
$postingmode = '[<a href="index.html">Return</a>]<div class="replymode">Catalog</div> ';
|
||||
} else {
|
||||
$postingmode = '[<a href="../">Return</a>]<div class="replymode">Posting mode: Reply</div> ';
|
||||
}
|
||||
|
||||
$postform = buildPostForm($parent);
|
||||
$postform = '';
|
||||
if ($parent >= TINYIB_NEWTHREAD) {
|
||||
$postform = buildPostForm($parent);
|
||||
}
|
||||
|
||||
$body = <<<EOF
|
||||
<body>
|
||||
<div class="adminbar">
|
||||
[<a href="catalog.html" style="text-decoration: underline;">Catalog</a>]
|
||||
[<a href="$managelink" style="text-decoration: underline;">Manage</a>]
|
||||
</div>
|
||||
<div class="logo">
|
||||
|
@ -551,6 +568,33 @@ EOF;
|
|||
return pageHeader() . $body . pageFooter();
|
||||
}
|
||||
|
||||
function buildCatalogPost($post) {
|
||||
$maxwidth = max(100, $post['thumb_width']);
|
||||
$replies = numRepliesToThreadByID($post['id']);
|
||||
$subject = trim($post['subject']) != '' ? $post['subject'] : substr(trim(str_ireplace("\n", '', strip_tags($post['message']))), 0, 75);
|
||||
|
||||
return <<<EOF
|
||||
<div class="catalogpost" style="max-width: {$maxwidth}px;">
|
||||
<a href="res/{$post['id']}.html">
|
||||
<img src="thumb/{$post["thumb"]}" alt="{$post["id"]}" width="{$post['thumb_width']}" height="{$post['thumb_height']}" border="0">
|
||||
</a><br>
|
||||
<b>$replies</b><br>
|
||||
$subject
|
||||
</div>
|
||||
EOF;
|
||||
}
|
||||
|
||||
function rebuildCatalog() {
|
||||
$threads = allThreads();
|
||||
$htmlposts = '';
|
||||
foreach ($threads as $post) {
|
||||
$htmlposts .= buildCatalogPost($post);
|
||||
}
|
||||
$htmlposts .= '<hr size="1">';
|
||||
|
||||
writePage('catalog.html', buildPage($htmlposts, -1));
|
||||
}
|
||||
|
||||
function rebuildIndexes() {
|
||||
$page = 0;
|
||||
$i = 0;
|
||||
|
@ -584,6 +628,10 @@ function rebuildIndexes() {
|
|||
$file = ($page == 0) ? TINYIB_INDEX : ($page . '.html');
|
||||
writePage($file, buildPage($htmlposts, 0, $pages, $page));
|
||||
}
|
||||
|
||||
if (TINYIB_CATALOG) {
|
||||
rebuildCatalog();
|
||||
}
|
||||
}
|
||||
|
||||
function rebuildThread($id) {
|
||||
|
|
|
@ -27,6 +27,7 @@ define('TINYIB_PREVIEWREPLIES', 3); // Amount of replies previewed on index pa
|
|||
define('TINYIB_TRUNCATE', 15); // Messages are truncated to this many lines on board index pages [0 to disable]
|
||||
define('TINYIB_WORDBREAK', 80); // Words longer than this many characters will be broken apart [0 to disable]
|
||||
define('TINYIB_TIMEZONE', 'UTC'); // See https://secure.php.net/manual/en/timezones.php - e.g. America/Los_Angeles
|
||||
define('TINYIB_CATALOG', true); // Generate catalog page
|
||||
$tinyib_hidefieldsop = array(); // Fields to hide when creating a new thread - e.g. array('name', 'email', 'subject', 'message', 'file', 'embed', 'password')
|
||||
$tinyib_hidefields = array(); // Fields to hide when replying
|
||||
|
||||
|
|
Loading…
Reference in a new issue