• R/O
  • HTTP
  • SSH
  • HTTPS

nucleus-jp-ancient: Commit

Nucleus CMS日本語版SVNをgit-svnしたもの。リポジトリの変換作業用


Commit MetaInfo

Revisionb4459361f8401257e902db6a1a4c1961d1276e2d (tree)
Zeit2009-07-04 23:22:36
Autorshizuki <shizuki@1ca2...>
Commitershizuki

Log Message

git-svn-id: https://svn.sourceforge.jp/svnroot/nucleus-jp/nucleus-jp/trunk@1025 1ca29b6e-896d-4ea0-84a5-967f57386b96

Ändern Zusammenfassung

Diff

--- a/utf8/install.php
+++ b/utf8/install.php
@@ -608,11 +608,11 @@ function doInstall() {
608608 . $collation;
609609 }
610610 // </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));
612612 }
613613
614614 // 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);
616616
617617 // 5. execute queries
618618 $filename = 'install.sql';
@@ -687,7 +687,7 @@ function doInstall() {
687687 }
688688 // </add for garble measure>*/
689689
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) );
691691 }
692692 }
693693
@@ -709,7 +709,7 @@ function doInstall() {
709709 . " '" . $itm_body . "',"
710710 . " '" . $itm_more . "',"
711711 . " 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) );
713713
714714 // 6. update global settings
715715 updateConfig('IndexURL', $config_indexurl);
@@ -736,7 +736,7 @@ function doInstall() {
736736 . " WHERE"
737737 . " mnumber = 1";
738738
739- sql_query($query) or _doError(_ERROR19 . ': ' . sql_error() );
739+ sql_query($query,$MYSQL_CONN) or _doError(_ERROR19 . ': ' . sql_error($MYSQL_CONN) );
740740
741741 // 8. update weblog settings
742742 $query = 'UPDATE ' . tableName('nucleus_blog')
@@ -746,7 +746,7 @@ function doInstall() {
746746 . " WHERE"
747747 . " bnumber = 1";
748748
749- sql_query($query) or _doError(_ERROR20 . ': ' . sql_error() );
749+ sql_query($query,$MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN) );
750750
751751 // 8-2. update category settings
752752 if ($charset == 'ujis') {
@@ -762,14 +762,14 @@ function doInstall() {
762762 . " WHERE"
763763 . " catid = 1";
764764
765- sql_query($query) or _doError(_ERROR20 . ': ' . sql_error() );
765+ sql_query($query,$MYSQL_CONN) or _doError(_ERROR20 . ': ' . sql_error($MYSQL_CONN) );
766766
767767 // 9. update item date
768768 $query = 'UPDATE ' . tableName('nucleus_item')
769769 . " SET itime = '" . date('Y-m-d H:i:s', time() ) ."'"
770770 . " WHERE inumber = 1";
771771
772- sql_query($query) or _doError(_ERROR21 . ': ' . sql_error() );
772+ sql_query($query,$MYSQL_CONN) or _doError(_ERROR21 . ': ' . sql_error($MYSQL_CONN) );
773773
774774 global $aConfPlugsToInstall, $aConfSkinsToImport;
775775 $aSkinErrors = array();
@@ -795,7 +795,7 @@ function doInstall() {
795795 $DIR_LIBS = $DIR_NUCLEUS . 'libs/';
796796
797797 // close database connection (needs to be closed if we want to include globalfunctions.php)
798- sql_close();
798+ sql_close($MYSQL_CONN);
799799
800800 $manager = '';
801801 include_once($DIR_LIBS . 'globalfunctions.php');
@@ -827,8 +827,9 @@ function doInstall() {
827827 $config_data .= " \$MYSQL_PREFIX = '" . (($mysql_usePrefix == 1) ? $mysql_prefix : '') . "';\n";
828828 $config_data .= " // new in 3.50. first element is db handler, the second is the db driver used by the handler\n";
829829 $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";
831831 $config_data .= " //\$MYSQL_HANDLER = array('pdo','mysql');\n";
832+ $config_data .= " \$MYSQL_HANDLER = array('".$MYSQL_HANDLER[0]."','".$MYSQL_HANDLER[1]."');\n";
832833 $config_data .= "\n";
833834 $config_data .= " // main nucleus directory\n";
834835 $config_data .= " \$DIR_NUCLEUS = '" . $config_adminpath . "';\n";
@@ -1101,6 +1102,7 @@ function doCheckFiles() {
11011102 }
11021103
11031104 function updateConfig($name, $val) {
1105+ global $MYSQL_CONN;
11041106 $name = addslashes($name);
11051107 $val = trim(addslashes($val) );
11061108
@@ -1108,8 +1110,8 @@ function updateConfig($name, $val) {
11081110 . " SET value = '$val'"
11091111 . " WHERE name = '$name'";
11101112
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);
11131115 }
11141116
11151117 function replaceDoubleBackslash($input) {
--- a/utf8/nucleus/documentation/history.html
+++ b/utf8/nucleus/documentation/history.html
@@ -57,6 +57,7 @@
5757 <li>
5858 <strong>Nucleus v3.5 (SVN)</strong>
5959 <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>
6061 <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>
6162 <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>
6263 <li>CHANGED: SEARCH.php改良(<a href="http://japan.nucleuscms.org/bb/viewtopic.php?t=4370" target="_blank" class="postlink">&lt;%relevance%&gt;対応SEARCH.php</a>、<a href="http://japan.nucleuscms.org/bb/viewtopic.php?t=3824" target="_blank" class="postlink">検索結果の正確さ</a>)(きゃしゃ)</li>
--- a/utf8/nucleus/libs/sql/mysql.php
+++ b/utf8/nucleus/libs/sql/mysql.php
@@ -135,6 +135,15 @@ if (function_exists('mysql_query') && !function_exists('sql_fetch_assoc'))
135135 }
136136
137137 /**
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+ /**
138147 * executes an SQL insert id
139148 */
140149 function sql_insert_id($conn = false)
--- a/utf8/nucleus/libs/sql/pdo.php
+++ b/utf8/nucleus/libs/sql/pdo.php
@@ -67,7 +67,7 @@ if (!function_exists('sql_fetch_assoc'))
6767
6868 } catch (PDOException $e) {
6969 $DBH =NULL;
70- startUpError('<p>Error!: ' . $e->getMessage() . '</p>', 'Connect Error');
70+ startUpError('<p>a1 Error!: ' . $e->getMessage() . '</p>', 'Connect Error');
7171 }
7272 //echo '<hr />DBH: '.print_r($DBH,true).'<hr />';
7373 return $DBH;
@@ -103,7 +103,7 @@ if (!function_exists('sql_fetch_assoc'))
103103 // </add for garble measure>*/
104104 } catch (PDOException $e) {
105105 $SQL_DBH = NULL;
106- startUpError('<p>Error!: ' . $e->getMessage() . '</p>', 'Connect Error');
106+ startUpError('<p>a2 Error!: ' . $e->getMessage() . '</p>', 'Connect Error');
107107 }
108108 // echo '<hr />DBH: '.print_r($SQL_DBH,true).'<hr />';
109109 $MYSQL_CONN &= $SQL_DBH;
@@ -168,6 +168,8 @@ if (!function_exists('sql_fetch_assoc'))
168168 function sql_select_db($db,&$dbh=NULL)
169169 {
170170 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;
171173 if (is_null($dbh)) {
172174 try {
173175 $SQL_DBH = NULL;
@@ -179,7 +181,7 @@ if (!function_exists('sql_fetch_assoc'))
179181 $SQL_DBH = new PDO($MYSQL_HANDLER[1].':host='.trim($host).$port.';dbname='.$db, $MYSQL_USER, $MYSQL_PASSWORD);
180182 return 1;
181183 } catch (PDOException $e) {
182- startUpError('<p>Error!: ' . $e->getMessage() . '</p>', 'Connect Error');
184+ startUpError('<p>a3 Error!: ' . $e->getMessage() . '</p>', 'Connect Error');
183185 return 0;
184186 }
185187 }
@@ -198,6 +200,17 @@ if (!function_exists('sql_fetch_assoc'))
198200 }
199201
200202 /**
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+ /**
201214 * executes an SQL insert id
202215 */
203216 function sql_insert_id($dbh=NULL)
Show on old repository browser