2
0
forked from Wavyzz/dolibarr

Merge remote-tracking branch 'upstream/develop' into psr2squizwhite

This commit is contained in:
Frédéric FRANCE
2019-02-03 22:41:57 +01:00
1546 changed files with 29438 additions and 33304 deletions

View File

@@ -42,7 +42,7 @@ $langs->load("admin");
if (empty($conf->global->MAIN_MODULE_API))
{
dol_syslog("Call Dolibarr API interfaces with module REST disabled");
print $langs->trans("WarningModuleNotActive",'Api').'.<br><br>';
print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>';
print $langs->trans("ToActivateModule");
exit;
}
@@ -52,7 +52,7 @@ $api = new DolibarrApi($db);
$api->r->addAPIClass('Luracast\\Restler\\Resources'); //this creates resources.json at API Root
$api->r->setSupportedFormats('JsonFormat', 'XmlFormat');
$api->r->addAuthenticationClass('DolibarrApiAccess','');
$api->r->addAuthenticationClass('DolibarrApiAccess', '');
$listofapis = array();
@@ -69,13 +69,13 @@ foreach ($modulesdir as $dir)
{
while (($file = readdir($handle))!==false)
{
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i",$file,$reg))
if (is_readable($dir.$file) && preg_match("/^(mod.*)\.class\.php$/i", $file, $reg))
{
$modulename=$reg[1];
// Defined if module is enabled
$enabled=true;
$module=$part=$obj=strtolower(preg_replace('/^mod/i','',$modulename));
$module=$part=$obj=strtolower(preg_replace('/^mod/i', '', $modulename));
//if ($part == 'propale') $part='propal';
if ($module == 'societe') {
$obj = 'thirdparty';
@@ -112,7 +112,7 @@ foreach ($modulesdir as $dir)
{
while (($file_searched = readdir($handle_part))!==false)
{
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i",$file_searched,$reg))
if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $reg))
{
$classname = ucwords($reg[1]);
require_once $dir_part.$file_searched;
@@ -167,10 +167,10 @@ $listofapis=Routes::toArray(); // TODO api for "status" is lost here
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ApiSetup"),$linkback,'title_setup');
print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup');
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
@@ -179,7 +179,7 @@ print '<br>';
$message='';
$url='<a href="'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword" target="_blank">'.$urlwithroot.'/api/index.php/login?login='.urlencode($user->login).'&password=yourpassword[&reset=1]</a>';
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
$message.=img_picto('','object_globe.png').' '.$url;
$message.=img_picto('', 'object_globe.png').' '.$url;
print $message;
print '<br>';
print '<br>';
@@ -208,7 +208,7 @@ foreach($listofapis['v1'] as $key => $val)
//print $key.' - '.$val['classname'].' - '.$val['fullpath']." - ".DOL_MAIN_URL_ROOT.'/api/index.php/'.strtolower(preg_replace('/Api$/','',$val['classname']))."/xxx<br>\n";
$url=$urlwithroot.'/api/index.php/'.$key;
$url.='?api_key=token';
print img_picto('','object_globe.png').' '.$method.' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
print img_picto('', 'object_globe.png').' '.$method.' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
}
}
}

View File

@@ -35,12 +35,12 @@ $langs->load("admin");
if (! $user->admin)
accessforbidden();
$action=GETPOST('action','aZ09');
$action=GETPOST('action', 'aZ09');
//Activate ProfId
if ($action == 'setproductionmode')
{
$status = GETPOST('status','alpha');
$status = GETPOST('status', 'alpha');
if (dolibarr_set_const($db, 'API_PRODUCTION_MODE', $status, 'chaine', 0, '', 0) > 0)
{
@@ -88,7 +88,7 @@ dol_mkdir(DOL_DATA_ROOT.'/api/temp'); // May have been deleted by a purge
llxHeader();
$linkback='<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
print load_fiche_titre($langs->trans("ApiSetup"),$linkback,'title_setup');
print load_fiche_titre($langs->trans("ApiSetup"), $linkback, 'title_setup');
print $langs->trans("ApiDesc")."<br>\n";
print "<br>\n";
@@ -109,13 +109,13 @@ $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 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 img_picto($langs->trans("Disabled"), 'switch_off');
print '</a></td>';
}
print '<td>&nbsp;</td>';
@@ -125,7 +125,7 @@ print '</table>';
print '<br><br>';
// Define $urlwithroot
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT,'/').'$/i','',trim($dolibarr_main_url_root));
$urlwithouturlroot=preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
$urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
@@ -133,7 +133,7 @@ $urlwithroot=$urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain
$message='';
$url=$urlwithroot.'/api/index.php/login?login=<strong>auserlogin</strong>&password=<strong>thepassword</strong>[&reset=1]';
$message.=$langs->trans("UrlToGetKeyToUseAPIs").':<br>';
$message.=img_picto('','object_globe.png').' '.$url;
$message.=img_picto('', 'object_globe.png').' '.$url;
print $message;
print '<br>';
print '<br>';
@@ -143,7 +143,7 @@ print '<u>'.$langs->trans("ApiExporerIs").':</u><br>';
if (dol_is_dir(DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/explorer'))
{
$url=DOL_MAIN_URL_ROOT.'/api/index.php/explorer';
print img_picto('','object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
print img_picto('', 'object_globe.png').' <a href="'.$url.'" target="_blank">'.$url."</a><br>\n";
}
else
{