⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 functions.php

📁 jsp程序开发系统
💻 PHP
字号:
<?php
// +-------------------------------------------------------------+
// | DeskPRO v [2.0.1 Production]
// | Copyright (C) 2001 - 2004 Headstart Solutions Limited
// | Supplied by WTN-WDYL
// | Nullified by WTN-WDYL
// | Distribution via WebForum, ForumRU and associated file dumps
// +-------------------------------------------------------------+
// | DESKPRO IS NOT FREE SOFTWARE
// +-------------------------------------------------------------+
// | License ID : Full Enterprise License =) ...
// | License Owner : WTN-WDYL Team
// +-------------------------------------------------------------+
// | $RCSfile: functions.php,v $
// | $Date: 2004/02/10 01:34:25 $
// | $Revision: 1.4 $
// +-------------------------------------------------------------+
// | File Details:
// | - Functions scanner
// +-------------------------------------------------------------+

error_reporting(E_ALL & ~E_NOTICE);

include("./global.php");

developer_check();

admin_header('Server Information', 'Functions Scan');

if (!ini_set('max_execution_time', '120')) {
	echo "Warning! Couldn't set execution time, so this may time out.<BR>";
}

$messages = exec('grep -onri "function.*(.*)" ../*', $message, $return);

if (!count($message)) {
    print "Unable to perform search.\n";
	exit();
} else {
    foreach ($message AS $val) {
        $val = split(':',$val);
        if (preg_match("/function\s{0,}(\S+?)\((.*)\)/", $val[2], $matches)) {
            if (stristr($val[0], '.sql')) { continue; }
            if (stristr($val[0], 'includes/graph')) { continue; }
            if (stristr($val[0], 'includes/fpdf')) { continue; }
            if (stristr($val[0], 'admin/functions.php')) { continue; } // Don't match ourselves; we don't define anything here
            $functions[$matches[1]]['file'][$val[0]] = $val[1];
            $functions[$matches[1]]['args'] = $matches[2];
            if (strstr($matches[2], '$')) {
                $type = 'PHP';
            } else {
                $type = 'JavaScript';
            }
            $functions[$matches[1]]['type'] = $type;
        }
    }
}

$keys = array_keys($functions);
sort($keys);
foreach ($keys AS $key) {
	$message = array();
	$orig_key = $key;
	ereg_replace('&', '\&', $key);
	$messages = exec("grep -nri \"$key\" ../*", $message, $return);
	$key = $orig_key;
	if (is_array($message)) {
		foreach ($message AS $val) {
			$orig = $val;
			$val = split(':', $val);
			if (!preg_match("/function\s{0,}\S+?\(.*\)/", $val[2], $matches)) {
				$functions[$key]['files'][$val[0]][] = $val[1];
			}
		}
	}
	if (!count($functions[$key]['files'])) {
		$unused[$key] = $functions[$key];
		unset($functions[$key]);
	}
}

$keys = array_keys($functions);
sort($keys);

print "<TABLE CELLPADDING=\"2\" CELLSPACING=\"0\">";
$rowscount = 0;
foreach ($keys AS $key) {
	if ($rowscount % 2) {
		$bgcolor="#EEEEFF";
	} else {
		$bgcolor="white";
	}
	
	if ($functions[$key]['type'] == "PHP") {
		$type = "PHP";
	} else {
		$type = "JavaScript";
	}

	echo "<TR VALIGN=\"top\" BGCOLOR=\"$bgcolor\"><TD><B>$key</B> ($type)<BR>";

	if ($functions[$key]['args']) {
		echo "Args: <U>{$functions[$key][args]}</U>\n";
	} else {
		echo "Args: <I>none</I>\n";
	}

	echo "<BR><U>Defined in files:</U><TABLE><TR><TD>";

	foreach ($functions[$key]['file'] AS $filename => $line) {
		ereg_replace('../', '', $filename);
		echo "$filename, line $line<BR>\n";
	}

	echo "</TD></TR></TABLE></TD><TD>\n";
	echo "<TABLE><TR><TD COLSPAN=\"2\"><U>Used in files:</U></TD></TR>";

	$rowscount2 = 0;
	
	foreach ($functions[$key]['files'] AS $filename => $lines) {
		if ($rowscount % 2) {
			if ($rowscount2 % 2) {
				$bgcolor="#CCCCDD";
			} else {
				$bgcolor="#DDDDEE";
			}
		} else {
			if ($rowscount2 % 2) {
				$bgcolor="#EEEEEE";
			} else {
				$bgcolor="#F6F6F6";
			}
		}
		$lines = join(', ', $lines);
		echo "<TR BGCOLOR=\"$bgcolor\"><TD><B>$filename</B></TD><TD>$lines<BR></TD></TR>\n";
		$rowscount2++;
	}
	echo "</TABLE></TD></TR>\n";
	$rowscount++;
}
echo "</TABLE>\n";

$keys = array_keys($unused);
sort($keys);

print "<TABLE CELLPADDING=\"2\" CELLSPACING=\"0\"><TR><TD><B>Unused functions:</B></TD></TR>";

$rowscount = 0;
foreach ($keys AS $key) {
	if ($rowscount % 2) {
		$bgcolor="#EEEEFF";
	} else {
		$bgcolor="white";
	}
	
	if ($unused[$key]['type'] == "PHP") {
		$type = "PHP";
	} else {
		$type = "JavaScript";
	}

	echo "<TR VALIGN=\"top\" BGCOLOR=\"$bgcolor\"><TD><B>$key</B> ($type)<BR>";

	if ($unused[$key]['args']) {
		echo "Args: <U>{$unused[$key][args]}</U>\n";
	} else {
		echo "Args: <I>none</I>\n";
	}

	echo "<BR><U>Defined in files:</U><TABLE><TR><TD>";

	foreach ($unused[$key]['file'] AS $filename => $line) {
		ereg_replace('../', '', $filename);
		echo "$filename, line $line<BR>\n";
	}

	echo "</TD></TR></TABLE></TD></TR>\n";
	$rowscount++;
}
echo "</TABLE>\n";

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -