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.

References $name.

Referenced by dump_colours(), and HFile_print_php_file().

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($format !==null) $name
Definition: metadata.php:146
+ Here is the caller graph for this function:

◆ dump_colours()

dump_colours (   $cats)

Definition at line 91 of file HFile_ueconv.php.

References array, and dump_array().

Referenced by HFile_print_php_file().

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)
Create styles array
The data for the language used.
+ 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.

References $name, convert(), data, file, files, html(), is, and to.

Referenced by dump_linkscripts(), and HFile_print_php_file().

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 />
144 Save 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
149 if (isset($fileout) && $fileout == "") {
150  unset($fileout);
151 }
152 if (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 }
File written to
Add some data
print $file
HFile_print_php_file($tofile=1)
Sum of both Ranges is
Definition: 03formulas.php:77
convert($file)
Definition: HFile_conv.php:151
if($format !==null) $name
Definition: metadata.php:146
Reload workbook from saved file
html()
Done writing files
Set page orientation and size
Definition: 04printing.php:77
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump_linkscripts()

dump_linkscripts (   $cats)

Definition at line 72 of file HFile_ueconv.php.

References array, and dump_hash().

Referenced by HFile_print_php_file().

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)
Create styles array
The data for the language used.
+ 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.

References $name.

Referenced by HFile_print_php_file().

103 {
104  print $name . " = \"" . addslashes($variable) . "\";\n";
105 }
if($format !==null) $name
Definition: metadata.php:146
+ Here is the caller graph for this function:

◆ get_categories()

get_categories ( )

Definition at line 58 of file HFile_ueconv.php.

References array.

Referenced by HFile_print_php_file().

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 }
Create styles array
The data for the language used.
+ 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.

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

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_colours($cats)
dump_array($array, $name)
dump_hash($hash, $name)
dump_var($variable, $name)
get_categories()
dump_linkscripts($cats)
+ 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))

Definition at line 3 of file HFile_ueconv.php.