aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'index.php')
-rw-r--r--index.php41
1 files changed, 29 insertions, 12 deletions
diff --git a/index.php b/index.php
index 30223661..5de60425 100644
--- a/index.php
+++ b/index.php
@@ -44,12 +44,18 @@ $GLOBALS['config']['DATASTORE'] = $GLOBALS['config']['DATADIR'].'/datastore.php'
44// Banned IPs 44// Banned IPs
45$GLOBALS['config']['IPBANS_FILENAME'] = $GLOBALS['config']['DATADIR'].'/ipbans.php'; 45$GLOBALS['config']['IPBANS_FILENAME'] = $GLOBALS['config']['DATADIR'].'/ipbans.php';
46 46
47// Processed updates file.
48$GLOBALS['config']['UPDATES_FILE'] = $GLOBALS['config']['DATADIR'].'/updates.txt';
49
47// Access log 50// Access log
48$GLOBALS['config']['LOG_FILE'] = $GLOBALS['config']['DATADIR'].'/log.txt'; 51$GLOBALS['config']['LOG_FILE'] = $GLOBALS['config']['DATADIR'].'/log.txt';
49 52
50// For updates check of Shaarli 53// For updates check of Shaarli
51$GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt'; 54$GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt';
52 55
56// Set ENABLE_UPDATECHECK to disabled by default.
57$GLOBALS['config']['ENABLE_UPDATECHECK'] = false;
58
53// RainTPL cache directory (keep the trailing slash!) 59// RainTPL cache directory (keep the trailing slash!)
54$GLOBALS['config']['RAINTPL_TMP'] = 'tmp/'; 60$GLOBALS['config']['RAINTPL_TMP'] = 'tmp/';
55// Raintpl template directory (keep the trailing slash!) 61// Raintpl template directory (keep the trailing slash!)
@@ -61,7 +67,6 @@ $GLOBALS['config']['CACHEDIR'] = 'cache';
61// Atom & RSS feed cache directory 67// Atom & RSS feed cache directory
62$GLOBALS['config']['PAGECACHE'] = 'pagecache'; 68$GLOBALS['config']['PAGECACHE'] = 'pagecache';
63 69
64
65/* 70/*
66 * Global configuration 71 * Global configuration
67 */ 72 */
@@ -111,7 +116,8 @@ $GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400;
111//); 116//);
112$GLOBALS['config']['ENABLED_PLUGINS'] = array('qrcode'); 117$GLOBALS['config']['ENABLED_PLUGINS'] = array('qrcode');
113 118
114//$GLOBALS['plugins']['WALLABAG_URL'] = 'https://demo.wallabag.org/'; 119// Initialize plugin parameters array.
120$GLOBALS['plugins'] = array();
115 121
116// PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable. 122// PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable.
117$GLOBALS['config']['PUBSUBHUB_URL'] = ''; 123$GLOBALS['config']['PUBSUBHUB_URL'] = '';
@@ -159,6 +165,7 @@ require_once 'application/Utils.php';
159require_once 'application/Config.php'; 165require_once 'application/Config.php';
160require_once 'application/PluginManager.php'; 166require_once 'application/PluginManager.php';
161require_once 'application/Router.php'; 167require_once 'application/Router.php';
168require_once 'application/Updater.php';
162 169
163// Ensure the PHP version is supported 170// Ensure the PHP version is supported
164try { 171try {
@@ -1110,6 +1117,25 @@ function renderPage()
1110 $GLOBALS['redirector'] 1117 $GLOBALS['redirector']
1111 ); 1118 );
1112 1119
1120 $updater = new Updater(
1121 read_updates_file($GLOBALS['config']['UPDATES_FILE']),
1122 $GLOBALS,
1123 $LINKSDB,
1124 isLoggedIn()
1125 );
1126 try {
1127 $newUpdates = $updater->update();
1128 if (! empty($newUpdates)) {
1129 write_updates_file(
1130 $GLOBALS['config']['UPDATES_FILE'],
1131 $updater->getDoneUpdates()
1132 );
1133 }
1134 }
1135 catch(Exception $e) {
1136 die($e->getMessage());
1137 }
1138
1113 $PAGE = new pageBuilder; 1139 $PAGE = new pageBuilder;
1114 1140
1115 // Determine which page will be rendered. 1141 // Determine which page will be rendered.
@@ -1119,9 +1145,9 @@ function renderPage()
1119 // Call plugin hooks for header, footer and includes, specifying which page will be rendered. 1145 // Call plugin hooks for header, footer and includes, specifying which page will be rendered.
1120 // Then assign generated data to RainTPL. 1146 // Then assign generated data to RainTPL.
1121 $common_hooks = array( 1147 $common_hooks = array(
1148 'includes',
1122 'header', 1149 'header',
1123 'footer', 1150 'footer',
1124 'includes',
1125 ); 1151 );
1126 $pluginManager = PluginManager::getInstance(); 1152 $pluginManager = PluginManager::getInstance();
1127 foreach($common_hooks as $name) { 1153 foreach($common_hooks as $name) {
@@ -2536,15 +2562,6 @@ function resizeImage($filepath)
2536 return true; 2562 return true;
2537} 2563}
2538 2564
2539try {
2540 mergeDeprecatedConfig($GLOBALS, isLoggedIn());
2541} catch(Exception $e) {
2542 error_log(
2543 'ERROR while merging deprecated options.php file.' . PHP_EOL .
2544 $e->getMessage()
2545 );
2546}
2547
2548if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=genthumbnail')) { genThumbnail(); exit; } // Thumbnail generation/cache does not need the link database. 2565if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=genthumbnail')) { genThumbnail(); exit; } // Thumbnail generation/cache does not need the link database.
2549if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=rss')) { showRSS(); exit; } 2566if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=rss')) { showRSS(); exit; }
2550if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=atom')) { showATOM(); exit; } 2567if (isset($_SERVER["QUERY_STRING"]) && startswith($_SERVER["QUERY_STRING"],'do=atom')) { showATOM(); exit; }