Merge pull request #1191 from ArthurHoaro/hotfix/daily-thumb

Fix fatal error on daily page: use new thumbnail system
This commit is contained in:
ArthurHoaro 2018-07-30 18:29:06 +02:00 committed by GitHub
commit 75c4b0d03b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 24 additions and 20 deletions

View file

@ -356,7 +356,6 @@ function showDailyRSS($conf, $loginManager) {
$conf->get('redirector.url'), $conf->get('redirector.url'),
$conf->get('redirector.encode_url') $conf->get('redirector.encode_url')
); );
$link['thumbnail'] = thumbnail($conf, $link['url']);
$link['timestamp'] = $link['created']->getTimestamp(); $link['timestamp'] = $link['created']->getTimestamp();
if (startsWith($link['url'], '?')) { if (startsWith($link['url'], '?')) {
$link['url'] = index_url($_SERVER) . $link['url']; // make permalink URL absolute $link['url'] = index_url($_SERVER) . $link['url']; // make permalink URL absolute
@ -371,6 +370,7 @@ function showDailyRSS($conf, $loginManager) {
$tpl->assign('links', $links); $tpl->assign('links', $links);
$tpl->assign('rssdate', escape($dayDate->format(DateTime::RSS))); $tpl->assign('rssdate', escape($dayDate->format(DateTime::RSS)));
$tpl->assign('hide_timestamps', $conf->get('privacy.hide_timestamps', false)); $tpl->assign('hide_timestamps', $conf->get('privacy.hide_timestamps', false));
$tpl->assign('index_url', $pageaddr);
$html = $tpl->draw('dailyrss', true); $html = $tpl->draw('dailyrss', true);
echo $html . PHP_EOL; echo $html . PHP_EOL;
@ -433,7 +433,6 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager, $loginManager)
$conf->get('redirector.url'), $conf->get('redirector.url'),
$conf->get('redirector.encode_url') $conf->get('redirector.encode_url')
); );
$linksToDisplay[$key]['thumbnail'] = thumbnail($conf, $link['url']);
$linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp(); $linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp();
} }
@ -1812,7 +1811,11 @@ function install($conf, $sessionManager, $loginManager) {
exit; exit;
} }
if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=dailyrss')) { showDailyRSS($conf); exit; } if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=dailyrss')) {
showDailyRSS($conf, $loginManager);
exit;
}
if (!isset($_SESSION['LINKS_PER_PAGE'])) { if (!isset($_SESSION['LINKS_PER_PAGE'])) {
$_SESSION['LINKS_PER_PAGE'] = $conf->get('general.links_per_page', 20); $_SESSION['LINKS_PER_PAGE'] = $conf->get('general.links_per_page', 20);
} }

View file

@ -69,9 +69,12 @@ <h3 class="window-subtitle">{function="format_date($dayDate, false)"}</h3>
</a> </a>
<a href="{$link.real_url}">{$link.title}</a> <a href="{$link.real_url}">{$link.title}</a>
</div> </div>
{$thumb=thumbnail($value.url)} {if="$thumbnails_enabled && !empty($link.thumbnail)"}
{if="$thumb!=false"} <div class="daily-entry-thumbnail">
<div class="daily-entry-thumbnail">{$thumb}</div> <img data-src="{$link.thumbnail}#" class="b-lazy"
src="#"
alt="thumbnail" width="{$thumbnails_width}" height="{$thumbnails_height}" />
</div>
{/if} {/if}
<div class="daily-entry-description">{$link.formatedDescription}</div> <div class="daily-entry-description">{$link.formatedDescription}</div>
{if="$link.tags"} {if="$link.tags"}
@ -83,7 +86,7 @@ <h3 class="window-subtitle">{function="format_date($dayDate, false)"}</h3>
{/loop} {/loop}
</div> </div>
{/if} {/if}
<div class="dailyEntryFooter"> <div class="dailyEntryFooter clear">
{loop="$link.link_plugin"} {loop="$link.link_plugin"}
{$value} {$value}
{/loop} {/loop}
@ -108,6 +111,7 @@ <h3 class="window-subtitle">{function="format_date($dayDate, false)"}</h3>
</div> </div>
</div> </div>
{include="page.footer"} {include="page.footer"}
<script src="js/thumbnails.min.js?v={$version_hash}"></script>
</body> </body>
</html> </html>

