dolibarr  16.0.5
oauth.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2012 Nicolas Villa aka Boyquotes http://informetic.fr
3  * Copyright (C) 2013 Florian Henry <florian.henry@opn-concept.pro>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <https://www.gnu.org/licenses/>.
17  */
18 
26 // Supported OAUTH (a provider is supported when a file xxx_oauthcallback.php is available into htdocs/core/modules/oauth)
27 $supportedoauth2array = array(
28  'OAUTH_GOOGLE_NAME'=>array('callbackfile' => 'google', 'picto' => 'google', 'urlforapp' => 'OAUTH_GOOGLE_DESC', 'name'=>'Google', 'urlforcredentials'=>'https://console.developers.google.com/'),
29 );
30 if (!empty($conf->stripe->enabled)) {
31  $supportedoauth2array['OAUTH_STRIPE_TEST_NAME'] = array('callbackfile' => 'stripetest', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeTest', 'urlforcredentials'=>'');
32  $supportedoauth2array['OAUTH_STRIPE_LIVE_NAME'] = array('callbackfile' => 'stripelive', 'picto' => 'stripe', 'urlforapp' => '', 'name'=>'StripeLive', 'urlforcredentials'=>'');
33 }
34 $supportedoauth2array['OAUTH_GITHUB_NAME'] = array('callbackfile' => 'github', 'picto' => 'github', 'urlforapp' => 'OAUTH_GITHUB_DESC', 'name'=>'GitHub', 'urlforcredentials'=>'https://github.com/settings/developers');
35 
36 
37 
38 // API access parameters OAUTH
39 $list = array(
40  array(
41  'OAUTH_AMAZON_NAME',
42  'OAUTH_AMAZON_ID',
43  'OAUTH_AMAZON_SECRET',
44  ),
45  array(
46  'OAUTH_BITBUCKET_NAME',
47  'OAUTH_BITBUCKET_ID',
48  'OAUTH_BITBUCKET_SECRET',
49  ),
50  array(
51  'OAUTH_BITLY_NAME',
52  'OAUTH_BITLY_ID',
53  'OAUTH_BITLY_SECRET',
54  ),
55  array(
56  'OAUTH_BITRIX24_NAME',
57  'OAUTH_BITRIX24_ID',
58  'OAUTH_BITRIX24_SECRET',
59  ),
60  array(
61  'OAUTH_BOX_NAME',
62  'OAUTH_BOX_ID',
63  'OAUTH_BOX_SECRET',
64  ),
65  array(
66  'OAUTH_BUFFER_NAME',
67  'OAUTH_BUFFER_ID',
68  'OAUTH_BUFFER_SECRET',
69  ),
70  array(
71  'OAUTH_DAILYMOTION_NAME',
72  'OAUTH_DAILYMOTION_ID',
73  'OAUTH_DAILYMOTION_SECRET',
74  ),
75  array(
76  'OAUTH_DEVIANTART_NAME',
77  'OAUTH_DEVIANTART_ID',
78  'OAUTH_DEVIANTART_SECRET',
79  ),
80  array(
81  'OAUTH_DROPBOX_NAME',
82  'OAUTH_DROPBOX_ID',
83  'OAUTH_DROPBOX_SECRET',
84  ),
85  array(
86  'OAUTH_ETSY_NAME',
87  'OAUTH_ETSY_ID',
88  'OAUTH_ETSY_SECRET',
89  ),
90  array(
91  'OAUTH_EVEONLINE_NAME',
92  'OAUTH_EVEONLINE_ID',
93  'OAUTH_EVEONLINE_SECRET',
94  ),
95  array(
96  'OAUTH_FACEBOOK_NAME',
97  'OAUTH_FACEBOOK_ID',
98  'OAUTH_FACEBOOK_SECRET',
99  ),
100  array(
101  'OAUTH_FITBIT_NAME',
102  'OAUTH_FITBIT_ID',
103  'OAUTH_FITBIT_SECRET',
104  ),
105  array(
106  'OAUTH_FIVEHUNDREDPX_NAME',
107  'OAUTH_FIVEHUNDREDPX_ID',
108  'OAUTH_FIVEHUNDREDPX_SECRET',
109  ),
110  array(
111  'OAUTH_FLICKR_NAME',
112  'OAUTH_FLICKR_ID',
113  'OAUTH_FLICKR_SECRET',
114  ),
115  array(
116  'OAUTH_FOURSQUARE_NAME',
117  'OAUTH_FOURSQUARE_ID',
118  'OAUTH_FOURSQUARE_SECRET',
119  ),
120  array(
121  'OAUTH_GITHUB_NAME',
122  'OAUTH_GITHUB_ID',
123  'OAUTH_GITHUB_SECRET',
124  'OAUTH_GITHUB_DESC',
125  ),
126  array(
127  'OAUTH_GOOGLE_NAME',
128  'OAUTH_GOOGLE_ID',
129  'OAUTH_GOOGLE_SECRET',
130  'OAUTH_GOOGLE_DESC',
131  ),
132  array(
133  'OAUTH_HUBIC_NAME',
134  'OAUTH_HUBIC_ID',
135  'OAUTH_HUBIC_SECRET',
136  ),
137  array(
138  'OAUTH_INSTAGRAM_NAME',
139  'OAUTH_INSTAGRAM_ID',
140  'OAUTH_INSTAGRAM_SECRET',
141  ),
142  array(
143  'OAUTH_LINKEDIN_NAME',
144  'OAUTH_LINKEDIN_ID',
145  'OAUTH_LINKEDIN_SECRET',
146  ),
147  array(
148  'OAUTH_MAILCHIMP_NAME',
149  'OAUTH_MAILCHIMP_ID',
150  'OAUTH_MAILCHIMP_SECRET',
151  ),
152  array(
153  'OAUTH_MICROSOFT_NAME',
154  'OAUTH_MICROSOFT_ID',
155  'OAUTH_MICROSOFT_SECRET',
156  ),
157  array(
158  'OAUTH_NEST_NAME',
159  'OAUTH_NEST_ID',
160  'OAUTH_NEST_SECRET',
161  ),
162  array(
163  'OAUTH_NETATMO_NAME',
164  'OAUTH_NETATMO_ID',
165  'OAUTH_NETATMO_SECRET',
166  ),
167  array(
168  'OAUTH_PARROTFLOWERPOWER_NAME',
169  'OAUTH_PARROTFLOWERPOWER_ID',
170  'OAUTH_PARROTFLOWERPOWER_SECRET',
171  ),
172  array(
173  'OAUTH_PAYPAL_NAME',
174  'OAUTH_PAYPAL_ID',
175  'OAUTH_PAYPAL_SECRET',
176  ),
177  array(
178  'OAUTH_POCKET_NAME',
179  'OAUTH_POCKET_ID',
180  'OAUTH_POCKET_SECRET',
181  ),
182  array(
183  'OAUTH_QUICKBOOKS_NAME',
184  'OAUTH_QUICKBOOKS_ID',
185  'OAUTH_QUICKBOOKS_SECRET',
186  ),
187  array(
188  'OAUTH_REDDIT_NAME',
189  'OAUTH_REDDIT_ID',
190  'OAUTH_REDDIT_SECRET',
191  ),
192  array(
193  'OAUTH_REDMINE_NAME',
194  'OAUTH_REDMINE_ID',
195  'OAUTH_REDMINE_SECRET',
196  ),
197  array(
198  'OAUTH_RUNKEEPER_NAME',
199  'OAUTH_RUNKEEPER_ID',
200  'OAUTH_RUNKEEPER_SECRET',
201  ),
202  array(
203  'OAUTH_SCOOPIT_NAME',
204  'OAUTH_SCOOPIT_ID',
205  'OAUTH_SCOOPIT_SECRET',
206  ),
207  array(
208  'OAUTH_SOUNDCLOUD_NAME',
209  'OAUTH_SOUNDCLOUD_ID',
210  'OAUTH_SOUNDCLOUD_SECRET',
211  ),
212  array(
213  'OAUTH_SPOTIFY_NAME',
214  'OAUTH_SPOTIFY_ID',
215  'OAUTH_SPOTIFY_SECRET',
216  ),
217  array(
218  'OAUTH_STRAVA_NAME',
219  'OAUTH_STRAVA_ID',
220  'OAUTH_STRAVA_SECRET',
221  ),
222  array(
223  'OAUTH_STRIPE_TEST_NAME',
224  'OAUTH_STRIPE_TEST_ID',
225  'STRIPE_TEST_SECRET_KEY',
226  ),
227  array(
228  'OAUTH_STRIPE_LIVE_NAME',
229  'OAUTH_STRIPE_LIVE_ID',
230  'STRIPE_LIVE_SECRET_KEY',
231  ),
232  array(
233  'OAUTH_TUMBLR_NAME',
234  'OAUTH_TUMBLR_ID',
235  'OAUTH_TUMBLR_SECRET',
236  ),
237  array(
238  'OAUTH_TWITTER_NAME',
239  'OAUTH_TWITTER_ID',
240  'OAUTH_TWITTER_SECRET',
241  ),
242  array(
243  'OAUTH_USTREAM_NAME',
244  'OAUTH_USTREAM_ID',
245  'OAUTH_USTREAM_SECRET',
246  ),
247  array(
248  'OAUTH_VIMEO_NAME',
249  'OAUTH_VIMEO_ID',
250  'OAUTH_VIMEO_SECRET',
251  ),
252  array(
253  'OAUTH_YAHOO_NAME',
254  'OAUTH_YAHOO_ID',
255  'OAUTH_YAHOO_SECRET',
256  ),
257  array(
258  'OAUTH_YAMMER_NAME',
259  'OAUTH_YAMMER_ID',
260  'OAUTH_YAMMER_SECRET',
261  ),
262 );
263 
264 
265 
272 {
273  global $langs, $conf;
274  $h = 0;
275  $head = array();
276 
277  $head[$h][0] = dol_buildpath('/admin/oauth.php', 1);
278  $head[$h][1] = $langs->trans("OAuthServices");
279  $head[$h][2] = 'services';
280  $h++;
281 
282  $head[$h][0] = dol_buildpath('/admin/oauthlogintokens.php', 1);
283  $head[$h][1] = $langs->trans("TokenManager");
284  $head[$h][2] = 'tokengeneration';
285  $h++;
286 
287  complete_head_from_modules($conf, $langs, null, $head, $h, 'oauthadmin');
288 
289  complete_head_from_modules($conf, $langs, null, $head, $h, 'oauthadmin', 'remove');
290 
291 
292  return $head;
293 }
oauthadmin_prepare_head
oauthadmin_prepare_head()
Return array of tabs to used on pages to setup cron module.
Definition: oauth.lib.php:271
dol_buildpath
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
Definition: functions.lib.php:1062
complete_head_from_modules
complete_head_from_modules($conf, $langs, $object, &$head, &$h, $type, $mode='add')
Complete or removed entries into a head array (used to build tabs).
Definition: functions.lib.php:9038