Skip to content

Commit 18ef560

Browse files
committed
Cleaned up and formatted code - some adjustments to selected files
The following adjustments were made: - Formate source code - Files should end with a newline (PHP:S113) - Control structures should use curly braces (PHP:S121) - Sections of code should not be commented out (PHP:S125) - Mergeable "if" statements should be combined (PHP:S1066) - Empty statements should be removed (PHP:S1116) - Boolean literals should not be redundant (PHP:S1125) - Lines should not end with trailing whitespaces (PHP:S1131) - Use empty() to check whether the array is empty or not (PHP:S1155) - Unused local variables should be removed (PHP:S1481) - Local variables should not be declared and then immediately returned or thrown (PHP:1488) - Deprecated constructor declarations should not be used (PHP:S1603) - PHP keywords and constants "true", "false", "null" should be lower case (PHP:S1781) - "require_once" and "include_once" should be used instead of "require" and "include" (PHP:S2003) - Unnecessary parentheses should not be used for constructs (PHP:S6600)
1 parent 6ec344c commit 18ef560

158 files changed

Lines changed: 19245 additions & 19384 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
1-
<?php
2-
# filesource oauth.gitlab.inc.php
3-
#
4-
# Some useful examples/documentation
5-
# https://docs.gitlab.com/ce/api/oauth2.html
6-
# https://grafana.com/docs/grafana/latest/auth/gitlab/
7-
8-
# Libraries used to create client
9-
# https://github.com/thephpleague/oauth2-client
10-
# https://github.com/omines/oauth2-gitlab
11-
#
12-
# IMPORTANT NOTICE
13-
# key in $tlCfg->OAuthServers[]
14-
# can be anything you want that make this configuration
15-
# does not overwrite other or will be overwritten
16-
#
17-
# HOW TO use this file ?
18-
# 1. copy this file to
19-
# [TESTLINK_INSTALL]/cfg/
20-
#
21-
# 2. configure according your application
22-
#
23-
# 3. add the following line to your custom_config.inc.php
24-
# require('aouth.gitlab.inc.php');
25-
#
26-
# ##############################################################
27-
#
28-
# This is a working example for test site
29-
# http://fman.hopto.org/
30-
#
31-
# You need to create the configuration for your site
32-
# This is only a working example that is useful
33-
# for the TestLink Development Team
34-
#
35-
$tlCfg->OAuthServers['gitlab'] = array();
36-
37-
$tlCfg->OAuthServers['gitlab']['redirect_uri'] =
38-
'http://fman.hopto.org/login.php?oauth=gitlab';
39-
40-
$tlCfg->OAuthServers['gitlab']['oauth_enabled'] = true;
41-
$tlCfg->OAuthServers['gitlab']['oauth_name'] = 'gitlab';
42-
43-
$tlCfg->OAuthServers['gitlab']['oauth_client_id'] =
44-
'27a03c93d60b5ddb4e0cef92149678fbe37c099733605e046a5428a9da4177ba';
45-
1+
<?php
2+
# filesource oauth.gitlab.inc.php
3+
#
4+
# Some useful examples/documentation
5+
# https://docs.gitlab.com/ce/api/oauth2.html
6+
# https://grafana.com/docs/grafana/latest/auth/gitlab/
7+
8+
# Libraries used to create client
9+
# https://github.com/thephpleague/oauth2-client
10+
# https://github.com/omines/oauth2-gitlab
11+
#
12+
# IMPORTANT NOTICE
13+
# key in $tlCfg->OAuthServers[]
14+
# can be anything you want that make this configuration
15+
# does not overwrite other or will be overwritten
16+
#
17+
# HOW TO use this file ?
18+
# 1. copy this file to
19+
# [TESTLINK_INSTALL]/cfg/
20+
#
21+
# 2. configure according your application
22+
#
23+
# 3. add the following line to your custom_config.inc.php
24+
# require('aouth.gitlab.inc.php');
25+
#
26+
# ##############################################################
27+
#
28+
# This is a working example for test site
29+
# http://fman.hopto.org/
30+
#
31+
# You need to create the configuration for your site
32+
# This is only a working example that is useful
33+
# for the TestLink Development Team
34+
#
35+
$tlCfg->OAuthServers['gitlab'] = array();
36+
37+
$tlCfg->OAuthServers['gitlab']['redirect_uri'] = 'http://fman.hopto.org/login.php?oauth=gitlab';
38+
39+
$tlCfg->OAuthServers['gitlab']['oauth_enabled'] = true;
40+
$tlCfg->OAuthServers['gitlab']['oauth_name'] = 'gitlab';
41+
42+
$tlCfg->OAuthServers['gitlab']['oauth_client_id'] = '27a03c93d60b5ddb4e0cef92149678fbe37c099733605e046a5428a9da4177ba';
43+
4644
$tlCfg->OAuthServers['gitlab']['oauth_client_secret'] = 'c157df291b81dbfd8084d38b155029baded3cf76c7449670bd2da889fe8b99eb';
Lines changed: 41 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,55 +1,52 @@
1-
<?php
2-
# filesource oauth.google.inc.php
3-
#
4-
# IMPORTANT NOTICE
5-
# key in $tlCfg->OAuthServers[]
6-
# can be anything you want that make this configuration
7-
# does not overwrite other or will be overwritten
8-
#
9-
# HOW TO use this file ?
10-
# 1. copy this file to
11-
# [TESTLINK_INSTALL]/cfg/
12-
#
13-
# 2. configure according your application
14-
#
15-
# 3. add the following line to your custom_config.inc.php
16-
# require('aouth.google.inc.php');
17-
#
18-
# #############################################################
19-
# Client implemented using
20-
# https://github.com/thephpleague/oauth2-google
21-
##
22-
# This is a working example for test site
23-
# http://fman.hopto.org/
24-
#
25-
# You need to create the configuration for your site
26-
# This is only a working example that is useful
27-
# for the TestLink Development Team
28-
#
29-
$tlCfg->OAuthServers['google'] = array();
30-
$tlCfg->OAuthServers['google']['redirect_uri'] =
31-
'http://fman.hopto.org/login.php?oauth=google';
32-
33-
$tlCfg->OAuthServers['google']['oauth_enabled'] = true;
34-
$tlCfg->OAuthServers['google']['oauth_name'] = 'google';
35-
36-
// Get from /gui/themes/default/images
37-
$tlCfg->OAuthServers['google']['oauth_client_id'] =
38-
'860603525614-fscj9cgr2dvks51uh6odl67skec536fd.apps.googleusercontent.com';
39-
40-
$tlCfg->OAuthServers['google']['oauth_client_secret'] =
41-
'_YOKquNTa4Fux-OMJoxDBuov';
1+
<?php
2+
# filesource oauth.google.inc.php
3+
#
4+
# IMPORTANT NOTICE
5+
# key in $tlCfg->OAuthServers[]
6+
# can be anything you want that make this configuration
7+
# does not overwrite other or will be overwritten
8+
#
9+
# HOW TO use this file ?
10+
# 1. copy this file to
11+
# [TESTLINK_INSTALL]/cfg/
12+
#
13+
# 2. configure according your application
14+
#
15+
# 3. add the following line to your custom_config.inc.php
16+
# require('aouth.google.inc.php');
17+
#
18+
# #############################################################
19+
# Client implemented using
20+
# https://github.com/thephpleague/oauth2-google
21+
# #
22+
# This is a working example for test site
23+
# http://fman.hopto.org/
24+
#
25+
# You need to create the configuration for your site
26+
# This is only a working example that is useful
27+
# for the TestLink Development Team
28+
#
29+
$tlCfg->OAuthServers['google'] = array();
30+
$tlCfg->OAuthServers['google']['redirect_uri'] = 'http://fman.hopto.org/login.php?oauth=google';
31+
32+
$tlCfg->OAuthServers['google']['oauth_enabled'] = true;
33+
$tlCfg->OAuthServers['google']['oauth_name'] = 'google';
34+
35+
// Get from /gui/themes/default/images
36+
$tlCfg->OAuthServers['google']['oauth_client_id'] = '860603525614-fscj9cgr2dvks51uh6odl67skec536fd.apps.googleusercontent.com';
37+
38+
$tlCfg->OAuthServers['google']['oauth_client_secret'] = '_YOKquNTa4Fux-OMJoxDBuov';
4239

