aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php37
1 files changed, 12 insertions, 25 deletions
diff --git a/index.php b/index.php
index 50a871e0..a96c9cfd 100644
--- a/index.php
+++ b/index.php
@@ -312,9 +312,7 @@ function showDailyRSS($conf, $loginManager)
312 $LINKSDB = new LinkDB( 312 $LINKSDB = new LinkDB(
313 $conf->get('resource.datastore'), 313 $conf->get('resource.datastore'),
314 $loginManager->isLoggedIn(), 314 $loginManager->isLoggedIn(),
315 $conf->get('privacy.hide_public_links'), 315 $conf->get('privacy.hide_public_links')
316 $conf->get('redirector.url'),
317 $conf->get('redirector.encode_url')
318 ); 316 );
319 317
320 /* Some Shaarlies may have very few links, so we need to look 318 /* Some Shaarlies may have very few links, so we need to look
@@ -356,13 +354,9 @@ function showDailyRSS($conf, $loginManager)
356 354
357 // We pre-format some fields for proper output. 355 // We pre-format some fields for proper output.
358 foreach ($links as &$link) { 356 foreach ($links as &$link) {
359 $link['formatedDescription'] = format_description( 357 $link['formatedDescription'] = format_description($link['description']);
360 $link['description'],
361 $conf->get('redirector.url'),
362 $conf->get('redirector.encode_url')
363 );
364 $link['timestamp'] = $link['created']->getTimestamp(); 358 $link['timestamp'] = $link['created']->getTimestamp();
365 if (startsWith($link['url'], '?')) { 359 if (is_note($link['url'])) {
366 $link['url'] = index_url($_SERVER) . $link['url']; // make permalink URL absolute 360 $link['url'] = index_url($_SERVER) . $link['url']; // make permalink URL absolute
367 } 361 }
368 } 362 }
@@ -433,11 +427,7 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager, $loginManager)
433 $taglist = explode(' ', $link['tags']); 427 $taglist = explode(' ', $link['tags']);
434 uasort($taglist, 'strcasecmp'); 428 uasort($taglist, 'strcasecmp');
435 $linksToDisplay[$key]['taglist']=$taglist; 429 $linksToDisplay[$key]['taglist']=$taglist;
436 $linksToDisplay[$key]['formatedDescription'] = format_description( 430 $linksToDisplay[$key]['formatedDescription'] = format_description($link['description']);
437 $link['description'],
438 $conf->get('redirector.url'),
439 $conf->get('redirector.encode_url')
440 );
441 $linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp(); 431 $linksToDisplay[$key]['timestamp'] = $link['created']->getTimestamp();
442 } 432 }
443 433
@@ -1175,11 +1165,15 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
1175 $link['title'] = $link['url']; 1165 $link['title'] = $link['url'];
1176 } 1166 }
1177 1167
1178 if ($conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE) { 1168 if ($conf->get('thumbnails.mode', Thumbnailer::MODE_NONE) !== Thumbnailer::MODE_NONE
1169 && ! is_note($link['url'])
1170 ) {
1179 $thumbnailer = new Thumbnailer($conf); 1171 $thumbnailer = new Thumbnailer($conf);
1180 $link['thumbnail'] = $thumbnailer->get($url); 1172 $link['thumbnail'] = $thumbnailer->get($url);
1181 } 1173 }
1182 1174
1175 $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
1176
1183 $pluginManager->executeHooks('save_link', $link); 1177 $pluginManager->executeHooks('save_link', $link);
1184 1178
1185 $LINKSDB[$id] = $link; 1179 $LINKSDB[$id] = $link;
@@ -1557,7 +1551,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
1557 $ids = []; 1551 $ids = [];
1558 foreach ($LINKSDB as $link) { 1552 foreach ($LINKSDB as $link) {
1559 // A note or not HTTP(S) 1553 // A note or not HTTP(S)
1560 if ($link['url'][0] === '?' || ! startsWith(strtolower($link['url']), 'http')) { 1554 if (is_note($link['url']) || ! startsWith(strtolower($link['url']), 'http')) {
1561 continue; 1555 continue;
1562 } 1556 }
1563 $ids[] = $link['id']; 1557 $ids[] = $link['id'];
@@ -1661,11 +1655,7 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager)
1661 $linkDisp = array(); 1655 $linkDisp = array();
1662 while ($i<$end && $i<count($keys)) { 1656 while ($i<$end && $i<count($keys)) {
1663 $link = $linksToDisplay[$keys[$i]]; 1657 $link = $linksToDisplay[$keys[$i]];
1664 $link['description'] = format_description( 1658 $link['description'] = format_description($link['description']);
1665 $link['description'],
1666 $conf->get('redirector.url'),
1667 $conf->get('redirector.encode_url')
1668 );
1669 $classLi = ($i % 2) != 0 ? '' : 'publicLinkHightLight'; 1659 $classLi = ($i % 2) != 0 ? '' : 'publicLinkHightLight';
1670 $link['class'] = $link['private'] == 0 ? $classLi : 'private'; 1660 $link['class'] = $link['private'] == 0 ? $classLi : 'private';
1671 $link['timestamp'] = $link['created']->getTimestamp(); 1661 $link['timestamp'] = $link['created']->getTimestamp();
@@ -1726,7 +1716,6 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager)
1726 'search_term' => $searchterm, 1716 'search_term' => $searchterm,
1727 'search_tags' => $searchtags, 1717 'search_tags' => $searchtags,
1728 'visibility' => ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '', 1718 'visibility' => ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '',
1729 'redirector' => $conf->get('redirector.url'), // Optional redirector URL.
1730 'links' => $linkDisp, 1719 'links' => $linkDisp,
1731 ); 1720 );
1732 1721
@@ -1876,9 +1865,7 @@ try {
1876$linkDb = new LinkDB( 1865$linkDb = new LinkDB(
1877 $conf->get('resource.datastore'), 1866 $conf->get('resource.datastore'),
1878 $loginManager->isLoggedIn(), 1867 $loginManager->isLoggedIn(),
1879 $conf->get('privacy.hide_public_links'), 1868 $conf->get('privacy.hide_public_links')
1880 $conf->get('redirector.url'),
1881 $conf->get('redirector.encode_url')
1882); 1869);
1883 1870
1884$container = new \Slim\Container(); 1871$container = new \Slim\Container();