SATS/lib/include/php/func

31 lines
786 B
Plaintext
Raw Normal View History

<?php
2017-01-27 14:54:30 +00:00
/* [1] Launches external script
=========================================================*/
function syscall($dependency=null){
/* (1) Check file */
if( is_null($dependency) || !file_exists($dependency) )
2017-01-27 14:54:30 +00:00
return false;
/* (2) Call and catch output */
$out = shell_exec($dependency);
/* (3) Clean output */
$out = preg_replace('/^\s+/', '', $out);
$out = preg_replace('/\s+$/', '', $out);
2017-01-27 14:54:30 +00:00
/* (4) Manage result */
if( is_numeric($out) ) return ($out==0);
else return $out;
}
/* [2] Log management
=========================================================*/
2017-01-30 09:59:52 +00:00
function slog($message="unknown error", $feature="main", $flag="daemon"){
file_put_contents(LOG_DIR."/$flag.log", time()." [$feature] $message\n", FILE_APPEND);
}
?>