4340
// Needed when you use the cURL implementation
4441
// Can be authorization_code (by default), client_credentials or password
45-
// $tlCfg->OAuthServers['google']['oauth_grant_type'] = 'authorization_code';
42+
// $tlCfg->OAuthServers['google']['oauth_grant_type'] = 'authorization_code';
4643
//$tlCfg->OAuthServers['google']['oauth_url'] = 'https://accounts.google.com/o/oauth2/auth';
4744
//$tlCfg->OAuthServers['google']['token_url'] = 'https://accounts.google.com/o/oauth2/token';
4845

4946
// false => then the only user will be selected automatically (applied for google)
50-
//$tlCfg->OAuthServers['google']['oauth_force_single'] = false;
47+
//$tlCfg->OAuthServers['google']['oauth_force_single'] = false;
5148

5249
// the domain you want to whitelist
53-
//$tlCfg->OAuthServers['google']['oauth_domain'] = 'google.com';
50+
//$tlCfg->OAuthServers['google']['oauth_domain'] = 'google.com';
5451
//$tlCfg->OAuthServers['google']['oauth_profile'] = 'https://www.googleapis.com/oauth2/v1/userinfo';
5552
//$tlCfg->OAuthServers['google']['oauth_scope'] = 'https://www.googleapis.com/auth/userinfo.email https://www.googleapis.com/auth/userinfo.profile';
Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,37 @@
1-
<?php
2-
//
3-
// filesource oauth.microsoft.inc.php
4-
//
5-
// IMPORTANTE NOTICE
6-
// key in $tlCfg->OAuthServers[]
7-
// can be anything you want that make this configuration
8-
// does not overwrite other or will be overwritten
9-
//
10-
// HOW TO use this file ?
11-
// 1. copy this file to
12-
// [TESTLINK_INSTALL]/cfg/
13-
//
14-
// 2. configure according your application
15-
//
16-
// 3. add the following line to your custom_config.inc.php
17-
// require('aouth.microsoft.inc.php');
18-
//
19-
// -------------------------------------------------------------
20-
$tlCfg->OAuthServers['microsoft'] = array();
21-
$tlCfg->OAuthServers['microsoft']['redirect_uri'] = '';
22-
23-
$tlCfg->OAuthServers['microsoft']['oauth_enabled'] = true;
24-
$tlCfg->OAuthServers['microsoft']['oauth_name'] = 'microsoft';
25-
$tlCfg->OAuthServers['microsoft']['oauth_client_id'] = 'CLIENT_ID';
26-
$tlCfg->OAuthServers['microsoft']['oauth_client_secret'] = 'CLIENT_SECRET';
27-
28-
// Can be authorization_code (by default), client_credentials or password
29-
$tlCfg->OAuthServers['microsoft']['oauth_grant_type'] = 'authorization_code';
30-
$tlCfg->OAuthServers['microsoft']['oauth_url'] = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize';
31-
32-
$tlCfg->OAuthServers['microsoft']['token_url'] = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
33-
34-
$tlCfg->OAuthServers['microsoft']['oauth_force_single'] = true;
35-
$tlCfg->OAuthServers['microsoft']['oauth_profile'] = 'https://graph.microsoft.com/v1.0/me';
1+
<?php
2+
//
3+
// filesource oauth.microsoft.inc.php
4+
//
5+
// IMPORTANTE NOTICE
6+
// key in $tlCfg->OAuthServers[]
7+
// can be anything you want that make this configuration
8+
// does not overwrite other or will be overwritten
9+
//
10+
// HOW TO use this file ?
11+
// 1. copy this file to
12+
// [TESTLINK_INSTALL]/cfg/
13+
//
14+
// 2. configure according your application
15+
//
16+
// 3. add the following line to your custom_config.inc.php
17+
// require('aouth.microsoft.inc.php');
18+
//
19+
// -------------------------------------------------------------
20+
$tlCfg->OAuthServers['microsoft'] = array();
21+
$tlCfg->OAuthServers['microsoft']['redirect_uri'] = '';
22+
23+
$tlCfg->OAuthServers['microsoft']['oauth_enabled'] = true;
24+
$tlCfg->OAuthServers['microsoft']['oauth_name'] = 'microsoft';
25+
$tlCfg->OAuthServers['microsoft']['oauth_client_id'] = 'CLIENT_ID';
26+
$tlCfg->OAuthServers['microsoft']['oauth_client_secret'] = 'CLIENT_SECRET';
27+
28+
// Can be authorization_code (by default), client_credentials or password
29+
$tlCfg->OAuthServers['microsoft']['oauth_grant_type'] = 'authorization_code';
30+
$tlCfg->OAuthServers['microsoft']['oauth_url'] = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize';
31+
32+
$tlCfg->OAuthServers['microsoft']['token_url'] = 'https://login.microsoftonline.com/common/oauth2/v2.0/token';
33+
34+
$tlCfg->OAuthServers['microsoft']['oauth_force_single'] = true;
35+
$tlCfg->OAuthServers['microsoft']['oauth_profile'] = 'https://graph.microsoft.com/v1.0/me';
3636
$tlCfg->OAuthServers['microsoft']['oauth_scope'] = 'User.Read';
3737

