function ReportErrorAndExit($sErrorMessage) { if (utils::IsModeCLI()) { $oP = new CLIPage("iTop - Export"); $oP->p('ERROR: ' . $sErrorMessage); $oP->output(); exit - 1; } else { $oP = new WebPage("iTop - Export"); $oP->p('ERROR: ' . $sErrorMessage); $oP->output(); exit - 1; } }
return trim($sValue); } ///////////////////////////////// // Main program if (!utils::IsModeCLI()) { $oP = new WebPage(Dict::S("TitleSynchroExecution")); $oP->p("This page is used internally by iTop"); $oP->output(); exit - 2; } $oP = new CLIPage(Dict::S("TitleSynchroExecution")); try { utils::UseParamFile(); } catch (Exception $e) { $oP->p("Error: " . $e->GetMessage()); $oP->output(); exit - 2; } // Next steps: // specific arguments: 'csvfile' // $sAuthUser = ReadMandatoryParam($oP, 'auth_user', 'raw_data'); $sAuthPwd = ReadMandatoryParam($oP, 'auth_pwd', 'raw_data'); if (UserRights::CheckCredentials($sAuthUser, $sAuthPwd)) { UserRights::Login($sAuthUser); // Login & set the user's language } else { $oP->p("Access restricted or wrong credentials ('{$sAuthUser}')"); $oP->output(); exit - 1; }