svnno****@sourc*****
svnno****@sourc*****
2009年 4月 22日 (水) 11:08:32 JST
Revision: 69 http://svn.sourceforge.jp/view?root=frameworkspider&view=rev&rev=69 Author: m_nakashima Date: 2009-04-22 11:08:32 +0900 (Wed, 22 Apr 2009) Log Message: ----------- Modified Paths: -------------- current/DATA/spider_command.inc.php current/DATA/spider_main.inc.php current/WWW_PUBLIC/spider.inc.php -------------- next part -------------- Modified: current/DATA/spider_command.inc.php =================================================================== --- current/DATA/spider_command.inc.php 2009-04-21 02:03:55 UTC (rev 68) +++ current/DATA/spider_command.inc.php 2009-04-22 02:08:32 UTC (rev 69) @@ -3,7 +3,7 @@ * framework-spider: コマンドプログラム用共通読み込みファイル */ // Framework Version -define( 'SPIDER_VERSION', '1.0.00' ); +define( 'SPIDER_VERSION', '1.0.01' ); define ( 'DIR_PATH_SPIDER_DATA', dirname(__FILE__) ); /* 設定ファイルの読み込み */ Modified: current/DATA/spider_main.inc.php =================================================================== --- current/DATA/spider_main.inc.php 2009-04-21 02:03:55 UTC (rev 68) +++ current/DATA/spider_main.inc.php 2009-04-22 02:08:32 UTC (rev 69) @@ -3,7 +3,7 @@ * framework-spider: Webページ利用用共通メイン実行ファイル */ // Framework Version -define( 'SPIDER_VERSION', '1.0.00' ); +define( 'SPIDER_VERSION', '1.0.01' ); /* 設定ファイルの読み込み */ require_once( dirname(__FILE__).DIRECTORY_SEPARATOR.'define.inc.php' ); Modified: current/WWW_PUBLIC/spider.inc.php =================================================================== --- current/WWW_PUBLIC/spider.inc.php 2009-04-21 02:03:55 UTC (rev 68) +++ current/WWW_PUBLIC/spider.inc.php 2009-04-22 02:08:32 UTC (rev 69) @@ -1,7 +1,7 @@ <?php /* * spider.inc.php - * @version 1.0.00 + * @version 1.0.01 * * if you need, change $DIR_PATH_SPIDER_DATA for your Env. */ @@ -22,9 +22,29 @@ } if( !isset( $DIR_PATH_SPIDER_DATA ) || strlen( trim( $DIR_PATH_SPIDER_DATA ) ) == 0 ) { - define ( "DIR_PATH_SPIDER_DATA", dirname(dirname( __FILE__ ) ).DIRECTORY_SEPARATOR."DATA" ); + $DIR_PATH_SPIDER_DATA = null; + $targetDir = dirname(__FILE__); + $rootPathLength = 1; + if(isset($_ENV) && isset($_ENV['OS']) && preg_match('/[wW][iI][nN]/',$_ENV['OS'] ) > 0 ) { + $rootPathLength = 3; + } + while( strlen($targetDir) > $rootPathLength ) { + $DIR_PATH_SPIDER_DATA = $targetDir.DIRECTORY_SEPARATOR.'DATA'; + if( is_dir( $DIR_PATH_SPIDER_DATA ) ) { + break; + } + $targetDir = dirname($targetDir); + } + unset($targetDir); + unset($rootPathLength); + if( is_null( $DIR_PATH_SPIDER_DATA ) ) { + header( 'Content-type: text/plain;charset=UTF-8' ); + die( 'Spider DATA Folder is not found!' ); + } else { + define ( 'DIR_PATH_SPIDER_DATA', $DIR_PATH_SPIDER_DATA ); + } } else { - define ( "DIR_PATH_SPIDER_DATA", $DIR_PATH_SPIDER_DATA ); + define ( 'DIR_PATH_SPIDER_DATA', $DIR_PATH_SPIDER_DATA ); } $request_protocol = $_SERVER['SERVER_PROTOCOL']; $request_port = $_SERVER['SERVER_PORT']; @@ -44,8 +64,8 @@ if( isset($SPIDER_DEFINE_BASE_URI) && strlen($SPIDER_DEFINE_BASE_URI) > 0 ) { $spider_base_uri = $SPIDER_DEFINE_BASE_URI; } else { - $spider_inc_path = str_replace( DIRECTORY_SEPARATOR, "/", __FILE__ ); - $spider_base_uri = dirname(str_replace( $document_root, "", $spider_inc_path )); + $spider_inc_path = str_replace( DIRECTORY_SEPARATOR, '/', __FILE__ ); + $spider_base_uri = dirname(str_replace( $document_root, '', $spider_inc_path )); if( preg_match('/^\\/\\~[0-9a-zA-Z\\_]+\\//',$request_uri) > 0 ) { // ユーザーディレクトリの場合リクエストURIの一つ目の要素をくっつける $dirname_array = explode('/',$request_uri); @@ -56,28 +76,31 @@ $spider_base_uri .= '/'; } -$prtcl = "http://"; +$prtcl = 'http://'; if( $is_ssl ) { - $prtcl = "https://"; + $prtcl = 'https://'; } -$target_port = ""; +$target_port = ''; if ( $request_port != 80 && $request_port != 443 ) { - $target_port = ":" . $request_port; + $target_port = ':' . $request_port; } $app_base_url = $prtcl . $request_server_name . $target_port . $spider_base_uri; -$app_nomal_url = "http://" . $request_server_name . $target_port . $spider_base_uri; -$app_ssl_url = "https://" . $request_server_name . $target_port . $spider_base_uri; +$app_nomal_url = 'http://' . $request_server_name . $target_port . $spider_base_uri; +$app_ssl_url = 'https://' . $request_server_name . $target_port . $spider_base_uri; -define( "APPLICATION_BASE_URL", $app_base_url ); -define( "APPLICATION_NML_URL", $app_nomal_url ); -define( "APPLICATION_SSL_URL", $app_ssl_url ); +define( 'APPLICATION_BASE_URL', $app_base_url ); +define( 'APPLICATION_NML_URL', $app_nomal_url ); +define( 'APPLICATION_SSL_URL', $app_ssl_url ); $app_base_uri = $spider_base_uri; if ( !preg_match( '/\\/$/', $app_base_uri ) ) { $app_base_uri .= '/'; } -define( "APPLICATION_BASE_URI", $app_base_uri ); -define( "APPLICATION_BASE_PATH", dirname(__FILE__ ) ); +define( 'APPLICATION_BASE_URI', $app_base_uri ); +define( 'APPLICATION_BASE_PATH', dirname(__FILE__ ) ); +unset($app_base_url); +unset($app_nomal_url); +unset($app_ssl_url); +unset($spider_base_uri); +require_once( DIR_PATH_SPIDER_DATA . DIRECTORY_SEPARATOR . 'spider_main.inc.php' ); -require_once( DIR_PATH_SPIDER_DATA . DIRECTORY_SEPARATOR . "spider_main.inc.php" ); - ?>