SATS/lib/include/func

30 lines
690 B
Plaintext
Raw Normal View History

#!/usr/bin/php
<?php
2017-01-27 14:54:30 +00:00
/* [1] Launches external script
=========================================================*/
function syscall($callable=null){
2017-01-27 14:54:30 +00:00
ini_set('display_errors', 'On');
error_reporting(E_ALL);
/* (1) Check file */
2017-01-27 14:54:30 +00:00
if( is_null($callable) || !file_exists($callable) )
return false;
/* (2) Call and catch output */
ob_start();
include $callable;
$out = ob_get_clean();
2017-01-27 14:54:30 +00:00
/* (3) Remove unnecessary (#!/usr/bin/php) from input */
$out = preg_replace("/^(\s*#!\/usr\/bin\/php\s*)*/", "", $out);
$out = preg_replace("/\s$/", "", $out);
/* (4) Manage result */
if( is_numeric($out) ) return ($out==0);
else return $out;
}
?>