mantisbt-plugins / GoogleOauth

Google Oauth 2.0 function for mantisBT.
Other
9 stars 16 forks source link

Use of undefined constant #20

Closed fgarciapatino closed 2 years ago

fgarciapatino commented 5 years ago

I am having the following error after selecting the google account. I check the refered configuration variables are properly set, so I can not trace the error source.

SYSTEM NOTICE: 'Use of undefined constant plugin_GoogleOauth_clientId - assumed 'plugin_GoogleOauth_clientId'' in 'C:\xampp\htdocs\mantisbt\plugins\GoogleOauth\pages\redirect.php' line 11 SYSTEM NOTICE: 'Use of undefined constant plugin_GoogleOauth_clientSecret - assumed 'plugin_GoogleOauth_clientSecret'' in 'C:\xampp\htdocs\mantisbt\plugins\GoogleOauth\pages\redirect.php' line 12 SYSTEM NOTICE: 'Use of undefined constant plugin_GoogleOauth_redirect_uri - assumed 'plugin_GoogleOauth_redirect_uri'' in 'C:\xampp\htdocs\mantisbt\plugins\GoogleOauth\pages\redirect.php' line 13 SYSTEM NOTICE: 'Undefined variable: redirect_uri' in 'C:\xampp\htdocs\mantisbt\plugins\GoogleOauth\pages\redirect.php' line 20

fgarciapatino commented 5 years ago

Solved: It is related with the PHP version

In page "redirect.php", change lines:

11: $client->setClientId(config_get(plugin_GoogleOauth_clientId)); 12: $client->setClientSecret(config_get(plugin_GoogleOauth_clientSecret)); 13: $client->setRedirectUri(config_get(plugin_GoogleOauth_redirect_uri));

20: #header('Location: ' . filter_var($redirect_uri, FILTER_SANITIZE_URL)); # I can not find where is defined $redirect_uri

To

11: $client->setClientId(config_get( 'plugin_GoogleOauth_clientId' )); 12: $client->setClientSecret(config_get( 'plugin_GoogleOauth_clientSecret' )); 13: $client->setRedirectUri(config_get( 'plugin_GoogleOauth_redirect_uri'));

20: #header('Location: ' . filter_var(config_get( 'plugin_GoogleOauth_redirect_uri'), FILTER_SANITIZE_URL));