aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php17
1 files changed, 9 insertions, 8 deletions
diff --git a/index.php b/index.php
index cddc9eeb..fb7318d9 100644
--- a/index.php
+++ b/index.php
@@ -707,7 +707,7 @@ function showLinkList($PAGE, $LINKSDB, $conf, $pluginManager) {
707 * @param PluginManager $pluginManager Plugin Manager instance, 707 * @param PluginManager $pluginManager Plugin Manager instance,
708 * @param LinkDB $LINKSDB 708 * @param LinkDB $LINKSDB
709 */ 709 */
710function renderPage($conf, $pluginManager, $LINKSDB) 710function renderPage($conf, $pluginManager, $LINKSDB, $history)
711{ 711{
712 $updater = new Updater( 712 $updater = new Updater(
713 read_updates_file($conf->get('resource.updates')), 713 read_updates_file($conf->get('resource.updates')),
@@ -728,12 +728,6 @@ function renderPage($conf, $pluginManager, $LINKSDB)
728 die($e->getMessage()); 728 die($e->getMessage());
729 } 729 }
730 730
731 try {
732 $history = new History($conf->get('resource.history'));
733 } catch(Exception $e) {
734 die($e->getMessage());
735 }
736
737 $PAGE = new PageBuilder($conf); 731 $PAGE = new PageBuilder($conf);
738 $PAGE->assign('linkcount', count($LINKSDB)); 732 $PAGE->assign('linkcount', count($LINKSDB));
739 $PAGE->assign('privateLinkcount', count_private($LINKSDB)); 733 $PAGE->assign('privateLinkcount', count_private($LINKSDB));
@@ -2240,9 +2234,16 @@ $linkDb = new LinkDB(
2240 $conf->get('redirector.encode_url') 2234 $conf->get('redirector.encode_url')
2241); 2235);
2242 2236
2237try {
2238 $history = new History($conf->get('resource.history'));
2239} catch(Exception $e) {
2240 die($e->getMessage());
2241}
2242
2243$container = new \Slim\Container(); 2243$container = new \Slim\Container();
2244$container['conf'] = $conf; 2244$container['conf'] = $conf;
2245$container['plugins'] = $pluginManager; 2245$container['plugins'] = $pluginManager;
2246$container['history'] = $history;
2246$app = new \Slim\App($container); 2247$app = new \Slim\App($container);
2247 2248
2248// REST API routes 2249// REST API routes
@@ -2262,7 +2263,7 @@ $response = $app->run(true);
2262if ($response->getStatusCode() == 404 && strpos($_SERVER['REQUEST_URI'], '/api/v1') === false) { 2263if ($response->getStatusCode() == 404 && strpos($_SERVER['REQUEST_URI'], '/api/v1') === false) {
2263 // We use UTF-8 for proper international characters handling. 2264 // We use UTF-8 for proper international characters handling.
2264 header('Content-Type: text/html; charset=utf-8'); 2265 header('Content-Type: text/html; charset=utf-8');
2265 renderPage($conf, $pluginManager, $linkDb); 2266 renderPage($conf, $pluginManager, $linkDb, $history);
2266} else { 2267} else {
2267 $app->respond($response); 2268 $app->respond($response);
2268} 2269}