From 2cc99ee0898229cf7055ec2b528416e11872209d Mon Sep 17 00:00:00 2001 From: Pavel Astakhov Date: Fri, 6 Oct 2023 17:59:38 +0600 Subject: [PATCH] Sync changes from the server (#1) --- includes/Hooks.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/includes/Hooks.php b/includes/Hooks.php index 2efa990..1bdc21f 100644 --- a/includes/Hooks.php +++ b/includes/Hooks.php @@ -45,6 +45,9 @@ class Hooks { */ public static function doSignin ( Title &$title, $article, OutputPage $out, User $user, WebRequest $request, MediaWiki $mw ) { + + global $wgOpenIDEndpoint; + $sessionId = null; $sessionId = @$_COOKIE['fssessionid']; $wikiSessionId = @$_COOKIE['wiki_en_session']; @@ -66,8 +69,7 @@ public static function doSignin ( Title &$title, $article, OutputPage $out, User } // make sure we test if the session is expired before we auto-login // example 1135c3c1-4dc9-477c-b5dd-c41c57f6bedf-prod - // OLD $ch = curl_init("https://ident.familysearch.org/cis-public-api/v4/session/$sessionId"); - $ch = curl_init("https://ident.familysearch.org/service/ident/cis/cis-public-api/v4/session/$sessionId"); + $ch = curl_init("https://$wgOpenIDEndpoint/service/ident/cis/cis-public-api/v4/session/$sessionId"); // When we curl_exec, return a string rather than output directly curl_setopt ($ch, CURLOPT_RETURNTRANSFER, true); // Ask for JSON instead of XML @@ -83,8 +85,8 @@ public static function doSignin ( Title &$title, $article, OutputPage $out, User // make sure we have a valid user before we auto-login // if the session is stale, we'll have a statusCode of 453 // if there is no session, we'll have a user count of zero - if ( - ( !empty($objJson->statusCode) && ( $objJson->statusCode == 453 ) ) || + if ( + ( !empty($objJson->statusCode) && ( $objJson->statusCode == 453 ) ) || ( !count($objJson->users) ) ) { return;