X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=25e37b32bed95d270260aa76ac7c9b4dcfadafc3;hb=cbfdcff2615e901bdc434d06f38a3da8eecbdf8b;hp=cc4483524abd9e6dd8bb9dad96d98f764e48f007;hpb=624f999fb75ceeefbc690276f42e5a545ad35357;p=github%2Fshaarli%2FShaarli.git 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) $conf->set('feed.rss_permalinks', !empty($_POST['enableRssPermalinks'])); $conf->set('updates.check_updates', !empty($_POST['updateCheck'])); $conf->set('privacy.hide_public_links', !empty($_POST['hidePublicLinks'])); + $conf->set('api.enabled', !empty($_POST['apiEnabled'])); + $conf->set('api.secret', escape($_POST['apiSecret'])); try { $conf->write(isLoggedIn()); } @@ -1170,6 +1172,8 @@ function renderPage($conf, $pluginManager) $PAGE->assign('enable_rss_permalinks', $conf->get('feed.rss_permalinks', false)); $PAGE->assign('enable_update_check', $conf->get('updates.check_updates', true)); $PAGE->assign('hide_public_links', $conf->get('privacy.hide_public_links', false)); + $PAGE->assign('api_enabled', $conf->get('api.enabled', true)); + $PAGE->assign('api_secret', $conf->get('api.secret')); $PAGE->renderPage('configure'); exit; } @@ -1952,6 +1956,14 @@ function install($conf) $conf->set('general.title', 'Shared links on '.escape(index_url($_SERVER))); } $conf->set('updates.check_updates', !empty($_POST['updateCheck'])); + $conf->set('api.enabled', !empty($_POST['enableApi'])); + $conf->set( + 'api.secret', + generate_api_secret( + $this->conf->get('credentials.login'), + $this->conf->get('credentials.salt') + ) + ); try { // Everything is ok, let's create config file. $conf->write(isLoggedIn());