Location: PHPKode > projects > Network Configuration Store > NCS-3.0.2/wwwroot/Settings/Logging.php
<?php

require_once('./CS_Includes.inc.php');

try {
	if (isset($_GET['submit']))
	{
		// No parameters are mandatory in this section.
		// FIXME - directory checks??

		$CS->getDb()->UpdateRecord('UPDATE `options` SET `log_enable` = ?, `log_debug` = ?, `log_path` = ?, `log_max_history` = ?',
			array($_POST['log_enable'], $_POST['log_debug'], $_POST['log_path'], $_POST['log_max_history']));
		header('Location: Logging.php?updated');
		exit();
	}
	else
	{
		$logForm = new CSForm('Logging.php?submit');
		$logForm->AddButton(new CSFormControl(CSF_SUBMIT, array('value' => 'Submit')));
		$logForm->AddButton(new CSFormControl(CSF_RESET, array('value' => 'Reset')));

		// options.log_enable
		//
		$s = $logForm->AddControl('<strong>Logging</strong><br />Defines whether logs should be enabled or disabled.',
				new CSFormControl(CSF_RADIO, array('name' => 'log_enable', 'value' => 1,
								'id' => 'log_enable_on', 'checked' => ($CS->GetOption('log_enable') == 1))));
		$s->AddChild(new CSFormControl(CSF_LABEL, array('for' => 'log_enable_on', 'text' => 'Enabled')));
		$s->AddChild(new CSFormControl(CSF_RADIO, array('name' => 'log_enable', 'value' => 0,
								'id' => 'log_enable_off', 'checked' => ($CS->GetOption('log_enable') == 0))));
		$s->AddChild(new CSFormControl(CSF_LABEL, array('for' => 'log_enable_off', 'text' => 'Disabled')));

		// options.log_debug
		//
		$s = $logForm->AddControl('<strong>Debugging</strong><br />Defines whether to generate debug log files. (Requires logging enabled.)',
				new CSFormControl(CSF_RADIO, array('name' => 'log_debug', 'value' => 1,
								'id' => 'log_debug_on', 'checked' => ($CS->GetOption('log_debug') == TRUE))));
		$s->AddChild(new CSFormControl(CSF_LABEL, array('for' => 'log_debug_on', 'text' => 'Enabled')));
		$s->AddChild(new CSFormControl(CSF_RADIO, array('name' => 'log_debug', 'value' => 0,
								'id' => 'log_debug_off', 'checked' => ($CS->GetOption('log_debug') == FALSE))));
		$s->Addchild(new CSFormControl(CSF_LABEL, array('for' => 'log_debug_off', 'text' => 'Disabled')));

		// options.log_path
		//
		$logForm->AddControl('<strong>Log Path</strong><br />Specifies where log files should be stored on the server.',
				new CSFormControl(CSF_TEXTBOX, array('name' => 'log_path', 'value' => $CS->GetOption('log_path'), 'size' => '40')));

		// options.log_max_history
		//
		$logForm->AddControl('<strong>Maximum Log History</strong><br />Specifies how many days worth of logs to keep.',
				new CSFormControl(CSF_TEXTBOX, array('name' => 'log_max_history', 'value' => $CS->GetOption('log_max_history'), 'size' => '10')));
	}
}
catch (Exception $e) {
	CS::Abort($e);
}

CS::PrintHtmlHeader('Logging - Settings');

?>

<body id="Main">

	<h1>Logging</h1>
	<p>These parameters define what logs Network Configuration Store should create and how they
	are managed.</p>

	<?php if (isset($_GET['updated'])): ?>
		<p class="InfoMsg">Options successfully updated.</p>
	<?php endif; ?>

	<?php $logForm->InsertHtml(); ?>

</body>
</html>
Return current item: Network Configuration Store