From 0fbd41a8847f6879ae80c883018c519735f117b4 Mon Sep 17 00:00:00 2001 From: Eric Espie Date: Wed, 7 Jun 2023 17:30:39 +0200 Subject: [PATCH] Merge remote-tracking branch 'origin/support/2.7' into support/3.0 -> fix syntax error --- synchro/synchro_exec.php | 63 +++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 33 deletions(-) diff --git a/synchro/synchro_exec.php b/synchro/synchro_exec.php index 3946b66b7..08174954d 100644 --- a/synchro/synchro_exec.php +++ b/synchro/synchro_exec.php @@ -102,51 +102,49 @@ if (utils::IsModeCLI()) exit -1; } } -else -{ +else { require_once(APPROOT.'/application/loginwebpage.class.inc.php'); //N°6022 - Make synchro scripts work by http via token authentication with SYNCHRO scopes $oCtx = new ContextTag(ContextTag::TAG_SYNCHRO); - LoginWebPage::ResetSession(true); + LoginWebPage::ResetSession(true); $iRet = LoginWebPage::DoLogin(false, false, LoginWebPage::EXIT_RETURN); - if ($iRet !== LoginWebPage::EXIT_CODE_OK) { - switch ($iRet) { - case LoginWebPage::EXIT_CODE_MISSINGLOGIN: - $oP->p("Missing parameter 'auth_user'"); - break; + if ($iRet !== LoginWebPage::EXIT_CODE_OK) { + switch ($iRet) { + case LoginWebPage::EXIT_CODE_MISSINGLOGIN: + $oP->p("Missing parameter 'auth_user'"); + break; - case LoginWebPage::EXIT_CODE_MISSINGPASSWORD: - $oP->p("Missing parameter 'auth_pwd'"); - break; + case LoginWebPage::EXIT_CODE_MISSINGPASSWORD: + $oP->p("Missing parameter 'auth_pwd'"); + break; - case LoginWebPage::EXIT_CODE_WRONGCREDENTIALS: - $oP->p('Invalid login'); - break; + case LoginWebPage::EXIT_CODE_WRONGCREDENTIALS: + $oP->p('Invalid login'); + break; - case LoginWebPage::EXIT_CODE_PORTALUSERNOTAUTHORIZED: - $oP->p('Portal user is not allowed'); - break; + case LoginWebPage::EXIT_CODE_PORTALUSERNOTAUTHORIZED: + $oP->p('Portal user is not allowed'); + break; - case LoginWebPage::EXIT_CODE_NOTAUTHORIZED: - $oP->p('This user is not authorized to use the web services. (The profile REST Services User is required to access the REST web services)'); - break; + case LoginWebPage::EXIT_CODE_NOTAUTHORIZED: + $oP->p('This user is not authorized to use the web services. (The profile REST Services User is required to access the REST web services)'); + break; - default: - $oP->p("Unknown authentication error (retCode=$iRet)"); - } - $oP->output(); - exit -1; - } + default: + $oP->p("Unknown authentication error (retCode=$iRet)"); + } + $oP->output(); + exit - 1; + } -$bSimulate = (utils::ReadParam('simulate', '0', true) == '1'); -$sDataSourcesList = ReadMandatoryParam($oP, 'data_sources', 'raw_data'); // May contain commas + $bSimulate = (utils::ReadParam('simulate', '0', true) == '1'); + $sDataSourcesList = ReadMandatoryParam($oP, 'data_sources', 'raw_data'); // May contain commas -if ($sDataSourcesList == null) -{ - UsageAndExit($oP); + if ($sDataSourcesList == null) { + UsageAndExit($oP); + } } - foreach(explode(',', $sDataSourcesList) as $iSDS) { $oSynchroDataSource = MetaModel::GetObject('SynchroDataSource', $iSDS, false); @@ -206,4 +204,3 @@ foreach(explode(',', $sDataSourcesList) as $iSDS) } $oP->output(); -?>