OSDN Git Service

コンテントタイプ送出時のキャラクタセット設定の修正
authorshizuki <shizuki@kinezumi.net>
Thu, 5 Apr 2012 15:09:58 +0000 (00:09 +0900)
committershizuki <shizuki@kinezumi.net>
Thu, 5 Apr 2012 15:09:58 +0000 (00:09 +0900)
globalfunctions.phpのsendContentTypeメソッドにおいて、引数$charsetにどんな値を渡してもデフォルト値でしかヘッダ情報が送信されなくなっていたので、引数に合わせるように修正

nucleus/libs/globalfunctions.php

index 43b4d3c..6676a54 100644 (file)
@@ -742,10 +742,14 @@ $manager->notify(
         * @param string $page_type\r
         * @param string $charset Deprecated. This has no meaning.\r
         */\r
-       function sendContentType($content_type, $page_type = '', $charset = _CHARSET)\r
+       function sendContentType($content_type, $page_type = '', $charset = '')\r
        {\r
                global $manager, $CONF;\r
-               \r
+\r
+               if ( empty($charset) )\r
+               {\r
+                       $charset = i18n::get_current_charset();\r
+               }\r
                if ( !headers_sent() )\r
                {\r
                        // if content type is application/xhtml+xml, only send it to browsers\r
@@ -767,14 +771,14 @@ $manager->notify(
                                'PreSendContentType',\r
                                array(\r
                                        'contentType' => &$content_type,\r
-                                       'charset' => i18n::get_current_charset(),\r
+                                       'charset' => $charset,\r
                                        'pageType' => $page_type\r
                                )\r
                        );\r
 \r
                        // strip strange characters\r
                        $content_type = preg_replace('|[^a-z0-9-+./]|i', '', $content_type);\r
-                       header('Content-Type: ' . $content_type . '; charset=' . i18n::get_current_charset());\r
+                       header('Content-Type: ' . $content_type . '; charset=' . $charset);\r
                } // end if\r
 \r
        }\r