Line 39... |
Line 39... |
39 |
*/
|
39 |
*/
|
40 |
|
40 |
|
41 |
define ( 'VERSION', '1.0' );
|
41 |
define ( 'VERSION', '1.0' );
|
42 |
define ( 'BUILD_DATE', '2016-04-03' );
|
42 |
define ( 'BUILD_DATE', '2016-04-03' );
|
43 |
define ( 'STORAGE_PATH', '/home/camp/sysinfo_reports/http' );
|
43 |
define ( 'STORAGE_PATH', '/home/camp/sysinfo_reports/http' );
|
- |
|
44 |
define ( 'TESTING', false );
|
44 |
|
45 |
|
45 |
function sanitize_filename ( $filename, $allowed = 'a-zA-Z0-9-', $special_chars = '_', $replace_char = '-', $removeDups = true ) {
|
46 |
function sanitize_filename ( $filename, $allowed = 'a-zA-Z0-9-', $special_chars = '_', $replace_char = '-', $removeDups = true ) {
|
46 |
$filename = str_replace( $allowed . $special_chars,$replace_char, $filename );
|
47 |
$filename = str_replace( $allowed . $special_chars,$replace_char, $filename );
|
47 |
if ( $removeDups )
|
48 |
if ( $removeDups )
|
48 |
$filename = preg_replace( "/($replace_char)+/", $replace_char, $filename );
|
49 |
$filename = preg_replace( "/($replace_char)+/", $replace_char, $filename );
|
Line 75... |
Line 76... |
75 |
print "Unable to parse date [$date]";
|
76 |
print "Unable to parse date [$date]";
|
76 |
// set it to empty so we won't do any work.
|
77 |
// set it to empty so we won't do any work.
|
77 |
$date = '';
|
78 |
$date = '';
|
78 |
}
|
79 |
}
|
79 |
|
80 |
|
80 |
file_put_contents( STORAGE_PATH . '/report.log', print_r( $report, true ) );
|
81 |
// file_put_contents( STORAGE_PATH . '/report.log', print_r( $report, true ) );
|
81 |
if ( empty( $date ) or empty( $client ) or empty( $hostname ) or empty( $report ) ) {
|
82 |
if ( empty( $date ) or empty( $client ) or empty( $hostname ) or empty( $report ) ) {
|
82 |
print( "You must pass a date, client, hostname and report. The values read were\n<br />" );
|
83 |
print( "You must pass a date, client, hostname and report. The values read were\n<br />" );
|
83 |
print "Date=[$date]\n<br />Client=[$client]\n<br />Hostname=[$hostname]\n<br />";
|
84 |
print "Date=[$date]\n<br />Client=[$client]\n<br />Hostname=[$hostname]\n<br />";
|
84 |
print "Report is\n<br /><pre>";
|
85 |
print "Report is\n<br /><pre>";
|
85 |
print_r( $report );
|
86 |
print_r( $report );
|