dolibarr 21.0.0-alpha
oauth.php
Go to the documentation of this file.
1<?php
2/* Copyright (C) 2015-2024 Frédéric France <frederic.france@free.fr>
3 * Copyright (C) 2016 Raphaël Doursenaud <rdoursenaud@gpcsolutions.fr>
4 * Copyright (C) 2022 Laurent Destailleur <eldy@users.sourceforge.net>
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <https://www.gnu.org/licenses/>.
18 */
19
27// Load Dolibarr environment
28require '../main.inc.php';
29require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php';
30require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php';
31
32$supportedoauth2array = getSupportedOauth2Array();
33
34// Define $urlwithroot
35$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
36$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
37//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
38
39// Load translation files required by the page
40$langs->loadLangs(array('admin', 'oauth', 'modulebuilder'));
41
42// Security check
43if (!$user->admin) {
45}
46
47$action = GETPOST('action', 'aZ09');
48$provider = GETPOST('provider', 'aZ09');
49$label = GETPOST('label', 'aZ09');
50
51$servicetoeditname = GETPOST('servicetoeditname', 'aZ09');
52
53$error = 0;
54
55
56/*
57 * Actions
58 */
59
60if ($action == 'add') { // $provider is OAUTH_XXX
61 if ($provider && $provider != '-1') {
62 $constname = strtoupper($provider).($label ? '-'.$label : '').'_ID';
63
64 if (getDolGlobalString($constname)) {
65 setEventMessages($langs->trans("AOAuthEntryForThisProviderAndLabelAlreadyHasAKey"), null, 'errors');
66 $error++;
67 } else {
68 dolibarr_set_const($db, $constname, $langs->trans('ToComplete'), 'chaine', 0, '', $conf->entity);
69 setEventMessages($langs->trans("OAuthProviderAdded"), null);
70 }
71 }
72}
73if ($action == 'update') {
74 foreach ($conf->global as $key => $val) {
75 if (!empty($val) && preg_match('/^OAUTH_.+_ID$/', $key)) {
76 $constvalue = str_replace('_ID', '', $key);
77 $newconstvalue = $constvalue;
78 if (GETPOSTISSET($constvalue.'_NAME')) {
79 $newconstvalue = preg_replace('/-.*$/', '', $constvalue).'-'.GETPOST($constvalue.'_NAME');
80 }
81
82 if (GETPOSTISSET($constvalue.'_ID')) {
83 if (!dolibarr_set_const($db, $newconstvalue.'_ID', GETPOST($constvalue.'_ID'), 'chaine', 0, '', $conf->entity)) {
84 $error++;
85 }
86 }
87 // If we reset this provider, we also remove the secret
88 if (GETPOSTISSET($constvalue.'_SECRET')) {
89 if (!dolibarr_set_const($db, $newconstvalue.'_SECRET', GETPOST($constvalue.'_ID') ? GETPOST($constvalue.'_SECRET') : '', 'chaine', 0, '', $conf->entity)) {
90 $error++;
91 }
92 }
93 if (GETPOSTISSET($constvalue.'_URL')) {
94 if (!dolibarr_set_const($db, $newconstvalue.'_URL', GETPOST($constvalue.'_URL'), 'chaine', 0, '', $conf->entity)) {
95 $error++;
96 }
97 }
98 if (GETPOSTISSET($constvalue.'_URLAUTHORIZE')) {
99 if (!dolibarr_set_const($db, $newconstvalue.'_URLAUTHORIZE', GETPOST($constvalue.'_URLAUTHORIZE'), 'chaine', 0, '', $conf->entity)) {
100 $error++;
101 }
102 }
103 if (GETPOSTISSET($constvalue.'_TENANT')) {
104 if (!dolibarr_set_const($db, $constvalue.'_TENANT', GETPOST($constvalue.'_TENANT'), 'chaine', 0, '', $conf->entity)) {
105 $error++;
106 }
107 }
108 if (GETPOSTISSET($constvalue.'_SCOPE')) {
109 if (is_array(GETPOST($constvalue.'_SCOPE'))) {
110 $scopestring = implode(',', GETPOST($constvalue.'_SCOPE'));
111 } else {
112 $scopestring = GETPOST($constvalue.'_SCOPE');
113 }
114 if (!dolibarr_set_const($db, $newconstvalue.'_SCOPE', $scopestring, 'chaine', 0, '', $conf->entity)) {
115 $error++;
116 }
117 } elseif ($newconstvalue !== $constvalue) {
118 if (!dolibarr_set_const($db, $newconstvalue.'_SCOPE', '', 'chaine', 0, '', $conf->entity)) {
119 $error++;
120 }
121 }
122
123 // If name changed, we have to delete old const and proceed few other changes
124 if ($constvalue !== $newconstvalue) {
125 dolibarr_del_const($db, $constvalue.'_ID', $conf->entity);
126 dolibarr_del_const($db, $constvalue.'_SECRET', $conf->entity);
127 dolibarr_del_const($db, $constvalue.'_URL', $conf->entity);
128 dolibarr_del_const($db, $constvalue.'_URLAUTHORIZE', $conf->entity);
129 dolibarr_del_const($db, $constvalue.'_SCOPE', $conf->entity);
130
131 // Update name of token
132 $oldname = preg_replace('/^OAUTH_/', '', $constvalue);
133 $oldprovider = ucfirst(strtolower(preg_replace('/-.*$/', '', $oldname)));
134 $oldlabel = preg_replace('/^.*-/', '', $oldname);
135 $newlabel = preg_replace('/^.*-/', '', $newconstvalue);
136
137
138 $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token";
139 $sql.= " SET service = '".$db->escape($oldprovider."-".$newlabel)."'";
140 $sql.= " WHERE service = '".$db->escape($oldprovider."-".$oldlabel)."'";
141
142
143 $resql = $db->query($sql);
144 if (!$resql) {
145 $error++;
146 }
147
148 // Update other const that was using the renamed key as token (might not be exhaustive)
149 if (getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE') == $oldname) {
150 if (!dolibarr_set_const($db, 'MAIN_MAIL_SMTPS_OAUTH_SERVICE', strtoupper($oldprovider).'-'.$newlabel, 'chaine', 0, '', $conf->entity)) {
151 $error++;
152 }
153 }
154 }
155 }
156 }
157
158
159 if (!$error) {
160 setEventMessages($langs->trans("SetupSaved"), null);
161 } else {
162 setEventMessages($langs->trans("Error"), null, 'errors');
163 }
164}
165
166if ($action == 'confirm_delete') {
167 $provider = GETPOST('provider', 'aZ09');
168 $label = GETPOST('label');
169
170 $globalkey = empty($provider) ? $label : $label.'-'.$provider;
171
172 if (getDolGlobalString($globalkey.'_ID') && getDolGlobalString($globalkey.'_SECRET')) { // If ID and secret exist, we delete first the token
173 $backtourl = DOL_URL_ROOT.'/admin/oauth.php?action=delete_entry&provider='.$provider.'&label='.$label.'&token='.newToken();
174 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
175 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
176 $callbacktodel = $urlwithroot;
177 if ($label == 'OAUTH_GOOGLE') {
178 $callbacktodel .= '/core/modules/oauth/google_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
179 } elseif ($label == 'OAUTH_GITHUB') {
180 $callbacktodel .= '/core/modules/oauth/github_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
181 } elseif ($label == 'OAUTH_STRIPE_LIVE') {
182 $callbacktodel .= '/core/modules/oauth/stripelive_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
183 } elseif ($label == 'OAUTH_STRIPE_TEST') {
184 $callbacktodel .= '/core/modules/oauth/stripetest_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
185 } elseif ($label == 'OAUTH_MICROSOFT') {
186 $callbacktodel .= '/core/modules/oauth/microsoft_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
187 } elseif ($label == 'OAUTH_MICROSOFT2') {
188 $callbacktodel .= '/core/modules/oauth/microsoft2_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
189 } elseif ($label == 'OAUTH_GENERIC') {
190 $callbacktodel .= '/core/modules/oauth/generic_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
191 }
192 header("Location: ".$callbacktodel);
193 exit;
194 } else {
195 $action = 'delete_entry';
196 }
197}
198
199if ($action == 'delete_entry') {
200 $provider = GETPOST('provider', 'aZ09');
201 $label = GETPOST('label');
202
203 $globalkey = empty($provider) ? $label : $label.'-'.$provider;
204
205 if (!dolibarr_del_const($db, $globalkey.'_NAME', $conf->entity)
206 || !dolibarr_del_const($db, $globalkey.'_ID', $conf->entity)
207 || !dolibarr_del_const($db, $globalkey.'_SECRET', $conf->entity)
208 || !dolibarr_del_const($db, $globalkey.'_URL', $conf->entity)
209 || !dolibarr_del_const($db, $globalkey.'_URLAUTHORIZE', $conf->entity)
210 || !dolibarr_del_const($db, $globalkey.'_SCOPE', $conf->entity)) {
211 setEventMessages($langs->trans("ErrorInEntryDeletion"), null, 'errors');
212 $error++;
213 } else {
214 setEventMessages($langs->trans("EntryDeleted"), null);
215 }
216}
217
218/*
219 * View
220 */
221
222$form = new Form($db);
223
224$title = $langs->trans('ConfigOAuth');
225$help_url = 'EN:Module_OAuth|FR:Module_OAuth_FR|ES:Módulo_OAuth_ES';
226
227llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-admin page-oauth');
228
229// Confirmation of action process
230if ($action == 'delete') {
231 $formquestion = array();
232 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?provider='.GETPOST('provider').'&label='.GETPOST('label'), $langs->trans('OAuthServiceConfirmDeleteTitle'), $langs->trans('OAuthServiceConfirmDeleteMessage'), 'confirm_delete', $formquestion, 0, 1, 220);
233 print $formconfirm;
234}
235
236
237$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
238print load_fiche_titre($title, $linkback, 'title_setup');
239
240print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
241print '<input type="hidden" name="token" value="'.newToken().'">';
242print '<input type="hidden" name="action" value="add">';
243
245
246print dol_get_fiche_head($head, 'services', '', -1, '');
247
248
249print '<span class="opacitymedium">'.$langs->trans("ListOfSupportedOauthProviders").'</span><br><br>';
250
251
252print '<select name="provider" id="provider" class="minwidth150">';
253print '<option name="-1" value="-1">'.$langs->trans("OAuthProvider").'</option>';
254$list = getAllOauth2Array();
255// TODO Make a loop directly on getSupportedOauth2Array() and remove getAllOauth2Array()
256foreach ($list as $key) {
257 $supported = 0;
258 $keyforsupportedoauth2array = $key[0];
259
260 if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
261 $supported = 1;
262 }
263 if (!$supported) {
264 continue; // show only supported
265 }
266
267 print '<option name="'.$keyforsupportedoauth2array.'" value="'.str_replace('_NAME', '', $keyforsupportedoauth2array).'">';
268
269 $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
270 $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
271 $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
272 $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
273
274 $label = $langs->trans($keyforsupportedoauth2array);
275 if ($label == $keyforsupportedoauth2array) {
276 print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
277 } else {
278 print $label;
279 }
280 print'</option>'."\n";
281}
282print '</select>';
283print ajax_combobox('provider');
284print ' <input type="text" name="label" value="" placeholder="'.$langs->trans("Label").'" pattern="^\S+$" title="'.$langs->trans("SpaceOrSpecialCharAreNotAllowed").'">';
285print ' <input type="submit" class="button small" name="add" value="'.$langs->trans("Add").'">';
286
287print '<br>';
288print '<br>';
289
290print dol_get_fiche_end();
291
292print '</form>';
293
294$listinsetup = [];
295// Define $listinsetup
296foreach ($conf->global as $key => $val) {
297 if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
298 $provider = preg_replace('/_ID$/', '', $key);
299 $listinsetup[] = array(
300 $provider.'_NAME',
301 $provider.'_ID',
302 $provider.'_SECRET',
303 $provider.'_URL', // For custom oauth links
304 $provider.'_SCOPE' // For custom oauth links
305 );
306 }
307}
308
309
310if (count($listinsetup) > 0) {
311 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
312 print '<input type="hidden" name="token" value="'.newToken().'">';
313 print '<input type="hidden" name="action" value="update">';
314
315 print '<div class="div-table-responsive-no-min">';
316
317 $i = 0;
318
319 // $list is defined into oauth.lib.php to the list of supporter OAuth providers.
320 foreach ($listinsetup as $key) {
321 $supported = 0;
322 $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
323 $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
324 $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
325 if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
326 $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
327 $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
328 } else {
329 $keybeforeprovider = $keyforsupportedoauth2array;
330 $keyforprovider = '';
331 }
332 $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
333 $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
334
335 if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
336 $supported = 1;
337 }
338 if (!$supported) {
339 continue; // show only supported
340 }
341
342 $i++;
343
344 print '<table class="noborder centpercent">';
345
346 // OAUTH service name
347 $label = $langs->trans($keyforsupportedoauth2array);
348 print '<tr class="liste_titre'.($i > 1 ? ' liste_titre_add' : '').'">';
349 print '<td class="titlefieldcreate">';
350 print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
351 if ($label == $keyforsupportedoauth2array) {
352 print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
353 } else {
354 print $label;
355 }
356 if ($servicetoeditname == $key[0]) {
357 print ' (<input style="width: 20%" type="text" name="'.$key[0].'" value="'.$keyforprovider.'" >)';
358 } elseif ($keyforprovider) {
359 print ' (<b>'.$keyforprovider.'</b>)';
360 } else {
361 print ' (<b>'.$langs->trans("NoName").'</b>)';
362 }
363 if (!($servicetoeditname == $key[0])) {
364 print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?token='.newToken().'&servicetoeditname='.urlencode($key[0]).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
365 }
366 print '</td>';
367 print '<td>';
368 if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials'])) {
369 print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']);
370 }
371 print '</td>';
372
373 // Delete
374 print '<td>';
375 $label = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
376 print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&provider='.urlencode($keyforprovider).'&label='.urlencode($label).'">';
377 print img_picto('', 'delete');
378 print '</a>';
379
380 print '</form>';
381 print '</td>';
382
383 print '</tr>';
384
385 if ($supported) {
386 $redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php';
387 print '<tr class="oddeven value">';
388 print '<td>'.$form->textwithpicto($langs->trans("RedirectURL"), $langs->trans("UseTheFollowingUrlAsRedirectURI")).'</td>';
389 print '<td><input style="width: 80%" type="text" name="uri'.$keyforsupportedoauth2array.'" id="uri'.$keyforsupportedoauth2array.$keyforprovider.'" value="'.$redirect_uri.'" disabled>';
390 print ajax_autoselect('uri'.$keyforsupportedoauth2array.$keyforprovider);
391 print '</td>';
392 print '<td></td>';
393 print '</tr>';
394
395 if ($keyforsupportedoauth2array == 'OAUTH_GENERIC_NAME') {
396 print '<tr class="oddeven value">';
397 print '<td>';
398 $tooltiphelp = $langs->trans("Example").'<br>https://mastodon.example.com<br>https://mastodon.social';
399 print $form->textwithpicto($langs->trans("URLOfOAuthServiceEndpoints"), $tooltiphelp);
400 print '</td>';
401 print '<td><input style="width: 80%" type="text" name="'.$key[3].'" value="'.getDolGlobalString($key[3]).'" >';
402 print '</td>';
403 print '<td></td>';
404 print '</tr>';
405 }
406 } else {
407 print '<tr class="oddeven value">';
408 print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
409 print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
410 print '</td>';
411 print '<td></td>';
412 print '</tr>';
413 }
414
415 // Api Id
416 print '<tr class="oddeven value">';
417 print '<td><label for="'.$key[1].'">'.$langs->trans("OAUTH_ID").'</label></td>';
418 print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.getDolGlobalString($key[1]).'">';
419 print '</td>';
420 print '<td></td>';
421 print '</tr>';
422
423 // Api Secret
424 print '<tr class="oddeven value">';
425 print '<td><label for="'.$key[2].'">'.$langs->trans("OAUTH_SECRET").'</label></td>';
426 print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.getDolGlobalString($key[2]).'">';
427 print '</td>';
428 print '<td></td>';
429 print '</tr>';
430
431 // Tenant
432 if ($keybeforeprovider == 'MICROSOFT' || $keybeforeprovider == 'MICROSOFT2') {
433 print '<tr class="oddeven value">';
434 print '<td><label for="'.$key[2].'">'.$langs->trans("OAUTH_TENANT").'</label></td>';
435 print '<td><input type="text" size="100" id="OAUTH_'.$keybeforeprovider.($keyforprovider ? '-'.$keyforprovider : '').'_TENANT" name="OAUTH_'.$keybeforeprovider.($keyforprovider ? '-'.$keyforprovider : '').'_TENANT" value="'.getDolGlobalString('OAUTH_'.$keybeforeprovider.($keyforprovider ? '-'.$keyforprovider : '').'_TENANT').'">';
436 print '</td>';
437 print '<td></td>';
438 print '</tr>';
439 }
440
441 // TODO Move this into token generation ?
442 if ($supported) {
443 if ($keyforsupportedoauth2array == 'OAUTH_GENERIC_NAME') {
444 print '<tr class="oddeven value">';
445 print '<td>';
446 print $form->textwithpicto($langs->trans("Scopes"), $langs->trans("ScopesDesc"));
447 print '</td>';
448 print '<td>';
449 print '<input style="width: 80%" type"text" name="'.$key[4].'" value="'.getDolGlobalString($key[4]).'" >';
450 print '</td>';
451 print '<td></td>';
452 print '</tr>';
453 } else {
454 $availablescopes = array_flip(explode(',', $supportedoauth2array[$keyforsupportedoauth2array]['availablescopes']));
455 $currentscopes = explode(',', getDolGlobalString($key[4]));
456 $scopestodispay = array();
457 foreach ($availablescopes as $keyscope => $valscope) {
458 if (in_array($keyscope, $currentscopes)) {
459 $scopestodispay[$keyscope] = 1;
460 } else {
461 $scopestodispay[$keyscope] = 0;
462 }
463 }
464 // Api Scope
465 print '<tr class="oddeven value">';
466 print '<td>'.$langs->trans("Scopes").'</td>';
467 print '<td>';
468 foreach ($scopestodispay as $scope => $val) {
469 print '<input type="checkbox" id="'.$keyforprovider.$scope.'" name="'.$key[4].'[]" value="'.$scope.'"'.($val ? ' checked' : '').'>';
470 print '<label style="margin-right: 10px" for="'.$keyforprovider.$scope.'">'.$scope.'</label>';
471 }
472 print '</td>';
473 print '<td></td>';
474 print '</tr>';
475 }
476 } else {
477 print '<tr class="oddeven value">';
478 print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
479 print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
480 print '</td>';
481 print '<td></td>';
482 print '</tr>';
483 }
484
485 print '</table>'."\n";
486
487 print '<br>';
488 }
489
490 print '</div>';
491
492 print $form->buttonsSaveCancel("Save", '');
493
494 print '</form>';
495}
496
497// End of page
498llxFooter();
499$db->close();
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).
dolibarr_del_const($db, $name, $entity=1)
Delete a constant.
ajax_combobox($htmlname, $events=array(), $minLengthToAutocomplete=0, $forcefocus=0, $widthTypeOfAutocomplete='resolve', $idforemptyvalue='-1', $morecss='')
Convert a html select field into an ajax combobox.
Definition ajax.lib.php:457
if(!defined('NOREQUIRESOC')) if(!defined( 'NOREQUIRETRAN')) if(!defined('NOTOKENRENEWAL')) if(!defined( 'NOREQUIREMENU')) if(!defined('NOREQUIREHTML')) if(!defined( 'NOREQUIREAJAX')) llxHeader($head='', $title='', $help_url='', $target='', $disablejs=0, $disablehead=0, $arrayofjs='', $arrayofcss='', $morequerystring='', $morecssonbody='', $replacemainareaby='', $disablenofollow=0, $disablenoindex=0)
Empty header.
Definition wrapper.php:70
Class to manage generation of HTML components Only common components must be here.
llxFooter()
Footer empty.
Definition document.php:107
load_fiche_titre($title, $morehtmlright='', $picto='generic', $pictoisfullpath=0, $id='', $morecssontable='', $morehtmlcenter='')
Load a title with picto.
setEventMessages($mesg, $mesgs, $style='mesgs', $messagekey='', $noduplicate=0, $attop=0)
Set event messages in dol_events session object.
img_picto($titlealt, $picto, $moreatt='', $pictoisfullpath=0, $srconly=0, $notitle=0, $alt='', $morecss='', $marginleftonlyshort=2)
Show picto whatever it's its name (generic function)
dol_get_fiche_head($links=array(), $active='', $title='', $notab=0, $picto='', $pictoisfullpath=0, $morehtmlright='', $morecss='', $limittoshow=0, $moretabssuffix='', $dragdropfile=0)
Show tabs of a record.
dol_get_fiche_end($notab=0)
Return tab footer of a card.
ajax_autoselect($htmlname, $addlink='', $textonlink='Link')
Make content of an input box selected when we click into input field.
newToken()
Return the value of token currently saved into session with name 'newtoken'.
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
getDolGlobalString($key, $default='')
Return a Dolibarr global constant string value.
img_edit($titlealt='default', $float=0, $other='')
Show logo edit/modify fiche.
getAllOauth2Array()
Return array of possible OAUTH2 services.
Definition oauth.lib.php:33
getSupportedOauth2Array()
Return array of tabs to used on pages to setup cron module.
oauthadmin_prepare_head()
Return array of tabs to used on pages to setup cron module.
accessforbidden($message='', $printheader=1, $printfooter=1, $showonlymessage=0, $params=null)
Show a message to say access is forbidden and stop program.