OSDN Git Service

Merge branch 'master' into skinnable-master
[nucleus-jp/nucleus-next.git] / nucleus / libs / globalfunctions.php
index 034b186..e104f67 100644 (file)
@@ -26,7 +26,7 @@ $nucleus['codename'] = '';
 checkVars(array('nucleus', 'CONF', 'DIR_LIBS', 'MYSQL_HOST', 'MYSQL_USER', 'MYSQL_PASSWORD', 'MYSQL_DATABASE', '$DIR_LOCALES', 'DIR_PLUGINS', 'HTTP_GET_VARS', 'HTTP_POST_VARS', 'HTTP_COOKIE_VARS', 'HTTP_ENV_VARS', 'HTTP_SESSION_VARS', 'HTTP_POST_FILES', 'HTTP_SERVER_VARS', 'GLOBALS', 'argv', 'argc', '_GET', '_POST', '_COOKIE', '_ENV', '_SESSION', '_SERVER', '_FILES'));\r
 \r
 /* debug mode */\r
-if ( array_key_exists('debug', $CONF) && $CONF['debug'] )\r
+if ( isset($CONF) && array_key_exists('debug', $CONF) && $CONF['debug'] )\r
 {\r
        /* report all errors! */\r
        error_reporting(E_ALL);\r
@@ -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