Source for file Options.inc

Documentation is available at Options.inc

  1. <?php /*-*- mode: php; tab-width:4 -*-*/
  2.  
  3. /*
  4.  * Copyright (C) 2003-2007 Jost Boekemeier.
  5.  *
  6.  * Permission is hereby granted, free of charge, to any person
  7.  * obtaining a copy of this file (the "Software"), to deal in the
  8.  * Software without restriction, including without limitation the
  9.  * rights to use, copy, modify, merge, publish, distribute,
  10.  * sublicense, and/or sell copies of the Software, and to permit
  11.  * persons to whom the Software is furnished to do so, subject to the
  12.  * following conditions:
  13.  *
  14.  * The above copyright notice and this permission notice shall be included in
  15.  * all copies or substantial portions of the Software.
  16.  *
  17.  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  18.  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  19.  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
  20.  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
  21.  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  22.  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  23.  * OTHER DEALINGS IN THE SOFTWARE.
  24.  */
  25.  
  26.  
  27. /**
  28.  * Helper function: Extract the URL from base and
  29.  * and set host, port and servlet accordingly.
  30.  * For example when the user has called:
  31.  * require_once("http://localhost:8080/JavaBridge/java/Java.inc");
  32.  * the JAVA_HOSTS is set to localhost:8080 and
  33.  * JAVA_SERVLET to /JavaBridge/JavaBridge.phpjavabridge.
  34.  * @access private
  35.  */
  36. function java_defineHostFromInitialQuery($java_base{
  37.   if($java_base!="java/"{
  38.     $url parse_url($java_base);
  39.     if(isset($url["scheme"]&& ($url["scheme"]=="http")) {
  40.       $host $url["host"];
  41.       $port $url["port"];
  42.       $path $url["path"];
  43.       define ("JAVA_HOSTS""$host:$port");
  44.       $dir dirname($path);
  45.       define ("JAVA_SERVLET""$dir/JavaBridge.phpjavabridge")// On ;; On or User
  46.       return true;
  47.     }
  48.   }
  49.   return false;
  50. }
  51.  
  52. // The version number of this pure PHP implementation
  53.  
  54. define ("JAVA_PEAR_VERSION""5.0.0");
  55.  
  56. if(!defined("JAVA_SEND_SIZE")) 
  57.   define("JAVA_SEND_SIZE"8192);
  58.  
  59. if(!defined("JAVA_RECV_SIZE")) 
  60.   define("JAVA_RECV_SIZE"8192);
  61.  
  62.  
  63. // parse "java.ini" for backward compatibility
  64. if (defined ("JAVA_PARSE_INI_FILE"&& JAVA_PARSE_INI_FILE{
  65.   $ini=@parse_ini_file("java.ini");
  66.   if(array_key_exists("java.hosts"$ini)) define("JAVA_HOSTS"$ini["java.hosts"]);
  67.   if(array_key_exists("java.servlet"$ini)) define("JAVA_SERVLET"$ini["java.servlet"]);
  68.   if(array_key_exists("java.log_level"$ini)) define("JAVA_LOG_LEVEL"$ini["java.log_level"]);
  69.  }
  70.  
  71. // Deploy JavaBridge.war and re-start the servlet engine or the
  72. // application server. The following settings direct PHP to the 
  73. // java virtual machine:
  74. if(!defined("JAVA_HOSTS")) {
  75.   if(!java_defineHostFromInitialQuery($JAVA_BASE)) {
  76.     define("JAVA_HOSTS""127.0.0.1:8080")// host1:port1;host2:port2;...
  77.     define("JAVA_SERVLET""On")// On ;; On or User
  78.   }
  79.  else {
  80.   if(!defined("JAVA_SERVLET")) 
  81.     define("JAVA_SERVLET""On")// On ;; On or User
  82.  }
  83. // The request log level between 0 (log off) and 4 (log debug). The
  84. // default request log level is initialized with the value from to the
  85. // Java system property "php.java.bridge.default_log_level".  The
  86. // servlet's init-param: servlet_log_level (see WEB-INF/web.xml)
  87. // overrides this value. The default level is 2.
  88.  
  89. if(!defined("JAVA_LOG_LEVEL"))
  90.   define ("JAVA_LOG_LEVEL"null)// integer between 0 and 4
  91.  
  92.  
  93. // May we use named pipes instead of local TCP sockets?  Set this to
  94. // the directory in which the named pipes should be created.
  95. // Note that pipes are a little bit slower than persistent TCP
  96. // sockets. But they are more secure.
  97. // Example: define("JAVA_PIPE_DIR", "/tmp");
  98. // Default is to use /dev/shm on Linux, false otherwise.
  99. if(!defined("JAVA_PIPE_DIR")) {
  100.   if (file_exists ("/dev/shm")) define("JAVA_PIPE_DIR""/dev/shm" );
  101.   elseif (file_exists ("/tmp")) define("JAVA_PIPE_DIR""/tmp" );
  102.   else                          define ("JAVA_PIPE_DIR"null);
  103. }
  104.  
  105. // Set to 1 for compatibility with earlier versions
  106. if (!defined("JAVA_PREFER_VALUES"))
  107.   define("JAVA_PREFER_VALUES"0);
  108.  
  109. // debug mode
  110. if(!defined("JAVA_DEBUG")) 
  111.   define("JAVA_DEBUG"false);

Documentation generated on Sun, 16 Mar 2008 19:11:47 +0100 by phpDocumentor 1.4.0a2