svnno****@sourc*****
svnno****@sourc*****
2009年 3月 30日 (月) 19:25:39 JST
Revision: 16 http://svn.sourceforge.jp/view?root=frameworkspider&view=rev&rev=16 Author: m_nakashima Date: 2009-03-30 19:25:39 +0900 (Mon, 30 Mar 2009) Log Message: ----------- Modified Paths: -------------- current/DATA/lib/spider/Builder.class.php current/DATA/lib/spider/Controller.class.php current/DATA/lib/spider/tags/Charset.class.php current/DATA/lib/spider/tags/OutputHtml.class.php current/DATA/lib/spider/tags/PageTitle.class.php current/DATA/lib/spider/tags/RewriteDocumentRoot.class.php current/DATA/lib/spider/tags/SetRequestParam.class.php current/DATA/lib/spider/tags/Widget.class.php current/README.txt current/WWW_PUBLIC/spider.inc.php -------------- next part -------------- Modified: current/DATA/lib/spider/Builder.class.php =================================================================== --- current/DATA/lib/spider/Builder.class.php 2009-03-30 02:43:06 UTC (rev 15) +++ current/DATA/lib/spider/Builder.class.php 2009-03-30 10:25:39 UTC (rev 16) @@ -106,7 +106,7 @@ ."tags".DIRECTORY_SEPARATOR.$file_name ); $tag_class_name = "spider_tags_".substr($file_name,0,strpos($file_name,".")); $tag_class_obj = new $tag_class_name; - if( !is_array( $tag_object_array[$tag_class_obj->priority]) ) { + if( !isset($tag_object_array[$tag_class_obj->priority]) || !is_array($tag_object_array[$tag_class_obj->priority]) ) { $tag_object_array[$tag_class_obj->priority] = array(); } array_push( $tag_object_array[$tag_class_obj->priority], $tag_class_obj ); @@ -172,12 +172,21 @@ if( $info_hash['force'] ) { $force = 'true'; } - $attribute_prefix = $info_hash['attribute_prefix']; - $attribute_prefix = str_replace('"','\\"',$attribute_prefix); - $post_contents = $info_hash['post']; - $post_contents = str_replace('"','\\"',$post_contents); - $get_contents = $info_hash['get']; - $get_contents = str_replace('"','\\"',$get_contents); + $attribute_prefix = ''; + if( isset($info_hash['attribute_prefix']) ) { + $attribute_prefix = $info_hash['attribute_prefix']; + $attribute_prefix = str_replace('"','\\"',$attribute_prefix); + } + $post_contents = ''; + if( isset($info_hash['post']) ) { + $post_contents = $info_hash['post']; + $post_contents = str_replace('"','\\"',$post_contents); + } + $get_contents = ''; + if( isset($info_hash['get']) ) { + $get_contents = $info_hash['get']; + $get_contents = str_replace('"','\\"',$get_contents); + } $string .= '$controller->loadModule( "' . $module_name . '", '.$force.',"'.$attribute_prefix .'","'.$get_contents.'", "'.$post_contents.'" );'."\n"; } @@ -205,12 +214,6 @@ $string .= 'header("$hkey: $hval");'."\n"; $string .= '}'."\n"; $string .= '}'."\n"; - // 下位互換:http_outputに乗せられたヘッダ - $string .= 'if( count( $this->headers ) > 0 ) {'."\n"; - $string .= 'foreach( $this->headers as $hkey => $hval ) {'."\n"; - $string .= 'header("$hkey: $hval");'."\n"; - $string .= '}'."\n"; - $string .= '}'."\n"; // リダイレクトの場合 $string .= 'if( !is_null( $request_object->redirect_url ) && strlen($request_object->redirect_url)> 0 ) {'."\n"; @@ -223,13 +226,6 @@ // レスポンスボディが指定されている場合 $string .= '} else if( !is_null( $request_object->response_body ) && strlen( $request_object->response_body ) > 0 ) {'."\n"; $string .= 'echo $request_object->response_body;'."\n"; - $string .= '}'; - // 下位互換:http_outputにレスポンスファイル - $string .= 'else if( !is_null( $this->response_file_path ) && strlen( $this->response_file_path ) > 0 && file_exists( $this->response_file_path ) ){'."\n"; - $string .= 'readfile($this->response_file_path);'."\n"; - // 下位互換:http_outputにレスポンスボディ - $string .= '} else if( !is_null( $this->response_body ) && strlen( $this->response_body ) > 0 ) {'."\n"; - $string .= 'echo $this->response_body;'; // レスポンスが何も指定されていないなら継続処理 $string .= "} else { \n\n?>"; Modified: current/DATA/lib/spider/Controller.class.php =================================================================== --- current/DATA/lib/spider/Controller.class.php 2009-03-30 02:43:06 UTC (rev 15) +++ current/DATA/lib/spider/Controller.class.php 2009-03-30 10:25:39 UTC (rev 16) @@ -49,11 +49,13 @@ } // グローバルエラーが存在したらエラーに追加 - $global_errors = unserialize( $_SESSION['spider.global_errors'] ); - if( is_array( $global_errors ) ) { - $this->request_object->errors = $global_errors; + if( isset($_SESSION) ) { + $global_errors = unserialize( $_SESSION['spider.global_errors'] ); + if( is_array( $global_errors ) ) { + $this->request_object->errors = $global_errors; + } + unset( $_SESSION['spider.global_errors'] ); } - unset( $_SESSION['spider.global_errors'] ); // リクエスト出力 $this->http_output_object->output( $this, $this->request_object ); // グローバルエラーが登録されていたらセッションに登録 @@ -89,7 +91,10 @@ } // 実行モジュールクラス名の取り出し $module_real_name = str_replace( ".", "_", $module_name ); - $module_obj = $this->executed_module_object_array[$module_name]; + $module_obj = null; + if( isset($this->executed_module_object_array[$module_name]) ) { + $module_obj = $this->executed_module_object_array[$module_name]; + } if( is_null( $module_obj ) ) { // モジュールがスタックにない場合は新規作成して実行 $module_obj = new $module_real_name; @@ -240,4 +245,4 @@ return $reterun_hash; } } -?> +?> \ No newline at end of file Modified: current/DATA/lib/spider/tags/Charset.class.php =================================================================== --- current/DATA/lib/spider/tags/Charset.class.php 2009-03-30 02:43:06 UTC (rev 15) +++ current/DATA/lib/spider/tags/Charset.class.php 2009-03-30 10:25:39 UTC (rev 16) @@ -116,19 +116,23 @@ $process_code .= "mb_language('".$language."');\n"; $process_code .= "mb_detect_order('".$detect_order."');\n"; $process_code .= "mb_internal_encoding('".$internal_charset."');\n"; - if( !is_array($build_information->preview_process_hash) ){ + if( isset($build_information->preview_process_hash) + || !is_array($build_information->preview_process_hash) ){ $build_information->preview_process_hash = array(); } - if( !is_array($build_information->preview_process_hash[$this->priority]) ){ + if( !isset($build_information->preview_process_hash[$this->priority]) + || !is_array($build_information->preview_process_hash[$this->priority]) ){ $build_information->preview_process_hash[$this->priority] = array(); } array_push( $build_information->preview_process_hash[$this->priority], $process_code ); // 表示文字列に対する処理実行コードを記述 - if( !is_array($build_information->convert_view_process_hash) ){ + if( !isset($build_information->convert_view_process_hash) + || !is_array($build_information->convert_view_process_hash) ){ $build_information->convert_view_process_hash = array(); } - if( !is_array($build_information->convert_view_process_hash[$this->priority]) ){ + if( !isset($build_information->convert_view_process_hash[$this->priority]) + || !is_array($build_information->convert_view_process_hash[$this->priority]) ){ $build_information->convert_view_process_hash[$this->priority] = array(); } if( strlen( trim( $convert_kana ) ) > 0 ) { Modified: current/DATA/lib/spider/tags/OutputHtml.class.php =================================================================== --- current/DATA/lib/spider/tags/OutputHtml.class.php 2009-03-30 02:43:06 UTC (rev 15) +++ current/DATA/lib/spider/tags/OutputHtml.class.php 2009-03-30 10:25:39 UTC (rev 16) @@ -64,15 +64,20 @@ $option_values = explode(' ',$output_option); $option_hash = array(); foreach( $option_values as $option_value ) { - list( $name, $value ) = explode('=',$option_value); - $name = trim($name); - $value = trim($value); + $name = $option_value; + $value = $option_value; + if( preg_match('/\\=/',$option_value) > 0 ) { + list( $name, $value ) = explode('=',$option_value); + $name = trim($name); + $value = trim($value); + } $option_hash[$name] = $value; } // HTMLファイルのライフタイム(sec) - $lifetime = $option_hash['lifetime']; - if( preg_match('/^[0-9]{1-10}$/', $lifetime ) == 0 ) { - $lifetime = 3600; + $lifetime = 3600; + if( isset($option_hash['lifetime']) + && preg_match('/^[0-9]{1-10}$/', $option_hash['lifetime'] ) > 0 ) { + $lifetime = $option_hash['lifetime']; } // コード追加 @@ -90,10 +95,12 @@ $process_code .= '@chmod( "'.$html_path.'", 0666 );'."\n"; $process_code .= '}'."\n"; $process_code .= '}'."\n"; - if( !is_array($build_information->convert_view_process_hash) ){ + if( !isset($build_information->convert_view_process_hash) + || !is_array($build_information->convert_view_process_hash) ){ $build_information->convert_view_process_hash = array(); } - if( !is_array($build_information->convert_view_process_hash[$this->priority]) ){ + if( !isset($build_information->convert_view_process_hash[$this->priority]) + || !is_array($build_information->convert_view_process_hash[$this->priority]) ){ $build_information->convert_view_process_hash[$this->priority] = array(); } array_push( $build_information->convert_view_process_hash[$this->priority], $process_code ); Modified: current/DATA/lib/spider/tags/PageTitle.class.php =================================================================== --- current/DATA/lib/spider/tags/PageTitle.class.php 2009-03-30 02:43:06 UTC (rev 15) +++ current/DATA/lib/spider/tags/PageTitle.class.php 2009-03-30 10:25:39 UTC (rev 16) @@ -42,10 +42,12 @@ // 前処理追加:ページタイトルを属性にセット $process_code = '$page_title="'.str_replace("'","\\'",$page_title).'";'."\n"; $process_code .= '$request_object->setAttribute("page_title",$page_title );'."\n"; - if( !is_array($build_information->preview_process_hash) ){ + if( !isset($build_information->preview_process_hash) + || !is_array($build_information->preview_process_hash) ){ $build_information->preview_process_hash = array(); } - if( !is_array($build_information->preview_process_hash[$this->priority]) ){ + if( !isset($build_information->preview_process_hash[$this->priority]) + || !is_array($build_information->preview_process_hash[$this->priority]) ){ $build_information->preview_process_hash[$this->priority] = array(); } array_push( $build_information->preview_process_hash[$this->priority], $process_code ); Modified: current/DATA/lib/spider/tags/RewriteDocumentRoot.class.php =================================================================== --- current/DATA/lib/spider/tags/RewriteDocumentRoot.class.php 2009-03-30 02:43:06 UTC (rev 15) +++ current/DATA/lib/spider/tags/RewriteDocumentRoot.class.php 2009-03-30 10:25:39 UTC (rev 16) @@ -108,10 +108,12 @@ $process_code .= ' }'."\n"; $process_code .= '}}}'; - if( !is_array($build_information->convert_view_process_hash) ){ + if( !isset($build_information->convert_view_process_hash) + || !is_array($build_information->convert_view_process_hash) ){ $build_information->convert_view_process_hash = array(); } - if( !is_array($build_information->convert_view_process_hash[$this->priority]) ){ + if( !isset($build_information->convert_view_process_hash[$this->priority]) + || !is_array($build_information->convert_view_process_hash[$this->priority]) ){ $build_information->convert_view_process_hash[$this->priority] = array(); } array_push( $build_information->convert_view_process_hash[$this->priority], $process_code ); Modified: current/DATA/lib/spider/tags/SetRequestParam.class.php =================================================================== --- current/DATA/lib/spider/tags/SetRequestParam.class.php 2009-03-30 02:43:06 UTC (rev 15) +++ current/DATA/lib/spider/tags/SetRequestParam.class.php 2009-03-30 10:25:39 UTC (rev 16) @@ -48,10 +48,12 @@ $process_code .= 'foreach($_COOKIE as $key=>$value){'."\n"; $process_code .= '$request_object->setAttribute(\'cookie.\'.$key,$value);'."\n"; $process_code .= '}'."\n"; - if( !is_array($build_information->preview_process_hash) ){ + if( !isset($build_information->preview_process_hash) + || !is_array($build_information->preview_process_hash) ){ $build_information->preview_process_hash = array(); } - if( !is_array($build_information->preview_process_hash[$this->priority]) ){ + if( !isset($build_information->preview_process_hash[$this->priority]) + || !is_array($build_information->preview_process_hash[$this->priority]) ){ $build_information->preview_process_hash[$this->priority] = array(); } array_push( $build_information->preview_process_hash[$this->priority], $process_code ); Modified: current/DATA/lib/spider/tags/Widget.class.php =================================================================== (Binary files differ) Modified: current/README.txt =================================================================== --- current/README.txt 2009-03-30 02:43:06 UTC (rev 15) +++ current/README.txt 2009-03-30 10:25:39 UTC (rev 16) @@ -7,6 +7,9 @@ 1) ページ内で$request->setAttributeメソッドで値をセットした場合に$GLOBALSに設定しない為 if/foreach/writeで問題が発生する不具合を修正 +2) Noticeの修正 + PHP5のerror_reportingをE_ALLで実行した際にNoticeやWarningが出る箇所を修正 + -- 2009-03-27 1)この機会しかないと思ったのでクラス名の変更を行いました。 ・ExecutableFileCreator.class.php -> Builder.class.php Modified: current/WWW_PUBLIC/spider.inc.php =================================================================== --- current/WWW_PUBLIC/spider.inc.php 2009-03-30 02:43:06 UTC (rev 15) +++ current/WWW_PUBLIC/spider.inc.php 2009-03-30 10:25:39 UTC (rev 16) @@ -18,7 +18,7 @@ die( 'コントロールファイルです' ); } -if( !defined( $DIR_PATH_SPIDER_DATA ) || strlen( trim( $DIR_PATH_SPIDER_DATA ) ) == 0 ) { +if( !isset( $DIR_PATH_SPIDER_DATA ) || strlen( trim( $DIR_PATH_SPIDER_DATA ) ) == 0 ) { define ( "DIR_PATH_SPIDER_DATA", dirname(dirname( __FILE__ ) ).DIRECTORY_SEPARATOR."DATA" ); } else { define ( "DIR_PATH_SPIDER_DATA", $DIR_PATH_SPIDER_DATA ); @@ -28,9 +28,11 @@ $request_server_name = $_SERVER['SERVER_NAME']; $request_url = $_SERVER['REQUEST_URI']; $document_root = $_SERVER['DOCUMENT_ROOT']; -$request_https = $_SERVER['HTTPS']; - -if( strlen($SPIDER_DEFINE_BASE_URI) > 0 ) { +$is_ssl = false; +if( isset($_SERVER['HTTPS']) && preg_match('/[oO][fF][fF]/', $_SERVER['HTTPS'] ) == 0 ) { + $is_ssl = true; +} +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( "\\", "/", __FILE__ ); @@ -41,7 +43,7 @@ } $prtcl = "http://"; -if( strlen(trim($request_https)) > 0 && preg_match('/[oO][fF][fF]/', $request_https ) == 0 ) { +if( $is_ssl ) { $prtcl = "https://"; } $target_port = "";