fujimoto                Tue Dec 11 17:12:54 2001 EDT

  Modified files:              
    /phpdoc/ja/features error-handling.xml http-auth.xml images.xml 
                        safe-mode.xml 
  Log:
  enclosing programlisting with CDATA.
  
  
Index: phpdoc/ja/features/error-handling.xml
diff -u phpdoc/ja/features/error-handling.xml:1.9 
phpdoc/ja/features/error-handling.xml:1.10
--- phpdoc/ja/features/error-handling.xml:1.9   Wed Nov 14 17:55:19 2001
+++ phpdoc/ja/features/error-handling.xml       Tue Dec 11 17:12:54 2001
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 1.10 $ -->
  <chapter id="features.error-handling">
   <title>エラー処理</title>
   
@@ -143,8 +144,8 @@
    
この場合、その式に関するエラーメッセージの出力がオフにされます。
    そのような式においてエラーが発生し、
    <link linkend="ini.track-errors">track_errors</link> 機能が有効の
-   場合、グローバル変数 $php_errormsg からエラーメッセージを
-   得ることができます。 
+   場合、グローバル変数 <literal>$php_errormsg</literal> からエラー
+   メッセージを得ることができます。 
   </para>
 
   <note>
@@ -173,76 +174,77 @@
    <example>
     <title>スクリプトでのエラー処理の使用法</title>
     <programlisting role="php">
