28 require
'../../main.inc.php';
29 require_once DOL_DOCUMENT_ROOT.
'/core/lib/admin.lib.php';
30 require_once DOL_DOCUMENT_ROOT.
'/core/lib/files.lib.php';
33 $langs->load(
"admin");
38 $action =
GETPOST(
'action',
'aZ09');
41 if ($action ==
'setproductionmode')
43 $status =
GETPOST(
'status',
'alpha');
51 $result =
dol_mkdir($conf->api->dir_temp);
54 setEventMessages($langs->trans(
"ErrorFailedToCreateDir", $conf->api->dir_temp), null,
'errors');
62 setEventMessages($langs->trans(
"ErrorFailedToDeleteFile", $conf->api->dir_temp.
'/routes.php'), null,
'errors');
69 header(
"Location: ".
$_SERVER[
"PHP_SELF"]);
77 if ($action ==
'save')
92 $linkback =
'<a href="'.DOL_URL_ROOT.
'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans(
"BackToModuleList").
'</a>';
95 print '<span class="opacitymedium">'.$langs->trans(
"ApiDesc").
"</span><br>\n";
98 print '<form method="POST" action="'.$_SERVER[
"PHP_SELF"].
'">';
99 print '<input type="hidden" name="token" value="'.newToken().
'">';
100 print '<input type="hidden" name="action" value="save">';
102 print '<table class="noborder centpercent">';
104 print '<tr class="liste_titre">';
105 print "<td>".$langs->trans(
"Parameter").
"</td>";
106 print '<td>'.$langs->trans(
"Value").
"</td>";
107 print "<td> </td>";
110 print '<tr class="oddeven">';
111 print '<td>'.$langs->trans(
"ApiProductionMode").
'</td>';
112 $production_mode = (empty($conf->global->API_PRODUCTION_MODE) ?
false:
true);
113 if ($production_mode)
115 print '<td><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=setproductionmode&token='.
newToken().
'&value='.($i + 1).
'&status=0">';
119 print '<td><a class="reposition" href="'.$_SERVER[
'PHP_SELF'].
'?action=setproductionmode&token='.
newToken().
'&value='.($i + 1).
'&status=1">';
123 print '<td> </td>';
126 print '<tr class="oddeven">';
127 print '<td>'.$langs->trans(
"RESTRICT_ON_IP");
128 print ' '.$langs->trans(
"Example").
': '.$langs->trans(
"IPListExample");
130 print '<td><input type="text" name="API_RESTRICT_ON_IP" value="'.dol_escape_htmltag($conf->global->API_RESTRICT_ON_IP).
'"></td>';
132 print '<input type="submit" class="button button-save" name="save" value="'.dol_escape_htmltag($langs->trans(
"Save")).
'"></td>';
143 $urlwithouturlroot = preg_replace(
'/'.preg_quote(DOL_URL_ROOT,
'/').
'$/i',
'', trim($dolibarr_main_url_root));
144 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
149 $url = $urlwithroot.
'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
150 $message .=
'<span class="opacitymedium">'.$langs->trans(
"UrlToGetKeyToUseAPIs").
':</span><br>';
151 $message .=
img_picto(
'',
'globe').
' '.$url;
157 print '<u>'.$langs->trans(
"ApiExporerIs").
':</u><br>';
158 if (
dol_is_dir(DOL_DOCUMENT_ROOT.
'/includes/restler/framework/Luracast/Restler/explorer'))
160 $url = DOL_MAIN_URL_ROOT.
'/api/index.php/explorer';
161 print img_picto(
'',
'globe').
' <a href="'.$url.
'" target="_blank">'.$url.
"</a><br>\n";
163 $langs->load(
"errors");
164 print info_admin($langs->trans(
"ErrorNotAvailableWithThisDistribution"), 0, 0,
'error');
GETPOST($paramname, $check= 'alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dolibarr_set_const($db, $name, $value, $type= 'chaine', $visible=0, $note= '', $entity=1)
Insert a parameter (key,value) into database (delete old key then insert it again).
dol_is_dir($folder)
Test if filename is a directory.
setEventMessages($mesg, $mesgs, $style= 'mesgs', $messagekey= '')
Set event messages in dol_events session object.
load_fiche_titre($titre, $morehtmlright= '', $picto= 'generic', $pictoisfullpath=0, $id= '', $morecssontable= '', $morehtmlcenter= '')
Load a title with picto.
img_picto($titlealt, $picto, $moreatt= '', $pictoisfullpath=false, $srconly=0, $notitle=0, $alt= '', $morecss= '', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_delete_file($file, $disableglob=0, $nophperrors=0, $nohook=0, $object=null, $allowdotdot=false, $indexdatabase=1)
Remove a file or several files with a mask.
accessforbidden($message= '', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program Calling this function terminate execution ...
print $_SERVER["PHP_SELF"]
Edit parameters.
print
Draft customers invoices.
dol_print_error($db= '', $error= '', $errors=null)
Displays error message system with all the information to facilitate the diagnosis and the escalation...
newToken()
Return the value of token currently saved into session with name 'newtoken'.
info_admin($text, $infoonimgalt=0, $nodiv=0, $admin= '1', $morecss= '', $textfordropdown= '')
Show information for admin users or standard users.
dol_mkdir($dir, $dataroot= '', $newmask=null)
Creation of a directory (this can create recursive subdir)