Revision edba33b5
Added by Doktor Notor over 8 years ago
src/etc/inc/pfsense-utils.inc | ||
---|---|---|
817 | 817 |
return; |
818 | 818 |
} |
819 | 819 |
|
820 |
/* |
|
821 |
* php_check_syntax($code_tocheck, $errormessage): checks $code_to_check for errors |
|
822 |
*/ |
|
823 |
if (!function_exists('php_check_syntax')) { |
|
824 |
global $g; |
|
825 |
function php_check_syntax($code_to_check, &$errormessage) { |
|
826 |
return false; |
|
827 |
$fout = fopen("{$g['tmp_path']}/codetocheck.php", "w"); |
|
828 |
$code = $_POST['content']; |
|
829 |
$code = str_replace("<?php", "", $code); |
|
830 |
$code = str_replace("?>", "", $code); |
|
831 |
fwrite($fout, "<?php\n\n"); |
|
832 |
fwrite($fout, $code_to_check); |
|
833 |
fwrite($fout, "\n\n?>\n"); |
|
834 |
fclose($fout); |
|
835 |
$command = "/usr/local/bin/php-cgi -l {$g['tmp_path']}/codetocheck.php"; |
|
836 |
$output = exec_command($command); |
|
837 |
if (stristr($output, "Errors parsing") == false) { |
|
838 |
echo "false\n"; |
|
839 |
$errormessage = ''; |
|
840 |
return(false); |
|
841 |
} else { |
|
842 |
$errormessage = $output; |
|
843 |
return(true); |
|
844 |
} |
|
845 |
} |
|
846 |
} |
|
847 |
|
|
848 |
/* |
|
849 |
* php_check_filename_syntax($filename, $errormessage): checks the file $filename for errors |
|
850 |
*/ |
|
851 |
if (!function_exists('php_check_syntax')) { |
|
852 |
function php_check_syntax($code_to_check, &$errormessage) { |
|
853 |
return false; |
|
854 |
$command = "/usr/local/bin/php-cgi -l " . escapeshellarg($code_to_check); |
|
855 |
$output = exec_command($command); |
|
856 |
if (stristr($output, "Errors parsing") == false) { |
|
857 |
echo "false\n"; |
|
858 |
$errormessage = ''; |
|
859 |
return(false); |
|
860 |
} else { |
|
861 |
$errormessage = $output; |
|
862 |
return(true); |
|
863 |
} |
|
864 |
} |
|
865 |
} |
|
866 |
|
|
867 | 820 |
/* |
868 | 821 |
* rmdir_recursive($path, $follow_links=false) |
869 | 822 |
* Recursively remove a directory tree (rm -rf path) |
Also available in: Unified diff
Remove unused broken functions
Not sure what was the idea here, but these are not used anywhere, do nothing as they immediately call ```return false;``` plus the second one is also misnamed.