예제 #1
0
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;
    }
}
 /**
  * Outputs (via some echo) the complete HTML page by assembling all its elements
  */
 public function output()
 {
     //$this->set_base($this->m_sRootUrl.'pages/');
     if (count($this->m_aReadyScripts) > 0) {
         $this->add_script("\$(document).ready(function() {\n" . implode("\n", $this->m_aReadyScripts) . "\n});");
     }
     parent::output();
 }
예제 #3
0
require_once APPROOT . '/application/startup.inc.php';
function ReadMandatoryParam($oP, $sParam, $sSanitizationFilter = 'parameter')
{
    $sValue = utils::ReadParam($sParam, null, true, $sSanitizationFilter);
    if (is_null($sValue)) {
        $oP->p("ERROR: Missing argument '{$sParam}'\n");
        exit(29);
    }
    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');