Merge pull request #11 from Sbgodin/rainVariables
This commit is contained in:
commit
1ec633a74f
5 changed files with 12 additions and 14 deletions
2
cache/.htaccess
vendored
Normal file
2
cache/.htaccess
vendored
Normal file
|
@ -0,0 +1,2 @@
|
|||
Allow from none
|
||||
Deny from all
|
2
data/.htaccess
Normal file
2
data/.htaccess
Normal file
|
@ -0,0 +1,2 @@
|
|||
Allow from none
|
||||
Deny from all
|
18
index.php
18
index.php
|
@ -26,6 +26,8 @@
|
|||
$GLOBALS['config']['PAGECACHE'] = 'pagecache'; // Page cache directory.
|
||||
$GLOBALS['config']['ENABLE_LOCALCACHE'] = true; // Enable Shaarli to store thumbnail in a local cache. Disable to reduce webspace usage.
|
||||
$GLOBALS['config']['PUBSUBHUB_URL'] = ''; // PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable.
|
||||
$GLOBALS['config']['RAINTPL_TMP'] = 'tmp' ; // Raintpl cache directory
|
||||
$GLOBALS['config']['RAINTPL_TPL'] = 'tpl/' ; // Raintpl template directory (keep the trailling slash!)
|
||||
$GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt'; // For updates check of Shaarli.
|
||||
$GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; // Updates check frequency for Shaarli. 86400 seconds=24 hours
|
||||
// Note: You must have publisher.php in the same directory as Shaarli index.php
|
||||
|
@ -63,9 +65,8 @@
|
|||
//error_reporting(-1); // See all errors (for debugging only)
|
||||
|
||||
include "inc/rain.tpl.class.php"; //include Rain TPL
|
||||
raintpl::$tpl_dir = "tpl/"; // template directory
|
||||
if (!is_dir('tmp')) { mkdir('tmp',0705); chmod('tmp',0705); }
|
||||
raintpl::$cache_dir = "tmp/"; // cache directory
|
||||
raintpl::$tpl_dir = $GLOBALS['config']['RAINTPL_TPL']; // template directory
|
||||
raintpl::$cache_dir = $GLOBALS['config']['RAINTPL_TMP']; // cache directory
|
||||
|
||||
ob_start(); // Output buffering for the page cache.
|
||||
|
||||
|
@ -87,16 +88,6 @@ function stripslashes_deep($value) { $value = is_array($value) ? array_map('stri
|
|||
|
||||
// Directories creations (Note that your web host may require differents rights than 705.)
|
||||
if (!is_writable(realpath(dirname(__FILE__)))) die('<pre>ERROR: Shaarli does not have the right to write in its own directory ('.realpath(dirname(__FILE__)).').</pre>');
|
||||
if (!is_dir($GLOBALS['config']['DATADIR'])) { mkdir($GLOBALS['config']['DATADIR'],0705); chmod($GLOBALS['config']['DATADIR'],0705); }
|
||||
if (!is_dir('tmp')) { mkdir('tmp',0705); chmod('tmp',0705); } // For RainTPL temporary files.
|
||||
if (!is_file($GLOBALS['config']['DATADIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['DATADIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
|
||||
// Second check to see if Shaarli can write in its directory, because on some hosts is_writable() is not reliable.
|
||||
if (!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>');
|
||||
if ($GLOBALS['config']['ENABLE_LOCALCACHE'])
|
||||
{
|
||||
if (!is_dir($GLOBALS['config']['CACHEDIR'])) { mkdir($GLOBALS['config']['CACHEDIR'],0705); chmod($GLOBALS['config']['CACHEDIR'],0705); }
|
||||
if (!is_file($GLOBALS['config']['CACHEDIR'].'/.htaccess')) { file_put_contents($GLOBALS['config']['CACHEDIR'].'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
|
||||
}
|
||||
|
||||
// Handling of old config file which do not have the new parameters.
|
||||
if (empty($GLOBALS['title'])) $GLOBALS['title']='Shared links on '.htmlspecialchars(indexUrl());
|
||||
|
@ -187,7 +178,6 @@ public function cachedVersion()
|
|||
public function cache($page)
|
||||
{
|
||||
if (!$this->shouldBeCached) return;
|
||||
if (!is_dir($GLOBALS['config']['PAGECACHE'])) { mkdir($GLOBALS['config']['PAGECACHE'],0705); chmod($GLOBALS['config']['PAGECACHE'],0705); }
|
||||
file_put_contents($this->filename,$page);
|
||||
}
|
||||
|
||||
|
|
2
pagecache/.htaccess
Normal file
2
pagecache/.htaccess
Normal file
|
@ -0,0 +1,2 @@
|
|||
Allow from none
|
||||
Deny from all
|
2
tmp/.htaccess
Normal file
2
tmp/.htaccess
Normal file
|
@ -0,0 +1,2 @@
|
|||
Allow from none
|
||||
Deny from all
|
Loading…
Reference in a new issue