dolibarr 22.0.5
index.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015 Jean-François Ferry <jfefe@aternatik.fr>
3 * Copyright (C) 2016 Laurent Destailleur <eldy@users.sourceforge.net>
4 * Copyright (C) 2017 Regis Houssin <regis.houssin@inodbox.com>
5 * Copyright (C) 2021 Alexis LAURIER <contact@alexislaurier.fr>
6 * Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
7 * Copyright (C) 2024 Frédéric France <frederic.france@free.fr>
8 *
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 3 of the License, or
12 * (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
30use Luracast\Restler\Format\UploadFormat;
31
32// API endpoints return JSON (or XML). A stray PHP warning or notice in the
33// response body corrupts the parser on the caller side. Silence the display
34// of PHP messages here while keeping them in the server log so that the
35// problem is still observable to the operator (filefunc.inc.php only does
36// this when dolibarr_main_prod is set, which leaves development setups
37// emitting HTML into every API answer).
38@ini_set('display_errors', '0');
39@ini_set('log_errors', '1');
40
41if (!defined('NOCSRFCHECK')) {
42 define('NOCSRFCHECK', '1'); // Do not check anti CSRF attack test
43}
44if (!defined('NOTOKENRENEWAL')) {
45 define('NOTOKENRENEWAL', '1'); // Do not check anti POST attack test
46}
47if (!defined('NOREQUIREMENU')) {
48 define('NOREQUIREMENU', '1'); // If there is no need to load and show top and left menu
49}
50if (!defined('NOREQUIREHTML')) {
51 define('NOREQUIREHTML', '1'); // If we don't need to load the html.form.class.php
52}
53if (!defined('NOREQUIREAJAX')) {
54 define('NOREQUIREAJAX', '1'); // Do not load ajax.lib.php library
55}
56if (!defined("NOLOGIN")) {
57 define("NOLOGIN", '1'); // If this page is public (can be called outside logged session)
58}
59if (!defined("NOSESSION")) {
60 define("NOSESSION", '1');
61}
62if (!defined("NODEFAULTVALUES")) {
63 define("NODEFAULTVALUES", '1');
64}
65
66// Force entity if a value is provided into HTTP header. Otherwise, will use the entity of user of token used.
67if (!empty($_SERVER['HTTP_DOLAPIENTITY'])) {
68 define("DOLENTITY", (int) $_SERVER['HTTP_DOLAPIENTITY']);
69}
70
71// Response for preflight requests (used by browser when into a CORS context)
72if (!empty($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'OPTIONS' && !empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) {
73 header('Access-Control-Allow-Origin: *');
74 header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
75 header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
76 http_response_code(204);
77 exit;
78}
79
80// When we request url to get the json file, we accept Cross site so we can include the descriptor into an external tool.
81if (preg_match('/\/explorer\/swagger\.json/', $_SERVER["PHP_SELF"])) {
82 header('Access-Control-Allow-Origin: *');
83 header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
84 header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
85}
86// When we request url to get an API, we accept Cross site so we can make js API call inside another website
87if (preg_match('/\/api\/index\.php/', $_SERVER["PHP_SELF"])) {
88 header('Access-Control-Allow-Origin: *');
89 header('Access-Control-Allow-Methods: GET, POST, PUT, DELETE');
90 header('Access-Control-Allow-Headers: Content-Type, Authorization, api_key, DOLAPIKEY');
91}
92header('X-Frame-Options: SAMEORIGIN');
93
94
95$res = 0;
96if (!$res && file_exists("../main.inc.php")) {
97 $res = include '../main.inc.php';
98}
99if (!$res) {
100 die("Include of main fails");
101}
102
103require_once DOL_DOCUMENT_ROOT.'/includes/restler/framework/Luracast/Restler/AutoLoader.php';
104
105call_user_func(
109 static function () {
110 $loader = Luracast\Restler\AutoLoader::instance();
111 spl_autoload_register($loader);
112 return $loader;
113 }
114);
115
116require_once DOL_DOCUMENT_ROOT.'/api/class/api.class.php';
117require_once DOL_DOCUMENT_ROOT.'/api/class/api_access.class.php';
118require_once DOL_DOCUMENT_ROOT.'/core/lib/functions2.lib.php';
128// In API context, we force the protection to avoid forging of criteria including bind SQL injection
129$conf->global->MAIN_DISALLOW_UNSECURED_SELECT_INTO_EXTRAFIELDS_FILTER = 1;
130
131
132$url = $_SERVER['PHP_SELF'];
133if (preg_match('/api\/index\.php$/', $url)) { // sometimes $_SERVER['PHP_SELF'] is 'api\/index\.php' instead of 'api\/index\.php/explorer.php' or 'api\/index\.php/method'
134 $url = $_SERVER['PHP_SELF'].(empty($_SERVER['PATH_INFO']) ? $_SERVER['ORIG_PATH_INFO'] : $_SERVER['PATH_INFO']);
135}
136// Fix for some NGINX setups (this should not be required even with NGINX, however setup of NGINX are often mysterious and this may help is such cases)
137if (getDolGlobalString('MAIN_NGINX_FIX')) {
138 $url = (isset($_SERVER['SCRIPT_URI']) && $_SERVER["SCRIPT_URI"] !== null) ? $_SERVER["SCRIPT_URI"] : $_SERVER['PHP_SELF'];
139}
140
141// Enable and test if module Api is enabled
142if (!isModEnabled('api')) {
143 $langs->load("admin");
144 dol_syslog("Call of Dolibarr API interfaces with module API REST are disabled");
145 print $langs->trans("WarningModuleNotActive", 'Api').'.<br><br>';
146 print $langs->trans("ToActivateModule");
147 //session_destroy();
148 exit(0);
149}
150
151// Test if explorer is not disabled
152if (preg_match('/api\/index\.php\/explorer/', $url) && getDolGlobalString('API_EXPLORER_DISABLED')) {
153 $langs->load("admin");
154 dol_syslog("Call Dolibarr API interfaces with module API REST disabled");
155 print $langs->trans("WarningAPIExplorerDisabled").'.<br><br>';
156 //session_destroy();
157 exit(0);
158}
159
160
161// This 2 lines are useful only if we want to exclude some Urls from the explorer
162//use Luracast\Restler\Explorer;
163//Explorer::$excludedPaths = array('/categories');
164
165
166// Analyze URLs
167// index.php/explorer do a redirect to index.php/explorer/
168// index.php/explorer/ called by swagger to build explorer page index.php/explorer/index.html
169// index.php/explorer/.../....png|.css|.js called by swagger for resources to build explorer page
170// index.php/explorer/resources.json called by swagger to get list of all services
171// index.php/explorer/resources.json/xxx called by swagger to get detail of services xxx
172// index.php/xxx called by any REST client to run API
173
174
175$reg = array();
176preg_match('/index\.php\/([^\/]+)(.*)$/', $url, $reg);
177// .../index.php/categories?sortfield=t.rowid&sortorder=ASC
178
179
180$hookmanager->initHooks(array('api'));
181
182// When in production mode, a file api/temp/routes.php is created with the API available of current call.
183// But, if we set $refreshcache to false, so it may have only one API in the routes.php file if we make a call for one API without
184// using the explorer. And when we make another call for another API, the API is not into the api/temp/routes.php and a 404 is returned.
185// So we force refresh to each call.
186$refreshcache = (getDolGlobalString('API_PRODUCTION_DO_NOT_ALWAYS_REFRESH_CACHE') ? false : true);
187if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) {
188 $refreshcache = true;
189 if (!is_writable($conf->api->dir_temp)) {
190 dol_syslog("ErrorFailedToWriteInApiTempDirectory ".$conf->api->dir_temp, LOG_ERR);
191 print 'Erreur temp dir api/temp not writable';
192 header('HTTP/1.1 500 temp dir api/temp not writable');
193 exit(0);
194 }
195}
196
197$api = new DolibarrApi($db, '', $refreshcache);
198//var_dump($api->r->apiVersionMap);
199
200// If MAIN_API_DEBUG is set to 1, we save logs into file "dolibarr_api.log"
201if (getDolGlobalString('MAIN_API_DEBUG')) {
202 $r = $api->r;
203 $r->onCall(function () use ($r) {
204 // Don't log Luracast Restler Explorer resources calls
205 //if (!preg_match('/^explorer/', $r->url)) {
206 // 'method' => $api->r->requestMethod,
207 // 'url' => $api->r->url,
208 // 'route' => $api->r->apiMethodInfo->className.'::'.$api->r->apiMethodInfo->methodName,
209 // 'version' => $api->r->getRequestedApiVersion(),
210 // 'data' => $api->r->getRequestData(),
211 //dol_syslog("Debug API input ".var_export($r, true), LOG_DEBUG, 0, '_api');
212 dol_syslog("Debug API url ".var_export($r->url, true), LOG_DEBUG, 0, '_api');
213 dol_syslog("Debug API input ".var_export($r->getRequestData(), true), LOG_DEBUG, 0, '_api');
214 //}
215 });
216}
217
218
219// Enable the Restler API Explorer.
220// See https://github.com/Luracast/Restler-API-Explorer for more info.
221$api->r->addAPIClass('Luracast\\Restler\\Explorer');
222
223$api->r->setSupportedFormats('JsonFormat', 'XmlFormat', 'UploadFormat'); // 'YamlFormat'
224$api->r->addAuthenticationClass('DolibarrApiAccess', '');
225
226// Define accepted mime types
227UploadFormat::$allowedMimeTypes = array('image/jpeg', 'image/png', 'text/plain', 'application/octet-stream');
228
229
230// Restrict API to some IPs
231if (getDolGlobalString('API_RESTRICT_ON_IP')) {
232 $allowedip = explode(' ', getDolGlobalString('API_RESTRICT_ON_IP'));
233 $ipremote = getUserRemoteIP();
234 if (!in_array($ipremote, $allowedip)) {
235 dol_syslog('Remote ip is '.$ipremote.', not into list ' . getDolGlobalString('API_RESTRICT_ON_IP'));
236 print 'APIs are not allowed from the IP '.$ipremote;
237 header('HTTP/1.1 503 API not allowed from your IP '.$ipremote);
238 //session_destroy();
239 exit(0);
240 }
241}
242
243
244// Call Explorer file for all APIs definitions (this part is slow)
245if (!empty($reg[1]) && $reg[1] == 'explorer' && ($reg[2] == '/swagger.json' || $reg[2] == '/swagger.json/root' || $reg[2] == '/resources.json' || $reg[2] == '/resources.json/root')) {
246 // Scan all API files to load them
247
248 $listofapis = array();
249
250 $modulesdir = dolGetModulesDirs();
251 foreach ($modulesdir as $dir) {
252 // Search available module
253 dol_syslog("Scan directory ".$dir." for module descriptor files, then search for API files");
254
255 $handle = @opendir(dol_osencode($dir));
256 if (is_resource($handle)) {
257 while (($file = readdir($handle)) !== false) {
258 $regmod = array();
259 if (is_readable($dir.$file) && preg_match("/^mod(.*)\.class\.php$/i", $file, $regmod)) {
260 $module = strtolower($regmod[1]);
261 $moduledirforclass = getModuleDirForApiClass($module);
262 $modulenameforenabled = $module;
263 if ($module == 'propale') {
264 $modulenameforenabled = 'propal';
265 } elseif ($module == 'supplierproposal') {
266 $modulenameforenabled = 'supplier_proposal';
267 } elseif ($module == 'ficheinter') {
268 $modulenameforenabled = 'intervention';
269 } elseif ($module == 'product' && !isModEnabled('product') && isModEnabled('service')) {
270 $modulenameforenabled = 'service';
271 }
272
273 dol_syslog("Found module file ".$file." - module=".$module." - modulenameforenabled=".$modulenameforenabled." - moduledirforclass=".$moduledirforclass);
274
275 // Defined if module is enabled
276 $enabled = true;
277 if (!isModEnabled($modulenameforenabled)) {
278 $enabled = false;
279 }
280
281 if ($enabled) {
282 // If exists, load the API class for enable module
283 // Search files named api_<object>.class.php into /htdocs/<module>/class directory
284 // @todo : use getElementProperties() function ?
285 $dir_part = dol_buildpath('/'.$moduledirforclass.'/class/');
286
287 $handle_part = @opendir(dol_osencode($dir_part));
288 if (is_resource($handle_part)) {
289 while (($file_searched = readdir($handle_part)) !== false) {
290 if ($file_searched == 'api_access.class.php') {
291 continue;
292 }
293
294 //$conf->global->API_DISABLE_LOGIN_API = 1;
295 if ($file_searched == 'api_login.class.php' && getDolGlobalString('API_DISABLE_LOGIN_API')) {
296 continue;
297 }
298
299 //dol_syslog("We scan to search api file with into ".$dir_part.$file_searched);
300
301 $regapi = array();
302 if (is_readable($dir_part.$file_searched) && preg_match("/^api_(.*)\.class\.php$/i", $file_searched, $regapi)) {
303 $classname = ucwords($regapi[1]);
304 $classname = str_replace('_', '', $classname);
305 require_once $dir_part.$file_searched;
306 if (class_exists($classname.'Api')) {
307 //dol_syslog("Found API by index.php: classname=".$classname."Api for module ".$dir." into ".$dir_part.$file_searched);
308 $listofapis[strtolower($classname.'Api')] = $classname.'Api';
309 } elseif (class_exists($classname)) {
310 //dol_syslog("Found API by index.php: classname=".$classname." for module ".$dir." into ".$dir_part.$file_searched);
311 $listofapis[strtolower($classname)] = $classname;
312 } else {
313 dol_syslog("We found an api_xxx file (".$file_searched.") but class ".$classname." does not exists after loading file", LOG_WARNING);
314 }
315 }
316 }
317 }
318 }
319 }
320 }
321 }
322 }
323
324 // Sort the classes before adding them to Restler.
325 // The Restler API Explorer shows the classes in the order they are added and it's a mess if they are not sorted.
326 asort($listofapis);
327 foreach ($listofapis as $apiname => $classname) {
328 $api->r->addAPIClass($classname, $apiname);
329 }
330 //var_dump($api->r);
331}
332
333// Call one APIs or one definition of an API
334$regbis = array();
335if (!empty($reg[1]) && ($reg[1] != 'explorer' || ($reg[2] != '/swagger.json' && $reg[2] != '/resources.json' && preg_match('/^\/(swagger|resources)\.json\/(.+)$/', $reg[2], $regbis) && $regbis[2] != 'root'))) {
336 $moduleobject = $reg[1];
337 if ($moduleobject == 'explorer') { // If we call page to explore details of a service
338 $moduleobject = $regbis[2];
339 }
340
341 $moduleobject = strtolower($moduleobject);
342 $moduledirforclass = getModuleDirForApiClass($moduleobject);
343
344 // Load a dedicated API file
345 dol_syslog("Load a dedicated API file moduleobject=".$moduleobject." moduledirforclass=".$moduledirforclass);
346
347 $tmpmodule = $moduleobject;
348 if ($tmpmodule != 'api') {
349 $tmpmodule = preg_replace('/api$/i', '', $tmpmodule);
350 }
351 $classfile = str_replace('_', '', $tmpmodule);
352
353 // Special cases that does not match name rules conventions
354 if ($moduleobject == 'supplierproposals') {
355 $classfile = 'supplier_proposals';
356 }
357 if ($moduleobject == 'supplierorders') {
358 $classfile = 'supplier_orders';
359 }
360 if ($moduleobject == 'supplierinvoices') {
361 $classfile = 'supplier_invoices';
362 }
363 if ($moduleobject == 'ficheinter') {
364 $classfile = 'interventions';
365 }
366 if ($moduleobject == 'interventions') {
367 $classfile = 'interventions';
368 }
369 if ($moduleobject == 'eventattendees') {
370 $moduledirforclass = 'eventorganization';
371 }
372
373 $dir_part_file = dol_buildpath('/'.$moduledirforclass.'/class/api_'.$classfile.'.class.php', 0, 2);
374
375 $classname = ucwords($moduleobject);
376
377 // Test rules on endpoints. For example:
378 // $conf->global->API_ENDPOINT_RULES = 'endpoint1:1,endpoint2:1,...'
379 if (getDolGlobalString('API_ENDPOINT_RULES')) {
380 $listofendpoints = explode(',', getDolGlobalString('API_ENDPOINT_RULES'));
381 $endpointisallowed = false;
382
383 foreach ($listofendpoints as $endpointrule) {
384 $tmparray = explode(':', $endpointrule);
385 if (($classfile == $tmparray[0] || $classfile.'api' == $tmparray[0]) && $tmparray[1] == 1) {
386 $endpointisallowed = true;
387 break;
388 }
389 }
390
391 if (! $endpointisallowed) {
392 dol_syslog('The API with endpoint /'.$classfile.' is forbidden by config API_ENDPOINT_RULES', LOG_WARNING);
393 print 'The API with endpoint /'.$classfile.' is forbidden by config API_ENDPOINT_RULES';
394 header('HTTP/1.1 501 API is forbidden by API_ENDPOINT_RULES');
395 //session_destroy();
396 exit(0);
397 }
398 }
399
400 $parameters = array('url' => $url, 'ip' => getUserRemoteIP(), 'moduleobject' => $moduleobject, 'classfile' => $classfile, 'classname' => $classname);
401 $object = $api;
402 $action = $api->r->requestMethod;
403 // Note that $action and $object may be modified by some hooks
404 $reshook = $hookmanager->executeHooks('beforeApiCall', $parameters, $object, $action);
405 if ($reshook < 0) {
406 dol_syslog('beforeapicall Failed to call hook '.$hookmanager->error, LOG_ERR);
407 }
408
409 dol_syslog('Search api file /'.$moduledirforclass.'/class/api_'.$classfile.'.class.php => dir_part_file='.$dir_part_file.', classname='.$classname);
410
411 $res = false;
412 if ($dir_part_file) {
413 $res = include_once $dir_part_file;
414 }
415 if (!$res) {
416 dol_syslog('Failed to make include_once '.$dir_part_file, LOG_WARNING);
417 print 'API not found (failed to include API file)';
418 header('HTTP/1.1 501 API not found (failed to include API file)');
419 //session_destroy();
420 exit(0);
421 }
422
423 if (class_exists($classname)) {
424 $api->r->addAPIClass($classname);
425 }
426}
427
428
429//var_dump($api->r->apiVersionMap);
430//exit;
431
432// We do not want that restler outputs data if we use native compression (default behaviour) but we want to have it returned into a string.
433// If API_DISABLE_COMPRESSION is set, returnResponse is false => It use default handling so output result directly.
434$usecompression = (!getDolGlobalString('API_DISABLE_COMPRESSION') && !empty($_SERVER['HTTP_ACCEPT_ENCODING']));
435$foundonealgorithm = 0;
436if ($usecompression) {
437 if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress')) {
438 $foundonealgorithm++;
439 }
440 if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) {
441 $foundonealgorithm++;
442 }
443 if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) {
444 $foundonealgorithm++;
445 }
446 if (!$foundonealgorithm) {
447 $usecompression = false;
448 }
449}
450
451//dol_syslog('We found some compression algorithm: '.$foundonealgorithm.' -> usecompression='.$usecompression, LOG_DEBUG);
452
453Luracast\Restler\Defaults::$returnResponse = $usecompression;
454
455// Call API (we suppose we found it).
456// The handle will use the file api/temp/routes.php to get data to run the API. If the file exists and the entry for API is not found, it will return 404.
457$responsedata = $api->r->handle();
458
459if (Luracast\Restler\Defaults::$returnResponse) {
460 // We try to compress the data received data
461 if (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'br') !== false && function_exists('brotli_compress') && defined('BROTLI_TEXT')) {
462 header('Content-Encoding: br');
463 $result = brotli_compress($responsedata, 11, constant('BROTLI_TEXT'));
464 } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'bz') !== false && function_exists('bzcompress')) {
465 header('Content-Encoding: bz');
466 $result = bzcompress($responsedata, 9);
467 } elseif (strpos($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip') !== false && function_exists('gzencode')) {
468 header('Content-Encoding: gzip');
469 $result = gzencode($responsedata, 9);
470 } else {
471 header('Content-Encoding: text/html');
472 print "No compression method found. Try to disable compression by adding API_DISABLE_COMPRESSION=1";
473 exit(0);
474 }
475
476 // Restler did not output data yet, we return it now
477 echo $result;
478}
479
480if (getDolGlobalInt("API_ENABLE_COUNT_CALLS") && $api->r->responseCode == 200) {
481 $error = 0;
482 $db->begin();
483 $userid = DolibarrApiAccess::$user->id;
484
485 $sql = "SELECT up.value";
486 $sql .= " FROM ".MAIN_DB_PREFIX."user_param as up";
487 $sql .= " WHERE up.param = 'API_COUNT_CALL'";
488 $sql .= " AND up.fk_user = ".((int) $userid);
489 $sql .= " AND up.entity = ".((int) $conf->entity);
490
491 $result = $db->query($sql);
492 if ($result) {
493 $updateapi = false;
494 $nbrows = $db->num_rows($result);
495 if ($nbrows == 0) {
496 $sql2 = "INSERT INTO ".MAIN_DB_PREFIX."user_param";
497 $sql2 .= " (fk_user, entity, param, value)";
498 $sql2 .= " VALUES (".((int) $userid).", ".((int) $conf->entity).", 'API_COUNT_CALL', 1)";
499 } else {
500 $updateapi = true;
501 $sql2 = "UPDATE ".MAIN_DB_PREFIX."user_param as up";
502 $sql2 .= " SET up.value = up.value + 1";
503 $sql2 .= " WHERE up.param = 'API_COUNT_CALL'";
504 $sql2 .= " AND up.fk_user = ".((int) $userid);
505 $sql2 .= " AND up.entity = ".((int) $conf->entity);
506 }
507
508 $result2 = $db->query($sql2);
509 if (!$result2) {
510 $modeapicall = $updateapi ? 'updating' : 'inserting';
511 dol_syslog('Error while '.$modeapicall. ' API_COUNT_CALL for user '.$userid, LOG_ERR);
512 $error++;
513 }
514 } else {
515 dol_syslog('Error on select API_COUNT_CALL for user '.$userid, LOG_ERR);
516 $error++;
517 }
518
519 if ($error) {
520 $db->rollback();
521 } else {
522 $db->commit();
523 }
524}
525
526// Call API termination method
527$apiMethodInfo = &$api->r->apiMethodInfo;
528$terminateCall = '_terminate_' . $apiMethodInfo->methodName . '_' . $api->r->responseFormat->getExtension();
529if (method_exists($apiMethodInfo->className, $terminateCall)) {
530 // Now flush output buffers so that response data is sent to the client even if we still have action to do in a termination method.
531 ob_end_flush();
532
533 // If you're using PHP-FPM, this function will allow you to send the response and then continue processing
534 if (function_exists('fastcgi_finish_request')) {
535 fastcgi_finish_request();
536 }
537
538 // Call a termination method. Warning: This method can do I/O, sync but must not make output.
539 call_user_func(array(Luracast\Restler\Scope::get($apiMethodInfo->className), $terminateCall), $responsedata);
540}
541
542//session_destroy();
if( $user->socid > 0) if(! $user->hasRight('accounting', 'chartofaccount')) $object
Definition card.php:67
Class for API REST v1.
Definition api.class.php:33
getModuleDirForApiClass($moduleobject)
Get name of directory where the api_...class.php file is stored.
dolGetModulesDirs($subdir='')
Return list of directories that contain modules.
dol_osencode($str)
Return a string encoded into OS filesystem encoding.
getDolGlobalInt($key, $default=0)
Return a Dolibarr global constant int value.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
getUserRemoteIP($trusted=0)
Return the real IP of remote user.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
dol_syslog($message, $level=LOG_INFO, $ident=0, $suffixinfilename='', $restricttologhandler='', $logcontext=null)
Write log message into outputs.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79