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