aidan Sun Sep 26 10:10:49 2004 EDT
Modified files:
/phpdoc/en/reference/misc/functions highlight-file.xml
Log:
Removed the crazy code, added note about phps highlighting
http://cvs.php.net/diff.php/phpdoc/en/reference/misc/functions/highlight-file.xml?r1=1.18&r2=1.19&ty=u
Index: phpdoc/en/reference/misc/functions/highlight-file.xml
diff -u phpdoc/en/reference/misc/functions/highlight-file.xml:1.18
phpdoc/en/reference/misc/functions/highlight-file.xml:1.19
--- phpdoc/en/reference/misc/functions/highlight-file.xml:1.18 Thu Aug 26 19:45:39
2004
+++ phpdoc/en/reference/misc/functions/highlight-file.xml Sun Sep 26 10:10:49
2004
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="iso-8859-1"?>
-<!-- $Revision: 1.18 $ -->
+<!-- $Revision: 1.19 $ -->
<!-- splitted from ./en/functions/misc.xml, last change in rev 1.22 -->
<refentry id="function.highlight-file">
<refnamediv>
@@ -32,84 +32,34 @@
4.2.0. Before this time it behaved like the default, which is &false;
</simpara>
</note>
+ <note>
+ <simpara>
+ Since PHP 4.2.1 this function is also affected by <link
+ linkend="ini.safe-mode">safe_mode</link> and <link
+ linkend="ini.open-basedir">open_basedir</link>.
+ </simpara>
+ </note>
<caution>
<simpara>
Care should be taken when using the
- <function>show_source</function> and
- <function>highlight_file</function> functions to make sure that
+ <function>highlight_file</function> function to make sure that
you do not inadvertently reveal sensitive information such as
passwords or any other type of information that might create a
potential security risk.
</simpara>
</caution>
- <note>
- <simpara>
- Since PHP 4.2.1 this function is also affected by <link
- linkend="ini.safe-mode">safe_mode</link> and <link
- linkend="ini.open-basedir">open_basedir</link>.
- </simpara>
- </note>
- <simpara>
- To setup a URL that can code highlight any script that you pass to
- it, we will make use of the "ForceType" directive in
- Apache to generate a nice URL pattern, and use the
- function <function>highlight_file</function> to show a nice looking
- code list.
- </simpara>
- <simpara>
- In your &httpd.conf; you can add the following:
- </simpara>
<para>
- <example>
- <title>Creating a source highlighting URL</title>
- <programlisting role="apache-conf">
-<![CDATA[
-<Location /source>
- ForceType application/x-httpd-php
-</Location>
-]]>
- </programlisting>
- <simpara>
- And then make a file named <filename>source</filename> and put it in your
- web root directory.
- </simpara>
- <programlisting role="php">
-<![CDATA[
-<html>
-<head>
-<title>Source Display</title>
-</head>
-<body bgcolor="white">
-<?php
- $script = getenv('SCRIPT_FILENAME');
- if (!$script) {
- echo "<br /><b>ERROR: Script Name needed</b><br />";
- } else {
- if (ereg("(\\.php|\\.inc)$", $script)) {
- echo "<h1>Source of: " . getenv("PATH_INFO") . "</h1>\n<hr />\n";
- highlight_file($script);
- } else {
- echo "<h1>ERROR: Only PHP or include script names are allowed</h1>";
- }
- }
- echo "<hr />Processed: " . date("Y/M/d H:i:s", time());
-?>
-</BODY>
-</HTML>
-]]>
- </programlisting>
- <simpara>
- Then you can use a URL like the one below to display a colorized
- version of a script located in "/path/to/script.php"
- in your web site.
- </simpara>
- <screen>
+ Many servers are configured to automatically highlight files
+ with a <emphasis>phps</emphasis> extension. For example,
+ <filename>example.phps</filename> when viewed will show the
+ syntax highlighted source of the file. To enable this, add this
+ line to the &httpd.conf;:
+ </para>
+ <screen>
<![CDATA[
-http://www.example.com/source/path/to/script.php
+AddType application/x-httpd-php-source .phps
]]>
- </screen>
- </example>
- </para>
+ </screen>
<simpara>
See also <function>highlight_string</function>.
</simpara>