-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource-display.php
More file actions
46 lines (40 loc) · 965 Bytes
/
Copy pathsource-display.php
File metadata and controls
46 lines (40 loc) · 965 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
function highlight_num($file)
{
for ($i = 1; $i <= count(file($file)); $i++) {
$lines = $lines."<a name='$i'>$i</a><br />";
}
$content = highlight_file($file, true);
echo '
<style type="text/css">
.num {
float: left;
color: gray;
font-size: 13px;
font-family: monospace;
text-align: right;
margin-right: 6pt;
padding-right: 6pt;
border-right: 1px solid gray;
line-height: 15px;}
body {margin: 0px; margin-left: 5px;}
td {vertical-align: top;}
code {white-space: nowrap;}
span {line-height: 15px;}
</style>';
echo "<table><tr><td class=\"num\">$lines</td><td>$content</td></tr></table>";
}
?>
<html>
<body>
<?php
$path = $_SERVER['DOCUMENT_ROOT'].$_SERVER['SCRIPT_NAME'];
if (file_exists($path)) {
highlight_num($path);
}
else {
echo 'No input file specified.';
}
?>
</body>
</html>