-&lt;?php
+<![CDATA[
+<?php
 // 独自のエラー処理を行う
 error_reporting(0);
 
 // ユーザ定義のエラー処理関数
 function userErrorHandler ($errno, $errmsg, $filename, $linenum, $vars) {
     // エラーエントリ用タイムスタンプ
-    $dt = date(&quot;Y-m-d H:i:s (T)&quot;);
+    $dt = date("Y-m-d H:i:s (T)");
 
     // エラー文字列の連想を定義
     // 実際に考慮するエントリは 2,8,256,512,1024のみ
     $errortype = array (
-                1   =&gt;  &quot;Error&quot;,
-                2   =&gt;  &quot;Warning&quot;,
-                4   =&gt;  &quot;Parsing Error&quot;,
-                8   =&gt;  &quot;Notice&quot;,
-                16  =&gt;  &quot;Core Error&quot;,
-                32  =&gt;  &quot;Core Warning&quot;,
-                64  =&gt;  &quot;Compile Error&quot;,
-                128 =&gt;  &quot;Compile Warning&quot;,
-                256 =&gt;  &quot;User Error&quot;,
-                512 =&gt;  &quot;User Warning&quot;,
-                1024=&gt;  &quot;User Notice&quot;
+                1   =>  "Error",
+                2   =>  "Warning",
+                4   =>  "Parsing Error",
+                8   =>  "Notice",
+                16  =>  "Core Error",
+                32  =>  "Core Warning",
+                64  =>  "Compile Error",
+                128 =>  "Compile Warning",
+                256 =>  "User Error",
+                512 =>  "User Warning",
+                1024=>  "User Notice"
                 );
     // モニタするエラーの種類を設定
     $user_errors = array(E_USER_ERROR, E_USER_WARNING, E_USER_NOTICE);
     
-    $err = &quot;&lt;errorentry&gt;\n&quot;;
-    $err .= &quot;\t&lt;datetime&gt;&quot;.$dt.&quot;&lt;/datetime&gt;\n&quot;;
-    $err .= &quot;\t&lt;errornum&gt;&quot;.$errno.&quot;&lt;/errnumber&gt;\n&quot;;
-    $err .= 
&quot;\t&lt;errortype&gt;&quot;.$errortype[$errno].&quot;&lt;/errortype&gt;\n&quot;;
-    $err .= &quot;\t&lt;errormsg&gt;&quot;.$errmsg.&quot;&lt;/errormsg&gt;\n&quot;;
-    $err .= 
&quot;\t&lt;scriptname&gt;&quot;.$filename.&quot;&lt;/scriptname&gt;\n&quot;;
-    $err .= 
&quot;\t&lt;scriptlinenum&gt;&quot;.$linenum.&quot;&lt;/scriptlinenum&gt;\n&quot;;
+    $err = "<errorentry>\n";
+    $err .= "\t<datetime>".$dt."</datetime>\n";
+    $err .= "\t<errornum>".$errno."</errnumber>\n";
+    $err .= "\t<errortype>".$errortype[$errno]."</errortype>\n";
+    $err .= "\t<errormsg>".$errmsg."</errormsg>\n";
+    $err .= "\t<scriptname>".$filename."</scriptname>\n";
+    $err .= "\t<scriptlinenum>".$linenum."</scriptlinenum>\n";
 
     if (in_array($errno, $user_errors))
-        $err .= 
&quot;\t&lt;vartrace&gt;&quot;.wddx_serialize_value($vars,&quot;Variables&quot;).&quot;&lt;/vartrace&gt;\n&quot;;
-    $err .= &quot;&lt;/errorentry&gt;\n\n&quot;;
+        $err .= 
+"\t<vartrace>".wddx_serialize_value($vars,"Variables")."</vartrace>\n";
+    $err .= "</errorentry>\n\n";
     
     // テスト用
     // echo $err;
 
     // 
エラーログに保存し、致命的なエラーの場合はメールを送信する
-    error_log($err, 3, &quot;/usr/local/php4/error.log&quot;);
+    error_log($err, 3, "/usr/local/php4/error.log");
     if ($errno == E_USER_ERROR)
-        mail(&quot;[EMAIL PROTECTED]&quot;,&quot;Critical User Error&quot;,$err);
+        mail("[EMAIL PROTECTED]","Critical User Error",$err);
 }
 
 
 function distance ($vect1, $vect2) {
     if (!is_array($vect1) || !is_array($vect2)) {
-        trigger_error(&quot;Incorrect parameters, arrays expected&quot;, 
E_USER_ERROR);
+        trigger_error("Incorrect parameters, arrays expected", E_USER_ERROR);
         return NULL;
     }
 
     if (count($vect1) != count($vect2)) {
-        trigger_error(&quot;Vectors need to be of the same size&quot;, E_USER_ERROR);
+        trigger_error("Vectors need to be of the same size", E_USER_ERROR);
         return NULL;
     }
 
-    for ($i=0; $i&lt;count($vect1); $i++) {
+    for ($i=0; $i<count($vect1); $i++) {
         $c1 = $vect1[$i]; $c2 = $vect2[$i];
         $d = 0.0;
         if (!is_numeric($c1)) {
-            trigger_error(&quot;Coordinate $i in vector 1 is not a number, using 
zero&quot;, 
+            trigger_error("Coordinate $i in vector 1 is not a number, using zero", 
                             E_USER_WARNING);
             $c1 = 0.0;
         }
         if (!is_numeric($c2)) {
-            trigger_error(&quot;Coordinate $i in vector 2 is not a number, using 
zero&quot;, 
+            trigger_error("Coordinate $i in vector 2 is not a number, using zero", 
                             E_USER_WARNING);
             $c2 = 0.0;
         }
@@ -251,26 +253,27 @@
     return sqrt($d);
 }
 
-$old_error_handler = set_error_handler(&quot;userErrorHandler&quot;);
+$old_error_handler = set_error_handler("userErrorHandler");
 
 // 未定義の定数、警告を生成
 $t = I_AM_NOT_DEFINED;
 
-// いくつかの &quot;vectors&quot; を定義
-$a = array(2,3,&quot;foo&quot;);
+// いくつかの "vectors" を定義
+$a = array(2,3,"foo");
 $b = array(5.5, 4.3, -1.6);
 $c = array (1,-3);
 
 // ユーザエラーを生成
-$t1 = distance($c,$b).&quot;\n&quot;;
+$t1 = distance($c,$b)."\n";
 
 // 別のユーザエラーを生成
-$t2 = distance($b,&quot;i am not an array&quot;).&quot;\n&quot;;
+$t2 = distance($b,"i am not an array")."\n";
 
 // 警告を生成
-$t3 = distance($a,$b).&quot;\n&quot;;
+$t3 = distance($a,$b)."\n";
 
-?&gt;
+?>
+]]>
     </programlisting>
    </example>
    上記のコードは、<link 
linkend="ref.errorfunc">エラー処理とログ関数
Index: phpdoc/ja/features/http-auth.xml
diff -u phpdoc/ja/features/http-auth.xml:1.10 phpdoc/ja/features/http-auth.xml:1.11
--- phpdoc/ja/features/http-auth.xml:1.10       Wed Nov 14 17:55:19 2001
+++ phpdoc/ja/features/http-auth.xml    Tue Dec 11 17:12:54 2001
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 1.11 $ -->
  <chapter id="features.http-auth">
   <title>PHP による HTTP 認証</title>
 
@@ -20,17 +21,19 @@
    <example>
     <title>HTTP 認証の例</title>
     <programlisting role="php">
-&lt;?php
+<![CDATA[
+<?php
   if(!isset($PHP_AUTH_USER)) {
-    header(&quot;WWW-Authenticate: Basic realm=\&quot;My Realm\&quot;&quot;);
-    header(&quot;HTTP/1.0 401 Unauthorized&quot;);
-    echo 
&quot;ユーザーがキャンセルボタンを押した時に送信されるテキスト\n&quot;;
+    header("WWW-Authenticate: Basic realm=\"My Realm\"");
+    header("HTTP/1.0 401 Unauthorized");
+    echo 
+"ユーザーがキャンセルボタンを押した時に送信されるテキスト\n";
     exit;
   } else {
-    echo &quot;&lt;p&gt;こんにちは、$PHP_AUTH_USER さん。&lt;/p&gt;&quot;;
-    echo &quot;&lt;p&gt;あなたは、$PHP_AUTH_PW 
をパスワードとして入力しました。&lt;/p&gt;&quot;;
+    echo "<p>こんにちは、$PHP_AUTH_USER さん。</p>";
+       echo "<p>あなたは、$PHP_AUTH_PW 
+をパスワードとして入力しました。</p>";
   }
 ?>
+]]>
     </programlisting>
    </example>
   </para>
@@ -93,27 +96,29 @@
   <example>
    <title>新規に名前/パスワードを入力させるHTTP 認証の例</title>
    <programlisting role="php">
-&lt;?php
+<![CDATA[
+<?php
   function  authenticate()  {
-    header( &quot;WWW-Authenticate: Basic realm=\&quot;Test Authentication 
System\&quot;&quot;);
-    header( &quot;HTTP/1.0 401 Unauthorized&quot;);
-    echo  
&quot;このリソースにアクセスする際には有効なログインIDとパスワードを入力する必要があります。\n&quot;;
+    header( "WWW-Authenticate: Basic realm=\"Test Authentication System\"");
+    header( "HTTP/1.0 401 Unauthorized");
+    echo  
+&quot;このリソースにアクセスする際には有効なログインIDとパスワードを入力する必要があります。\n";
     exit;
   }
 
-  if(!isset($PHP_AUTH_USER)  ||  ($SeenBefore ==  1  &amp;&amp;  !strcmp($OldAuth,  
$PHP_AUTH_USER))  )  {
+  if(!isset($PHP_AUTH_USER)  ||  ($SeenBefore ==  1  &&  !strcmp($OldAuth,  
+$PHP_AUTH_USER))  )  {
     authenticate();
   }  
   else  {
-   echo &quot;&lt;/p&gt;Welcome: $PHP_AUTH_USER&lt;br&gt;&quot;;
-   echo &quot;Old: $OldAuth&quot;;
-   echo &quot;&lt;form action=\&quot;$PHP_SELF\&quot; METHOD=POST&gt;\n&quot;;
-   echo &quot;&lt;input type=\&quot;hidden\&quot; name=\&quot;SeenBefore\&quot; 
value=\&quot;1\&quot;&gt;\n&quot;;
-   echo &quot;&lt;input type=\&quot;hidden\&quot; name=\&quot;OldAuth\&quot; 
value=\&quot;$PHP_AUTH_USER\&quot;&gt;\n&quot;;
-   echo &quot;&lt;input type=\&quot;submit\&quot; value=\&quot;Re 
Authenticate\&quot;&gt;\n&quot;;
-   echo &quot;&lt;/form&gt;&lt;/p&gt;\n&quot;;
+   echo "</p>Welcome: $PHP_AUTH_USER<br>";
+   echo "Old: $OldAuth";
+   echo "<form action=\"$PHP_SELF\" METHOD=POST>\n";
+   echo "<input type=\"hidden\" name=\"SeenBefore\" value=\"1\">\n";
+   echo "<input type=\"hidden\" name=\"OldAuth\" value=\"$PHP_AUTH_USER\">\n";
+   echo "<input type=\"submit\" value=\"Re Authenticate\">\n";
+   echo "</form></p>\n";
   }
 ?>
+]]>
    </programlisting>
   </example>
   <simpara>
Index: phpdoc/ja/features/images.xml
diff -u phpdoc/ja/features/images.xml:1.4 phpdoc/ja/features/images.xml:1.5
--- phpdoc/ja/features/images.xml:1.4   Wed Nov 14 17:55:19 2001
+++ phpdoc/ja/features/images.xml       Tue Dec 11 17:12:54 2001
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 1.5 $ -->
  <chapter id="features.images">
   <title>イメージの作成および操作</title>
 
@@ -16,7 +17,8 @@
    <example>
     <title>PHPによるPNGの作成</title>
     <programlisting role="php">
-&lt;?php
+<![CDATA[
+<?php
     Header("Content-type: image/png");
     $string=implode($argv," ");
     $im = imageCreateFromPng("images/button1.png");
@@ -26,6 +28,7 @@
     ImagePng($im);
     ImageDestroy($im);
 ?>
+]]>
     </programlisting>
    </example>
 
Index: phpdoc/ja/features/safe-mode.xml
diff -u phpdoc/ja/features/safe-mode.xml:1.4 phpdoc/ja/features/safe-mode.xml:1.5
--- phpdoc/ja/features/safe-mode.xml:1.4        Wed Nov 14 17:55:19 2001
+++ phpdoc/ja/features/safe-mode.xml    Tue Dec 11 17:12:54 2001
@@ -1,4 +1,5 @@
 <?xml version="1.0" encoding="utf-8"?>
+<!-- $Revision: 1.5 $ -->
  <chapter id="features.safe-mode">
   <title>セーフモード</title>
 
@@ -12,12 +13,14 @@
   <para>
    
セーフモードを制御する設定ディレクティブには、次のようなものがあります。
    <programlisting role="ini">
+<![CDATA[
 safe_mode = Off 
 open_basedir = 
 safe_mode_exec_dir = 
 safe_mode_allowed_env_vars = PHP_ 
 safe_mode_protected_env_vars = LD_LIBRARY_PATH 
 disable_functions = 
+]]>
    </programlisting>
   </para>
   <para>
@@ -25,20 +28,26 @@
    
現在のスクリプトの所有者がファイル関数により処理されているファイル
    の所有者に一致するかどうかを調べます。例えば、
    <programlisting role="ls">
+<![CDATA[
 -rw-rw-r--    1 rasmus   rasmus       33 Jul  1 19:20 script.php 
 -rw-r--r--    1 root     root       1116 May 26 18:01 /etc/passwd 
+]]>
    </programlisting>
    以下のscript.php を実行すると、
    <programlisting role="php">
-&lt;?php
+<![CDATA[
+<?php
  readfile('/etc/passwd'); 
-?&gt;  
+?>
+]]>
    </programlisting>
    
セーフモードが有効な場合、以下のようなエラーが出力されます。
-   <programlisting role="php">
+   <screen>
+<![CDATA[
 Warning: SAFE MODE Restriction in effect. The script whose uid is 500 is not 
 allowed to access /etc/passwd owned by uid 0 in /docroot/script.php on line 2
-   </programlisting>
+]]>
+   </screen>
   </para>
   <para>
    <link linkend="ini.safe-mode">safe_mode</link>の代わりに、
@@ -46,28 +55,36 @@
    
のファイル操作は、制限されます。例を以下に示します。(Apache
    httpd.conf の例) 
    <programlisting role="ini">
-&lt;Directory /docroot&gt; 
+<![CDATA[
+<Directory /docroot>
 php_admin_value open_basedir /docroot 
-&lt;/Directory&gt;  
+</Directory>
+]]>
    </programlisting>
    
このopen_basedir設定で同じscript.phpを実行した場合、以下のような結果
    となります。
-   <programlisting role="php">
+   <screen>
+<![CDATA[
 Warning: open_basedir restriction in effect. File is in wrong directory in 
 /docroot/script.php on line 2 
-   </programlisting>
+]]>
+   </screen>
   </para>
   <para>
    
個々の関数を無効にすることも可能です。以下の設定をphp.iniファイルに
    追加してみましょう。
    <programlisting role="ini">
+<![CDATA[
 disable_functions readfile,system  
+]]>
    </programlisting>
    この場合、次のような出力となります。
-   <programlisting role="php">
+   <screen>
+<![CDATA[
 Warning: readfile() has been disabled for security reasons in 
 /docroot/script.php on line 2 
-   </programlisting>
+]]>
+   </screen>
   </para>
 
   <sect1 id="features.safe-mode.functions">


Reply via email to