svnno****@sourc*****
svnno****@sourc*****
2010年 3月 26日 (金) 17:15:28 JST
Revision: 87 http://sourceforge.jp/projects/frameworkspider/svn/view?view=rev&revision=87 Author: m_nakashima Date: 2010-03-26 17:15:28 +0900 (Fri, 26 Mar 2010) Log Message: ----------- Modified Paths: -------------- current/README.txt current/htdocs/index.php current/htdocs/spider.inc.php current/spider/lib/spider/HttpRequest.class.php current/spider/lib/spider/ModuleBase.class.php current/spider/lib/spider/functions.inc.php current/spider/lib/spider/module/AutoEncode.class.php current/spider/lib/spider/module/AutoFormat.class.php current/spider/lib/spider/module/NoCache.class.php current/spider/lib/spider/tags/Template.class.php current/spider/lib/spider/tags/Widget.class.php current/spider/lib/util/File.class.php current/spider/lib/util/GetHTTPResponse.class.php current/spider/lib/util/LockProcess.class.php current/spider/lib/util/MobileTerminal.class.php current/spider/lib/util/mail/SMTP.class.php current/spider/messages.inc.php current/spider/pages/default/index.php Added Paths: ----------- current/htdocs/ current/spider/templates/default/public_default.tpl current/spider/widgets/default/example.tpl current/spider/widgets/default/example.tpl.index.php Removed Paths: ------------- current/WWW_PUBLIC/ current/spider/templates/default/public_default.php current/spider/widgets/default/example.php current/spider/widgets/default/index.php -------------- next part -------------- Modified: current/README.txt =================================================================== --- current/README.txt 2010-03-26 08:06:02 UTC (rev 86) +++ current/README.txt 2010-03-26 08:15:28 UTC (rev 87) @@ -3,6 +3,14 @@ ** ** このファイルにはコミットごとに変更点とファイル名を記述します。 ** +-- 2010-03-26 +1) リバースプロキシ経由の場合のリダイレクト不具合を修正しました。 +2) テンプレート内でのXML宣言をechoしなくても記述できるように自動置換機能を追加しました。 + テンプレートの拡張子はなんでも構いませんので開発上の都合からphpから一般的なtplに変更することにしました。 +3) ダイナミックウィジェットに関する機能の変更 + ページダイレクト指定のウィジェットをウィジェット名.ページ名のファイルとするように変更しました。 +4) 時流に従って配布版のドキュメントルート用フォルダ名をhtdocsに変更しました + -- 2010-01-20 1) GETパラメータによるデバッグコマンドを実装しました spiderdebugcmd=viewmoduletime Modified: current/htdocs/index.php =================================================================== --- current/WWW_PUBLIC/index.php 2009-10-07 09:23:27 UTC (rev 83) +++ current/htdocs/index.php 2010-03-26 08:15:28 UTC (rev 87) @@ -1,6 +1,6 @@ <?php include_once( "./spider.inc.php" ); ?> {charset:UTF-8} -{template:public_default.php} +{template:public_default.tpl} {page-title:framework-sipder example page!} {module:example.Hello force post(a="afds) get() attribute_prefix(media)} {module:example.Hello force} Modified: current/htdocs/spider.inc.php =================================================================== --- current/WWW_PUBLIC/spider.inc.php 2009-10-07 09:23:27 UTC (rev 83) +++ current/htdocs/spider.inc.php 2010-03-26 08:15:28 UTC (rev 87) @@ -159,4 +159,4 @@ unset($app_ssl_url); require_once( DIR_PATH_SPIDER_DATA . DIRECTORY_SEPARATOR . 'spider_main.inc.php' ); -?> +?> \ No newline at end of file Modified: current/spider/lib/spider/HttpRequest.class.php =================================================================== --- current/spider/lib/spider/HttpRequest.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/spider/HttpRequest.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -151,6 +151,7 @@ || APPLICATION_PROXY_REV_HOST == $_SERVER['HTTP_X_FORWARDED_SERVER'] ) ) { // リバースプロキシホスト名が設置されていてそこからのアクセスの場合 $url = preg_replace('/\\/$/','',APPLICATION_PROXY_REV_BASE_URI).$url; + $this->redirect_url = $url; } else { // リバースプロキシ経由でない場合 $this->redirect_url = $url; @@ -584,4 +585,4 @@ unset($this->valueHash[$key]); } } -?> +?> \ No newline at end of file Modified: current/spider/lib/spider/ModuleBase.class.php =================================================================== --- current/spider/lib/spider/ModuleBase.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/spider/ModuleBase.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -136,4 +136,4 @@ } } } -?> +?> \ No newline at end of file Modified: current/spider/lib/spider/functions.inc.php =================================================================== --- current/spider/lib/spider/functions.inc.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/spider/functions.inc.php 2010-03-26 08:15:28 UTC (rev 87) @@ -328,4 +328,4 @@ } return $regist_columns; } -?> +?> \ No newline at end of file Modified: current/spider/lib/spider/module/AutoEncode.class.php =================================================================== --- current/spider/lib/spider/module/AutoEncode.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/spider/module/AutoEncode.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -49,4 +49,4 @@ } } } -?> +?> \ No newline at end of file Modified: current/spider/lib/spider/module/AutoFormat.class.php =================================================================== --- current/spider/lib/spider/module/AutoFormat.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/spider/module/AutoFormat.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -41,4 +41,4 @@ } } } -?> +?> \ No newline at end of file Modified: current/spider/lib/spider/module/NoCache.class.php =================================================================== --- current/spider/lib/spider/module/NoCache.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/spider/module/NoCache.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -23,4 +23,4 @@ $request->setResponseHeader( 'Expires', '0' ); } } -?> +?> \ No newline at end of file Modified: current/spider/lib/spider/tags/Template.class.php =================================================================== (Binary files differ) Modified: current/spider/lib/spider/tags/Widget.class.php =================================================================== (Binary files differ) Modified: current/spider/lib/util/File.class.php =================================================================== --- current/spider/lib/util/File.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/util/File.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -48,5 +48,34 @@ } return true; } + /** + * spiderアプリケーション内の絶対ファイルパスをアプリケーションURIに変換します + */ + function path2suri( $absolutePath ) { + $basePath = str_replace(DIRECTORY_SEPARATOR,'/',APPLICATION_BASE_PATH); + $absolutePath = str_replace(DIRECTORY_SEPARATOR,'/',$absolutePath); + if( strlen($absolutePath) >= strlen($basePath) ) { + $retUri = str_replace($basePath,'',$absolutePath); + if( preg_match('/\\/$/',$retUri) > 0 ) { $retUri = preg_replace('/\\/$/','',$retUri); } + if( preg_match('/^\\//',$retUri) == 0 ) { $retUri = '/'.$retUri; } + return $retUri; + } + return false; + } + /** + * spiderアプリケーション内のURIからファイル絶対パスに変換します + */ + function suri2path( $uri ) { + $absolutePath = str_replace(DIRECTORY_SEPARATOR,'/',APPLICATION_BASE_PATH); + if( preg_match('/\\/$/',$absolutePath) > 0 ) { + $absolutePath = preg_replace('/\\/$/','',$absolutePath); + } + if( '/' == $uri ) { + } else { + $absolutePath .= $uri; + } + $absolutePath = str_replace('/',DIRECTORY_SEPARATOR,$absolutePath); + return $absolutePath; + } } ?> \ No newline at end of file Modified: current/spider/lib/util/GetHTTPResponse.class.php =================================================================== --- current/spider/lib/util/GetHTTPResponse.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/util/GetHTTPResponse.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -204,4 +204,4 @@ // echo "通信に失敗"; //} // -?> +?> \ No newline at end of file Modified: current/spider/lib/util/LockProcess.class.php =================================================================== --- current/spider/lib/util/LockProcess.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/util/LockProcess.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -80,4 +80,4 @@ } } -?> +?> \ No newline at end of file Modified: current/spider/lib/util/MobileTerminal.class.php =================================================================== --- current/spider/lib/util/MobileTerminal.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/util/MobileTerminal.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -88,4 +88,4 @@ return $this->message; } } -?> +?> \ No newline at end of file Modified: current/spider/lib/util/mail/SMTP.class.php =================================================================== --- current/spider/lib/util/mail/SMTP.class.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/lib/util/mail/SMTP.class.php 2010-03-26 08:15:28 UTC (rev 87) @@ -48,17 +48,34 @@ return false; } } + $mailSendObj = null; + if( preg_match('/^[fF](|[aA][lL][sS][eE])$/',$this->options['smtp_auth']) > 0 + || strlen($this->options['smtp_auth']) == 0 ) { + $this->options['smtp_auth'] = false; + } + if( preg_match('/^[pP][oO][pP][bB][eE][fF][oO][rR][eE]$/',$this->options['smtp_auth']) > 0 ) { + if( $this->connectPopBeforeSmtp() ) { + $params = array( + "host" => $this->options['smtp_host'], + "port" => $this->options['smtp_port'], + "localhost" => $_SERVER['HOST_NAME'] + ); + $mailSendObj = & Mail::factory( 'smtp', $params ); + } else { + return false; + } + } else { + $params = array( + "host" => $this->options['smtp_host'], + "port" => $this->options['smtp_port'], + "auth" => $this->options['smtp_auth'], + "username" => $this->options['smtp_auth_user'], + "password" => $this->options['smtp_auth_pass'], + "localhost" => $_SERVER['HOST_NAME'] + ); + $mailSendObj = & Mail::factory( 'smtp', $params ); + } - $params = array( - "host" => $this->options['smtp_host'], - "port" => $this->options['smtp_port'], - "auth" => $this->options['smtp_auth'], - "username" => $this->options['smtp_auth_user'], - "password" => $this->options['smtp_auth_pass'], - "localhost" => $_SERVER['HOST_NAME'] - ); - $mailSendObj = & Mail::factory( 'smtp', $params ); - // 送信を実行する $result = $mailSendObj->send( $this->getToAddress(), $header_hash, $body_strings ); if ( PEAR::isError( $result ) ) { @@ -158,8 +175,29 @@ $smtp_auth = trim($options['smtp_auth']); $smtp_auth_user = trim($options['smtp_auth_user']); $smtp_auth_pass = trim($options['smtp_auth_pass']); - if( !$smtp_auth || strlen($smtp_auth) > 0 ) { + + if( preg_match('/^[fF](|[aA][lL][sS][eE])$/',$smtp_auth) > 0 + || strlen($smtp_auth) == 0 ) { + $smtp_auth = false; + } + if( $smtp_auth === false ) { + // 認証なし + } else if( preg_match('/^[pP][oO][pP][bB][eE][fF][oO][rR][eE]$/',$smtp_auth) > 0 ) { + // pop before smtp + if( strlen(trim($options['pop_host'])) == 0 ) { + array_push($error_messages,'認証用POPサーバホスト名を入力してください。'); + } + if( strlen(trim($options['pop_port'])) == 0 ) { + array_push($error_messages,'認証用POPサーバポート番号を入力してください。'); + } if( strlen($smtp_auth_user) == 0 ) { + array_push($error_messages,'認証ユーザ名を入力してください。'); + } + if( strlen($smtp_auth_pass) == 0 ) { + array_push($error_messages,'認証パスワードを入力してください。'); + } + } else { + if( strlen($smtp_auth_user) == 0 ) { array_push($error_messages,'SMTP認証ユーザ名を入力してください。'); } if( strlen($smtp_auth_pass) == 0 ) { @@ -168,5 +206,37 @@ } return $error_messages; } + /** + * pop before smtpのためpopサーバーに接続して切断します + */ + function connectPopBeforeSmtp() { + $socket = fsockopen($this->options['pop_host'], $this->options['pop_port'], $errorNumber, $errorMessage, 10); + if( $socket !== false ) { + $buffer = fgets($socket, 512); + if (substr($buffer, 0, 3) != '+OK') { + fputs($socket, "QUIT \r\n"); + fclose($socket); + } else { + fputs($socket, "USER ".$this->options['smtp_auth_user']."\r\n "); + $buffer = fgets($socket, 512); + if (substr($buffer, 0, 3) != '+OK') { + fputs($socket, "QUIT \r\n"); + fclose($socket); + } else { + fputs($socket, "PASS ".$this->options['smtp_auth_pass']."\r\n"); + $buffer = fgets($socket, 512); + if (substr($buffer, 0, 3) != '+OK') { + fputs($socket, "QUIT \r\n"); + fclose($socket); + } else { + fputs($socket, "QUIT \r\n"); + fclose($socket); + return true; + } + } + } + } + return false; + } } ?> \ No newline at end of file Modified: current/spider/messages.inc.php =================================================================== --- current/spider/messages.inc.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/messages.inc.php 2010-03-26 08:15:28 UTC (rev 87) @@ -26,4 +26,4 @@ 'spider.tags.usesession.cantstart' => 'Core Error : アプリケーションセッションを開始できませんでした。', 'spider.tags.write.objectcanthasnumericmember' => 'Core Error : オブジェクトの添え字には数字を指定できません。', ); -?> +?> \ No newline at end of file Modified: current/spider/pages/default/index.php =================================================================== --- current/spider/pages/default/index.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/pages/default/index.php 2010-03-26 08:15:28 UTC (rev 87) @@ -11,10 +11,10 @@ </tr> <tr> <td> - {widget:example.php dynamic} + {widget:example.tpl dynamic} </td> <td> - {widget:example.php} + {widget:example.tpl} </td> </tr> </tbody> Deleted: current/spider/templates/default/public_default.php =================================================================== --- current/spider/templates/default/public_default.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/templates/default/public_default.php 2010-03-26 08:15:28 UTC (rev 87) @@ -1,36 +0,0 @@ -<?php echo '<?xml version="1.0" encoding="UTF-8"?>'; ?> -<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" - "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> -<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> -<head> - <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> - <meta http-equiv="Content-Script-Type" content="text/javascript" /> - <meta http-equiv="Content-Style-Type" content="text/css" /> - <meta content="ja" name="content-language" /> - <meta content="2008.09.01" name="build" /> - <meta content="M.Nakashima" name="author" /> - <meta name="description" content="Welcome spider framework!" /> - <meta name="keywords" content="Welcome spider framework!" /> - <title>{write:page_title}</title> - <style type="text/css"> - * { font-family:monospace; } - table { border-style:solid; border-width:1px; border-color:#000080; border-collapse:collapse; } - th,td { border-style:solid; border-width:1px; border-color:#000080; text-align:center; padding:5px; } - th { color:#FFFFFF; background-color:#0000D0; } - #header { width:100%; background-color:#6060D0; color:#F0F0F0; } - #contents { width:100%; text-align:left; padding:5px; } - #footer { width:100%; background-color:#6060D0; color:#F0F0F0; } - #contents h1 { font-size:20px; color:#008080; text-align:center; } - #contents h2 { font-size:18px; color:#FFFFFF; background-color:#008080; margin:0px 0px 5px 0px; padding:3px; } - #contents h3 { font-size:16px; color:#FFFFFF; background-color:#008080; margin:0px 0px 5px 0px; padding:3px; } - div.example-block { background-color:#DDFFFF; border-style:solid; border-width:1px; border-color:#008080; margin: 5px auto 5px auto; padding: 5px; } - </style> -</head> -<body style="margin:0 auto;text-align:center;"> - <div id="header">Welcome Spider framework! This is sample template!</div> - <div id="contents"> - {page-contents} - </div> - <div id="footer">Welcome Spider framework! This is sample template!</div> -</body> -</html> \ No newline at end of file Copied: current/spider/templates/default/public_default.tpl (from rev 83, current/spider/templates/default/public_default.php) =================================================================== --- current/spider/templates/default/public_default.tpl (rev 0) +++ current/spider/templates/default/public_default.tpl 2010-03-26 08:15:28 UTC (rev 87) @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" + "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml" lang="ja" xml:lang="ja"> +<head> + <meta http-equiv="Content-type" content="text/html; charset=UTF-8" /> + <meta http-equiv="Content-Script-Type" content="text/javascript" /> + <meta http-equiv="Content-Style-Type" content="text/css" /> + <meta content="ja" name="content-language" /> + <meta content="2008.09.01" name="build" /> + <meta content="M.Nakashima" name="author" /> + <meta name="description" content="Welcome spider framework!" /> + <meta name="keywords" content="Welcome spider framework!" /> + <title>{write:page_title}</title> + <style type="text/css"> + * { font-family:monospace; } + table { border-style:solid; border-width:1px; border-color:#000080; border-collapse:collapse; } + th,td { border-style:solid; border-width:1px; border-color:#000080; text-align:center; padding:5px; } + th { color:#FFFFFF; background-color:#0000D0; } + #header { width:100%; background-color:#6060D0; color:#F0F0F0; } + #contents { width:100%; text-align:left; padding:5px; } + #footer { width:100%; background-color:#6060D0; color:#F0F0F0; } + #contents h1 { font-size:20px; color:#008080; text-align:center; } + #contents h2 { font-size:18px; color:#FFFFFF; background-color:#008080; margin:0px 0px 5px 0px; padding:3px; } + #contents h3 { font-size:16px; color:#FFFFFF; background-color:#008080; margin:0px 0px 5px 0px; padding:3px; } + div.example-block { background-color:#DDFFFF; border-style:solid; border-width:1px; border-color:#008080; margin: 5px auto 5px auto; padding: 5px; } + </style> +</head> +<body style="margin:0 auto;text-align:center;"> + <div id="header">Welcome Spider framework! This is sample template!</div> + <div id="contents"> + {page-contents} + </div> + <div id="footer">Welcome Spider framework! This is sample template!</div> +</body> +</html> \ No newline at end of file Deleted: current/spider/widgets/default/example.php =================================================================== --- current/spider/widgets/default/example.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/widgets/default/example.php 2010-03-26 08:15:28 UTC (rev 87) @@ -1,4 +0,0 @@ -<div style="width:150px;height:150px;border-style:solid;border-width:1px;text-align:center;"> - Example<br /> - Widget! -</div> \ No newline at end of file Copied: current/spider/widgets/default/example.tpl (from rev 83, current/spider/widgets/default/example.php) =================================================================== --- current/spider/widgets/default/example.tpl (rev 0) +++ current/spider/widgets/default/example.tpl 2010-03-26 08:15:28 UTC (rev 87) @@ -0,0 +1,4 @@ +<div style="width:150px;height:150px;border-style:solid;border-width:1px;text-align:center;"> + Example<br /> + Widget! +</div> \ No newline at end of file Copied: current/spider/widgets/default/example.tpl.index.php (from rev 83, current/spider/widgets/default/index.php) =================================================================== --- current/spider/widgets/default/example.tpl.index.php (rev 0) +++ current/spider/widgets/default/example.tpl.index.php 2010-03-26 08:15:28 UTC (rev 87) @@ -0,0 +1,5 @@ +<div style="width:150px;height:150px;border-style:solid;border-width:1px;text-align:center;"> + index.php<br /> + Dynamic<br /> + Widget! +</div> \ No newline at end of file Deleted: current/spider/widgets/default/index.php =================================================================== --- current/spider/widgets/default/index.php 2010-03-26 08:06:02 UTC (rev 86) +++ current/spider/widgets/default/index.php 2010-03-26 08:15:28 UTC (rev 87) @@ -1,5 +0,0 @@ -<div style="width:150px;height:150px;border-style:solid;border-width:1px;text-align:center;"> - index.php<br /> - Dynamic<br /> - Widget! -</div> \ No newline at end of file