aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php40
1 files changed, 13 insertions, 27 deletions
diff --git a/index.php b/index.php
index 322c360c..68e0364c 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
@@ -1074,7 +1064,6 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
1074 $PAGE->assign('api_enabled', $conf->get('api.enabled', true)); 1064 $PAGE->assign('api_enabled', $conf->get('api.enabled', true));
1075 $PAGE->assign('api_secret', $conf->get('api.secret')); 1065 $PAGE->assign('api_secret', $conf->get('api.secret'));
1076 $PAGE->assign('languages', Languages::getAvailableLanguages()); 1066 $PAGE->assign('languages', Languages::getAvailableLanguages());
1077 $PAGE->assign('language', $conf->get('translation.language'));
1078 $PAGE->assign('gd_enabled', extension_loaded('gd')); 1067 $PAGE->assign('gd_enabled', extension_loaded('gd'));
1079 $PAGE->assign('thumbnails_mode', $conf->get('thumbnails.mode', Thumbnailer::MODE_NONE)); 1068 $PAGE->assign('thumbnails_mode', $conf->get('thumbnails.mode', Thumbnailer::MODE_NONE));
1080 $PAGE->assign('pagetitle', t('Configure') .' - '. $conf->get('general.title', 'Shaarli')); 1069 $PAGE->assign('pagetitle', t('Configure') .' - '. $conf->get('general.title', 'Shaarli'));
@@ -1176,11 +1165,15 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
1176 $link['title'] = $link['url']; 1165 $link['title'] = $link['url'];
1177 } 1166 }
1178 1167
1179 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 ) {
1180 $thumbnailer = new Thumbnailer($conf); 1171 $thumbnailer = new Thumbnailer($conf);
1181 $link['thumbnail'] = $thumbnailer->get($url); 1172 $link['thumbnail'] = $thumbnailer->get($url);
1182 } 1173 }
1183 1174
1175 $link['sticky'] = isset($link['sticky']) ? $link['sticky'] : false;
1176
1184 $pluginManager->executeHooks('save_link', $link); 1177 $pluginManager->executeHooks('save_link', $link);
1185 1178
1186 $LINKSDB[$id] = $link; 1179 $LINKSDB[$id] = $link;
@@ -1603,7 +1596,7 @@ function renderPage($conf, $pluginManager, $LINKSDB, $history, $sessionManager,
1603 $ids = []; 1596 $ids = [];
1604 foreach ($LINKSDB as $link) { 1597 foreach ($LINKSDB as $link) {
1605 // A note or not HTTP(S) 1598 // A note or not HTTP(S)
1606 if ($link['url'][0] === '?' || ! startsWith(strtolower($link['url']), 'http')) { 1599 if (is_note($link['url']) || ! startsWith(strtolower($link['url']), 'http')) {
1607 continue; 1600 continue;
1608 } 1601 }
1609 $ids[] = $link['id']; 1602 $ids[] = $link['id'];
@@ -1707,11 +1700,7 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager)
1707 $linkDisp = array(); 1700 $linkDisp = array();
1708 while ($i<$end && $i<count($keys)) { 1701 while ($i<$end && $i<count($keys)) {
1709 $link = $linksToDisplay[$keys[$i]]; 1702 $link = $linksToDisplay[$keys[$i]];
1710 $link['description'] = format_description( 1703 $link['description'] = format_description($link['description']);
1711 $link['description'],
1712 $conf->get('redirector.url'),
1713 $conf->get('redirector.encode_url')
1714 );
1715 $classLi = ($i % 2) != 0 ? '' : 'publicLinkHightLight'; 1704 $classLi = ($i % 2) != 0 ? '' : 'publicLinkHightLight';
1716 $link['class'] = $link['private'] == 0 ? $classLi : 'private'; 1705 $link['class'] = $link['private'] == 0 ? $classLi : 'private';
1717 $link['timestamp'] = $link['created']->getTimestamp(); 1706 $link['timestamp'] = $link['created']->getTimestamp();
@@ -1772,7 +1761,6 @@ function buildLinkList($PAGE, $LINKSDB, $conf, $pluginManager, $loginManager)
1772 'search_term' => $searchterm, 1761 'search_term' => $searchterm,
1773 'search_tags' => $searchtags, 1762 'search_tags' => $searchtags,
1774 'visibility' => ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '', 1763 'visibility' => ! empty($_SESSION['visibility']) ? $_SESSION['visibility'] : '',
1775 'redirector' => $conf->get('redirector.url'), // Optional redirector URL.
1776 'links' => $linkDisp, 1764 'links' => $linkDisp,
1777 ); 1765 );
1778 1766
@@ -1922,9 +1910,7 @@ try {
1922$linkDb = new LinkDB( 1910$linkDb = new LinkDB(
1923 $conf->get('resource.datastore'), 1911 $conf->get('resource.datastore'),
1924 $loginManager->isLoggedIn(), 1912 $loginManager->isLoggedIn(),
1925 $conf->get('privacy.hide_public_links'), 1913 $conf->get('privacy.hide_public_links')
1926 $conf->get('redirector.url'),
1927 $conf->get('redirector.encode_url')
1928); 1914);
1929 1915
1930$container = new \Slim\Container(); 1916$container = new \Slim\Container();
@@ -1947,7 +1933,7 @@ $app->group('/api/v1', function () {
1947 $this->put('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:putTag')->setName('putTag'); 1933 $this->put('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:putTag')->setName('putTag');
1948 $this->delete('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:deleteTag')->setName('deleteTag'); 1934 $this->delete('/tags/{tagName:[\w]+}', '\Shaarli\Api\Controllers\Tags:deleteTag')->setName('deleteTag');
1949 1935
1950 $this->get('/history', '\Shaarli\Api\Controllers\History:getHistory')->setName('getHistory'); 1936 $this->get('/history', '\Shaarli\Api\Controllers\HistoryController:getHistory')->setName('getHistory');
1951})->add('\Shaarli\Api\ApiMiddleware'); 1937})->add('\Shaarli\Api\ApiMiddleware');
1952 1938
1953$response = $app->run(true); 1939$response = $app->run(true);