aboutsummaryrefslogtreecommitdiffhomepage
path: root/application
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-06-11 09:08:02 +0200
committerArthurHoaro <arthur@hoa.ro>2016-06-11 09:30:56 +0200
commit894a3c4bf38d8dcadb6941049b9167e5101805bd (patch)
tree6e158c07f620fced157dba0a51638590814b50bc /application
parent51def0d84955c7a951bd091eb5eeb3fce9deabd4 (diff)
downloadShaarli-894a3c4bf38d8dcadb6941049b9167e5101805bd.tar.gz
Shaarli-894a3c4bf38d8dcadb6941049b9167e5101805bd.tar.zst
Shaarli-894a3c4bf38d8dcadb6941049b9167e5101805bd.zip
Rename configuration key for better sections
Diffstat (limited to 'application')
-rw-r--r--application/ApplicationUtils.php18
-rw-r--r--application/PageBuilder.php16
-rw-r--r--application/Updater.php10
-rw-r--r--application/config/ConfigManager.php58
-rw-r--r--application/config/ConfigPhp.php48
5 files changed, 77 insertions, 73 deletions
diff --git a/application/ApplicationUtils.php b/application/ApplicationUtils.php
index c5a157b9..e67b2902 100644
--- a/application/ApplicationUtils.php
+++ b/application/ApplicationUtils.php
@@ -145,7 +145,7 @@ class ApplicationUtils
145 'application', 145 'application',
146 'inc', 146 'inc',
147 'plugins', 147 'plugins',
148 $conf->get('path.raintpl_tpl'), 148 $conf->get('resource.raintpl_tpl'),
149 ) as $path) { 149 ) as $path) {
150 if (! is_readable(realpath($path))) { 150 if (! is_readable(realpath($path))) {
151 $errors[] = '"'.$path.'" directory is not readable'; 151 $errors[] = '"'.$path.'" directory is not readable';
@@ -154,10 +154,10 @@ class ApplicationUtils
154 154
155 // Check cache and data directories are readable and writeable 155 // Check cache and data directories are readable and writeable
156 foreach (array( 156 foreach (array(
157 $conf->get('path.thumbnails_cache'), 157 $conf->get('resource.thumbnails_cache'),
158 $conf->get('path.data_dir'), 158 $conf->get('resource.data_dir'),
159 $conf->get('path.page_cache'), 159 $conf->get('resource.page_cache'),
160 $conf->get('path.raintpl_tmp'), 160 $conf->get('resource.raintpl_tmp'),
161 ) as $path) { 161 ) as $path) {
162 if (! is_readable(realpath($path))) { 162 if (! is_readable(realpath($path))) {
163 $errors[] = '"'.$path.'" directory is not readable'; 163 $errors[] = '"'.$path.'" directory is not readable';
@@ -170,10 +170,10 @@ class ApplicationUtils
170 // Check configuration files are readable and writeable 170 // Check configuration files are readable and writeable
171 foreach (array( 171 foreach (array(
172 $conf->getConfigFileExt(), 172 $conf->getConfigFileExt(),
173 $conf->get('path.datastore'), 173 $conf->get('resource.datastore'),
174 $conf->get('path.ban_file'), 174 $conf->get('resource.ban_file'),
175 $conf->get('path.log'), 175 $conf->get('resource.log'),
176 $conf->get('path.update_check'), 176 $conf->get('resource.update_check'),
177 ) as $path) { 177 ) as $path) {
178 if (! is_file(realpath($path))) { 178 if (! is_file(realpath($path))) {
179 # the file may not exist yet 179 # the file may not exist yet
diff --git a/application/PageBuilder.php b/application/PageBuilder.php
index 843cc0dc..88dbfa8a 100644
--- a/application/PageBuilder.php
+++ b/application/PageBuilder.php
@@ -41,17 +41,17 @@ class PageBuilder
41 try { 41 try {
42 $version = ApplicationUtils::checkUpdate( 42 $version = ApplicationUtils::checkUpdate(
43 shaarli_version, 43 shaarli_version,
44 $this->conf->get('path.update_check'), 44 $this->conf->get('resource.update_check'),
45 $this->conf->get('general.check_updates_interval'), 45 $this->conf->get('updates.check_updates_interval'),
46 $this->conf->get('general.check_updates'), 46 $this->conf->get('updates.check_updates'),
47 isLoggedIn(), 47 isLoggedIn(),
48 $this->conf->get('general.check_updates_branch') 48 $this->conf->get('updates.check_updates_branch')
49 ); 49 );
50 $this->tpl->assign('newVersion', escape($version)); 50 $this->tpl->assign('newVersion', escape($version));
51 $this->tpl->assign('versionError', ''); 51 $this->tpl->assign('versionError', '');
52 52
53 } catch (Exception $exc) { 53 } catch (Exception $exc) {
54 logm($this->conf->get('path.log'), $_SERVER['REMOTE_ADDR'], $exc->getMessage()); 54 logm($this->conf->get('resource.log'), $_SERVER['REMOTE_ADDR'], $exc->getMessage());
55 $this->tpl->assign('newVersion', ''); 55 $this->tpl->assign('newVersion', '');
56 $this->tpl->assign('versionError', escape($exc->getMessage())); 56 $this->tpl->assign('versionError', escape($exc->getMessage()));
57 } 57 }
@@ -80,9 +80,9 @@ class PageBuilder
80 $this->tpl->assign('pagetitle', $this->conf->get('pagetitle')); 80 $this->tpl->assign('pagetitle', $this->conf->get('pagetitle'));
81 } 81 }
82 $this->tpl->assign('shaarlititle', $this->conf->get('title', 'Shaarli')); 82 $this->tpl->assign('shaarlititle', $this->conf->get('title', 'Shaarli'));
83 $this->tpl->assign('openshaarli', $this->conf->get('extras.open_shaarli', false)); 83 $this->tpl->assign('openshaarli', $this->conf->get('security.open_shaarli', false));
84 $this->tpl->assign('showatom', $this->conf->get('extras.show_atom', false)); 84 $this->tpl->assign('showatom', $this->conf->get('feed.show_atom', false));
85 $this->tpl->assign('hide_timestamps', $this->conf->get('extras.hide_timestamps', false)); 85 $this->tpl->assign('hide_timestamps', $this->conf->get('privacy.hide_timestamps', false));
86 if (!empty($GLOBALS['plugin_errors'])) { 86 if (!empty($GLOBALS['plugin_errors'])) {
87 $this->tpl->assign('plugin_errors', $GLOBALS['plugin_errors']); 87 $this->tpl->assign('plugin_errors', $GLOBALS['plugin_errors']);
88 } 88 }
diff --git a/application/Updater.php b/application/Updater.php
index b8940e41..fd45d17f 100644
--- a/application/Updater.php
+++ b/application/Updater.php
@@ -114,8 +114,8 @@ class Updater
114 */ 114 */
115 public function updateMethodMergeDeprecatedConfigFile() 115 public function updateMethodMergeDeprecatedConfigFile()
116 { 116 {
117 if (is_file($this->conf->get('path.data_dir') . '/options.php')) { 117 if (is_file($this->conf->get('resource.data_dir') . '/options.php')) {
118 include $this->conf->get('path.data_dir') . '/options.php'; 118 include $this->conf->get('resource.data_dir') . '/options.php';
119 119
120 // Load GLOBALS into config 120 // Load GLOBALS into config
121 $allowedKeys = array_merge(ConfigPhp::$ROOT_KEYS); 121 $allowedKeys = array_merge(ConfigPhp::$ROOT_KEYS);
@@ -126,7 +126,7 @@ class Updater
126 } 126 }
127 } 127 }
128 $this->conf->write($this->isLoggedIn); 128 $this->conf->write($this->isLoggedIn);
129 unlink($this->conf->get('path.data_dir').'/options.php'); 129 unlink($this->conf->get('resource.data_dir').'/options.php');
130 } 130 }
131 131
132 return true; 132 return true;
@@ -143,7 +143,7 @@ class Updater
143 $link['tags'] = implode(' ', array_unique(LinkFilter::tagsStrToArray($link['tags'], true))); 143 $link['tags'] = implode(' ', array_unique(LinkFilter::tagsStrToArray($link['tags'], true)));
144 $this->linkDB[$link['linkdate']] = $link; 144 $this->linkDB[$link['linkdate']] = $link;
145 } 145 }
146 $this->linkDB->savedb($this->conf->get('path.page_cache')); 146 $this->linkDB->savedb($this->conf->get('resource.page_cache'));
147 return true; 147 return true;
148 } 148 }
149 149
@@ -207,7 +207,7 @@ class Updater
207 try { 207 try {
208 $this->conf->set('general.title', escape($this->conf->get('general.title'))); 208 $this->conf->set('general.title', escape($this->conf->get('general.title')));
209 $this->conf->set('general.header_link', escape($this->conf->get('general.header_link'))); 209 $this->conf->set('general.header_link', escape($this->conf->get('general.header_link')));
210 $this->conf->set('extras.redirector', escape($this->conf->get('extras.redirector'))); 210 $this->conf->set('redirector.url', escape($this->conf->get('redirector.url')));
211 $this->conf->write($this->isLoggedIn); 211 $this->conf->write($this->isLoggedIn);
212 } catch (Exception $e) { 212 } catch (Exception $e) {
213 error_log($e->getMessage()); 213 error_log($e->getMessage());
diff --git a/application/config/ConfigManager.php b/application/config/ConfigManager.php
index 5aafc89d..ff41772a 100644
--- a/application/config/ConfigManager.php
+++ b/application/config/ConfigManager.php
@@ -186,8 +186,8 @@ class ConfigManager
186 'general.timezone', 186 'general.timezone',
187 'general.title', 187 'general.title',
188 'general.header_link', 188 'general.header_link',
189 'general.default_private_links', 189 'privacy.default_private_links',
190 'extras.redirector', 190 'redirector.url',
191 ); 191 );
192 192
193 // Only logged in user can alter config. 193 // Only logged in user can alter config.
@@ -287,39 +287,43 @@ class ConfigManager
287 */ 287 */
288 protected function setDefaultValues() 288 protected function setDefaultValues()
289 { 289 {
290 $this->setEmpty('path.data_dir', 'data'); 290 $this->setEmpty('resource.data_dir', 'data');
291 $this->setEmpty('path.config', 'data/config.php'); 291 $this->setEmpty('resource.config', 'data/config.php');
292 $this->setEmpty('path.datastore', 'data/datastore.php'); 292 $this->setEmpty('resource.datastore', 'data/datastore.php');
293 $this->setEmpty('path.ban_file', 'data/ipbans.php'); 293 $this->setEmpty('resource.ban_file', 'data/ipbans.php');
294 $this->setEmpty('path.updates', 'data/updates.txt'); 294 $this->setEmpty('resource.updates', 'data/updates.txt');
295 $this->setEmpty('path.log', 'data/log.txt'); 295 $this->setEmpty('resource.log', 'data/log.txt');
296 $this->setEmpty('path.update_check', 'data/lastupdatecheck.txt'); 296 $this->setEmpty('resource.update_check', 'data/lastupdatecheck.txt');
297 $this->setEmpty('path.raintpl_tpl', 'tpl/'); 297 $this->setEmpty('resource.raintpl_tpl', 'tpl/');
298 $this->setEmpty('path.raintpl_tmp', 'tmp/'); 298 $this->setEmpty('resource.raintpl_tmp', 'tmp/');
299 $this->setEmpty('path.thumbnails_cache', 'cache'); 299 $this->setEmpty('resource.thumbnails_cache', 'cache');
300 $this->setEmpty('path.page_cache', 'pagecache'); 300 $this->setEmpty('resource.page_cache', 'pagecache');
301 301
302 $this->setEmpty('security.ban_after', 4); 302 $this->setEmpty('security.ban_after', 4);
303 $this->setEmpty('security.ban_duration', 1800); 303 $this->setEmpty('security.ban_duration', 1800);
304 $this->setEmpty('security.session_protection_disabled', false); 304 $this->setEmpty('security.session_protection_disabled', false);
305 $this->setEmpty('security.open_shaarli', false);
305 306
306 $this->setEmpty('general.check_updates', false);
307 $this->setEmpty('general.rss_permalinks', true);
308 $this->setEmpty('general.links_per_page', 20);
309 $this->setEmpty('general.default_private_links', false);
310 $this->setEmpty('general.enable_thumbnails', true);
311 $this->setEmpty('general.enable_localcache', true);
312 $this->setEmpty('general.check_updates_branch', 'stable');
313 $this->setEmpty('general.check_updates_interval', 86400);
314 $this->setEmpty('general.header_link', '?'); 307 $this->setEmpty('general.header_link', '?');
308 $this->setEmpty('general.links_per_page', 20);
315 $this->setEmpty('general.enabled_plugins', array('qrcode')); 309 $this->setEmpty('general.enabled_plugins', array('qrcode'));
316 310
317 $this->setEmpty('extras.show_atom', false); 311 $this->setEmpty('updates.check_updates', false);
318 $this->setEmpty('extras.hide_public_links', false); 312 $this->setEmpty('updates.check_updates_branch', 'stable');
319 $this->setEmpty('extras.hide_timestamps', false); 313 $this->setEmpty('updates.check_updates_interval', 86400);
320 $this->setEmpty('extras.open_shaarli', false); 314
321 $this->setEmpty('extras.redirector', ''); 315 $this->setEmpty('feed.rss_permalinks', true);
322 $this->setEmpty('extras.redirector_encode_url', true); 316 $this->setEmpty('feed.show_atom', false);
317
318 $this->setEmpty('privacy.default_private_links', false);
319 $this->setEmpty('privacy.hide_public_links', false);
320 $this->setEmpty('privacy.hide_timestamps', false);
321
322 $this->setEmpty('thumbnail.enable_thumbnails', true);
323 $this->setEmpty('thumbnail.enable_localcache', true);
324
325 $this->setEmpty('redirector.url', '');
326 $this->setEmpty('redirector.encode_url', true);
323 327
324 $this->setEmpty('plugins', array()); 328 $this->setEmpty('plugins', array());
325 } 329 }
diff --git a/application/config/ConfigPhp.php b/application/config/ConfigPhp.php
index b122f4f1..27187b66 100644
--- a/application/config/ConfigPhp.php
+++ b/application/config/ConfigPhp.php
@@ -34,38 +34,38 @@ class ConfigPhp implements ConfigIO
34 'credentials.login' => 'login', 34 'credentials.login' => 'login',
35 'credentials.hash' => 'hash', 35 'credentials.hash' => 'hash',
36 'credentials.salt' => 'salt', 36 'credentials.salt' => 'salt',
37 'path.data_dir' => 'config.DATADIR', 37 'resource.data_dir' => 'config.DATADIR',
38 'path.config' => 'config.CONFIG_FILE', 38 'resource.config' => 'config.CONFIG_FILE',
39 'path.datastore' => 'config.DATASTORE', 39 'resource.datastore' => 'config.DATASTORE',
40 'path.updates' => 'config.UPDATES_FILE', 40 'resource.updates' => 'config.UPDATES_FILE',
41 'path.log' => 'config.LOG_FILE', 41 'resource.log' => 'config.LOG_FILE',
42 'path.update_check' => 'config.UPDATECHECK_FILENAME', 42 'resource.update_check' => 'config.UPDATECHECK_FILENAME',
43 'path.raintpl_tpl' => 'config.RAINTPL_TPL', 43 'resource.raintpl_tpl' => 'config.RAINTPL_TPL',
44 'path.raintpl_tmp' => 'config.RAINTPL_TMP', 44 'resource.raintpl_tmp' => 'config.RAINTPL_TMP',
45 'path.thumbnails_cache' => 'config.CACHEDIR', 45 'resource.thumbnails_cache' => 'config.CACHEDIR',
46 'path.page_cache' => 'config.PAGECACHE', 46 'resource.page_cache' => 'config.PAGECACHE',
47 'path.ban_file' => 'config.IPBANS_FILENAME', 47 'resource.ban_file' => 'config.IPBANS_FILENAME',
48 'security.session_protection_disabled' => 'disablesessionprotection', 48 'security.session_protection_disabled' => 'disablesessionprotection',
49 'security.ban_after' => 'config.BAN_AFTER', 49 'security.ban_after' => 'config.BAN_AFTER',
50 'security.ban_duration' => 'config.BAN_DURATION', 50 'security.ban_duration' => 'config.BAN_DURATION',
51 'general.title' => 'title', 51 'general.title' => 'title',
52 'general.timezone' => 'timezone', 52 'general.timezone' => 'timezone',
53 'general.header_link' => 'titleLink', 53 'general.header_link' => 'titleLink',
54 'general.check_updates' => 'config.ENABLE_UPDATECHECK', 54 'updates.check_updates' => 'config.ENABLE_UPDATECHECK',
55 'general.check_updates_branch' => 'config.UPDATECHECK_BRANCH', 55 'updates.check_updates_branch' => 'config.UPDATECHECK_BRANCH',
56 'general.check_updates_interval' => 'config.UPDATECHECK_INTERVAL', 56 'updates.check_updates_interval' => 'config.UPDATECHECK_INTERVAL',
57 'general.default_private_links' => 'privateLinkByDefault', 57 'privacy.default_private_links' => 'privateLinkByDefault',
58 'general.rss_permalinks' => 'config.ENABLE_RSS_PERMALINKS', 58 'feed.rss_permalinks' => 'config.ENABLE_RSS_PERMALINKS',
59 'general.links_per_page' => 'config.LINKS_PER_PAGE', 59 'general.links_per_page' => 'config.LINKS_PER_PAGE',
60 'general.enable_thumbnails' => 'config.ENABLE_THUMBNAILS', 60 'thumbnail.enable_thumbnails' => 'config.ENABLE_THUMBNAILS',
61 'general.enable_localcache' => 'config.ENABLE_LOCALCACHE', 61 'thumbnail.enable_localcache' => 'config.ENABLE_LOCALCACHE',
62 'general.enabled_plugins' => 'config.ENABLED_PLUGINS', 62 'general.enabled_plugins' => 'config.ENABLED_PLUGINS',
63 'extras.redirector' => 'redirector', 63 'redirector.url' => 'redirector',
64 'extras.redirector_encode_url' => 'config.REDIRECTOR_URLENCODE', 64 'redirector.encode_url' => 'config.REDIRECTOR_URLENCODE',
65 'extras.show_atom' => 'config.SHOW_ATOM', 65 'feed.show_atom' => 'config.SHOW_ATOM',
66 'extras.hide_public_links' => 'config.HIDE_PUBLIC_LINKS', 66 'privacy.hide_public_links' => 'config.HIDE_PUBLIC_LINKS',
67 'extras.hide_timestamps' => 'config.HIDE_TIMESTAMPS', 67 'privacy.hide_timestamps' => 'config.HIDE_TIMESTAMPS',
68 'extras.open_shaarli' => 'config.OPEN_SHAARLI', 68 'security.open_shaarli' => 'config.OPEN_SHAARLI',
69 ); 69 );
70 70
71 /** 71 /**