View file

@ -8,7 +8,7 @@
<h3><a href="{$value.url}">{$value.title}</a></h3> <h3><a href="{$value.url}">{$value.title}</a></h3>
<small>{if="!$hide_timestamps"}{function="strftime('%c', $value.timestamp)"} - {/if}{if="$value.tags"}{$value.tags}{/if}<br> <small>{if="!$hide_timestamps"}{function="strftime('%c', $value.timestamp)"} - {/if}{if="$value.tags"}{$value.tags}{/if}<br>
{$value.url}</small><br> {$value.url}</small><br>
{if="$value.thumbnail"}{$value.thumbnail}{/if}<br> {if="$value.thumbnail"}<img src="{$index_url}{$value.thumbnail}#" alt="thumbnail" />{/if}<br>
{if="$value.description"}{$value.formatedDescription}{/if} {if="$value.description"}{$value.formatedDescription}{/if}
<br><br><hr> <br><br><hr>
{/loop} {/loop}

View file

@ -58,14 +58,6 @@
</td> </td>
</tr> </tr>
<tr>
<td><b>Redirector</b></td>
<td>
<input type="text" name="redirector" id="redirector" size="50" value="{$redirector}"><br>
(e.g. <i>http://anonym.to/?</i> will mask the HTTP_REFERER)
</td>
</tr>
<tr> <tr>
<td><b>Security:</b></td> <td><b>Security:</b></td>
<td> <td>

View file

@ -68,8 +68,12 @@
<div class="dailyEntryTitle"> <div class="dailyEntryTitle">
<a href="{$link.real_url}">{$link.title}</a> <a href="{$link.real_url}">{$link.title}</a>
</div> </div>
{if="$link.thumbnail"} {if="$thumbnails_enabled && !empty($link.thumbnail)"}
<div class="dailyEntryThumbnail">{$link.thumbnail}</div> <div class="dailyEntryThumbnail">
<img data-src="{$link.thumbnail}#" class="b-lazy"
src="#"
alt="thumbnail" width="{$thumbnails_width}" height="{$thumbnails_height}" />
</div>
{/if} {/if}
<div class="dailyEntryDescription">{$link.formatedDescription}</div> <div class="dailyEntryDescription">{$link.formatedDescription}</div>
@ -97,5 +101,6 @@
<div id="closing"><img src="img/squiggle_closing.png" width="66" height="61" alt="-"></div> <div id="closing"><img src="img/squiggle_closing.png" width="66" height="61" alt="-"></div>
</div> </div>
{include="page.footer"} {include="page.footer"}
<script src="js/thumbnails.min.js?v={$version_hash}"></script>
</body> </body>
</html> </html>

View file

@ -4,11 +4,11 @@
<link>{$absurl}</link> <link>{$absurl}</link>
<pubDate>{$rssdate}</pubDate> <pubDate>{$rssdate}</pubDate>
<description><![CDATA[ <description><![CDATA[
{loop="$links"} {loop="links"}
<h3><a href="{$value.url}">{$value.title}</a></h3> <h3><a href="{$value.url}">{$value.title}</a></h3>
<small>{if="!$hide_timestamps"}{function="strftime('%c', $value.timestamp)"} - {/if}{if="$value.tags"}{$value.tags}{/if}<br> <small>{if="!$hide_timestamps"}{function="strftime('%c', $value.timestamp)"} - {/if}{if="$value.tags"}{$value.tags}{/if}<br>
{$value.url}</small><br> {$value.url}</small><br>
{if="$value.thumbnail"}{$value.thumbnail}{/if}<br> {if="$value.thumbnail"}<img src="{$index_url}{$value.thumbnail}#" alt="thumbnail" />{/if}<br>
{if="$value.description"}{$value.formatedDescription}{/if} {if="$value.description"}{$value.formatedDescription}{/if}
<br><br><hr> <br><br><hr>
{/loop} {/loop}