dolibarr 21.0.3
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
42$supportedoauth2array = getSupportedOauth2Array();
43
44// Define $urlwithroot
45$urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
46$urlwithroot = $urlwithouturlroot.DOL_URL_ROOT; // This is to use external domain name found into config file
47//$urlwithroot=DOL_MAIN_URL_ROOT; // This is to use same domain name than current
48
49// Load translation files required by the page
50$langs->loadLangs(array('admin', 'oauth', 'modulebuilder'));
51
52// Security check
53if (!$user->admin) {
55}
56
57$action = GETPOST('action', 'aZ09');
58$provider = GETPOST('provider', 'aZ09');
59$label = GETPOST('label', 'aZ09');
60
61$servicetoeditname = GETPOST('servicetoeditname', 'aZ09');
62
63$error = 0;
64
65
66/*
67 * Actions
68 */
69
70if ($action == 'add') { // $provider is OAUTH_XXX
71 if ($provider && $provider != '-1') {
72 $constname = strtoupper($provider).($label ? '-'.$label : '').'_ID';
73
74 if (getDolGlobalString($constname)) {
75 setEventMessages($langs->trans("AOAuthEntryForThisProviderAndLabelAlreadyHasAKey"), null, 'errors');
76 $error++;
77 } else {
78 dolibarr_set_const($db, $constname, $langs->trans('ToComplete'), 'chaine', 0, '', $conf->entity);
79 setEventMessages($langs->trans("OAuthProviderAdded"), null);
80 }
81 }
82}
83if ($action == 'update') {
84 foreach ($conf->global as $key => $val) {
85 if (!empty($val) && preg_match('/^OAUTH_.+_ID$/', $key)) {
86 $constvalue = str_replace('_ID', '', $key);
87 $newconstvalue = $constvalue;
88 if (GETPOSTISSET($constvalue.'_NAME')) {
89 $newconstvalue = preg_replace('/-.*$/', '', $constvalue).'-'.GETPOST($constvalue.'_NAME');
90 }
91
92 if (GETPOSTISSET($constvalue.'_ID')) {
93 if (!dolibarr_set_const($db, $newconstvalue.'_ID', GETPOST($constvalue.'_ID'), 'chaine', 0, '', $conf->entity)) {
94 $error++;
95 }
96 }
97 // If we reset this provider, we also remove the secret
98 if (GETPOSTISSET($constvalue.'_SECRET')) {
99 if (!dolibarr_set_const($db, $newconstvalue.'_SECRET', GETPOST($constvalue.'_ID') ? GETPOST($constvalue.'_SECRET') : '', 'chaine', 0, '', $conf->entity)) {
100 $error++;
101 }
102 }
103 if (GETPOSTISSET($constvalue.'_URL')) {
104 if (!dolibarr_set_const($db, $newconstvalue.'_URL', GETPOST($constvalue.'_URL'), 'chaine', 0, '', $conf->entity)) {
105 $error++;
106 }
107 }
108 if (GETPOSTISSET($constvalue.'_URLAUTHORIZE')) {
109 if (!dolibarr_set_const($db, $newconstvalue.'_URLAUTHORIZE', GETPOST($constvalue.'_URLAUTHORIZE'), 'chaine', 0, '', $conf->entity)) {
110 $error++;
111 }
112 }
113 if (GETPOSTISSET($constvalue.'_TENANT')) {
114 if (!dolibarr_set_const($db, $constvalue.'_TENANT', GETPOST($constvalue.'_TENANT'), 'chaine', 0, '', $conf->entity)) {
115 $error++;
116 }
117 }
118 if (GETPOSTISSET($constvalue.'_SCOPE')) {
119 if (is_array(GETPOST($constvalue.'_SCOPE'))) {
120 $scopestring = implode(',', GETPOST($constvalue.'_SCOPE'));
121 } else {
122 $scopestring = GETPOST($constvalue.'_SCOPE');
123 }
124 if (!dolibarr_set_const($db, $newconstvalue.'_SCOPE', $scopestring, 'chaine', 0, '', $conf->entity)) {
125 $error++;
126 }
127 } elseif ($newconstvalue !== $constvalue) {
128 if (!dolibarr_set_const($db, $newconstvalue.'_SCOPE', '', 'chaine', 0, '', $conf->entity)) {
129 $error++;
130 }
131 }
132
133 // If name changed, we have to delete old const and proceed few other changes
134 if ($constvalue !== $newconstvalue) {
135 dolibarr_del_const($db, $constvalue.'_ID', $conf->entity);
136 dolibarr_del_const($db, $constvalue.'_SECRET', $conf->entity);
137 dolibarr_del_const($db, $constvalue.'_URL', $conf->entity);
138 dolibarr_del_const($db, $constvalue.'_URLAUTHORIZE', $conf->entity);
139 dolibarr_del_const($db, $constvalue.'_SCOPE', $conf->entity);
140
141 // Update name of token
142 $oldname = preg_replace('/^OAUTH_/', '', $constvalue);
143 $oldprovider = ucfirst(strtolower(preg_replace('/-.*$/', '', $oldname)));
144 $oldlabel = preg_replace('/^.*-/', '', $oldname);
145 $newlabel = preg_replace('/^.*-/', '', $newconstvalue);
146
147
148 $sql = "UPDATE ".MAIN_DB_PREFIX."oauth_token";
149 $sql.= " SET service = '".$db->escape($oldprovider."-".$newlabel)."'";
150 $sql.= " WHERE service = '".$db->escape($oldprovider."-".$oldlabel)."'";
151
152
153 $resql = $db->query($sql);
154 if (!$resql) {
155 $error++;
156 }
157
158 // Update other const that was using the renamed key as token (might not be exhaustive)
159 if (getDolGlobalString('MAIN_MAIL_SMTPS_OAUTH_SERVICE') == $oldname) {
160 if (!dolibarr_set_const($db, 'MAIN_MAIL_SMTPS_OAUTH_SERVICE', strtoupper($oldprovider).'-'.$newlabel, 'chaine', 0, '', $conf->entity)) {
161 $error++;
162 }
163 }
164 }
165 }
166 }
167
168
169 if (!$error) {
170 setEventMessages($langs->trans("SetupSaved"), null);
171 } else {
172 setEventMessages($langs->trans("Error"), null, 'errors');
173 }
174}
175
176if ($action == 'confirm_delete') {
177 $provider = GETPOST('provider', 'aZ09');
178 $label = GETPOST('label');
179
180 $globalkey = empty($provider) ? $label : $label.'-'.$provider;
181
182 if (getDolGlobalString($globalkey.'_ID') && getDolGlobalString($globalkey.'_SECRET')) { // If ID and secret exist, we delete first the token
183 $backtourl = DOL_URL_ROOT.'/admin/oauth.php?action=delete_entry&provider='.$provider.'&label='.$label.'&token='.newToken();
184 $urlwithouturlroot = preg_replace('/'.preg_quote(DOL_URL_ROOT, '/').'$/i', '', trim($dolibarr_main_url_root));
185 $urlwithroot = $urlwithouturlroot.DOL_URL_ROOT;
186 $callbacktodel = $urlwithroot;
187 if ($label == 'OAUTH_GOOGLE') {
188 $callbacktodel .= '/core/modules/oauth/google_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
189 } elseif ($label == 'OAUTH_GITHUB') {
190 $callbacktodel .= '/core/modules/oauth/github_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
191 } elseif ($label == 'OAUTH_STRIPELIVE') {
192 $callbacktodel .= '/core/modules/oauth/stripelive_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
193 } elseif ($label == 'OAUTH_STRIPETEST') {
194 $callbacktodel .= '/core/modules/oauth/stripetest_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
195 } elseif ($label == 'OAUTH_MICROSOFT') {
196 $callbacktodel .= '/core/modules/oauth/microsoft_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
197 } elseif ($label == 'OAUTH_MICROSOFT2') {
198 $callbacktodel .= '/core/modules/oauth/microsoft2_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
199 } elseif ($label == 'OAUTH_GENERIC') {
200 $callbacktodel .= '/core/modules/oauth/generic_oauthcallback.php?action=delete&keyforprovider='.$provider.'&token='.newToken().'&backtourl='.urlencode($backtourl);
201 }
202 header("Location: ".$callbacktodel);
203 exit;
204 } else {
205 $action = 'delete_entry';
206 }
207}
208
209if ($action == 'delete_entry') {
210 $provider = GETPOST('provider', 'aZ09');
211 $label = GETPOST('label');
212
213 $globalkey = empty($provider) ? $label : $label.'-'.$provider;
214
215 if (!dolibarr_del_const($db, $globalkey.'_NAME', $conf->entity)
216 || !dolibarr_del_const($db, $globalkey.'_ID', $conf->entity)
217 || !dolibarr_del_const($db, $globalkey.'_SECRET', $conf->entity)
218 || !dolibarr_del_const($db, $globalkey.'_URL', $conf->entity)
219 || !dolibarr_del_const($db, $globalkey.'_URLAUTHORIZE', $conf->entity)
220 || !dolibarr_del_const($db, $globalkey.'_SCOPE', $conf->entity)
221 || !dolibarr_del_const($db, $globalkey.'_TENANT', $conf->entity)) {
222 setEventMessages($langs->trans("ErrorInEntryDeletion"), null, 'errors');
223 $error++;
224 } else {
225 setEventMessages($langs->trans("EntryDeleted"), null);
226 }
227}
228
229/*
230 * View
231 */
232
233$form = new Form($db);
234
235$title = $langs->trans('ConfigOAuth');
236$help_url = 'EN:Module_OAuth|FR:Module_OAuth_FR|ES:Módulo_OAuth_ES';
237
238llxHeader('', $title, $help_url, '', 0, 0, '', '', '', 'mod-admin page-oauth');
239
240// Confirmation of action process
241if ($action == 'delete') {
242 $formquestion = array();
243 $formconfirm = $form->formconfirm($_SERVER["PHP_SELF"].'?provider='.GETPOST('provider').'&label='.GETPOST('label'), $langs->trans('OAuthServiceConfirmDeleteTitle'), $langs->trans('OAuthServiceConfirmDeleteMessage'), 'confirm_delete', $formquestion, 0, 1, 220);
244 print $formconfirm;
245}
246
247
248$linkback = '<a href="'.DOL_URL_ROOT.'/admin/modules.php?restore_lastsearch_values=1">'.$langs->trans("BackToModuleList").'</a>';
249print load_fiche_titre($title, $linkback, 'title_setup');
250
251print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
252print '<input type="hidden" name="token" value="'.newToken().'">';
253print '<input type="hidden" name="action" value="add">';
254
256
257print dol_get_fiche_head($head, 'services', '', -1, '');
258
259
260print '<span class="opacitymedium">'.$langs->trans("ListOfSupportedOauthProviders").'</span><br><br>';
261
262
263$list = getAllOauth2Array();
264
265
266print '<select name="provider" id="provider" class="minwidth150">';
267print '<option name="-1" value="-1">'.$langs->trans("OAuthProvider").'</option>';
268// TODO Make a loop directly on getSupportedOauth2Array() and remove getAllOauth2Array()
269foreach ($list as $key) {
270 $supported = 0;
271 $keyforsupportedoauth2array = $key[0];
272
273 if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
274 $supported = 1;
275 }
276 if (!$supported) {
277 continue; // show only supported
278 }
279
280 print '<option name="'.$keyforsupportedoauth2array.'" value="'.str_replace('_NAME', '', $keyforsupportedoauth2array).'">';
281
282 $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
283 $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
284 $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
285 $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
286
287 $label = $langs->trans($keyforsupportedoauth2array);
288 if ($label == $keyforsupportedoauth2array) {
289 print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
290 } else {
291 print $label;
292 }
293 print'</option>'."\n";
294}
295print '</select>';
296print ajax_combobox('provider');
297print ' <input type="text" name="label" value="" placeholder="'.$langs->trans("Label").'" pattern="^[a-zA-Z0-9]+$" title="'.$langs->trans("SpaceOrSpecialCharAreNotAllowed").'">';
298print ' <input type="submit" class="button small" name="add" value="'.$langs->trans("Add").'">';
299
300print '<br>';
301print '<br>';
302
303print dol_get_fiche_end();
304
305print '</form>';
306
307$listinsetup = [];
308// Define $listinsetup
309foreach ($conf->global as $key => $val) {
310 if (!empty($val) && preg_match('/^OAUTH_.*_ID$/', $key)) {
311 $provider = preg_replace('/_ID$/', '', $key);
312 $listinsetup[] = array(
313 $provider.'_NAME',
314 $provider.'_ID',
315 $provider.'_SECRET',
316 $provider.'_URL', // For custom oauth links
317 $provider.'_SCOPE' // For custom oauth links
318 );
319 }
320}
321
322
323if (count($listinsetup) > 0) {
324 print '<form action="'.$_SERVER["PHP_SELF"].'" method="POST">';
325 print '<input type="hidden" name="token" value="'.newToken().'">';
326 print '<input type="hidden" name="action" value="update">';
327
328 print '<div class="div-table-responsive-no-min">';
329
330 $i = 0;
331
332 // $list is defined into oauth.lib.php to the list of supporter OAuth providers.
333 foreach ($listinsetup as $key) {
334 $supported = 0;
335 $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
336 $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
337 $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
338 if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
339 $keybeforeprovider = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
340 $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
341 } else {
342 $keybeforeprovider = $keyforsupportedoauth2array;
343 $keyforprovider = '';
344 }
345 $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
346 $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
347
348 if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
349 $supported = 1;
350 }
351 if (!$supported) {
352 continue; // show only supported
353 }
354
355 $i++;
356
357 print '<table class="noborder centpercent">';
358
359 // OAUTH service name
360 $label = $langs->trans($keyforsupportedoauth2array);
361 print '<tr class="liste_titre'.($i > 1 ? ' liste_titre_add' : '').'">';
362 print '<td class="titlefieldcreate">';
363 print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
364 if ($label == $keyforsupportedoauth2array) {
365 print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
366 } else {
367 print $label;
368 }
369 if ($servicetoeditname == $key[0]) {
370 print ' (<input style="width: 20%" type="text" name="'.$key[0].'" value="'.$keyforprovider.'" >)';
371 } elseif ($keyforprovider) {
372 print ' (<b>'.$keyforprovider.'</b>)';
373 } else {
374 print ' (<b>'.$langs->trans("NoName").'</b>)';
375 }
376 if (!($servicetoeditname == $key[0])) {
377 print '<a class="editfielda reposition" href="'.$_SERVER["PHP_SELF"].'?token='.newToken().'&servicetoeditname='.urlencode($key[0]).'">'.img_edit($langs->transnoentitiesnoconv('Edit'), 1).'</a>';
378 }
379 print '</td>';
380 print '<td>';
381 if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials'])) {
382 print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']);
383 }
384 print '</td>';
385
386 // Delete
387 print '<td>';
388 $label = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
389 print '<a href="'.$_SERVER["PHP_SELF"].'?action=delete&token='.newToken().'&provider='.urlencode($keyforprovider).'&label='.urlencode($label).'">';
390 print img_picto('', 'delete');
391 print '</a>';
392
393 print '</form>';
394 print '</td>';
395
396 print '</tr>';
397
398 if ($supported) {
399 $redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php';
400 print '<tr class="oddeven value">';
401 print '<td>'.$form->textwithpicto($langs->trans("RedirectURL"), $langs->trans("UseTheFollowingUrlAsRedirectURI")).'</td>';
402 print '<td><input style="width: 80%" type="text" name="uri'.$keyforsupportedoauth2array.'" id="uri'.$keyforsupportedoauth2array.$keyforprovider.'" value="'.$redirect_uri.'" disabled>';
403 print ajax_autoselect('uri'.$keyforsupportedoauth2array.$keyforprovider);
404 print '</td>';
405 print '<td></td>';
406 print '</tr>';
407
408 if ($keyforsupportedoauth2array == 'OAUTH_GENERIC_NAME') {
409 print '<tr class="oddeven value">';
410 print '<td>';
411 $tooltiphelp = $langs->trans("Example").'<br>https://mastodon.example.com<br>https://mastodon.social';
412 print $form->textwithpicto($langs->trans("URLOfOAuthServiceEndpoints"), $tooltiphelp);
413 print '</td>';
414 print '<td><input style="width: 80%" type="text" name="'.$key[3].'" value="'.getDolGlobalString($key[3]).'" >';
415 print '</td>';
416 print '<td></td>';
417 print '</tr>';
418 }
419 } else {
420 print '<tr class="oddeven value">';
421 print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
422 print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
423 print '</td>';
424 print '<td></td>';
425 print '</tr>';
426 }
427
428 // Api Id
429 print '<tr class="oddeven value">';
430 print '<td><label for="'.$key[1].'">'.$langs->trans("OAUTH_ID").'</label></td>';
431 print '<td><input type="text" size="100" id="'.$key[1].'" name="'.$key[1].'" value="'.getDolGlobalString($key[1]).'">';
432 print '</td>';
433 print '<td></td>';
434 print '</tr>';
435
436 // Api Secret
437 print '<tr class="oddeven value">';
438 print '<td><label for="'.$key[2].'">'.$langs->trans("OAUTH_SECRET").'</label></td>';
439 print '<td><input type="password" size="100" id="'.$key[2].'" name="'.$key[2].'" value="'.getDolGlobalString($key[2]).'">';
440 print '</td>';
441 print '<td></td>';
442 print '</tr>';
443
444 // Tenant
445 if ($keybeforeprovider == 'MICROSOFT' || $keybeforeprovider == 'MICROSOFT2') {
446 print '<tr class="oddeven value">';
447 print '<td><label for="'.$key[2].'">'.$langs->trans("OAUTH_TENANT").'</label></td>';
448 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').'">';
449 print '</td>';
450 print '<td></td>';
451 print '</tr>';
452 }
453
454 // TODO Move this into token generation ?
455 if ($supported) {
456 if ($keyforsupportedoauth2array == 'OAUTH_GENERIC_NAME') {
457 print '<tr class="oddeven value">';
458 print '<td>';
459 print $form->textwithpicto($langs->trans("Scopes"), $langs->trans("ScopesDesc"));
460 print '</td>';
461 print '<td>';
462 print '<input style="width: 80%" type"text" name="'.$key[4].'" value="'.getDolGlobalString($key[4]).'" >';
463 print '</td>';
464 print '<td></td>';
465 print '</tr>';
466 } else {
467 $availablescopes = array_flip(explode(',', $supportedoauth2array[$keyforsupportedoauth2array]['availablescopes']));
468 $currentscopes = explode(',', getDolGlobalString($key[4]));
469 $scopestodispay = array();
470 foreach ($availablescopes as $keyscope => $valscope) {
471 if (in_array($keyscope, $currentscopes)) {
472 $scopestodispay[$keyscope] = 1;
473 } else {
474 $scopestodispay[$keyscope] = 0;
475 }
476 }
477 // Api Scope
478 print '<tr class="oddeven value">';
479 print '<td>'.$langs->trans("Scopes").'</td>';
480 print '<td>';
481 foreach ($scopestodispay as $scope => $val) {
482 print '<input type="checkbox" id="'.$keyforprovider.$scope.'" name="'.$key[4].'[]" value="'.$scope.'"'.($val ? ' checked' : '').'>';
483 print '<label style="margin-right: 10px" for="'.$keyforprovider.$scope.'">'.$scope.'</label>';
484 }
485 print '</td>';
486 print '<td></td>';
487 print '</tr>';
488 }
489 } else {
490 print '<tr class="oddeven value">';
491 print '<td>'.$langs->trans("UseTheFollowingUrlAsRedirectURI").'</td>';
492 print '<td>'.$langs->trans("FeatureNotYetSupported").'</td>';
493 print '</td>';
494 print '<td></td>';
495 print '</tr>';
496 }
497
498 print '</table>'."\n";
499
500 print '<br>';
501 }
502
503 print '</div>';
504
505 print $form->buttonsSaveCancel("Save", '');
506
507 print '</form>';
508}
509
510// End of page
511llxFooter();
512$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:459
llxFooter($comment='', $zone='private', $disabledoutputofmessages=0)
Empty footer.
Definition wrapper.php:87
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:71
Class to manage generation of HTML components Only common components must be here.
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, $allowothertags=array())
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.
global $conf
The following vars must be defined: $type2label $form $conf, $lang, The following vars may also be de...
Definition member.php:79
getAllOauth2Array()
Return array of possible OAUTH2 services.
Definition oauth.lib.php:34
getSupportedOauth2Array()
Return array of tabs to use 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.