Skip to content

Commit 6ec344c

Browse files
committed
Cleaned up and formatted code - some adjustments to selected files
The following adjustments were made: - Formate source code - Control structures should use curly braces (PHP:S121) - Mergeable "if" statements should be combined (PHP:S1066) - Redundant pairs of parentheses should be removed (PHP:1110) - Boolean literals should not be redundant (PHP:S1125) - Return of boolean expressions should not be wrapped into an "if-then-else" statement (PHP:S1126) - 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) - "elseif" keyword should be used in place of "else if" keywords (PHP:S1793) - Unused assignments should be removed (PHP:S1854) - "&&" and "||" should be used (PHP:S2010) - Unnecessary parentheses should not be used for constructs (PHP:S6600)
1 parent be7060f commit 6ec344c

135 files changed

Lines changed: 17367 additions & 17769 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.

cfg/const.inc.php

Lines changed: 1217 additions & 990 deletions
Large diffs are not rendered by default.
Lines changed: 57 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,62 +1,57 @@
1-
<?php
2-
//
3-
// filesource oauth.azuread.inc.php
4-
//
5-
// Azure AD
6-
// Fill in CLIENT_ID,
7-
// CLIENT_SECRET,
8-
// YOURTESTLINKSERVER,
9-
// TENANTID
10-
// with your information
11-
// See this article for registering an application: https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code
12-
// Make sure, you grant admint consent for it: https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/configure-user-consent
13-
14-
//
15-
// IMPORTANTE NOTICE
16-
// key in $tlCfg->OAuthServers[]
17-
// can be anything you want that make this configuration
18-
// does not overwrite other or will be overwritten
19-
//
20-
// HOW TO use this file ?
21-
// 1. copy this file to
22-
// [TESTLINK_INSTALL]/cfg/
23-
//
24-
// 2. configure according your application
25-
//
26-
// 3. add the following line to your custom_config.inc.php
27-
// require('aouth.azuread.inc.php');
28-
//
29-
// -------------------------------------------------------------
30-
$tlCfg->OAuthServers['azuread'] = array();
31-
32-
$tlCfg->OAuthServers['azuread']['redirect_uri'] = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') . $_SERVER['HTTP_HOST'] . '/login.php';
33-
34-
35-
$tlCfg->OAuthServers['azuread']['oauth_client_id'] = 'CHANGE_WITH_CLIENT_ID';
36-
$tlCfg->OAuthServers['azuread']['oauth_client_secret'] =
37-
'CHANGE_WITH_CLIENT_SECRET';
38-
39-
// https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0/.well-known/openid-configuration
40-
$azureADBaseURL = 'https://login.microsoftonline.com/CHANGE_WITH_TENANT_ID';
41-
$msGraphURL = 'https://graph.microsoft.com';
42-
$tlCfg->OAuthServers['azuread']['oauth_url'] =
43-
$azureADBaseURL . '/oauth2/v2.0/authorize';
44-
45-
$tlCfg->OAuthServers['azuread']['token_url'] =
46-
$azureADBaseURL . '/oauth2/v2.0/token';
47-
48-
$tlCfg->OAuthServers['azuread']['oauth_profile'] =
49-
$msGraphURL . '/oidc/userinfo';
50-
51-
52-
$tlCfg->OAuthServers['azuread']['oauth_enabled'] = true;
53-
$tlCfg->OAuthServers['azuread']['oauth_name'] = 'azuread'; //do not change this
54-
$tlCfg->OAuthServers['azuread']['oauth_force_single'] = true;
55-
$tlCfg->OAuthServers['azuread']['oauth_grant_type'] = 'authorization_code';
56-
57-
// the domain you want to whitelist (email domains)
58-
$tlCfg->OAuthServers['azuread']['oauth_domain'] = 'autsoft.hu';
59-
60-
61-
$tlCfg->OAuthServers['azuread']['oauth_scope'] =
62-
'https://graph.microsoft.com/mail.read https://graph.microsoft.com/user.read openid profile email';
1+
<?php
2+
//
3+
// filesource oauth.azuread.inc.php
4+
//
5+
// Azure AD
6+
// Fill in CLIENT_ID,
7+
// CLIENT_SECRET,
8+
// YOURTESTLINKSERVER,
9+
// TENANTID
10+
// with your information
11+
// See this article for registering an application: https://docs.microsoft.com/en-us/azure/active-directory/develop/v1-protocols-oauth-code
12+
// Make sure, you grant admint consent for it: https://docs.microsoft.com/en-us/azure/active-directory/manage-apps/configure-user-consent
13+
14+
//
15+
// IMPORTANTE NOTICE
16+
// key in $tlCfg->OAuthServers[]
17+
// can be anything you want that make this configuration
18+
// does not overwrite other or will be overwritten
19+
//
20+
// HOW TO use this file ?
21+
// 1. copy this file to
22+
// [TESTLINK_INSTALL]/cfg/
23+
//
24+
// 2. configure according your application
25+
//
26+
// 3. add the following line to your custom_config.inc.php
27+
// require('aouth.azuread.inc.php');
28+
//
29+
// -------------------------------------------------------------
30+
$tlCfg->OAuthServers['azuread'] = array();
31+
32+
$tlCfg->OAuthServers['azuread']['redirect_uri'] = (empty($_SERVER['HTTPS']) ? 'http://' : 'https://') .
33+
$_SERVER['HTTP_HOST'] . '/login.php';
34+
35+
$tlCfg->OAuthServers['azuread']['oauth_client_id'] = 'CHANGE_WITH_CLIENT_ID';
36+
$tlCfg->OAuthServers['azuread']['oauth_client_secret'] = 'CHANGE_WITH_CLIENT_SECRET';
37+
38+
// https://login.microsoftonline.com/YOUR_TENANT_ID/v2.0/.well-known/openid-configuration
39+
$azureADBaseURL = 'https://login.microsoftonline.com/CHANGE_WITH_TENANT_ID';
40+
$msGraphURL = 'https://graph.microsoft.com';
41+
$tlCfg->OAuthServers['azuread']['oauth_url'] = $azureADBaseURL .
42+
'/oauth2/v2.0/authorize';
43+
44+
$tlCfg->OAuthServers['azuread']['token_url'] = $azureADBaseURL .
45+
'/oauth2/v2.0/token';
46+
47+
$tlCfg->OAuthServers['azuread']['oauth_profile'] = $msGraphURL . '/oidc/userinfo';
48+
49+
$tlCfg->OAuthServers['azuread']['oauth_enabled'] = true;
50+
$tlCfg->OAuthServers['azuread']['oauth_name'] = 'azuread'; // do not change this
51+
$tlCfg->OAuthServers['azuread']['oauth_force_single'] = true;
52+
$tlCfg->OAuthServers['azuread']['oauth_grant_type'] = 'authorization_code';
53+
54+
// the domain you want to whitelist (email domains)
55+
$tlCfg->OAuthServers['azuread']['oauth_domain'] = 'autsoft.hu';
56+
57+
$tlCfg->OAuthServers['azuread']['oauth_scope'] = 'https://graph.microsoft.com/mail.read https://graph.microsoft.com/user.read openid profile email';
Lines changed: 43 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,44 @@
1-
<?php
2-
#
3-
# @filename oauth.github.inc.php
4-
#
5-
# 20200522 - tested OK
6-
# Application is registered for github user testlinkOAuth
7-
# this user is owned by TestLink Development Team.
8-
#
9-
#
10-
# Client implemented using
11-
# https://github.com/thephpleague/oauth2-github
12-
#
13-
#
14-
# IMPORTANT NOTICE
15-
# key in $tlCfg->OAuthServers[]
16-
# can be anything you want that make this configuration
17-
# does not overwrite other or will be overwritten
18-
#
19-
# HOW TO use this file ?
20-
# 1. copy this file to
21-
# [TESTLINK_INSTALL]/cfg/
22-
#
23-
# 2. configure according your application
24-
#
25-
# 3. add the following line to your custom_config.inc.php
26-
# require('aouth.github.inc.php');
27-
#
28-
# ###########################################################
29-
# This is a working example for test site
30-
# http://fman.hopto.org/
31-
#
32-
# You need to create the configuration for your site
33-
# This is only a working example that is useful
34-
# for the TestLink Development Team
35-
#
36-
$tlCfg->OAuthServers['github'] = array();
37-
$tlCfg->OAuthServers['github']['redirect_uri'] =
38-
'http://fman.hopto.org/login.php?oauth=github';
39-
40-
$tlCfg->OAuthServers['github']['oauth_client_id'] ='aa5f70a8de342fb95043';
41-
$tlCfg->OAuthServers['github']['oauth_client_secret'] =
42-
'c8d61d5ec4ed4eb2ac81064c27043ddef351107e';
43-
44-
$tlCfg->OAuthServers['github']['oauth_enabled'] = true;
1+
<?php
2+
#
3+
# @filename oauth.github.inc.php
4+
#
5+
# 20200522 - tested OK
6+
# Application is registered for github user testlinkOAuth
7+
# this user is owned by TestLink Development Team.
8+
#
9+
#
10+
# Client implemented using
11+
# https://github.com/thephpleague/oauth2-github
12+
#
13+
#
14+
# IMPORTANT NOTICE
15+
# key in $tlCfg->OAuthServers[]
16+
# can be anything you want that make this configuration
17+
# does not overwrite other or will be overwritten
18+
#
19+
# HOW TO use this file ?
20+
# 1. copy this file to
21+
# [TESTLINK_INSTALL]/cfg/
22+
#
23+
# 2. configure according your application
24+
#
25+
# 3. add the following line to your custom_config.inc.php
26+
# require('aouth.github.inc.php');
27+
#
28+
# ###########################################################
29+
# This is a working example for test site
30+
# http://fman.hopto.org/
31+
#
32+
# You need to create the configuration for your site
33+
# This is only a working example that is useful
34+
# for the TestLink Development Team
35+
#
36+
$tlCfg->OAuthServers['github'] = array();
37+
$tlCfg->OAuthServers['github']['redirect_uri'] = 'http://fman.hopto.org/login.php?oauth=github';
38+
39+
$tlCfg->OAuthServers['github']['oauth_client_id'] = 'aa5f70a8de342fb95043';
40+
$tlCfg->OAuthServers['github']['oauth_client_secret'] = 'c8d61d5ec4ed4eb2ac81064c27043ddef351107e';
41+
42+
$tlCfg->OAuthServers['github']['oauth_enabled'] = true;
4543
$tlCfg->OAuthServers['github']['oauth_name'] = 'github';
46-
# End Of File
44+

0 commit comments

Comments
 (0)