2017-01-27 11:21:32 +00:00
|
|
|
#!/usr/bin/php
|
|
|
|
<?php
|
|
|
|
|
2017-01-27 14:54:30 +00:00
|
|
|
/* [1] Launches external script
|
|
|
|
=========================================================*/
|
2017-01-27 11:21:32 +00:00
|
|
|
function syscall($callable=null){
|
2017-01-27 14:54:30 +00:00
|
|
|
ini_set('display_errors', 'On');
|
|
|
|
error_reporting(E_ALL);
|
2017-01-27 11:21:32 +00:00
|
|
|
|
|
|
|
/* (1) Check file */
|
2017-01-27 14:54:30 +00:00
|
|
|
if( is_null($callable) || !file_exists($callable) )
|
|
|
|
return false;
|
2017-01-27 11:21:32 +00:00
|
|
|
|
|
|
|
/* (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;
|
2017-01-27 11:21:32 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
?>
|