2 $BEAUT_PATH = realpath(
".").
"/Services/COPage/syntax_highlight/php";
4 require
"$BEAUT_PATH/Beautifier/HFile.php";
12 global $indent, $unindent, $stringchars,
$config, $keywords, $delimiters, $lang_name;
13 global $linecommenton, $blockcommenton, $blockcommentoff;
14 global $perl, $nocase, $notrim;
15 if ($tofile) print
"<?php\n";
else print
"<?\n";
16 print
"######################################\n";
17 print
"# Beautifier Highlighting Configuration File \n";
18 print
"# $lang_name\n";
19 print
"######################################\n";
24 print
"\n# Colours\n\n";
28 dump_var(
"green",
"\$blockcommentcolour");
29 dump_var(
"green",
"\$linecommentcolour ");
30 print
"\n# Indent Strings\n\n";
33 print
"\n# String characters and delimiters\n\n";
37 print
"\n# Comment settings\n\n";
38 dump_var ($linecommenton,
"\$linecommenton ");
39 dump_var ($blockcommenton,
"\$blockcommenton ");
40 dump_var ($blockcommentoff,
"\$blockcommentoff ");
41 print
"\n# Keywords (keyword mapping to colour number)\n\n";
43 print
"\n# Special extensions\n";
45 if ($tofile) print
"\n?>";
else print
"\n?>";
53 foreach(array_keys($keywords) as $k)
56 if (!in_array($cat, $usedcats)) array_push($usedcats, $cat);
64 // Each category can specify a PHP function that returns an altered
65 // version of the keyword.
66 # This link is then placed in a <a href=\"...\">foo</a>; structure around keyword 'foo' - which is
73 $linkhash{$c} =
"donothing";
77 print
"\n# DoNothing link function\n\n";
78 print
"function donothing(\$keywordin)\n{\n return \$keywordin;\n}\n";
88 array_push($usedcols, $colours[$c-1]);
95 print
$name.
" = \"".addslashes($variable).
"\";\n";
101 print
$name.
" = array(";
102 foreach($array as $a)
104 if (!$first) print
", ";
else $first = 0;
105 print
"\"".addslashes($a).
"\"";
113 print
$name.
" = array(";
114 foreach(array_keys($hash) as $k)
116 if (!$first) print
", ";
else $first = 0;
117 print
"\n \"".addslashes($k).
"\"";
118 print
" => \"".addslashes($hash[$k]).
"\"";
124 <html><title>Configuration Converter</title><body>
125 <h1>Important Note</h1>
126 <p>This script should <b>not</b> be run on a
public server. It is possible to access files other than syntax highlight files (by entering /etc/passwd,
for example). Although
this should not display anything useful, it is still possible that important data may be extractable. As such, only run
this script <b>locally</b> (it should not be necessary to run it on a
public server, anyway).</p>
127 <form action=
"HFileconv.php">Please specify a syntax file to
convert:<br />
128 <input type=
"text" width=
"64" size=
"64" name=
"file" value=
"<?php print $file; ?>" /><br />
130 <input type=
"text" width=
"64" size=
"64" name=
"fileout" value=
"<?php print stripslashes($fileout); ?>" /><br />
131 <input type=
"submit" /></form><hr />
134 if (isset($fileout) && $fileout ==
"") unset($fileout);
137 HFile_parse_file(
$file);
140 $out = ob_get_contents();
143 $fd = fopen($fileout,
"w");