ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
HFile_ueconv.php File Reference

Go to the source code of this file.

Functions

 HFile_print_php_file ($tofile=1)
 
 get_categories ()
 
 dump_linkscripts ($cats)
 
 dump_colours ($cats)
 
 dump_var ($variable, $name)
 
 dump_array ($array, $name)
 
 dump_hash ($hash, $name)
 

Variables

 $BEAUT_PATH = realpath(".") . "/Services/COPage/syntax_highlight/php"
 
 if (!isset( $BEAUT_PATH))
 
print $file
 

Function Documentation

◆ dump_array()

dump_array (   $array,
  $name 
)

Definition at line 107 of file HFile_ueconv.php.

108{
109 $first = 1;
110 print $name . " = array(";
111 foreach ($array as $a) {
112 if (!$first) {
113 print ", ";
114 } else {
115 $first = 0;
116 }
117 print "\"" . addslashes($a) . "\"";
118 }
119 print ");\n";
120}
if(! $in) print
if($format !==null) $name
Definition: metadata.php:146

References $name, and print.

Referenced by dump_colours(), and HFile_print_php_file().

+ Here is the caller graph for this function:

◆ dump_colours()

dump_colours (   $cats)

Definition at line 91 of file HFile_ueconv.php.

92{
93 global $colours;
94
95 $usedcols = array();
96 foreach ($cats as $c) {
97 array_push($usedcols, $colours[$c-1]);
98 }
99 dump_array($usedcols, "\$colours ");
100}
dump_array($array, $name)

References dump_array().

Referenced by HFile_print_php_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_hash()

dump_hash (   $hash,
  $name 
)

Definition at line 122 of file HFile_ueconv.php.

123{
124 $first = 1;
125 print $name . " = array(";
126 foreach (array_keys($hash) as $k) {
127 if (!$first) {
128 print ", ";
129 } else {
130 $first = 0;
131 }
132 print "\n \"" . addslashes($k) . "\"";
133 print " => \"" . addslashes($hash[$k]) . "\"";
134 }
135 print ");\n";
136}
137
138?>
139<html><title>Configuration Converter</title><body>
140<h1>Important Note</h1>
141<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>
142<form action="HFileconv.php">Please specify a syntax file to convert:<br />
143<input type="text" width="64" size="64" name="file" value="<?php print $file; ?>" /><br />
144Save to:<br />
145<input type="text" width="64" size="64" name="fileout" value="<?php print stripslashes($fileout); ?>" /><br />
146<input type="submit" /></form><hr />
147<pre>
148<?php
149if (isset($fileout) && $fileout == "") {
150 unset($fileout);
151}
152if (isset($file) && file_exists($file)) {
153 HFile_parse_file($file);
154 ob_start();
155 HFile_print_php_file(isset($fileout));
156 $out = ob_get_contents();
157 if (isset($fileout)) {
158 $fd = fopen($fileout, "w");
159 fputs($fd, $out);
160 fclose($fd);
161 }
162 ob_end_flush();
163}
convert($file)
Definition: HFile_conv.php:151
HFile_print_php_file($tofile=1)
print $file
html()
An exception for terminatinating execution or to throw for unit testing.
$this data['403_header']

References $name, and print.

Referenced by dump_linkscripts(), and HFile_print_php_file().

+ Here is the caller graph for this function:

◆ dump_linkscripts()

dump_linkscripts (   $cats)

Definition at line 72 of file HFile_ueconv.php.

73{
74 print "
75// Each category can specify a PHP function that returns an altered
76// version of the keyword.
77 # This link is then placed in a <a href=\"...\">foo</a>; structure around keyword 'foo' - which is
78 \n\n";
79
80 $linkhash = array();
81
82 foreach ($cats as $c) {
83 $linkhash{$c} = "donothing";
84 }
85
86 dump_hash($linkhash, "\$linkscripts ");
87 print "\n# DoNothing link function\n\n";
88 print "function donothing(\$keywordin)\n{\n return \$keywordin;\n}\n";
89}
dump_hash($hash, $name)

References dump_hash(), and print.

Referenced by HFile_print_php_file().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_var()

dump_var (   $variable,
  $name 
)

Definition at line 102 of file HFile_ueconv.php.

103{
104 print $name . " = \"" . addslashes($variable) . "\";\n";
105}

References $name, and print.

Referenced by HFile_print_php_file().

+ Here is the caller graph for this function:

◆ get_categories()

get_categories ( )

Definition at line 58 of file HFile_ueconv.php.

59{
60 global $keywords;
61 $usedcats = array();
62
63 foreach (array_keys($keywords) as $k) {
64 $cat = $keywords[$k];
65 if (!in_array($cat, $usedcats)) {
66 array_push($usedcats, $cat);
67 }
68 }
69 return $usedcats;
70}

Referenced by HFile_print_php_file().

+ Here is the caller graph for this function:

◆ HFile_print_php_file()

HFile_print_php_file (   $tofile = 1)

Definition at line 12 of file HFile_ueconv.php.

13{
14 global $indent, $unindent, $stringchars, $config, $keywords, $delimiters, $lang_name;
15 global $linecommenton, $blockcommenton, $blockcommentoff;
16 global $perl, $nocase, $notrim;
17 if ($tofile) {
18 print "<?php\n";
19 } else {
20 print "&lt;?\n";
21 }
22 print "######################################\n";
23 print "# Beautifier Highlighting Configuration File \n";
24 print "# $lang_name\n";
25 print "######################################\n";
26 print "# Flags\n\n";
27 dump_var($nocase, "\$nocase ");
28 dump_var($notrim, "\$notrim ");
29 dump_var($perl, "\$perl ");
30 print "\n# Colours\n\n";
31 $used_categories = get_categories();
32 dump_colours($used_categories);
33 dump_var("blue", "\$quotecolour ");
34 dump_var("green", "\$blockcommentcolour");
35 dump_var("green", "\$linecommentcolour ");
36 print "\n# Indent Strings\n\n";
37 dump_array($indent, "\$indent ");
38 dump_array($unindent, "\$unindent ");
39 print "\n# String characters and delimiters\n\n";
40 dump_array($stringchars, "\$stringchars ");
41 dump_array($delimiters, "\$delimiters ");
42 dump_var($escchar, "\$escchar ");
43 print "\n# Comment settings\n\n";
44 dump_var($linecommenton, "\$linecommenton ");
45 dump_var($blockcommenton, "\$blockcommenton ");
46 dump_var($blockcommentoff, "\$blockcommentoff ");
47 print "\n# Keywords (keyword mapping to colour number)\n\n";
48 dump_hash($keywords, "\$keywords ");
49 print "\n# Special extensions\n";
50 dump_linkscripts($used_categories);
51 if ($tofile) {
52 print "\n?>";
53 } else {
54 print "\n?&gt;";
55 }
56}
dump_var($variable, $name)
dump_linkscripts($cats)
get_categories()
dump_colours($cats)

References $config, dump_array(), dump_colours(), dump_hash(), dump_linkscripts(), dump_var(), get_categories(), and print.

+ Here is the call graph for this function:

Variable Documentation

◆ $BEAUT_PATH

$BEAUT_PATH = realpath(".") . "/Services/COPage/syntax_highlight/php"

Definition at line 2 of file HFile_ueconv.php.

◆ $file

print $file

Definition at line 143 of file HFile_ueconv.php.

◆ if

if(!isset($BEAUT_PATH)) ( isset $BEAUT_PATH)

Definition at line 3 of file HFile_ueconv.php.