diff options
author | Seb Sauvage <sebsauvage@sebsauvage.net> | 2011-09-20 13:28:06 +0200 |
---|---|---|
committer | Emilien Klein <emilien@klein.st> | 2011-09-20 13:28:06 +0200 |
commit | ef4275c50edad6de268d53214db37f071e227b34 (patch) | |
tree | 056eb8e549aebfb97f83b95652e290074e8583c3 | |
parent | ca2012366bfbe008a2177336d9b787d2bab43a3d (diff) | |
download | Shaarli-ef4275c50edad6de268d53214db37f071e227b34.tar.gz Shaarli-ef4275c50edad6de268d53214db37f071e227b34.tar.zst Shaarli-ef4275c50edad6de268d53214db37f071e227b34.zip |
Version 0.0.14 beta
-rw-r--r-- | index.php | 33 |
1 files changed, 17 insertions, 16 deletions
@@ -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. | |||
17 | define('BAN_DURATION',1800); // Ban duration for IP address after login failures (in seconds) (1800 sec. = 30 minutes) | 17 | define('BAN_DURATION',1800); // Ban duration for IP address after login failures (in seconds) (1800 sec. = 30 minutes) |
18 | define('OPEN_SHAARLI',false); // If true, anyone can add/edit/delete links without having to login | 18 | define('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 !) |
23 | if (get_magic_quotes_gpc()) | 22 | ini_set('max_input_time','60'); // High execution time in case of problematic imports/exports. |
24 | { | 23 | ini_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'); | 24 | ini_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"; | 25 | ini_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; | 26 | define('PHPPREFIX','<?php /* '); // Prefix to encapsulate data in php code. |
28 | } | 27 | define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code. |
28 | $STARTTIME = microtime(true); // Measure page execution time. | ||
29 | checkphpversion(); | 29 | checkphpversion(); |
30 | error_reporting(E_ALL^E_WARNING); // See all error except warnings. | 30 | error_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. | ||
33 | ob_start(); | 32 | ob_start(); |
33 | // In case stupid admin has left magic_quotes enabled in php.ini: | ||
34 | if (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) |
35 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); | 42 | header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT"); |
36 | header("Cache-Control: no-store, no-cache, must-revalidate"); | 43 | header("Cache-Control: no-store, no-cache, must-revalidate"); |
37 | header("Cache-Control: post-check=0, pre-check=0", false); | 44 | header("Cache-Control: post-check=0, pre-check=0", false); |
38 | header("Pragma: no-cache"); | 45 | header("Pragma: no-cache"); |
39 | define('shaarli_version','0.0.13 beta'); | 46 | define('shaarli_version','0.0.14 beta'); |
40 | if (!is_dir(DATADIR)) { mkdir(DATADIR,0705); chmod(DATADIR,0705); } | 47 | if (!is_dir(DATADIR)) { mkdir(DATADIR,0705); chmod(DATADIR,0705); } |
41 | if (!is_file(DATADIR.'/.htaccess')) { file_put_contents(DATADIR.'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. | 48 | if (!is_file(DATADIR.'/.htaccess')) { file_put_contents(DATADIR.'/.htaccess',"Allow from none\nDeny from all\n"); } // Protect data files. |
42 | if (!is_file(CONFIG_FILE)) install(); | 49 | if (!is_file(CONFIG_FILE)) install(); |
43 | require CONFIG_FILE; // Read login/password hash into $GLOBALS. | 50 | require CONFIG_FILE; // Read login/password hash into $GLOBALS. |
44 | ini_set('max_input_time','60'); // High execution time in case of problematic imports/exports. | ||
45 | ini_set('memory_limit', '128M'); // Try to set max upload file size and read (May not work on some hosts). | ||
46 | ini_set('post_max_size', '16M'); | ||
47 | ini_set('upload_max_filesize', '16M'); | ||
48 | define('PHPPREFIX','<?php /* '); // Prefix to encapsulate data in php code. | ||
49 | define('PHPSUFFIX',' */ ?>'); // Suffix to encapsulate data in php code. | ||
50 | autoLocale(); // Sniff browser language and set date format accordingly. | 51 | autoLocale(); // Sniff browser language and set date format accordingly. |
51 | header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper international characters handling. | 52 | header('Content-Type: text/html; charset=utf-8'); // We use UTF-8 for proper international characters handling. |
52 | $LINKSDB=false; | 53 | $LINKSDB=false; |