aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authornodiscc <nodiscc@gmail.com>2014-08-12 02:07:15 +0200
committernodiscc <nodiscc@gmail.com>2014-08-12 02:07:15 +0200
commit1ec633a74f7a652bff199be0dc9800e85d8d5782 (patch)
treeae77468974990b2463bb4a4fc9a07ef4ce15398d /index.php
parente411f7f9d7682256fdba017d409e8356c4644ab9 (diff)
parent3bb684f59f04511ed157833d3d9552ee0e65d980 (diff)
downloadShaarli-1ec633a74f7a652bff199be0dc9800e85d8d5782.tar.gz
Shaarli-1ec633a74f7a652bff199be0dc9800e85d8d5782.tar.zst
Shaarli-1ec633a74f7a652bff199be0dc9800e85d8d5782.zip
Merge pull request #11 from Sbgodin/rainVariables
Diffstat (limited to 'index.php')
-rw-r--r--index.php18
1 files changed, 4 insertions, 14 deletions
diff --git a/index.php b/index.php
index 5dd0353b..3136193f 100644
--- a/index.php
+++ b/index.php
@@ -26,6 +26,8 @@ $GLOBALS['config']['CACHEDIR'] = 'cache'; // Cache directory for thumbnails for
26$GLOBALS['config']['PAGECACHE'] = 'pagecache'; // Page cache directory. 26$GLOBALS['config']['PAGECACHE'] = 'pagecache'; // Page cache directory.
27$GLOBALS['config']['ENABLE_LOCALCACHE'] = true; // Enable Shaarli to store thumbnail in a local cache. Disable to reduce webspace usage. 27$GLOBALS['config']['ENABLE_LOCALCACHE'] = true; // Enable Shaarli to store thumbnail in a local cache. Disable to reduce webspace usage.
28$GLOBALS['config']['PUBSUBHUB_URL'] = ''; // PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable. 28$GLOBALS['config']['PUBSUBHUB_URL'] = ''; // PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable.
29$GLOBALS['config']['RAINTPL_TMP'] = 'tmp' ; // Raintpl cache directory
30$GLOBALS['config']['RAINTPL_TPL'] = 'tpl/' ; // Raintpl template directory (keep the trailling slash!)
29$GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt'; // For updates check of Shaarli. 31$GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt'; // For updates check of Shaarli.
30$GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; // Updates check frequency for Shaarli. 86400 seconds=24 hours 32$GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; // Updates check frequency for Shaarli. 86400 seconds=24 hours
31 // Note: You must have publisher.php in the same directory as Shaarli index.php 33 // Note: You must have publisher.php in the same directory as Shaarli index.php
@@ -63,9 +65,8 @@ error_reporting(E_ALL^E_WARNING); // See all error except warnings.
63//error_reporting(-1); // See all errors (for debugging only) 65//error_reporting(-1); // See all errors (for debugging only)
64 66
65include "inc/rain.tpl.class.php"; //include Rain TPL 67include "inc/rain.tpl.class.php"; //include Rain TPL
66raintpl::$tpl_dir = "tpl/"; // template directory 68raintpl::$tpl_dir = $GLOBALS['config']['RAINTPL_TPL']; // template directory
67if (!is_dir('tmp')) { mkdir('tmp',0705); chmod('tmp',0705); } 69raintpl::$cache_dir = $GLOBALS['config']['RAINTPL_TMP']; // cache directory
68raintpl::$cache_dir = "tmp/"; // cache directory
69 70
70ob_start(); // Output buffering for the page cache. 71ob_start(); // Output buffering for the page cache.
71 72
@@ -87,16 +88,6 @@ header("Pragma: no-cache");
87 88
88// Directories creations (Note that your web host may require differents rights than 705.) 89// Directories creations (Note that your web host may require differents rights than 705.)
89if (!is_writable(realpath(dirname(__FILE__)))) die('<pre>ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').</pre>'); 90if (!is_writable(realpath(dirname(__FILE__)))) die('<pre>ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').</pre>');
90if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); }
91if (!is_dir('tmp')) { mkdir('tmp',0705); chmod('tmp',0705); } // For RainTPL temporary files.
92if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
93// Second check to see if Shaarli can write in its directory, because on some hosts is_writable() is not reliable.
94if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) die('<pre>ERROR: Shaarli does not have the right to write in its data directory ('.realpath($GLOBALS['config']['DATADIR']).').</pre>');
95if ($GLOBALS['config']['ENABLE_LOCALCACHE'])
96{
97 if (!is_dir($GLOBALS['config']['CACHEDIR'])) { mkdir($GLOBALS['config']['CACHEDIR'],0705); chmod($GLOBALS['config']['CACHEDIR'],0705); }
98 if (!is_file($GLOBALS['config']['CACHEDIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['CACHEDIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
99}
100 91
101// Handling of old config file which do not have the new parameters. 92// Handling of old config file which do not have the new parameters.
102if (empty($GLOBALS['title'])) $GLOBALS['title']='Shared links on '.htmlspecialchars(indexUrl()); 93if (empty($GLOBALS['title'])) $GLOBALS['title']='Shared links on '.htmlspecialchars(indexUrl());
@@ -187,7 +178,6 @@ class pageCache
187 public function cache($page) 178 public function cache($page)
188 { 179 {
189 if (!$this->shouldBeCached) return; 180 if (!$this->shouldBeCached) return;
190 if (!is_dir($GLOBALS['config']['PAGECACHE'])) { mkdir($GLOBALS['config']['PAGECACHE'],0705); chmod($GLOBALS['config']['PAGECACHE'],0705); }
191 file_put_contents($this->filename,$page); 181 file_put_contents($this->filename,$page);
192 } 182 }
193 183