[P2-php-svn] [835] expack:

Back to archive index

svnno****@sourc***** svnno****@sourc*****
2010年 2月 23日 (火) 23:38:56 JST


Revision: 835
          http://sourceforge.jp/projects/p2-php/svn/view?view=rev&revision=835
Author:   rsk
Date:     2010-02-23 23:38:56 +0900 (Tue, 23 Feb 2010)

Log Message:
-----------
expack:
- IE,Firefoxではスレ一覧表示でスレッドタイトルの上下が切れることがあるのに対処。
- リバースプロキシ経由でのアクセスに対応するための設定値
  $_conf['reverse_proxy_{host,port,path}'] を conf/conf_admin.inc.php に追加。

Modified Paths:
--------------
    p2ex/trunk/conf/conf_admin.inc.php
    p2ex/trunk/conf/ip_au.php
    p2ex/trunk/lib/bootstrap.php
    p2ex/trunk/lib/startup.funcs.php
    p2ex/trunk/style/subject_css.inc
    p2ex/trunk/title.php


-------------- next part --------------
Modified: p2ex/trunk/conf/conf_admin.inc.php
===================================================================
--- p2ex/trunk/conf/conf_admin.inc.php	2010-02-16 11:45:37 UTC (rev 834)
+++ p2ex/trunk/conf/conf_admin.inc.php	2010-02-23 14:38:56 UTC (rev 835)
@@ -32,6 +32,31 @@
 
 // }}}
 // ----------------------------------------------------------------------
+// {{{ ƒŠƒo[ƒXƒvƒƒLƒV
+
+// ƒŠƒo[ƒXƒvƒƒLƒV‚ð’Ê‚µ‚ăAƒNƒZƒX‚·‚éÛ‚̃zƒXƒg–¼B
+// $_SERVER['HTTP_HOST'] ‚ðã‘‚«‚µAƒIƒŠƒWƒiƒ‹‚Ì’l‚ð
+// $_SERVER['X_REP2_ORIG_HTTP_HOST'] ‚ɏ‘‚«ž‚ށB
+// 'auto' ‚̏ꍇA$_SERVER['HTTP_X_FORWARDED_HOST'] ‚ª
+// Ý’肳‚ê‚Ä‚¢‚éê‡‚¾‚¯“K—p‚³‚ê‚é
+$_conf['reverse_proxy_host'] = '';  // ("")
+
+// ƒŠƒo[ƒXƒvƒƒLƒV‚ð’Ê‚µ‚ăAƒNƒZƒX‚·‚éÛ‚̃|[ƒg”ԍ†B
+// $_SERVER['HTTP_PORT'] ‚ðã‘‚µ‚«AƒIƒŠƒWƒiƒ‹‚Ì’l‚ð
+// $_SERVER['X_REP2_ORIG_HTTP_PORT'] ‚ɏ‘‚«ž‚ށB
+// 'auto' ‚̏ꍇA$_SERVER['HTTP_X_FORWARDED_PORT'] ‚ª
+// Ý’肳‚ê‚Ä‚¢‚éê‡‚¾‚¯“K—p‚³‚ê‚éB
+$_conf['reverse_proxy_port'] = '';  // ("")
+
+// ƒŠƒo[ƒXƒvƒƒLƒV‚ð’Ê‚µ‚ăAƒNƒZƒX‚·‚éÛ‚̃pƒXB
+// $_SERVER['REQUEST_URI'], $_SERVER['SCRIPT_NAME'], $_SERVER['PHP_SELF']
+// ‚Ì‘O‚É•t‰Á‚³‚ê‚éB
+// ƒIƒŠƒWƒiƒ‹‚Ì’l‚́A‚»‚ꂼ‚ê $_SERVER["X_REP2_ORIG_{$key}"] ‚ɏ‘‚«ž‚Ü‚ê‚éB
+// reverse_proxy_host ‚ª–³Œø‚Ì‚Æ‚«‚Í–³Ž‹‚³‚ê‚éB
+$_conf['reverse_proxy_path'] = '';  // ("")
+
+// }}}
+// ----------------------------------------------------------------------
 // {{{ ƒZƒLƒ…ƒŠƒeƒB‹@”\
 
 /**

Modified: p2ex/trunk/conf/ip_au.php
===================================================================
--- p2ex/trunk/conf/ip_au.php	2010-02-16 11:45:37 UTC (rev 834)
+++ p2ex/trunk/conf/ip_au.php	2010-02-23 14:38:56 UTC (rev 835)
@@ -43,4 +43,5 @@
  * c-basic-offset: 4
  * indent-tabs-mode: nil
  * End:
- */// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker:
+ */
+// vim: set syn=php fenc=cp932 ai et ts=4 sw=4 sts=4 fdm=marker:

Modified: p2ex/trunk/lib/bootstrap.php
===================================================================
--- p2ex/trunk/lib/bootstrap.php	2010-02-16 11:45:37 UTC (rev 834)
+++ p2ex/trunk/lib/bootstrap.php	2010-02-23 14:38:56 UTC (rev 835)
@@ -6,6 +6,8 @@
 
 require_once 'Net/UserAgent/Mobile.php';
 
