mirror of
https://github.com/YunoHost-Apps/dolibarr_ynh.git
synced 2024-09-03 18:35:53 +02:00
117 lines
3.5 KiB
PHP
117 lines
3.5 KiB
PHP
<?php
|
|
/* Copyright (C) 2004 Rodolphe Quiedeville <rodolphe@quiedeville.org>
|
|
* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.org>
|
|
* Copyright (C) 2011 Juanjo Menent <jmenent@2byte.es>
|
|
* Copyright (C) 2012 Regis Houssin <regis.houssin@capnetworks.com>
|
|
* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License as published by
|
|
* the Free Software Foundation; either version 3 of the License, or
|
|
* (at your option) any later version.
|
|
*
|
|
* This program is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
* GNU General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU General Public License
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
/**
|
|
* \file htdocs/api/admin/api.php
|
|
* \ingroup api
|
|
* \brief Page to setup api module
|
|
*/
|
|
|
|
require '../../main.inc.php';
|
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
|
|
|
|
$langs->load("admin");
|
|
|
|
if (! $user->admin)
|
|
accessforbidden();
|
|
|
|
$action=GETPOST("action");
|
|
|
|
//Activate ProfId
|
|
if ($action == 'setproductionmode')
|
|
{
|
|
$status = GETPOST('status','alpha');
|
|
|
|
if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', $conf->entity) > 0)
|
|
{
|
|
header("Location: ".$_SERVER["PHP_SELF"]);
|
|
exit;
|
|
}
|
|
else
|
|
{
|
|
dol_print_error($db);
|
|
}
|
|
}
|
|
|
|
|
|
/*
|
|
* View
|
|
*/
|
|
|
|
llxHeader();
|
|
|
|
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php">'.$langs->trans("BackToModuleList").'</a>';
|
|
print_fiche_titre($langs->trans("ApiSetup"),$linkback,'title_setup');
|
|
|
|
print $langs->trans("ApiDesc")."<br>\n";
|
|
print "<br>\n";
|
|
|
|
//print '<form name="apisetupform" action="'.$_SERVER["PHP_SELF"].'" method="post">';
|
|
print '<input type="hidden" name="token" value="'.$_SESSION['newtoken'].'">';
|
|
print '<table class="noborder" width="100%">';
|
|
|
|
print '<tr class="liste_titre">';
|
|
print "<td>".$langs->trans("Parameter")."</td>";
|
|
print "<td>".$langs->trans("Value")."</td>";
|
|
print "<td> </td>";
|
|
print "</tr>";
|
|
|
|
print '<tr class="impair">';
|
|
print '<td>'.$langs->trans("ApiProductionMode").'</td>';
|
|
$production_mode=(empty($conf->global->API_PRODUCTION_MODE)?false:true);
|
|
if ($production_mode)
|
|
{
|
|
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=0">';
|
|
print img_picto($langs->trans("Activated"),'switch_on');
|
|
print '</a></td>';
|
|
}
|
|
else
|
|
{
|
|
print '<td align="center"><a href="'.$_SERVER['PHP_SELF'].'?action=setproductionmode&value='.($i+1).'&status=1">';
|
|
print img_picto($langs->trans("Disabled"),'switch_off');
|
|
print '</a></td>';
|
|
}
|
|
print '<td> </td>';
|
|
print '</tr>';
|
|
|
|
print '</table>';
|
|
print '<br><br>';
|
|
|
|
// API endpoint
|
|
print '<u>'.$langs->trans("ApiEndPointIs").':</u><br>';
|
|
$url=DOL_MAIN_URL_ROOT.'/public/api/';
|
|
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
|
$url=DOL_MAIN_URL_ROOT.'/public/api/.json';
|
|
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
|
|
|
// Explorer
|
|
print '<u>'.$langs->trans("ApiExporerIs").':</u><br>';
|
|
$url=DOL_MAIN_URL_ROOT.'/public/api/explorer/index.html';
|
|
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
|
|
|
|
print '<br>';
|
|
print '<br>';
|
|
print $langs->trans("OnlyActiveElementsAreExposed", DOL_URL_ROOT.'/admin/modules.php');
|
|
|
|
|
|
|
|
llxFooter();
|
|
$db->close();
|