SATS/lib/include/func

30 lines
690 B
PHP
Executable File

#!/usr/bin/php
<?php
/* [1] Launches external script
=========================================================*/
function syscall($callable=null){
ini_set('display_errors', 'On');
error_reporting(E_ALL);
/* (1) Check file */
if( is_null($callable) || !file_exists($callable) )
return false;
/* (2) Call and catch output */
ob_start();
include $callable;
$out = ob_get_clean();
/* (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;
}
?>