diff options
author | VirtualTam <virtualtam@flibidi.net> | 2015-11-11 18:58:32 +0100 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2015-11-11 18:58:32 +0100 |
commit | a00ea49c69ae3144cc6e6761a2e73630f904401b (patch) | |
tree | 27c36f311b30d9eb184c7d27b38b8c8c6299d4fc /index.php | |
parent | fd006c630b64146edc402b68d8503c716f8a55d6 (diff) | |
parent | 28bb2b74e3c82ad4563db253ffeca2720b23f268 (diff) | |
download | Shaarli-a00ea49c69ae3144cc6e6761a2e73630f904401b.tar.gz Shaarli-a00ea49c69ae3144cc6e6761a2e73630f904401b.tar.zst Shaarli-a00ea49c69ae3144cc6e6761a2e73630f904401b.zip |
Merge pull request #373 from virtualtam/index/format-globals-comments
index.php: group globals by theme, format comments
Diffstat (limited to 'index.php')
-rwxr-xr-x | index.php | 132 |
1 files changed, 99 insertions, 33 deletions
@@ -22,54 +22,120 @@ if (date_default_timezone_get() == '') { | |||
22 | date_default_timezone_set('UTC'); | 22 | date_default_timezone_set('UTC'); |
23 | } | 23 | } |
24 | 24 | ||
25 | // ----------------------------------------------------------------------------------------------- | 25 | /* ----------------------------------------------------------------------------- |
26 | // Hardcoded parameter (These parameters can be overwritten by editing the file /data/config.php) | 26 | * Hardcoded parameters |
27 | // You should not touch any code below (or at your own risks!) | 27 | * You should not touch any code below (or at your own risks!) |
28 | $GLOBALS['config']['DATADIR'] = 'data'; // Data subdirectory | 28 | * (These parameters can be overwritten by editing the file /data/config.php) |
29 | $GLOBALS['config']['CONFIG_FILE'] = $GLOBALS['config']['DATADIR'].'/config.php'; // Configuration file (user login/password) | 29 | * ----------------------------------------------------------------------------- |
30 | $GLOBALS['config']['DATASTORE'] = $GLOBALS['config']['DATADIR'].'/datastore.php'; // Data storage file. | 30 | */ |
31 | $GLOBALS['config']['LINKS_PER_PAGE'] = 20; // Default links per page. | 31 | |
32 | $GLOBALS['config']['IPBANS_FILENAME'] = $GLOBALS['config']['DATADIR'].'/ipbans.php'; // File storage for failures and bans. | 32 | /* |
33 | $GLOBALS['config']['BAN_AFTER'] = 4; // Ban IP after this many failures. | 33 | * Shaarli directories & configuration files |
34 | $GLOBALS['config']['BAN_DURATION'] = 1800; // Ban duration for IP address after login failures (in seconds) (1800 sec. = 30 minutes) | 34 | */ |
35 | $GLOBALS['config']['OPEN_SHAARLI'] = false; // If true, anyone can add/edit/delete links without having to login | 35 | // Data subdirectory |
36 | $GLOBALS['config']['HIDE_TIMESTAMPS'] = false; // If true, the moment when links were saved are not shown to users that are not logged in. | 36 | $GLOBALS['config']['DATADIR'] = 'data'; |
37 | $GLOBALS['config']['SHOW_ATOM'] = false; // If true, an extra "ATOM feed" button will be displayed in the toolbar | 37 | |
38 | $GLOBALS['config']['ENABLE_THUMBNAILS'] = true; // Enable thumbnails in links. | 38 | // Main configuration file |
39 | $GLOBALS['config']['CACHEDIR'] = 'cache'; // Cache directory for thumbnails for SLOW services (like flickr) | 39 | $GLOBALS['config']['CONFIG_FILE'] = $GLOBALS['config']['DATADIR'].'/config.php'; |
40 | $GLOBALS['config']['PAGECACHE'] = 'pagecache'; // Page cache directory. | 40 | |
41 | $GLOBALS['config']['ENABLE_LOCALCACHE'] = true; // Enable Shaarli to store thumbnail in a local cache. Disable to reduce web space usage. | 41 | // Link datastore |
42 | $GLOBALS['config']['PUBSUBHUB_URL'] = ''; // PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable. | 42 | $GLOBALS['config']['DATASTORE'] = $GLOBALS['config']['DATADIR'].'/datastore.php'; |
43 | $GLOBALS['config']['RAINTPL_TMP'] = 'tmp/' ; // Raintpl cache directory (keep the trailing slash!) | 43 | |
44 | $GLOBALS['config']['RAINTPL_TPL'] = 'tpl/' ; // Raintpl template directory (keep the trailing slash!) | 44 | // Banned IPs |
45 | $GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt'; // For updates check of Shaarli. | 45 | $GLOBALS['config']['IPBANS_FILENAME'] = $GLOBALS['config']['DATADIR'].'/ipbans.php'; |
46 | $GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; // Updates check frequency for Shaarli. 86400 seconds=24 hours | 46 | |
47 | // Note: You must have publisher.php in the same directory as Shaarli index.php | 47 | // For updates check of Shaarli |
48 | $GLOBALS['config']['ENABLE_RSS_PERMALINKS'] = true; // Enable RSS permalinks by default. This corresponds to the default behavior of shaarli before this was added as an option. | 48 | $GLOBALS['config']['UPDATECHECK_FILENAME'] = $GLOBALS['config']['DATADIR'].'/lastupdatecheck.txt'; |
49 | |||
50 | // RainTPL cache directory (keep the trailing slash!) | ||
51 | $GLOBALS['config']['RAINTPL_TMP'] = 'tmp/'; | ||
52 | // Raintpl template directory (keep the trailing slash!) | ||
53 | $GLOBALS['config']['RAINTPL_TPL'] = 'tpl/'; | ||
54 | |||
55 | // Thuumbnail cache directory | ||
56 | $GLOBALS['config']['CACHEDIR'] = 'cache'; | ||
57 | |||
58 | // Atom & RSS feed cache directory | ||
59 | $GLOBALS['config']['PAGECACHE'] = 'pagecache'; | ||
60 | |||
61 | |||
62 | /* | ||
63 | * Global configuration | ||
64 | */ | ||
65 | // Ban IP after this many failures | ||
66 | $GLOBALS['config']['BAN_AFTER'] = 4; | ||
67 | // Ban duration for IP address after login failures (in seconds) | ||
68 | $GLOBALS['config']['BAN_DURATION'] = 1800; | ||
69 | |||
70 | // Feed options | ||
71 | // Enable RSS permalinks by default. | ||
72 | // This corresponds to the default behavior of shaarli before this was added as an option. | ||
73 | $GLOBALS['config']['ENABLE_RSS_PERMALINKS'] = true; | ||
74 | // If true, an extra "ATOM feed" button will be displayed in the toolbar | ||
75 | $GLOBALS['config']['SHOW_ATOM'] = false; | ||
76 | |||
77 | // Link display options | ||
49 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] = false; | 78 | $GLOBALS['config']['HIDE_PUBLIC_LINKS'] = false; |
79 | $GLOBALS['config']['HIDE_TIMESTAMPS'] = false; | ||
80 | $GLOBALS['config']['LINKS_PER_PAGE'] = 20; | ||
81 | |||
82 | // Open Shaarli (true): anyone can add/edit/delete links without having to login | ||
83 | $GLOBALS['config']['OPEN_SHAARLI'] = false; | ||
84 | |||
85 | // Thumbnails | ||
86 | // Display thumbnails in links | ||
87 | $GLOBALS['config']['ENABLE_THUMBNAILS'] = true; | ||
88 | // Store thumbnails in a local cache | ||
89 | $GLOBALS['config']['ENABLE_LOCALCACHE'] = true; | ||
90 | |||
91 | // Update check frequency for Shaarli. 86400 seconds=24 hours | ||
92 | $GLOBALS['config']['UPDATECHECK_INTERVAL'] = 86400 ; | ||
93 | |||
94 | |||
95 | /* | ||
96 | * Plugin configuration | ||
97 | * | ||
98 | * Warning: order matters! | ||
99 | * | ||
100 | * These settings may be be overriden in: | ||
101 | * - data/config.php | ||
102 | * - each plugin's configuration file | ||
103 | */ | ||
50 | //$GLOBALS['config']['ENABLED_PLUGINS'] = array( | 104 | //$GLOBALS['config']['ENABLED_PLUGINS'] = array( |
51 | // 'qrcode', 'archiveorg', 'readityourself', 'demo_plugin', 'playvideos', | 105 | // 'qrcode', 'archiveorg', 'readityourself', 'demo_plugin', 'playvideos', |
52 | // 'wallabag', 'markdown', 'addlink_toolbar', | 106 | // 'wallabag', 'markdown', 'addlink_toolbar', |
53 | //); | 107 | //); |
54 | // Warning: order matters. | ||
55 | $GLOBALS['config']['ENABLED_PLUGINS'] = array('qrcode'); | 108 | $GLOBALS['config']['ENABLED_PLUGINS'] = array('qrcode'); |
56 | 109 | ||
57 | // Default plugins, default config - will be overriden by config.php and then plugin's config.php file. | ||
58 | //$GLOBALS['plugins']['WALLABAG_URL'] = 'https://demo.wallabag.org/'; | 110 | //$GLOBALS['plugins']['WALLABAG_URL'] = 'https://demo.wallabag.org/'; |
59 | // ----------------------------------------------------------------------------------------------- | 111 | |
112 | // PubSubHubbub support. Put an empty string to disable, or put your hub url here to enable. | ||
113 | $GLOBALS['config']['PUBSUBHUB_URL'] = ''; | ||
114 | |||
115 | /* | ||
116 | * PHP configuration | ||
117 | */ | ||
60 | define('shaarli_version', '0.5.4'); | 118 | define('shaarli_version', '0.5.4'); |
119 | |||
61 | // http://server.com/x/shaarli --> /shaarli/ | 120 | // http://server.com/x/shaarli --> /shaarli/ |
62 | define('WEB_PATH', substr($_SERVER["REQUEST_URI"], 0, 1+strrpos($_SERVER["REQUEST_URI"], '/', 0))); | 121 | define('WEB_PATH', substr($_SERVER["REQUEST_URI"], 0, 1+strrpos($_SERVER["REQUEST_URI"], '/', 0))); |
63 | 122 | ||
64 | // PHP Settings | 123 | // High execution time in case of problematic imports/exports. |
65 | ini_set('max_input_time','60'); // High execution time in case of problematic imports/exports. | 124 | ini_set('max_input_time','60'); |
66 | ini_set('memory_limit', '128M'); // Try to set max upload file size and read (May not work on some hosts). | 125 | |
126 | // Try to set max upload file size and read | ||
127 | ini_set('memory_limit', '128M'); | ||
67 | ini_set('post_max_size', '16M'); | 128 | ini_set('post_max_size', '16M'); |
68 | ini_set('upload_max_filesize', '16M'); | 129 | ini_set('upload_max_filesize', '16M'); |
69 | error_reporting(E_ALL^E_WARNING); // See all error except warnings. | ||
70 | //error_reporting(-1); // See all errors (for debugging only) | ||
71 | 130 | ||
72 | // User configuration | 131 | // See all error except warnings |
132 | error_reporting(E_ALL^E_WARNING); | ||
133 | // See all errors (for debugging only) | ||
134 | //error_reporting(-1); | ||
135 | |||
136 | /* | ||
137 | * User configuration | ||
138 | */ | ||
73 | if (is_file($GLOBALS['config']['CONFIG_FILE'])) { | 139 | if (is_file($GLOBALS['config']['CONFIG_FILE'])) { |
74 | require_once $GLOBALS['config']['CONFIG_FILE']; | 140 | require_once $GLOBALS['config']['CONFIG_FILE']; |
75 | } | 141 | } |