';
- // Api Name
- $label = $langs->trans($keyforsupportedoauth2array);
- print '';
- print '';
- print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
- if ($label == $keyforsupportedoauth2array) {
- print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
- } else {
- print $label;
- }
- if ($keyforprovider) {
- print ' ('.$keyforprovider.' )';
- } else {
- print ' ('.$langs->trans("NoName").' )';
- }
- print ' ';
- print '';
- if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials'])) {
- print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']);
- }
- print ' ';
- print ' ';
+ $i = 0;
- if ($supported) {
- $redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php';
- print '';
- print ''.$langs->trans("UseTheFollowingUrlAsRedirectURI").' ';
- print ' ';
- print ' ';
-
- if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
- print '';
- print ''.$langs->trans("URLOfServiceForAuthorization").' ';
- print ' ';
- print ' ';
+ // $list is defined into oauth.lib.php to the list of supporter OAuth providers.
+ foreach ($listinsetup as $key) {
+ $supported = 0;
+ $keyforsupportedoauth2array = $key[0]; // May be OAUTH_GOOGLE_NAME or OAUTH_GOOGLE_xxx_NAME
+ $keyforsupportedoauth2array = preg_replace('/^OAUTH_/', '', $keyforsupportedoauth2array);
+ $keyforsupportedoauth2array = preg_replace('/_NAME$/', '', $keyforsupportedoauth2array);
+ if (preg_match('/^.*-/', $keyforsupportedoauth2array)) {
+ $keyforprovider = preg_replace('/^.*-/', '', $keyforsupportedoauth2array);
+ } else {
+ $keyforprovider = '';
}
- } else {
- print '';
- print ''.$langs->trans("UseTheFollowingUrlAsRedirectURI").' ';
- print ''.$langs->trans("FeatureNotYetSupported").' ';
- print ' ';
- }
+ $keyforsupportedoauth2array = preg_replace('/-.*$/', '', $keyforsupportedoauth2array);
+ $keyforsupportedoauth2array = 'OAUTH_'.$keyforsupportedoauth2array.'_NAME';
- // Api Id
- print '';
- print ''.$langs->trans("OAUTH_ID").' ';
- print ' ';
- print ' ';
+ if (in_array($keyforsupportedoauth2array, array_keys($supportedoauth2array))) {
+ $supported = 1;
+ }
+ if (!$supported) {
+ continue; // show only supported
+ }
- // Api Secret
- print '';
- print ''.$langs->trans("OAUTH_SECRET").' ';
- print ' ';
- print ' ';
+ $i++;
- // TODO Move this into token generation
- if ($supported) {
- if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
+ // Api Name
+ $label = $langs->trans($keyforsupportedoauth2array);
+ print '';
+ print '';
+ print img_picto('', $supportedoauth2array[$keyforsupportedoauth2array]['picto'], 'class="pictofixedwidth"');
+ if ($label == $keyforsupportedoauth2array) {
+ print $supportedoauth2array[$keyforsupportedoauth2array]['name'];
+ } else {
+ print $label;
+ }
+ if ($keyforprovider) {
+ print ' ('.$keyforprovider.' )';
+ } else {
+ print ' ('.$langs->trans("NoName").' )';
+ }
+ print ' ';
+ print '';
+ if (!empty($supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials'])) {
+ print $langs->trans("OAUTH_URL_FOR_CREDENTIAL", $supportedoauth2array[$keyforsupportedoauth2array]['urlforcredentials']);
+ }
+ print ' ';
+ print ' ';
+
+ if ($supported) {
+ $redirect_uri = $urlwithroot.'/core/modules/oauth/'.$supportedoauth2array[$keyforsupportedoauth2array]['callbackfile'].'_oauthcallback.php';
print '';
- print ''.$langs->trans("Scopes").' ';
- print '';
- print ' ';
+ print ' '.$langs->trans("UseTheFollowingUrlAsRedirectURI").' ';
+ print ' ';
print ' ';
+
+ if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
+ print '';
+ print ''.$langs->trans("URLOfServiceForAuthorization").' ';
+ print ' ';
+ print ' ';
+ }
} else {
print '';
- print ''.$langs->trans("Scopes").' ';
- print '';
- //print ' ';
- print $supportedoauth2array[$keyforsupportedoauth2array]['defaultscope'];
+ print ' '.$langs->trans("UseTheFollowingUrlAsRedirectURI").' ';
+ print ''.$langs->trans("FeatureNotYetSupported").' ';
print ' ';
}
+
+ // Api Id
+ print '';
+ print ''.$langs->trans("OAUTH_ID").' ';
+ print ' ';
+ print ' ';
+
+ // Api Secret
+ print '';
+ print ''.$langs->trans("OAUTH_SECRET").' ';
+ print ' ';
+ print ' ';
+
+ // TODO Move this into token generation
+ if ($supported) {
+ if ($keyforsupportedoauth2array == 'OAUTH_OTHER_NAME') {
+ print '';
+ print ''.$langs->trans("Scopes").' ';
+ print '';
+ print ' ';
+ print ' ';
+ } else {
+ print '';
+ print ''.$langs->trans("Scopes").' ';
+ print '';
+ //print ' ';
+ print $supportedoauth2array[$keyforsupportedoauth2array]['defaultscope'];
+ print ' ';
+ }
+ }
}
+
+ print '