aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--index.php33
1 files changed, 17 insertions, 16 deletions
diff --git a/index.php b/index.php
index 369f4926..520d7d30 100644
--- a/index.php
+++ b/index.php
@@ -1,5 +1,5 @@
1<?php 1<?php
2// Shaarli 0.0.13 beta - Shaare your links... 2// Shaarli 0.0.14 beta - Shaare your links...
3// The personal, minimalist, super-fast, no-database delicious clone. By sebsauvage.net 3// The personal, minimalist, super-fast, no-database delicious clone. By sebsauvage.net
4// http://sebsauvage.net/wiki/doku.php?id=php:shaarli 4// http://sebsauvage.net/wiki/doku.php?id=php:shaarli
5// Licence: http://www.opensource.org/licenses/zlib-license.php 5// Licence: http://www.opensource.org/licenses/zlib-license.php
@@ -17,36 +17,37 @@ define('BAN_AFTER',4); // Ban IP after this many failures.
17define('BAN_DURATION',1800); // Ban duration for IP address after login failures (in seconds) (1800 sec. = 30 minutes) 17define('BAN_DURATION',1800); // Ban duration for IP address after login failures (in seconds) (1800 sec. = 30 minutes)
18define('OPEN_SHAARLI',false); // If true, anyone can add/edit/delete links without having to login 18define('OPEN_SHAARLI',false); // If true, anyone can add/edit/delete links without having to login
19 19
20
21// ----------------------------------------------------------------------------------------------- 20// -----------------------------------------------------------------------------------------------
22// Program config (touch at your own risks !) 21// Program config (touch at your own risks !)
23if (get_magic_quotes_gpc()) 22ini_set('max_input_time','60'); // High execution time in case of problematic imports/exports.
24{ 23ini_set('memory_limit', '128M'); // Try to set max upload file size and read (May not work on some hosts).
25 header('Content-Type: text/plain; charset=utf-8'); 24ini_set('post_max_size', '16M');
26 echo "ERROR: magic_quotes_gpc is ON in your php config. This is *BAD*. You *MUST* disable it, either by changing the value in php.ini,\n"; 25ini_set('upload_max_filesize', '16M');
27 echo "or by adding ONE the following line in .htaccess (depending on your host):\n\nphp_flag magic_quotes_gpc Off\nor\nSetEnv MAGIC_QUOTES 0"; exit; 26define('PHPPREFIX','<?php /* '); // Prefix to encapsulate data in php code.
28} 27define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code.
28$STARTTIME = microtime(true); // Measure page execution time.
29checkphpversion(); 29checkphpversion();
30error_reporting(E_ALL^E_WARNING); // See all error except warnings. 30error_reporting(E_ALL^E_WARNING); // See all error except warnings.
31//error_reporting(-1); // See all errors (for debugging only) 31//error_reporting(-1); // See all errors (for debugging only)
32$STARTTIME = microtime(true); // Measure page execution time.
33ob_start(); 32ob_start();
33// In case stupid admin has left magic_quotes enabled in php.ini:
34if (get_magic_quotes_gpc())
35{
36 function stripslashes_deep($value) { $value = is_array($value) ? array_map('stripslashes_deep', $value) : stripslashes($value); return $value; }
37 $_POST = array_map('stripslashes_deep', $_POST);
38 $_GET = array_map('stripslashes_deep', $_GET);
39 $_COOKIE = array_map('stripslashes_deep', $_COOKIE);
40}
34// Prevent caching: (yes, it's ugly) 41// Prevent caching: (yes, it's ugly)
35header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); 42header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
36header("Cache-Control: no-store, no-cache, must-revalidate"); 43header("Cache-Control: no-store, no-cache, must-revalidate");
37header("Cache-Control: post-check=0, pre-check=0", false); 44header("Cache-Control: post-check=0, pre-check=0", false);
38header("Pragma: no-cache"); 45header("Pragma: no-cache");
39define('shaarli_version','0.0.13 beta'); 46define('shaarli_version','0.0.14 beta');
40if (!is_dir(DATADIR)) { mkdir(DATADIR,0705); chmod(DATADIR,0705); } 47if (!is_dir(DATADIR)) { mkdir(DATADIR,0705); chmod(DATADIR,0705); }
41if (!is_file(DATADIR.'/.htaccess')) { file_put_contents(DATADIR.'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. 48if (!is_file(DATADIR.'/.htaccess')) { file_put_contents(DATADIR.'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files.
42if (!is_file(CONFIG_FILE)) install(); 49if (!is_file(CONFIG_FILE)) install();
43require CONFIG_FILE; // Read login/password hash into $GLOBALS. 50require CONFIG_FILE; // Read login/password hash into $GLOBALS.
44ini_set('max_input_time','60'); // High execution time in case of problematic imports/exports.
45ini_set('memory_limit', '128M'); // Try to set max upload file size and read (May not work on some hosts).
46ini_set('post_max_size', '16M');
47ini_set('upload_max_filesize', '16M');
48define('PHPPREFIX','<?php /* '); // Prefix to encapsulate data in php code.
49define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code.
50autoLocale(); // Sniff browser language and set date format accordingly. 51autoLocale(); // Sniff browser language and set date format accordingly.
51header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper international characters handling. 52header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper international characters handling.
52$LINKSDB=false; 53$LINKSDB=false;