if ($_SESSION['SourceType'] == SOURCE_DISK) { $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_DISK;\n" . "\$CFG['Sources']['Source1']['LogLineType'] = '" . ReplaceDollarChar($_SESSION['SourceLogLineType']) . "';\n" . "\$CFG['Sources']['Source1']['DiskFile'] = '" . ReplaceDollarChar($_SESSION['SourceDiskFile']) . "';\n" . ""; } else { if ($_SESSION['SourceType'] == SOURCE_DB) { // Need to create the LIST first! CreateDBTypesList($_SESSION['SourceDBType']); $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_DB;\n" . "\$CFG['Sources']['Source1']['DBTableType'] = '" . ReplaceDollarChar($_SESSION['SourceDBTableType']) . "';\n" . "\$CFG['Sources']['Source1']['DBType'] = " . ReplaceDollarChar($content['DBTYPES'][$_SESSION['SourceDBType']]['typeastext']) . ";\n" . "\$CFG['Sources']['Source1']['DBServer'] = '" . ReplaceDollarChar($_SESSION['SourceDBServer']) . "';\n" . "\$CFG['Sources']['Source1']['DBName'] = '" . ReplaceDollarChar($_SESSION['SourceDBName']) . "';\n" . "\$CFG['Sources']['Source1']['DBUser'] = '******'SourceDBUser']) . "';\n" . "\$CFG['Sources']['Source1']['DBPassword'] = '******'SourceDBPassword']) . "';\n" . "\$CFG['Sources']['Source1']['DBTableName'] = '" . ReplaceDollarChar($_SESSION['SourceDBTableName']) . "';\n" . "\$CFG['Sources']['Source1']['DBEnableRowCounting'] = " . ReplaceDollarChar($_SESSION['SourceDBEnableRowCounting']) . ";\n" . ""; } else { if ($_SESSION['SourceType'] == SOURCE_PDO) { // Need to create the LIST first! CreateDBTypesList($_SESSION['SourceDBType']); $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_PDO;\n" . "\$CFG['Sources']['Source1']['DBTableType'] = '" . ReplaceDollarChar($_SESSION['SourceDBTableType']) . "';\n" . "\$CFG['Sources']['Source1']['DBType'] = " . ReplaceDollarChar($content['DBTYPES'][$_SESSION['SourceDBType']]['typeastext']) . ";\n" . "\$CFG['Sources']['Source1']['DBServer'] = '" . ReplaceDollarChar($_SESSION['SourceDBServer']) . "';\n" . "\$CFG['Sources']['Source1']['DBName'] = '" . ReplaceDollarChar($_SESSION['SourceDBName']) . "';\n" . "\$CFG['Sources']['Source1']['DBUser'] = '******'SourceDBUser']) . "';\n" . "\$CFG['Sources']['Source1']['DBPassword'] = '******'SourceDBPassword']) . "';\n" . "\$CFG['Sources']['Source1']['DBTableName'] = '" . ReplaceDollarChar($_SESSION['SourceDBTableName']) . "';\n" . "\$CFG['Sources']['Source1']['DBEnableRowCounting'] = " . ReplaceDollarChar($_SESSION['SourceDBEnableRowCounting']) . ";\n" . ""; } else { if ($_SESSION['SourceType'] == SOURCE_MONGODB) { // Need to create the LIST first! CreateDBTypesList($_SESSION['SourceDBType']); $firstsource .= "\$CFG['Sources']['Source1']['SourceType'] = SOURCE_MONGODB;\n" . "\$CFG['Sources']['Source1']['DBTableType'] = '" . ReplaceDollarChar($_SESSION['SourceDBTableType']) . "';\n" . "\$CFG['Sources']['Source1']['DBServer'] = '" . ReplaceDollarChar($_SESSION['SourceDBServer']) . "';\n" . "\$CFG['Sources']['Source1']['DBName'] = '" . ReplaceDollarChar($_SESSION['SourceDBName']) . "';\n" . "\$CFG['Sources']['Source1']['DBUser'] = '******'SourceDBUser']) . "';\n" . "\$CFG['Sources']['Source1']['DBPassword'] = '******'SourceDBPassword']) . "';\n" . "\$CFG['Sources']['Source1']['DBTableName'] = '" . ReplaceDollarChar($_SESSION['SourceDBTableName']) . "';\n" . ""; } } } } $patterns[] = "/\\/\\/ --- \\%Insert Source Here\\%/"; $replacements[] = $firstsource; // One call to replace them all ^^ $filebuffer = preg_replace($patterns, $replacements, $filebuffer); // echo $filebuffer; // Create file and write config into it! $handle = fopen($content['BASEPATH'] . "config.php", "w"); if ($handle === false) { RevertOneStep($content['INSTALL_STEP'] - 1, GetAndReplaceLangStr($content['LN_INSTALL_FAILEDCREATECFGFILE'], $content['BASEPATH'] . "config.php")); }
$content['SourceViewID'] = $mysource['ViewID']; $content['VIEWS'] = $content['Views']; foreach ($content['VIEWS'] as $myView) { if ($myView['ID'] == $content['SourceViewID']) { $content['VIEWS'][$myView['ID']]['selected'] = "selected"; } else { $content['VIEWS'][$myView['ID']]['selected'] = ""; } } // SOURCE_DISK specific $content['SourceLogLineType'] = $mysource['LogLineType']; CreateLogLineTypesList($content['SourceLogLineType']); $content['SourceDiskFile'] = $mysource['DiskFile']; // SOURCE_DB specific $content['SourceDBType'] = $mysource['DBType']; CreateDBTypesList($content['SourceDBType']); $content['SourceDBTableType'] = $mysource['DBTableType']; CreateDBMappingsList($content['SourceDBTableType']); $content['SourceDBName'] = $mysource['DBName']; $content['SourceDBServer'] = $mysource['DBServer']; $content['SourceDBTableName'] = $mysource['DBTableName']; $content['SourceDBUser'] = $mysource['DBUser']; $content['SourceDBPassword'] = $mysource['DBPassword']; $content['SourceDBEnableRowCounting'] = $mysource['DBEnableRowCounting']; if ($content['SourceDBEnableRowCounting'] == 1) { $content['SourceDBEnableRowCounting_true'] = "checked"; $content['SourceDBEnableRowCounting_false'] = ""; } else { $content['SourceDBEnableRowCounting_true'] = ""; $content['SourceDBEnableRowCounting_false'] = "checked"; }