aboutsummaryrefslogtreecommitdiffhomepage
path: root/index.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-07-31 10:46:17 +0200
committerArthurHoaro <arthur@hoa.ro>2016-12-12 03:54:10 +0100
commitcbfdcff2615e901bdc434d06f38a3da8eecbdf8b (patch)
treede0d67591015f1bd6d35bd8490adfc8981d3355c /index.php
parent624f999fb75ceeefbc690276f42e5a545ad35357 (diff)
downloadShaarli-cbfdcff2615e901bdc434d06f38a3da8eecbdf8b.tar.gz
Shaarli-cbfdcff2615e901bdc434d06f38a3da8eecbdf8b.tar.zst
Shaarli-cbfdcff2615e901bdc434d06f38a3da8eecbdf8b.zip
Prepare settings for the API in the admin page and during the install
API settings: - api.enabled - api.secret The API settings will be initialized (and the secret generated) with an update method.
Diffstat (limited to 'index.php')
-rw-r--r--index.php12
1 files changed, 12 insertions, 0 deletions
diff --git a/index.php b/index.php
index cc448352..25e37b32 100644
--- a/index.php
+++ b/index.php
@@ -1142,6 +1142,8 @@ function renderPage($conf, $pluginManager)
1142 $conf->set('feed.rss_permalinks', !empty($_POST['enableRssPermalinks'])); 1142 $conf->set('feed.rss_permalinks', !empty($_POST['enableRssPermalinks']));
1143 $conf->set('updates.check_updates', !empty($_POST['updateCheck'])); 1143 $conf->set('updates.check_updates', !empty($_POST['updateCheck']));
1144 $conf->set('privacy.hide_public_links', !empty($_POST['hidePublicLinks'])); 1144 $conf->set('privacy.hide_public_links', !empty($_POST['hidePublicLinks']));
1145 $conf->set('api.enabled', !empty($_POST['apiEnabled']));
1146 $conf->set('api.secret', escape($_POST['apiSecret']));
1145 try { 1147 try {
1146 $conf->write(isLoggedIn()); 1148 $conf->write(isLoggedIn());
1147 } 1149 }
@@ -1170,6 +1172,8 @@ function renderPage($conf, $pluginManager)
1170 $PAGE->assign('enable_rss_permalinks', $conf->get('feed.rss_permalinks', false)); 1172 $PAGE->assign('enable_rss_permalinks', $conf->get('feed.rss_permalinks', false));
1171 $PAGE->assign('enable_update_check', $conf->get('updates.check_updates', true)); 1173 $PAGE->assign('enable_update_check', $conf->get('updates.check_updates', true));
1172 $PAGE->assign('hide_public_links', $conf->get('privacy.hide_public_links', false)); 1174 $PAGE->assign('hide_public_links', $conf->get('privacy.hide_public_links', false));
1175 $PAGE->assign('api_enabled', $conf->get('api.enabled', true));
1176 $PAGE->assign('api_secret', $conf->get('api.secret'));
1173 $PAGE->renderPage('configure'); 1177 $PAGE->renderPage('configure');
1174 exit; 1178 exit;
1175 } 1179 }
@@ -1952,6 +1956,14 @@ function install($conf)
1952 $conf->set('general.title', 'Shared links on '.escape(index_url($_SERVER))); 1956 $conf->set('general.title', 'Shared links on '.escape(index_url($_SERVER)));
1953 } 1957 }
1954 $conf->set('updates.check_updates', !empty($_POST['updateCheck'])); 1958 $conf->set('updates.check_updates', !empty($_POST['updateCheck']));
1959 $conf->set('api.enabled', !empty($_POST['enableApi']));
1960 $conf->set(
1961 'api.secret',
1962 generate_api_secret(
1963 $this->conf->get('credentials.login'),
1964 $this->conf->get('credentials.salt')
1965 )
1966 );
1955 try { 1967 try {
1956 // Everything is ok, let's create config file. 1968 // Everything is ok, let's create config file.
1957 $conf->write(isLoggedIn()); 1969 $conf->write(isLoggedIn());