aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php106
1 files changed, 53 insertions, 53 deletions
diff --git a/index.php b/index.php
index d061f912..b9576de8 100644
--- a/index.php
+++ b/index.php
@@ -108,8 +108,8 @@ if (isset($_COOKIE['shaarli']) && !is_session_id_valid($_COOKIE['shaarli'])) {
108$conf = new ConfigManager(); 108$conf = new ConfigManager();
109$conf->setEmpty('general.timezone', date_default_timezone_get()); 109$conf->setEmpty('general.timezone', date_default_timezone_get());
110$conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER))); 110$conf->setEmpty('general.title', 'Shared links on '. escape(index_url($_SERVER)));
111RainTPL::$tpl_dir = $conf->get('path.raintpl_tpl'); // template directory 111RainTPL::$tpl_dir = $conf->get('resource.raintpl_tpl'); // template directory
112RainTPL::$cache_dir = $conf->get('path.raintpl_tmp'); // cache directory 112RainTPL::$cache_dir = $conf->get('resource.raintpl_tmp'); // cache directory
113 113
114$pluginManager = new PluginManager($conf); 114$pluginManager = new PluginManager($conf);
115$pluginManager->load($conf->get('general.enabled_plugins')); 115$pluginManager->load($conf->get('general.enabled_plugins'));
@@ -172,7 +172,7 @@ header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper int
172 */ 172 */
173function setup_login_state($conf) 173function setup_login_state($conf)
174{ 174{
175 if ($conf->get('extras.open_shaarli')) { 175 if ($conf->get('security.open_shaarli')) {
176 return true; 176 return true;
177 } 177 }
178 $userIsLoggedIn = false; // By default, we do not consider the user as logged in; 178 $userIsLoggedIn = false; // By default, we do not consider the user as logged in;
@@ -273,10 +273,10 @@ function check_auth($login, $password, $conf)
273 if ($login == $conf->get('credentials.login') && $hash == $conf->get('credentials.hash')) 273 if ($login == $conf->get('credentials.login') && $hash == $conf->get('credentials.hash'))
274 { // Login/password is correct. 274 { // Login/password is correct.
275 fillSessionInfo($conf); 275 fillSessionInfo($conf);
276 logm($conf->get('path.log'), $_SERVER['REMOTE_ADDR'], 'Login successful'); 276 logm($conf->get('resource.log'), $_SERVER['REMOTE_ADDR'], 'Login successful');
277 return true; 277 return true;
278 } 278 }
279 logm($conf->get('path.log'), $_SERVER['REMOTE_ADDR'], 'Login failed for user '.$login); 279 logm($conf->get('resource.log'), $_SERVER['REMOTE_ADDR'], 'Login failed for user '.$login);
280 return false; 280 return false;
281} 281}
282 282
@@ -302,14 +302,14 @@ function logout() {
302// ------------------------------------------------------------------------------------------ 302// ------------------------------------------------------------------------------------------
303// Brute force protection system 303// Brute force protection system
304// Several consecutive failed logins will ban the IP address for 30 minutes. 304// Several consecutive failed logins will ban the IP address for 30 minutes.
305if (!is_file($conf->get('path.ban_file', 'data/ipbans.php'))) { 305if (!is_file($conf->get('resource.ban_file', 'data/ipbans.php'))) {
306 // FIXME! globals 306 // FIXME! globals
307 file_put_contents( 307 file_put_contents(
308 $conf->get('path.ban_file', 'data/ipbans.php'), 308 $conf->get('resource.ban_file', 'data/ipbans.php'),
309 "<?php\n\$GLOBALS['IPBANS']=".var_export(array('FAILURES'=>array(),'BANS'=>array()),true).";\n?>" 309 "<?php\n\$GLOBALS['IPBANS']=".var_export(array('FAILURES'=>array(),'BANS'=>array()),true).";\n?>"
310 ); 310 );
311} 311}
312include $conf->get('path.ban_file', 'data/ipbans.php'); 312include $conf->get('resource.ban_file', 'data/ipbans.php');
313/** 313/**
314 * Signal a failed login. Will ban the IP if too many failures: 314 * Signal a failed login. Will ban the IP if too many failures:
315 * 315 *
@@ -324,11 +324,11 @@ function ban_loginFailed($conf)
324 if ($gb['FAILURES'][$ip] > ($conf->get('security.ban_after') - 1)) 324 if ($gb['FAILURES'][$ip] > ($conf->get('security.ban_after') - 1))
325 { 325 {
326 $gb['BANS'][$ip] = time() + $conf->get('security.ban_after', 1800); 326 $gb['BANS'][$ip] = time() + $conf->get('security.ban_after', 1800);
327 logm($conf->get('path.log'), $_SERVER['REMOTE_ADDR'], 'IP address banned from login'); 327 logm($conf->get('resource.log'), $_SERVER['REMOTE_ADDR'], 'IP address banned from login');
328 } 328 }
329 $GLOBALS['IPBANS'] = $gb; 329 $GLOBALS['IPBANS'] = $gb;
330 file_put_contents( 330 file_put_contents(
331 $conf->get('path.ban_file', 'data/ipbans.php'), 331 $conf->get('resource.ban_file', 'data/ipbans.php'),
332 "<?php\n\$GLOBALS['IPBANS']=".var_export($gb,true).";\n?>" 332 "<?php\n\$GLOBALS['IPBANS']=".var_export($gb,true).";\n?>"
333 ); 333 );
334} 334}
@@ -345,7 +345,7 @@ function ban_loginOk($conf)
345 unset($gb['FAILURES'][$ip]); unset($gb['BANS'][$ip]); 345 unset($gb['FAILURES'][$ip]); unset($gb['BANS'][$ip]);
346 $GLOBALS['IPBANS'] = $gb; 346 $GLOBALS['IPBANS'] = $gb;
347 file_put_contents( 347 file_put_contents(
348 $conf->get('path.ban_file', 'data/ipbans.php'), 348 $conf->get('resource.ban_file', 'data/ipbans.php'),
349 "<?php\n\$GLOBALS['IPBANS']=".var_export($gb,true).";\n?>" 349 "<?php\n\$GLOBALS['IPBANS']=".var_export($gb,true).";\n?>"
350 ); 350 );
351} 351}
@@ -365,10 +365,10 @@ function ban_canLogin($conf)
365 // User is banned. Check if the ban has expired: 365 // User is banned. Check if the ban has expired:
366 if ($gb['BANS'][$ip]<=time()) 366 if ($gb['BANS'][$ip]<=time())
367 { // Ban expired, user can try to login again. 367 { // Ban expired, user can try to login again.
368 logm($conf->get('path.log'), $_SERVER['REMOTE_ADDR'], 'Ban lifted.'); 368 logm($conf->get('resource.log'), $_SERVER['REMOTE_ADDR'], 'Ban lifted.');
369 unset($gb['FAILURES'][$ip]); unset($gb['BANS'][$ip]); 369 unset($gb['FAILURES'][$ip]); unset($gb['BANS'][$ip]);
370 file_put_contents( 370 file_put_contents(
371 $conf->get('path.ban_file', 'data/ipbans.php'), 371 $conf->get('resource.ban_file', 'data/ipbans.php'),
372 "<?php\n\$GLOBALS['IPBANS']=".var_export($gb,true).";\n?>" 372 "<?php\n\$GLOBALS['IPBANS']=".var_export($gb,true).";\n?>"
373 ); 373 );
374 return true; // Ban has expired, user can login. 374 return true; // Ban has expired, user can login.
@@ -533,11 +533,11 @@ function showDailyRSS($conf) {
533 // If cached was not found (or not usable), then read the database and build the response: 533 // If cached was not found (or not usable), then read the database and build the response:
534 // Read links from database (and filter private links if used it not logged in). 534 // Read links from database (and filter private links if used it not logged in).
535 $LINKSDB = new LinkDB( 535 $LINKSDB = new LinkDB(
536 $conf->get('path.datastore'), 536 $conf->get('resource.datastore'),
537 isLoggedIn(), 537 isLoggedIn(),
538 $conf->get('extras.hide_public_links'), 538 $conf->get('privacy.hide_public_links'),
539 $conf->get('extras.redirector'), 539 $conf->get('redirector.url'),
540 $conf->get('extras.redirector_encode_url') 540 $conf->get('redirector.encode_url')
541 ); 541 );
542 542
543 /* Some Shaarlies may have very few links, so we need to look 543 /* Some Shaarlies may have very few links, so we need to look
@@ -590,7 +590,7 @@ function showDailyRSS($conf) {
590 // We pre-format some fields for proper output. 590 // We pre-format some fields for proper output.
591 foreach ($linkdates as $linkdate) { 591 foreach ($linkdates as $linkdate) {
592 $l = $LINKSDB[$linkdate]; 592 $l = $LINKSDB[$linkdate];
593 $l['formatedDescription'] = format_description($l['description'], $conf->get('extras.redirector')); 593 $l['formatedDescription'] = format_description($l['description'], $conf->get('redirector.url'));
594 $l['thumbnail'] = thumbnail($conf, $l['url']); 594 $l['thumbnail'] = thumbnail($conf, $l['url']);
595 $l_date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $l['linkdate']); 595 $l_date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $l['linkdate']);
596 $l['timestamp'] = $l_date->getTimestamp(); 596 $l['timestamp'] = $l_date->getTimestamp();
@@ -607,7 +607,7 @@ function showDailyRSS($conf) {
607 $tpl->assign('absurl', $absurl); 607 $tpl->assign('absurl', $absurl);
608 $tpl->assign('links', $links); 608 $tpl->assign('links', $links);
609 $tpl->assign('rssdate', escape($dayDate->format(DateTime::RSS))); 609 $tpl->assign('rssdate', escape($dayDate->format(DateTime::RSS)));
610 $tpl->assign('hide_timestamps', $conf->get('extras.hide_timestamps', false)); 610 $tpl->assign('hide_timestamps', $conf->get('privacy.hide_timestamps', false));
611 $html = $tpl->draw('dailyrss', $return_string=true); 611 $html = $tpl->draw('dailyrss', $return_string=true);
612 612
613 echo $html . PHP_EOL; 613 echo $html . PHP_EOL;
@@ -657,7 +657,7 @@ function showDaily($pageBuilder, $LINKSDB, $conf, $pluginManager)
657 $taglist = explode(' ',$link['tags']); 657 $taglist = explode(' ',$link['tags']);
658 uasort($taglist, 'strcasecmp'); 658 uasort($taglist, 'strcasecmp');
659 $linksToDisplay[$key]['taglist']=$taglist; 659 $linksToDisplay[$key]['taglist']=$taglist;
660 $linksToDisplay[$key]['formatedDescription'] = format_description($link['description'], $conf->get('extras.redirector')); 660 $linksToDisplay[$key]['formatedDescription'] = format_description($link['description'], $conf->get('redirector.url'));
661 $linksToDisplay[$key]['thumbnail'] = thumbnail($conf, $link['url']); 661 $linksToDisplay[$key]['thumbnail'] = thumbnail($conf, $link['url']);
662 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); 662 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']);
663 $linksToDisplay[$key]['timestamp'] = $date->getTimestamp(); 663 $linksToDisplay[$key]['timestamp'] = $date->getTimestamp();
@@ -726,15 +726,15 @@ function showLinkList($PAGE, $LINKSDB, $conf, $pluginManager) {
726function renderPage($conf, $pluginManager) 726function renderPage($conf, $pluginManager)
727{ 727{
728 $LINKSDB = new LinkDB( 728 $LINKSDB = new LinkDB(
729 $conf->get('path.datastore'), 729 $conf->get('resource.datastore'),
730 isLoggedIn(), 730 isLoggedIn(),
731 $conf->get('extras.hide_public_links'), 731 $conf->get('privacy.hide_public_links'),
732 $conf->get('extras.redirector'), 732 $conf->get('redirector.url'),
733 $conf->get('extras.redirector_encode_url') 733 $conf->get('redirector.encode_url')
734 ); 734 );
735 735
736 $updater = new Updater( 736 $updater = new Updater(
737 read_updates_file($conf->get('path.updates')), 737 read_updates_file($conf->get('resource.updates')),
738 $LINKSDB, 738 $LINKSDB,
739 $conf, 739 $conf,
740 isLoggedIn() 740 isLoggedIn()
@@ -743,7 +743,7 @@ function renderPage($conf, $pluginManager)
743 $newUpdates = $updater->update(); 743 $newUpdates = $updater->update();
744 if (! empty($newUpdates)) { 744 if (! empty($newUpdates)) {
745 write_updates_file( 745 write_updates_file(
746 $conf->get('path.updates'), 746 $conf->get('resource.updates'),
747 $updater->getDoneUpdates() 747 $updater->getDoneUpdates()
748 ); 748 );
749 } 749 }
@@ -782,7 +782,7 @@ function renderPage($conf, $pluginManager)
782 // -------- Display login form. 782 // -------- Display login form.
783 if ($targetPage == Router::$PAGE_LOGIN) 783 if ($targetPage == Router::$PAGE_LOGIN)
784 { 784 {
785 if ($conf->get('extras.open_shaarli')) { header('Location: ?'); exit; } // No need to login for open Shaarli 785 if ($conf->get('security.open_shaarli')) { header('Location: ?'); exit; } // No need to login for open Shaarli
786 $token=''; if (ban_canLogin($conf)) $token=getToken($conf); // Do not waste token generation if not useful. 786 $token=''; if (ban_canLogin($conf)) $token=getToken($conf); // Do not waste token generation if not useful.
787 $PAGE->assign('token',$token); 787 $PAGE->assign('token',$token);
788 if (isset($_GET['username'])) { 788 if (isset($_GET['username'])) {
@@ -795,7 +795,7 @@ function renderPage($conf, $pluginManager)
795 // -------- User wants to logout. 795 // -------- User wants to logout.
796 if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=logout')) 796 if (isset($_SERVER['QUERY_STRING']) && startsWith($_SERVER['QUERY_STRING'], 'do=logout'))
797 { 797 {
798 invalidateCaches($conf->get('path.page_cache')); 798 invalidateCaches($conf->get('resource.page_cache'));
799 logout(); 799 logout();
800 header('Location: ?'); 800 header('Location: ?');
801 exit; 801 exit;
@@ -895,7 +895,7 @@ function renderPage($conf, $pluginManager)
895 // Cache system 895 // Cache system
896 $query = $_SERVER['QUERY_STRING']; 896 $query = $_SERVER['QUERY_STRING'];
897 $cache = new CachedPage( 897 $cache = new CachedPage(
898 $conf->get('path.page_cache'), 898 $conf->get('resource.page_cache'),
899 page_url($_SERVER), 899 page_url($_SERVER),
900 startsWith($query,'do='. $targetPage) && !isLoggedIn() 900 startsWith($query,'do='. $targetPage) && !isLoggedIn()
901 ); 901 );
@@ -908,8 +908,8 @@ function renderPage($conf, $pluginManager)
908 // Generate data. 908 // Generate data.
909 $feedGenerator = new FeedBuilder($LINKSDB, $feedType, $_SERVER, $_GET, isLoggedIn()); 909 $feedGenerator = new FeedBuilder($LINKSDB, $feedType, $_SERVER, $_GET, isLoggedIn());
910 $feedGenerator->setLocale(strtolower(setlocale(LC_COLLATE, 0))); 910 $feedGenerator->setLocale(strtolower(setlocale(LC_COLLATE, 0)));
911 $feedGenerator->setHideDates($conf->get('extras.hide_timestamps') && !isLoggedIn()); 911 $feedGenerator->setHideDates($conf->get('privacy.hide_timestamps') && !isLoggedIn());
912 $feedGenerator->setUsePermalinks(isset($_GET['permalinks']) || !$conf->get('general.rss_permalinks')); 912 $feedGenerator->setUsePermalinks(isset($_GET['permalinks']) || !$conf->get('feed.rss_permalinks'));
913 $pshUrl = $conf->get('config.PUBSUBHUB_URL'); 913 $pshUrl = $conf->get('config.PUBSUBHUB_URL');
914 if (!empty($pshUrl)) { 914 if (!empty($pshUrl)) {
915 $feedGenerator->setPubsubhubUrl($pshUrl); 915 $feedGenerator->setPubsubhubUrl($pshUrl);
@@ -1072,7 +1072,7 @@ function renderPage($conf, $pluginManager)
1072 // -------- User wants to change his/her password. 1072 // -------- User wants to change his/her password.
1073 if ($targetPage == Router::$PAGE_CHANGEPASSWORD) 1073 if ($targetPage == Router::$PAGE_CHANGEPASSWORD)
1074 { 1074 {
1075 if ($conf->get('extras.open_shaarli')) { 1075 if ($conf->get('security.open_shaarli')) {
1076 die('You are not supposed to change a password on an Open Shaarli.'); 1076 die('You are not supposed to change a password on an Open Shaarli.');
1077 } 1077 }
1078 1078
@@ -1128,12 +1128,12 @@ function renderPage($conf, $pluginManager)
1128 $conf->set('general.timezone', $tz); 1128 $conf->set('general.timezone', $tz);
1129 $conf->set('general.title', escape($_POST['title'])); 1129 $conf->set('general.title', escape($_POST['title']));
1130 $conf->set('general.header_link', escape($_POST['titleLink'])); 1130 $conf->set('general.header_link', escape($_POST['titleLink']));
1131 $conf->set('extras.redirector', escape($_POST['redirector'])); 1131 $conf->set('redirector.url', escape($_POST['redirector']));
1132 $conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection'])); 1132 $conf->set('security.session_protection_disabled', !empty($_POST['disablesessionprotection']));
1133 $conf->set('general.default_private_links', !empty($_POST['privateLinkByDefault'])); 1133 $conf->set('privacy.default_private_links', !empty($_POST['privateLinkByDefault']));
1134 $conf->set('general.rss_permalinks', !empty($_POST['enableRssPermalinks'])); 1134 $conf->set('feed.rss_permalinks', !empty($_POST['enableRssPermalinks']));
1135 $conf->set('general.check_updates', !empty($_POST['updateCheck'])); 1135 $conf->set('updates.check_updates', !empty($_POST['updateCheck']));
1136 $conf->set('extras.hide_public_links', !empty($_POST['hidePublicLinks'])); 1136 $conf->set('privacy.hide_public_links', !empty($_POST['hidePublicLinks']));
1137 try { 1137 try {
1138 $conf->write(isLoggedIn()); 1138 $conf->write(isLoggedIn());
1139 } 1139 }
@@ -1154,14 +1154,14 @@ function renderPage($conf, $pluginManager)
1154 { 1154 {
1155 $PAGE->assign('token',getToken($conf)); 1155 $PAGE->assign('token',getToken($conf));
1156 $PAGE->assign('title', $conf->get('general.title')); 1156 $PAGE->assign('title', $conf->get('general.title'));
1157 $PAGE->assign('redirector', $conf->get('extras.redirector')); 1157 $PAGE->assign('redirector', $conf->get('redirector.url'));
1158 list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone')); 1158 list($timezone_form, $timezone_js) = generateTimeZoneForm($conf->get('general.timezone'));
1159 $PAGE->assign('timezone_form', $timezone_form); 1159 $PAGE->assign('timezone_form', $timezone_form);
1160 $PAGE->assign('timezone_js',$timezone_js); 1160 $PAGE->assign('timezone_js',$timezone_js);
1161 $PAGE->assign('private_links_default', $conf->get('general.default_private_links', false)); 1161 $PAGE->assign('private_links_default', $conf->get('privacy.default_private_links', false));
1162 $PAGE->assign('enable_rss_permalinks', $conf->get('general.rss_permalinks', false)); 1162 $PAGE->assign('enable_rss_permalinks', $conf->get('feed.rss_permalinks', false));
1163 $PAGE->assign('enable_update_check', $conf->get('general.check_updates', true)); 1163 $PAGE->assign('enable_update_check', $conf->get('updates.check_updates', true));
1164 $PAGE->assign('hide_public_links', $conf->get('extras.hide_public_links', false)); 1164 $PAGE->assign('hide_public_links', $conf->get('privacy.hide_public_links', false));
1165 $PAGE->renderPage('configure'); 1165 $PAGE->renderPage('configure');
1166 exit; 1166 exit;
1167 } 1167 }
@@ -1193,7 +1193,7 @@ function renderPage($conf, $pluginManager)
1193 $value['tags']=trim(implode(' ',$tags)); 1193 $value['tags']=trim(implode(' ',$tags));
1194 $LINKSDB[$key]=$value; 1194 $LINKSDB[$key]=$value;
1195 } 1195 }
1196 $LINKSDB->savedb($conf->get('path.page_cache')); 1196 $LINKSDB->savedb($conf->get('resource.page_cache'));
1197 echo '<script>alert("Tag was removed from '.count($linksToAlter).' links.");document.location=\'?\';</script>'; 1197 echo '<script>alert("Tag was removed from '.count($linksToAlter).' links.");document.location=\'?\';</script>';
1198 exit; 1198 exit;
1199 } 1199 }
@@ -1210,7 +1210,7 @@ function renderPage($conf, $pluginManager)
1210 $value['tags']=trim(implode(' ',$tags)); 1210 $value['tags']=trim(implode(' ',$tags));
1211 $LINKSDB[$key]=$value; 1211 $LINKSDB[$key]=$value;
1212 } 1212 }
1213 $LINKSDB->savedb($conf->get('path.page_cache')); // Save to disk. 1213 $LINKSDB->savedb($conf->get('resource.page_cache')); // Save to disk.
1214 echo '<script>alert("Tag was renamed in '.count($linksToAlter).' links.");document.location=\'?searchtags='.urlencode($_POST['totag']).'\';</script>'; 1214 echo '<script>alert("Tag was renamed in '.count($linksToAlter).' links.");document.location=\'?searchtags='.urlencode($_POST['totag']).'\';</script>';
1215 exit; 1215 exit;
1216 } 1216 }
@@ -1261,7 +1261,7 @@ function renderPage($conf, $pluginManager)
1261 $pluginManager->executeHooks('save_link', $link); 1261 $pluginManager->executeHooks('save_link', $link);
1262 1262
1263 $LINKSDB[$linkdate] = $link; 1263 $LINKSDB[$linkdate] = $link;
1264 $LINKSDB->savedb($conf->get('path.page_cache')); 1264 $LINKSDB->savedb($conf->get('resource.page_cache'));
1265 pubsubhub($conf); 1265 pubsubhub($conf);
1266 1266
1267 // If we are called from the bookmarklet, we must close the popup: 1267 // If we are called from the bookmarklet, we must close the popup:
@@ -1303,7 +1303,7 @@ function renderPage($conf, $pluginManager)
1303 $pluginManager->executeHooks('delete_link', $LINKSDB[$linkdate]); 1303 $pluginManager->executeHooks('delete_link', $LINKSDB[$linkdate]);
1304 1304
1305 unset($LINKSDB[$linkdate]); 1305 unset($LINKSDB[$linkdate]);
1306 $LINKSDB->savedb('path.page_cache'); // save to disk 1306 $LINKSDB->savedb('resource.page_cache'); // save to disk
1307 1307
1308 // If we are called from the bookmarklet, we must close the popup: 1308 // If we are called from the bookmarklet, we must close the popup:
1309 if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo '<script>self.close();</script>'; exit; } 1309 if (isset($_GET['source']) && ($_GET['source']=='bookmarklet' || $_GET['source']=='firefoxsocialapi')) { echo '<script>self.close();</script>'; exit; }
@@ -1629,7 +1629,7 @@ function importFile($LINKSDB, $conf)
1629 } 1629 }
1630 } 1630 }
1631 } 1631 }
1632 $LINKSDB->savedb($conf->get('path.page_cache')); 1632 $LINKSDB->savedb($conf->get('resource.page_cache'));
1633 1633
1634 echo '<script>alert("File '.json_encode($filename).' ('.$filesize.' bytes) was successfully processed: '.$import_count.' links imported.");document.location=\'?\';</script>'; 1634 echo '<script>alert("File '.json_encode($filename).' ('.$filesize.' bytes) was successfully processed: '.$import_count.' links imported.");document.location=\'?\';</script>';
1635 } 1635 }
@@ -1693,7 +1693,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
1693 while ($i<$end && $i<count($keys)) 1693 while ($i<$end && $i<count($keys))
1694 { 1694 {
1695 $link = $linksToDisplay[$keys[$i]]; 1695 $link = $linksToDisplay[$keys[$i]];
1696 $link['description'] = format_description($link['description'], $conf->get('extras.redirector')); 1696 $link['description'] = format_description($link['description'], $conf->get('redirector.url'));
1697 $classLi = ($i % 2) != 0 ? '' : 'publicLinkHightLight'; 1697 $classLi = ($i % 2) != 0 ? '' : 'publicLinkHightLight';
1698 $link['class'] = $link['private'] == 0 ? $classLi : 'private'; 1698 $link['class'] = $link['private'] == 0 ? $classLi : 'private';
1699 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); 1699 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']);
@@ -1735,7 +1735,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
1735 'result_count' => count($linksToDisplay), 1735 'result_count' => count($linksToDisplay),
1736 'search_term' => $searchterm, 1736 'search_term' => $searchterm,
1737 'search_tags' => $searchtags, 1737 'search_tags' => $searchtags,
1738 'redirector' => $conf->get('extras.redirector'), // Optional redirector URL. 1738 'redirector' => $conf->get('redirector.url'), // Optional redirector URL.
1739 'token' => $token, 1739 'token' => $token,
1740 'links' => $linkDisp, 1740 'links' => $linkDisp,
1741 'tags' => $LINKSDB->allTags(), 1741 'tags' => $LINKSDB->allTags(),
@@ -1773,7 +1773,7 @@ function buildLinkList($PAGE,$LINKSDB, $conf, $pluginManager)
1773 */ 1773 */
1774function computeThumbnail($conf, $url, $href = false) 1774function computeThumbnail($conf, $url, $href = false)
1775{ 1775{
1776 if (!$conf->get('general.enable_thumbnails')) return array(); 1776 if (!$conf->get('thumbnail.enable_thumbnails')) return array();
1777 if ($href==false) $href=$url; 1777 if ($href==false) $href=$url;
1778 1778
1779 // For most hosts, the URL of the thumbnail can be easily deduced from the URL of the link. 1779 // For most hosts, the URL of the thumbnail can be easily deduced from the URL of the link.
@@ -1841,7 +1841,7 @@ function computeThumbnail($conf, $url, $href = false)
1841 // So we deport the thumbnail generation in order not to slow down page generation 1841 // So we deport the thumbnail generation in order not to slow down page generation
1842 // (and we also cache the thumbnail) 1842 // (and we also cache the thumbnail)
1843 1843
1844 if (! $conf->get('general.enable_localcache')) return array(); // If local cache is disabled, no thumbnails for services which require the use a local cache. 1844 if (! $conf->get('thumbnail.enable_localcache')) return array(); // If local cache is disabled, no thumbnails for services which require the use a local cache.
1845 1845
1846 if ($domain=='flickr.com' || endsWith($domain,'.flickr.com') 1846 if ($domain=='flickr.com' || endsWith($domain,'.flickr.com')
1847 || $domain=='vimeo.com' 1847 || $domain=='vimeo.com'
@@ -1996,7 +1996,7 @@ function install($conf)
1996 } else { 1996 } else {
1997 $conf->set('general.title', 'Shared links on '.escape(index_url($_SERVER))); 1997 $conf->set('general.title', 'Shared links on '.escape(index_url($_SERVER)));
1998 } 1998 }
1999 $conf->set('general.check_updates', !empty($_POST['updateCheck'])); 1999 $conf->set('updates.check_updates', !empty($_POST['updateCheck']));
2000 try { 2000 try {
2001 // Everything is ok, let's create config file. 2001 // Everything is ok, let's create config file.
2002 $conf->write(isLoggedIn()); 2002 $conf->write(isLoggedIn());
@@ -2047,7 +2047,7 @@ function genThumbnail($conf)
2047 $sign = hash_hmac('sha256', $_GET['url'], $conf->get('credentials.salt')); 2047 $sign = hash_hmac('sha256', $_GET['url'], $conf->get('credentials.salt'));
2048 if ($sign!=$_GET['hmac']) die('Naughty boy!'); 2048 if ($sign!=$_GET['hmac']) die('Naughty boy!');
2049 2049
2050 $cacheDir = $conf->get('path.thumbnails_cache', 'cache'); 2050 $cacheDir = $conf->get('resource.thumbnails_cache', 'cache');
2051 // Let's see if we don't already have the image for this URL in the cache. 2051 // Let's see if we don't already have the image for this URL in the cache.
2052 $thumbname=hash('sha1',$_GET['url']).'.jpg'; 2052 $thumbname=hash('sha1',$_GET['url']).'.jpg';
2053 if (is_file($cacheDir .'/'. $thumbname)) 2053 if (is_file($cacheDir .'/'. $thumbname))