2013-11-03 23:03:57 +00:00
|
|
|
<?php
|
|
|
|
|
2015-07-10 11:36:21 +00:00
|
|
|
/*
|
|
|
|
* Configuration to JSON converter
|
|
|
|
* Written by Job Snijders <job@instituut.net>
|
|
|
|
*
|
|
|
|
*/
|
2013-11-03 23:03:57 +00:00
|
|
|
|
2013-11-25 20:33:33 +00:00
|
|
|
$defaults_file = 'includes/defaults.inc.php';
|
2015-07-10 11:36:21 +00:00
|
|
|
$config_file = 'config.php';
|
2013-11-03 23:03:57 +00:00
|
|
|
|
2013-11-25 20:35:55 +00:00
|
|
|
// move to install dir
|
2013-11-03 23:03:57 +00:00
|
|
|
chdir(dirname($argv[0]));
|
|
|
|
|
2015-07-13 18:10:26 +00:00
|
|
|
function iscli() {
|
2015-07-10 11:36:21 +00:00
|
|
|
if (php_sapi_name() == 'cli' && empty($_SERVER['REMOTE_ADDR'])) {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2013-11-03 23:03:57 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// check if we are running throw the CLI, otherwise abort
|
2015-07-10 11:36:21 +00:00
|
|
|
if (iscli()) {
|
|
|
|
include_once $defaults_file;
|
|
|
|
include_once $config_file;
|
|
|
|
print (json_encode($config));
|
2013-11-03 23:03:57 +00:00
|
|
|
}
|