+p2_rewrite_vars_for_proxy();
+
 // {{{ ƒ†[ƒU[Ý’è “Çž
 
 // ƒ†[ƒU[Ý’肪‚ ‚ê‚Γǂݍž‚Þ

Modified: p2ex/trunk/lib/startup.funcs.php
===================================================================
--- p2ex/trunk/lib/startup.funcs.php	2010-02-16 11:45:37 UTC (rev 834)
+++ p2ex/trunk/lib/startup.funcs.php	2010-02-23 14:38:56 UTC (rev 835)
@@ -145,7 +145,7 @@
 /**
  * ƒNƒ‰ƒXƒ[ƒ_[
  *
- * @string $name
+ * @param string $name
  * @return void
  */
 function p2_load_class($name)
@@ -191,7 +191,59 @@
 }
 
 // }}}
+// {{{ p2_rewrite_vars_for_proxy()
 
+/**
+ * ƒŠƒo[ƒXƒvƒƒLƒVŒo—R‚Å“®ì‚·‚é‚悤‚É$_SERVER•Ï”‚ð‘‚«Š·‚¦‚é
+ *
+ * @param void
+ * @return void
+ */
+function p2_rewrite_vars_for_proxy()
+{
+    global $_conf;
+
+    foreach (array('HTTP_HOST', 'HTTP_PORT', 'REQUEST_URI', 'SCRIPT_NAME', 'PHP_SELF') as $key) {
+        $_SERVER["X_REP2_ORIG_{$key}"] = $_SERVER[$key];
+    }
+
+    if ($_conf['reverse_proxy_host']) {
+        if ($_conf['reverse_proxy_host'] === 'auto') {
+            if (isset($_SERVER['HTTP_X_FORWARDED_HOST'])) {
+                $_SERVER['HTTP_HOST'] = $_SERVER['HTTP_X_FORWARDED_HOST'];
+            } else {
+                return;
+            }
+        } else {
+            $_SERVER['HTTP_HOST'] = $_conf['reverse_proxy_host'];
+        }
+    } else {
+        return;
+    }
+
+    if ($_conf['reverse_proxy_port']) {
+        if ($_conf['reverse_proxy_port'] === 'auto') {
+            if (isset($_SERVER['HTTP_X_FORWARDED_PORT'])) {
+                $SERVER['HTTP_PORT'] = $_SERVER['HTTP_X_FORWARDED_PORT'];
+            }
+        } else {
+             $SERVER['HTTP_PORT'] = $_conf['reverse_proxy_port'];
+        }
+    }
+
+    if ($_conf['reverse_proxy_path']) {
+        foreach (array('REQUEST_URI', 'SCRIPT_NAME', 'PHP_SELF') as $key) {
+            if (!isset($_SERVER[$key]) || $_SERVER[$key] === '') {
+                $_SERVER[$key] = $_conf['reverse_proxy_path'] . '/';
+            } else {
+                $_SERVER[$key] = $_conf['reverse_proxy_path'] . $_SERVER[$key];
+            }
+        }
+    }
+}
+
+// }}}
+
 /*
  * Local Variables:
  * mode: php

Modified: p2ex/trunk/style/subject_css.inc
===================================================================
--- p2ex/trunk/style/subject_css.inc	2010-02-16 11:45:37 UTC (rev 834)
+++ p2ex/trunk/style/subject_css.inc	2010-02-23 14:38:56 UTC (rev 835)
@@ -16,7 +16,7 @@
 
 echo <<<EOSTYLE
 
-body{
+body {
 	margin: 0 0 8px 0;
 	padding: 0;
 	line-height: 130%;
@@ -36,8 +36,10 @@
 	margin: 0;
 	padding: 0;
 }
+/*
 form.check {
 }
+*/
 form#urlform {
 	margin: 8px;
 }
@@ -271,10 +273,13 @@
 */
 
 /* tl ƒXƒŒƒbƒhƒŠƒXƒg ƒ^ƒCƒgƒ‹–¼—“ */
+table.threadlist td.tl {
+    padding: 0 4px;
+}
 table.threadlist td.tl div.el {
 	min-width: 10em;
 	margin: 0;
-	padding: 0;
+	padding: 4px 0;
 	overflow: hidden;
 	text-overflow: ellipsis;
 	-o-text-overflow: ellipsis;

Modified: p2ex/trunk/title.php
===================================================================
--- p2ex/trunk/title.php	2010-02-16 11:45:37 UTC (rev 834)
+++ p2ex/trunk/title.php	2010-02-23 14:38:56 UTC (rev 835)
@@ -62,7 +62,7 @@
 $htm['auth_user'] = "<p>ƒƒOƒCƒ“ƒ†[ƒU: {$_login->user_u} - " . date("Y/m/d (D) G:i") . "</p>\n";
 
 // iŒg‘сjƒƒOƒCƒ“—pURL
-$base_url = rtrim(dirname(P2Util::getMyUrl()), '/');
+$base_url = rtrim(dirname(P2Util::getMyUrl()), '/') . '/';
 $url_b = $base_url . '?user=' . rawurlencode($_login->user_u) . '&b=';
 $url_b_ht = htmlspecialchars($url_b, ENT_QUOTES);
 



P2-php-svn メーリングリストの案内
Back to archive index