|
|
@ -9,9 +9,9 @@ $apiKey = new ApiKey;
|
|
|
|
$core->blog->settings->addNamespace('rest');
|
|
|
|
$core->blog->settings->addNamespace('rest');
|
|
|
|
if (is_null($core->blog->settings->rest->rest_active)) {
|
|
|
|
if (is_null($core->blog->settings->rest->rest_active)) {
|
|
|
|
try {
|
|
|
|
try {
|
|
|
|
// Default state is active if the comments are configured to allow wiki syntax
|
|
|
|
|
|
|
|
$core->blog->settings->rest->put('rest_active',false,'boolean',true);
|
|
|
|
$core->blog->settings->rest->put('rest_active',false,'boolean',true);
|
|
|
|
$core->blog->settings->rest->put('rest_is_open',false,'boolean',true);
|
|
|
|
$core->blog->settings->rest->put('rest_is_open',false,'boolean',true);
|
|
|
|
|
|
|
|
$core->blog->settings->rest->put('rest_send_cors_headers',true,'boolean',true);
|
|
|
|
$core->blog->triggerBlog();
|
|
|
|
$core->blog->triggerBlog();
|
|
|
|
http::redirect($p_url);
|
|
|
|
http::redirect($p_url);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -22,6 +22,7 @@ if (is_null($core->blog->settings->rest->rest_active)) {
|
|
|
|
// Getting current parameters
|
|
|
|
// Getting current parameters
|
|
|
|
$active = (boolean)$core->blog->settings->rest->rest_active;
|
|
|
|
$active = (boolean)$core->blog->settings->rest->rest_active;
|
|
|
|
$openApi = (boolean)$core->blog->settings->rest->rest_is_open;
|
|
|
|
$openApi = (boolean)$core->blog->settings->rest->rest_is_open;
|
|
|
|
|
|
|
|
$sendHeaders =(boolean)$core->blog->settings->rest->rest_send_cors_headers;
|
|
|
|
|
|
|
|
|
|
|
|
//Sousmission Formulaire parametres
|
|
|
|
//Sousmission Formulaire parametres
|
|
|
|
if ((!empty($_POST['saveconfig'])) && ($core->auth->isSuperAdmin())) {
|
|
|
|
if ((!empty($_POST['saveconfig'])) && ($core->auth->isSuperAdmin())) {
|
|
|
@ -34,6 +35,9 @@ if ((!empty($_POST['saveconfig'])) && ($core->auth->isSuperAdmin())) {
|
|
|
|
$openApi = (empty($_POST['open'])) ? false : true;
|
|
|
|
$openApi = (empty($_POST['open'])) ? false : true;
|
|
|
|
$core->blog->settings->rest->put('rest_is_open',$openApi,'boolean');
|
|
|
|
$core->blog->settings->rest->put('rest_is_open',$openApi,'boolean');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sendHeaders = (empty($_POST['sendHeaders'])) ? false : true;
|
|
|
|
|
|
|
|
$core->blog->settings->rest->put('rest_send_cors_headers',$sendHeaders,'boolean');
|
|
|
|
|
|
|
|
|
|
|
|
dcPage::addSuccessNotice(__('Configuration successfully updated.'));
|
|
|
|
dcPage::addSuccessNotice(__('Configuration successfully updated.'));
|
|
|
|
http::redirect($p_url);
|
|
|
|
http::redirect($p_url);
|
|
|
|
}catch (Exception $e)
|
|
|
|
}catch (Exception $e)
|
|
|
@ -47,7 +51,7 @@ if(!empty($_POST['resetApiKey'])){
|
|
|
|
$apiKey -> new_key($core->auth->userID());
|
|
|
|
$apiKey -> new_key($core->auth->userID());
|
|
|
|
dcPage::addSuccessNotice(__('Your new key is').' '.$apiKey->key);
|
|
|
|
dcPage::addSuccessNotice(__('Your new key is').' '.$apiKey->key);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
//is user admin isSuperAdmin
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|
<html>
|
|
|
|
<html>
|
|
|
@ -58,9 +62,12 @@ if(!empty($_POST['resetApiKey'])){
|
|
|
|
<h2><?php echo __('Your API key');?></h2>
|
|
|
|
<h2><?php echo __('Your API key');?></h2>
|
|
|
|
<?php echo $apiKey-> get_dc_admin_form($core->auth->userID()); ?>
|
|
|
|
<?php echo $apiKey-> get_dc_admin_form($core->auth->userID()); ?>
|
|
|
|
|
|
|
|
|
|
|
|
<?php if($core->auth->isSuperAdmin()): ?>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
//Seulement si administrateur:
|
|
|
|
|
|
|
|
if($core->auth->isSuperAdmin()):
|
|
|
|
|
|
|
|
?>
|
|
|
|
|
|
|
|
|
|
|
|
<h2>Rest API configuration</h2>
|
|
|
|
<h2><?php echo __('Rest API configuration'); ?></h2>
|
|
|
|
<form method="post" action="<?php http::getSelfURI(); ?>">
|
|
|
|
<form method="post" action="<?php http::getSelfURI(); ?>">
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<?php echo form::checkbox('active', 1, $active); ?>
|
|
|
|
<?php echo form::checkbox('active', 1, $active); ?>
|
|
|
@ -73,11 +80,17 @@ if(!empty($_POST['resetApiKey'])){
|
|
|
|
<p class="info"><?php echo __("If checked, few methods as GET will be allowed to externals users without API key.
|
|
|
|
<p class="info"><?php echo __("If checked, few methods as GET will be allowed to externals users without API key.
|
|
|
|
However, they won't be able to request for non public content."); ?></p>
|
|
|
|
However, they won't be able to request for non public content."); ?></p>
|
|
|
|
<?php echo $core->formNonce(); ?>
|
|
|
|
<?php echo $core->formNonce(); ?>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
|
|
|
|
<?php echo form::checkbox('sendHeaders', 1, $sendHeaders); ?>
|
|
|
|
|
|
|
|
<label class="classic" for="sendHeaders"> <?php echo __('Send Coors headers');?></label>
|
|
|
|
|
|
|
|
</p>
|
|
|
|
<p>
|
|
|
|
<p>
|
|
|
|
<input type="submit" name="saveconfig" value="<?php echo __('Save configuration'); ?>" />
|
|
|
|
<input type="submit" name="saveconfig" value="<?php echo __('Save configuration'); ?>" />
|
|
|
|
</p>
|
|
|
|
</p>
|
|
|
|
|
|
|
|
|
|
|
|
</from>
|
|
|
|
</from>
|
|
|
|
<?php endif; ?>
|
|
|
|
<?php
|
|
|
|
|
|
|
|
endif;
|
|
|
|
|
|
|
|
?>
|
|
|
|
</body>
|
|
|
|
</body>
|
|
|
|
</html>
|
|
|
|
</html>
|