Lines changed: 26 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,28 @@
1-
<?php
2-
#
3-
# 20200522 - tested OK
4-
# Application is registered for github user testlinkOAuth
5-
# using ngrok to provide a public URL.
6-
#
7-
# Here the command:
8-
# NOT IS THE CASE
9-
# ngrok http -region eu -subdomain=testlink 80
10-
#
11-
$tlCfg->OAuthServers[2]['redirect_uri'] =
12-
'http://fman.hopto.org/login.php?oauth=github';
13-
14-
$tlCfg->OAuthServers[2]['oauth_client_id'] ='aa5f70a8de342fb95043';
15-
$tlCfg->OAuthServers[2]['oauth_client_secret'] =
16-
'c8d61d5ec4ed4eb2ac81064c27043ddef351107e';
17-
18-
$tlCfg->OAuthServers[2]['oauth_enabled'] = true;
19-
$tlCfg->OAuthServers[2]['oauth_name'] = 'github';
20-
21-
// Can be authorization_code (by default), client_credentials or password
22-
$tlCfg->OAuthServers[2]['oauth_grant_type'] = 'authorization_code';
23-
$tlCfg->OAuthServers[2]['oauth_url'] = 'https://github.com/login/oauth/authorize';
24-
25-
$tlCfg->OAuthServers[2]['token_url'] = 'https://github.com/login/oauth/access_token';
26-
$tlCfg->OAuthServers[2]['oauth_force_single'] = false;
27-
$tlCfg->OAuthServers[2]['oauth_profile'] = 'https://api.github.com/user';
1+
<?php
2+
#
3+
# 20200522 - tested OK
4+
# Application is registered for github user testlinkOAuth
5+
# using ngrok to provide a public URL.
6+
#
7+
# Here the command:
8+
# NOT IS THE CASE
9+
# ngrok http -region eu -subdomain=testlink 80
10+
#
11+
$tlCfg->OAuthServers[2]['redirect_uri'] = 'http://fman.hopto.org/login.php?oauth=github';
12+
13+
$tlCfg->OAuthServers[2]['oauth_client_id'] = 'aa5f70a8de342fb95043';
14+
$tlCfg->OAuthServers[2]['oauth_client_secret'] = 'c8d61d5ec4ed4eb2ac81064c27043ddef351107e';
15+
16+
$tlCfg->OAuthServers[2]['oauth_enabled'] = true;
17+
$tlCfg->OAuthServers[2]['oauth_name'] = 'github';
18+
19+
// Can be authorization_code (by default), client_credentials or password
20+
$tlCfg->OAuthServers[2]['oauth_grant_type'] = 'authorization_code';
21+
$tlCfg->OAuthServers[2]['oauth_url'] = 'https://github.com/login/oauth/authorize';
22+
23+
$tlCfg->OAuthServers[2]['token_url'] = 'https://github.com/login/oauth/access_token';
24+
$tlCfg->OAuthServers[2]['oauth_force_single'] = false;
25+
$tlCfg->OAuthServers[2]['oauth_profile'] = 'https://api.github.com/user';
2826
$tlCfg->OAuthServers[2]['oauth_scope'] = 'user:email';
2927

30-
# End Of File
28+

firstLogin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232
doDBConnect($db, database::ONERROREXIT);
3333

34-
$message = ''; // lang_get('your_info_please');
34+
$message = '';
3535
if (! is_null($args->doEditUser)) {
3636
if (strcmp($args->password, $args->password2)) {
3737
$message = lang_get('passwd_dont_match');

0 commit comments

Comments
 (0)