* Copyright (C) 2016 Raphaƫl Doursenaud * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * */ /** * \file htdocs/admin/oauth.php * \ingroup oauth * \brief Setup page to configure oauth access api */ require '../main.inc.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/admin.lib.php'; require_once DOL_DOCUMENT_ROOT.'/core/lib/oauth.lib.php'; // Define $urlwithroot $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 // Load translation files required by the page $langs->loadLangs(array('admin', 'oauth')); // Security check if (!$user->admin) accessforbidden(); $action = GETPOST('action', 'alpha'); /* * Actions */ if ($action == 'update') { $error = 0; foreach ($list as $constname) { $constvalue = GETPOST($constname[1], 'alpha'); if (!dolibarr_set_const($db, $constname[1], $constvalue, 'chaine', 0, '', $conf->entity)) $error++; $constvalue = GETPOST($constname[2], 'alpha'); if (!dolibarr_set_const($db, $constname[2], $constvalue, 'chaine', 0, '', $conf->entity)) $error++; } if (! $error) { setEventMessages($langs->trans("SetupSaved"), null); } else { setEventMessages($langs->trans("Error"), null, 'errors'); } } /* * View */ llxHeader(); $form = new Form($db); $linkback=''.$langs->trans("BackToModuleList").''; print load_fiche_titre($langs->trans('ConfigOAuth'), $linkback, 'title_setup'); print '
'; print ''; print ''; $head = oauthadmin_prepare_head(); dol_fiche_head($head, 'services', '', -1, 'technic'); print $langs->trans("ListOfSupportedOauthProviders").'

'; print ''; $i=0; // $list is defined into oauth.lib.php foreach ($list as $key) { $supported=0; if (in_array($key[0], array_keys($supportedoauth2array))) $supported=1; if (! $supported) continue; // show only supported $i++; print ''; // Api Name $label = $langs->trans($key[0]); print ''; print ''; print ''; if ($supported) { $redirect_uri=$urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$key[0]].'_oauthcallback.php'; print ''; print ''; print ''; } else { print ''; print ''; print ''; print ''; } // Api Id print ''; print ''; print ''; // Api Secret print ''; print ''; print ''; } print '
'.$label.''; if (! empty($key[3])) print $langs->trans($key[3]); print '
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").''; print '
'.$langs->trans("UseTheFollowingUrlAsRedirectURI").''.$langs->trans("FeatureNotYetSupported").'
'; print '
'; print '
'."\n"; dol_fiche_end(); print '
'; print '
'; // End of page llxFooter(); $db->close();