OSDN Git Service

スタートアップエラーの文字化けを解消するコードを追加
authorshizuki <shizuki@kinezumi.net>
Thu, 12 Apr 2012 01:42:01 +0000 (10:42 +0900)
committershizuki <shizuki@kinezumi.net>
Thu, 12 Apr 2012 01:42:01 +0000 (10:42 +0900)
ついでに/nucleus/index.phpと/nucleus/sql/mysql.phpのコードをクリーンアップ

nucleus/index.php
nucleus/libs/sql/mysql.php

index 41dd1c7..d534e82 100644 (file)
@@ -35,22 +35,25 @@ if ($CONF['alertOnSecurityRisk'] == 1)
        $aFound = array();
        foreach($aFiles as $fileName => $fileDesc)
        {
-               if (@file_exists($fileName))
+               if ( @file_exists($fileName) )
+               {
                        array_push($aFound, $fileDesc);
+               }
        }
-       if (@is_writable('../config.php')) {
+       if ( @is_writable('../config.php') ) {
                array_push($aFound, _ERRORS_CONFIGPHP);
        }
        if (sizeof($aFound) > 0)
        {
+               sendContentType('text/html', 'startUpError');
                startUpError(
-                       _ERRORS_STARTUPERROR1. implode($aFound, '</li><li>')._ERRORS_STARTUPERROR2,
+                       _ERRORS_STARTUPERROR1 . implode($aFound, '</li><li>') . _ERRORS_STARTUPERROR2,
                        _ERRORS_STARTUPERROR3
                );
        }
 }
 
-$bNeedsLogin = false;
+$bNeedsLogin   = false;
 $bIsActivation = in_array($action, array('activate', 'activatesetpwd'));
 
 if ( $action == 'logout' )
index bc8d7af..406e90c 100644 (file)
@@ -98,24 +98,36 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
        /**\r
          * disconnects from SQL server\r
          */\r
-       function sql_disconnect($conn = false) {\r
+       function sql_disconnect($conn = false)\r
+       {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                @mysql_close($conn);\r
        }\r
 \r
-       function sql_close($conn = false) {\r
+       function sql_close($conn = false)\r
+       {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                @mysql_close($conn);\r
        }\r
 \r
        /**\r
          * executes an SQL query\r
          */\r
-       function sql_query($query,$conn = false) {\r
+       function sql_query($query,$conn = false)\r
+       {\r
                global $SQLCount,$MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                $SQLCount++;\r
                $res = mysql_query($query,$conn) or print("mySQL error with query $query: " . mysql_error($conn) . '<p />');\r
                return $res;\r
@@ -127,18 +139,24 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
        function sql_error($conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                return mysql_error($conn);\r
        }\r
 \r
        /**\r
          * executes an SQL db select\r
          */\r
-       function sql_select_db($db,$conn = false)\r
+       function sql_select_db($db, $conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
-               return mysql_select_db($db,$conn);\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
+               return mysql_select_db($db, $conn);\r
        }\r
 \r
        /*\r
@@ -147,7 +165,7 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
        function sql_real_escape_string($val, $conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn)\r
+               if ( !$conn )\r
                {\r
                        $conn =& $MYSQL_CONN;\r
                }\r
@@ -157,10 +175,14 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
        /**\r
          * executes an PDO::quote() like escape, ie adds quotes arround the string and escapes chars as needed\r
          */\r
-       function sql_quote_string($val,$conn = false) {\r
+       function sql_quote_string($val, $conn = false)\r
+       {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
-               return "'".mysql_real_escape_string($val,$conn)."'";\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
+               return "'" . mysql_real_escape_string($val, $conn) . "'";\r
        }\r
 \r
        /**\r
@@ -169,7 +191,10 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
        function sql_insert_id($conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                return mysql_insert_id($conn);\r
        }\r
 \r
@@ -203,7 +228,10 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
        function sql_affected_rows($conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                return mysql_affected_rows($conn);\r
        }\r
 \r
@@ -250,28 +278,34 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
        /**\r
          * Get column information from a result and return as an object\r
          */\r
-       function sql_fetch_field($res,$offset = 0)\r
+       function sql_fetch_field($res, $offset = 0)\r
        {\r
-               return mysql_fetch_field($res,$offset);\r
+               return mysql_fetch_field($res, $offset);\r
        }\r
 \r
        /**\r
          * Get current system status (returns string)\r
          */\r
-       function sql_stat($conn=false)\r
+       function sql_stat($conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                return mysql_stat($conn);\r
        }\r
 \r
        /**\r
          * Returns the name of the character set\r
          */\r
-       function sql_client_encoding($conn=false)\r
+       function sql_client_encoding($conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                return mysql_client_encoding($conn);\r
        }\r
 \r
@@ -286,30 +320,39 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
        /**\r
          * Get SQL server version\r
          */\r
-       function sql_get_server_info($conn=false)\r
+       function sql_get_server_info($conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                return mysql_get_server_info($conn);\r
        }\r
 \r
        /**\r
          * Returns a string describing the type of SQL connection in use for the connection or FALSE on failure\r
          */\r
-       function sql_get_host_info($conn=false)\r
+       function sql_get_host_info($conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                return mysql_get_host_info($conn);\r
        }\r
 \r
        /**\r
          * Returns the SQL protocol on success, or FALSE on failure.\r
          */\r
-       function sql_get_proto_info($conn=false)\r
+       function sql_get_proto_info($conn = false)\r
        {\r
                global $MYSQL_CONN;\r
-               if (!$conn) $conn = $MYSQL_CONN;\r
+               if ( !$conn )\r
+               {\r
+                       $conn = $MYSQL_CONN;\r
+               }\r
                return mysql_get_proto_info($conn);\r
        }\r
 \r