-function
-jirafeau_quoted ($str)
-{
- return QUOTE . str_replace (QUOTE, "\'", $str) . QUOTE;
-}
-
-function
-jirafeau_export_cfg ($cfg)
-{
- $handle = fopen (JIRAFEAU_CFG, 'w');
- fwrite ($handle, '<?php' . NL);
- fwrite ($handle,
- '/* ' .
- t ('This file was generated by the install process. ' .
- 'You can edit it. Please see config.original.php to understand the ' .
- 'configuration items.') . ' */' . NL);
- foreach ($cfg as $key => $item)
- {
- fwrite ($handle, '$cfg[' . jirafeau_quoted ($key) . '] = ');
- if (is_bool ($item))
- fwrite ($handle, ($item ? 'true' : 'false'));
- else if (is_string ($item))
- fwrite ($handle, jirafeau_quoted ($item));
- else if (is_int ($item))
- fwrite ($handle, $item);
- else if (is_array ($item))
- fwrite ($handle, str_replace(array("\n", "\r"), "",
- var_export ($item, true)));
- else
- fwrite ($handle, 'null');
- fwrite ($handle, ';'.NL);
- }
- /* No newline at the end of the file to be able to send headers. */
- fwrite ($handle, '?>');
- fclose ($handle);
-}