Nucleus CMS日本語版SVNをgit-svnしたもの。リポジトリの変換作業用
Revision | b4459361f8401257e902db6a1a4c1961d1276e2d (tree) |
---|---|
Zeit | 2009-07-04 23:22:36 |
Autor | shizuki <shizuki@1ca2...> |
Commiter | shizuki |
git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@1025 1ca29b6e-896d-4ea0-84a5-967f57386b96
@@ -608,11 +608,11 @@ function doInstall() { | ||
608 | 608 | . $collation; |
609 | 609 | } |
610 | 610 | // </add for garble measure>*/ |
611 | - sql_query($sql) or _doError(_ERROR16 . ': ' . sql_error()); | |
611 | + sql_query($sql,$MYSQL_CONN) or _doError(_ERROR16 . ': ' . sql_error($MYSQL_CONN)); | |
612 | 612 | } |
613 | 613 | |
614 | 614 | // 4. try to select database |
615 | - sql_select_db($mysql_database) or _doError(_ERROR17); | |
615 | + sql_select_db($mysql_database,$MYSQL_CONN) or _doError(_ERROR17); | |
616 | 616 | |
617 | 617 | // 5. execute queries |
618 | 618 | $filename = 'install.sql'; |
@@ -687,7 +687,7 @@ function doInstall() { | ||
687 | 687 | } |
688 | 688 | // </add for garble measure>*/ |
689 | 689 | |
690 | - sql_query($query) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($query) . '</small>): ' . sql_error() ); | |
690 | + sql_query($query,$MYSQL_CONN) or _doError(_ERROR30 . ' (<small>' . htmlspecialchars($query) . '</small>): ' . sql_error($MYSQL_CONN) ); | |
691 | 691 | } |
692 | 692 | } |
693 | 693 |
@@ -709,7 +709,7 @@ function doInstall() { | ||
709 | 709 | . " '" . $itm_body . "'," |
710 | 710 | . " '" . $itm_more . "'," |
711 | 711 | . " 1, 1, '2005-08-15 11:04:26', 0, 0, 0, 1, 0, 1);"; |
712 | - sql_query($newpost) or _doError(_ERROR18 . ' (<small>' . htmlspecialchars($newpost) . '</small>): ' . sql_error() ); | |
712 | + sql_query($newpost,$MYSQL_CONN) or _doError(_ERROR18 . ' (<small>' . htmlspecialchars($newpost) . '</small>): ' . sql_error($MYSQL_CONN) ); | |
713 | 713 | |
714 | 714 | // 6. update global settings |
715 | 715 | updateConfig('IndexURL', $config_indexurl); |
@@ -736,7 +736,7 @@ function doInstall() { | ||
736 | 736 | . " WHERE" |
737 | 737 | . " mnumber = 1"; |
738 | 738 | |
739 | - sql_query($query) or _doError(_ERROR19 . ': ' . sql_error() ); | |
739 | + sql_query($query,$MYSQL_CONN) or _doError(_ERROR19 . ': ' . sql_error($MYSQL_CONN) ); | |
740 | 740 | |
741 | 741 | // 8. update weblog settings |
742 | 742 | $query = 'UPDATE ' . tableName('nucleus_blog') |
@@ -746,7 +746,7 @@ function doInstall() { | ||
746 | 746 | . " WHERE" |
747 | 747 | . " bnumber = 1"; |
748 | 748 | |
749 | - sql_query($query) or _doError(_ERROR20 . ': ' . sql_error() ); | |
749 | + sql_query($query,$MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN) ); | |
750 | 750 | |
751 | 751 | // 8-2. update category settings |
752 | 752 | if ($charset == 'ujis') { |
@@ -762,14 +762,14 @@ function doInstall() { | ||
762 | 762 | . " WHERE" |
763 | 763 | . " catid = 1"; |
764 | 764 | |
765 | - sql_query($query) or _doError(_ERROR20 . ': ' . sql_error() ); | |
765 | + sql_query($query,$MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN) ); | |
766 | 766 | |
767 | 767 | // 9. update item date |
768 | 768 | $query = 'UPDATE ' . tableName('nucleus_item') |
769 | 769 | . " SET itime = '" . date('Y-m-d H:i:s', time() ) ."'" |
770 | 770 | . " WHERE inumber = 1"; |
771 | 771 | |
772 | - sql_query($query) or _doError(_ERROR21 . ': ' . sql_error() ); | |
772 | + sql_query($query,$MYSQL_CONN) or _doError(_ERROR21 . ': ' . sql_error($MYSQL_CONN) ); | |
773 | 773 | |
774 | 774 | global $aConfPlugsToInstall, $aConfSkinsToImport; |
775 | 775 | $aSkinErrors = array(); |
@@ -795,7 +795,7 @@ function doInstall() { | ||
795 | 795 | $DIR_LIBS = $DIR_NUCLEUS . 'libs/'; |
796 | 796 | |
797 | 797 | // close database connection (needs to be closed if we want to include globalfunctions.php) |
798 | - sql_close(); | |
798 | + sql_close($MYSQL_CONN); | |
799 | 799 | |
800 | 800 | $manager = ''; |
801 | 801 | include_once($DIR_LIBS . 'globalfunctions.php'); |
@@ -827,8 +827,9 @@ function doInstall() { | ||
827 | 827 | $config_data .= " \$MYSQL_PREFIX = '" . (($mysql_usePrefix == 1) ? $mysql_prefix : '') . "';\n"; |
828 | 828 | $config_data .= " // new in 3.50. first element is db handler, the second is the db driver used by the handler\n"; |
829 | 829 | $config_data .= " // default is \$MYSQL_HANDLER = array('mysql','mysql');\n"; |
830 | - $config_data .= " \$MYSQL_HANDLER = array('mysql','mysql');\n"; | |
830 | + $config_data .= " //\$MYSQL_HANDLER = array('mysql','mysql');\n"; | |
831 | 831 | $config_data .= " //\$MYSQL_HANDLER = array('pdo','mysql');\n"; |
832 | + $config_data .= " \$MYSQL_HANDLER = array('".$MYSQL_HANDLER[0]."','".$MYSQL_HANDLER[1]."');\n"; | |
832 | 833 | $config_data .= "\n"; |
833 | 834 | $config_data .= " // main nucleus directory\n"; |
834 | 835 | $config_data .= " \$DIR_NUCLEUS = '" . $config_adminpath . "';\n"; |
@@ -1101,6 +1102,7 @@ function doCheckFiles() { | ||
1101 | 1102 | } |
1102 | 1103 | |
1103 | 1104 | function updateConfig($name, $val) { |
1105 | + global $MYSQL_CONN; | |
1104 | 1106 | $name = addslashes($name); |
1105 | 1107 | $val = trim(addslashes($val) ); |
1106 | 1108 |
@@ -1108,8 +1110,8 @@ function updateConfig($name, $val) { | ||
1108 | 1110 | . " SET value = '$val'" |
1109 | 1111 | . " WHERE name = '$name'"; |
1110 | 1112 | |
1111 | - sql_query($query) or _doError(_ERROR26 . ': ' . mysql_error() ); | |
1112 | - return sql_insert_id(); | |
1113 | + sql_query($query,$MYSQL_CONN) or _doError(_ERROR26 . ': ' . mysql_error($MYSQL_CONN) ); | |
1114 | + return sql_insert_id($MYSQL_CONN); | |
1113 | 1115 | } |
1114 | 1116 | |
1115 | 1117 | function replaceDoubleBackslash($input) { |
@@ -57,6 +57,7 @@ | ||
57 | 57 | <li> |
58 | 58 | <strong>Nucleus v3.5 (SVN)</strong> |
59 | 59 | <ul> |
60 | + <li>CHANGED: modified install.php and sql_* handlers to allow installation using PDO. Activation is manual and not intended for public consumption in 3.50. Only tested for pdo-mysql handler. (ftruscot)</li> | |
60 | 61 | <li>ADDED/CHANGED: extended sql_* api to cover all mysql_* functions used in core. Functions loaded from nucleus/libs/sql/ folder. See <a href="http://wakka.xiffy.nl/planning:3.50#mysql_api_warning" title="sql API">here</a>. (ftruscot)</li> |
61 | 62 | <li>FIXED: atom.phpとxml-rss2.phpで_CHARSETをチェックして文字コード変換(<a href="http://japan.nucleuscms.org/bb/viewtopic.php?t=4376" target="_blank" class="postlink">Nicleus3.41 へアップグレード後 xml-rss2.php でエラー</a>)(きゃしゃ)</li> |
62 | 63 | <li>CHANGED: SEARCH.php改良(<a href="http://japan.nucleuscms.org/bb/viewtopic.php?t=4370" target="_blank" class="postlink"><%relevance%>対応SEARCH.php</a>、<a href="http://japan.nucleuscms.org/bb/viewtopic.php?t=3824" target="_blank" class="postlink">検索結果の正確さ</a>)(きゃしゃ)</li> |
@@ -135,6 +135,15 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc')) | ||
135 | 135 | } |
136 | 136 | |
137 | 137 | /** |
138 | + * executes an PDO::quote() like escape, ie adds quotes arround the string and escapes chars as needed | |
139 | + */ | |
140 | + function sql_quote_string($val,$conn = false) { | |
141 | + global $MYSQL_CONN; | |
142 | + if (!$conn) $conn = $MYSQL_CONN; | |
143 | + return "'".mysql_real_escape_string($val,$conn)."'"; | |
144 | + } | |
145 | + | |
146 | + /** | |
138 | 147 | * executes an SQL insert id |
139 | 148 | */ |
140 | 149 | function sql_insert_id($conn = false) |
@@ -67,7 +67,7 @@ if (!function_exists('sql_fetch_assoc')) | ||
67 | 67 | |
68 | 68 | } catch (PDOException $e) { |
69 | 69 | $DBH =NULL; |
70 | - startUpError('<p>Error!: ' . $e->getMessage() . '</p>', 'Connect Error'); | |
70 | + startUpError('<p>a1 Error!: ' . $e->getMessage() . '</p>', 'Connect Error'); | |
71 | 71 | } |
72 | 72 | //echo '<hr />DBH: '.print_r($DBH,true).'<hr />'; |
73 | 73 | return $DBH; |
@@ -103,7 +103,7 @@ if (!function_exists('sql_fetch_assoc')) | ||
103 | 103 | // </add for garble measure>*/ |
104 | 104 | } catch (PDOException $e) { |
105 | 105 | $SQL_DBH = NULL; |
106 | - startUpError('<p>Error!: ' . $e->getMessage() . '</p>', 'Connect Error'); | |
106 | + startUpError('<p>a2 Error!: ' . $e->getMessage() . '</p>', 'Connect Error'); | |
107 | 107 | } |
108 | 108 | // echo '<hr />DBH: '.print_r($SQL_DBH,true).'<hr />'; |
109 | 109 | $MYSQL_CONN &= $SQL_DBH; |
@@ -168,6 +168,8 @@ if (!function_exists('sql_fetch_assoc')) | ||
168 | 168 | function sql_select_db($db,&$dbh=NULL) |
169 | 169 | { |
170 | 170 | global $MYSQL_HOST, $MYSQL_USER, $MYSQL_PASSWORD, $MYSQL_DATABASE, $MYSQL_CONN, $MYSQL_HANDLER, $SQL_DBH; |
171 | +//echo '<hr />'.print_r($dbh,true).'<hr />'; | |
172 | +//exit; | |
171 | 173 | if (is_null($dbh)) { |
172 | 174 | try { |
173 | 175 | $SQL_DBH = NULL; |
@@ -179,7 +181,7 @@ if (!function_exists('sql_fetch_assoc')) | ||
179 | 181 | $SQL_DBH = new PDO($MYSQL_HANDLER[1].':host='.trim($host).$port.';dbname='.$db, $MYSQL_USER, $MYSQL_PASSWORD); |
180 | 182 | return 1; |
181 | 183 | } catch (PDOException $e) { |
182 | - startUpError('<p>Error!: ' . $e->getMessage() . '</p>', 'Connect Error'); | |
184 | + startUpError('<p>a3 Error!: ' . $e->getMessage() . '</p>', 'Connect Error'); | |
183 | 185 | return 0; |
184 | 186 | } |
185 | 187 | } |
@@ -198,6 +200,17 @@ if (!function_exists('sql_fetch_assoc')) | ||
198 | 200 | } |
199 | 201 | |
200 | 202 | /** |
203 | + * executes an PDO::quote() like escape, ie adds quotes arround the string and escapes chars as needed | |
204 | + */ | |
205 | + function sql_quote_string($val,$dbh=NULL) { | |
206 | + global $SQL_DBH; | |
207 | + if (is_null($dbh)) | |
208 | + return $SQL_DBH->quote($val); | |
209 | + else | |
210 | + return $dbh->quote($val); | |
211 | + } | |
212 | + | |
213 | + /** | |
201 | 214 | * executes an SQL insert id |
202 | 215 | */ |
203 | 216 | function sql_insert_id($dbh=NULL) |