@author Stephan Tijink @copyright Copyright (c) 2005-2006 Paul Sullivan - http://sf.net/projects/cpaint @version 2.0.3 */ if (!(isset($_REQUEST["cpaint_function"]))) { $debug_html_start = ' CPAINT Debug Interface
CPAINT Debug Interface
backend filename: '.$_SERVER["SCRIPT_NAME"].'
'; $debug_html_end = "

"; // get function names and function variables/values $functionArray = getCallableCode(); $debug_body = ""; if (count($functionArray) > 0) { foreach ($functionArray as $func_name=>$func_variables) { $debug_body = $debug_body . "
" . $func_name . "
"; $debug_body = $debug_body . ''; if ( count($func_variables) > 0) { foreach ($func_variables as $var_name=>$var_preset) { $debug_body = $debug_body . ''; if (strlen($var_preset) > 0) { $debug_body = $debug_body . ""; } $debug_body = $debug_body . ''; } } $debug_body = $debug_body . ""; $debug_body = $debug_body . "
Parameter ($'.$var_name.'):   default value is ".$var_preset."  
Response Type:
"; } } print($debug_html_start . $debug_body . $debug_html_end); die(); } function getCallableCode() { $scriptName = $_SERVER['SCRIPT_FILENAME']; $fileLines = file($scriptName); for ($i=0; $i < sizeof($fileLines); $i++) { $line = trim($fileLines[$i]); if (substr($line, 0, 9) == "FUNCTION " || substr($line,0,9) == "function ") { $match[] = $line; } } for ($i = 0; $i < sizeof($match); $i++) { $line = str_replace("function ", "", $match[$i]); $line = str_replace("FUNCTION ", "", $line); $line = str_replace("{", "", $line); $parts = explode("(", $line); $func_name = trim($parts[0]); $Tempargs = explode(")", $parts[1]); $args = explode(",", $Tempargs[0]); $argSize = sizeof($args); // check args for preset values if ($argSize > 0) { foreach ($args as $arg) { $arg = trim ($arg); $varArray = explode ("=", $arg); $var_name = trim (str_replace ("$", "", $varArray["0"])); $var_value = trim ($varArray["1"]); $resultArray[$func_name][$var_name] = $var_value; } } } return $resultArray; } ?>