From: <var...@us...> - 2017-07-10 16:26:35
|
Revision: 10022 http://sourceforge.net/p/phpwiki/code/10022 Author: vargenau Date: 2017-07-10 16:26:33 +0000 (Mon, 10 Jul 2017) Log Message: ----------- PDO patch by Sebastien Le Callonnec Modified Paths: -------------- trunk/lib/DbSession/PDO.php trunk/lib/WikiDB/backend/PDO.php trunk/lib/wikilens/RatingsDb.php trunk/pgsrc/ReleaseNotes Modified: trunk/lib/DbSession/PDO.php =================================================================== --- trunk/lib/DbSession/PDO.php 2017-07-07 12:14:48 UTC (rev 10021) +++ trunk/lib/DbSession/PDO.php 2017-07-10 16:26:33 UTC (rev 10022) @@ -175,8 +175,10 @@ */ if (USE_SAFE_DBSESSION) { $this->_backend->beginTransaction(); - $rs = $this->query("DELETE FROM $table" - . " WHERE sess_id=$id"); + $delete = $this->prepare("DELETE FROM $table" + . " WHERE sess_id=?"); + $delete->bindParam(1, $id, PDO::PARAM_STR, 32); + $delete->execute(); $sth = $dbh->prepare("INSERT INTO $table" . " (sess_id, sess_data, sess_date, sess_ip)" . " VALUES (?, ?, ?, ?)"); Modified: trunk/lib/WikiDB/backend/PDO.php =================================================================== --- trunk/lib/WikiDB/backend/PDO.php 2017-07-07 12:14:48 UTC (rev 10021) +++ trunk/lib/WikiDB/backend/PDO.php 2017-07-10 16:26:33 UTC (rev 10022) @@ -385,6 +385,7 @@ $page_tbl = $this->_table_names['page_tbl']; $sth = $dbh->prepare("SELECT id FROM $page_tbl WHERE pagename=? LIMIT 1"); $sth->bindParam(1, $pagename, PDO::PARAM_STR, 100); + $sth->execute(); $id = $sth->fetchColumn(); if (!$create_if_missing) { return $id; @@ -937,7 +938,7 @@ { $s = '('; foreach ($pagenames as $p) { - $s .= ($this->_dbh->qstr($p) . ","); + $s .= ($this->_dbh->quote($p) . ","); } return substr($s, 0, -1) . ")"; } @@ -1326,7 +1327,7 @@ $sth = $dbh->prepare("INSERT INTO $log_tbl" . " (time_stamp,remote_host,remote_user,request_method,request_line,request_args," . "request_file,request_uri,request_time,status,bytes_sent,referer,agent,request_duration)" - . " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?)"); + . " VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); // Either use unixtime as %d (long), or the native timestamp format. $sth->bindParam(1, $entry->time, PDO::PARAM_INT); $sth->bindParam(2, $entry->host, PDO::PARAM_STR, 100); @@ -1341,7 +1342,7 @@ $sth->bindParam(11, $entry->size, PDO::PARAM_INT); $sth->bindParam(12, $entry->referer, PDO::PARAM_STR, 255); $sth->bindParam(13, $entry->user_agent, PDO::PARAM_STR, 255); - $sth->bindParam(14, $entry->duration, PDO::PARAM_FLOAT); + $sth->bindParam(14, $entry->duration, PDO::PARAM_STR); $sth->execute(); } } Modified: trunk/lib/wikilens/RatingsDb.php =================================================================== --- trunk/lib/wikilens/RatingsDb.php 2017-07-07 12:14:48 UTC (rev 10021) +++ trunk/lib/wikilens/RatingsDb.php 2017-07-10 16:26:33 UTC (rev 10022) @@ -90,6 +90,9 @@ } elseif (is_a($this->_backend, 'WikiDB_backend_ADODOB')) { $this->_sqlbackend = &$this->_backend; $this->dbtype = "ADODB"; + } elseif (is_a($this->_backend, 'WikiDB_backend_PDO')) { + $this->_sqlbackend = &$this->_backend; + $this->dbtype = "PDO"; } else { include_once 'lib/WikiDB/backend/ADODB.php'; // It is not possible to decouple a ref from the source again. (4.3.11) Modified: trunk/pgsrc/ReleaseNotes =================================================================== --- trunk/pgsrc/ReleaseNotes 2017-07-07 12:14:48 UTC (rev 10021) +++ trunk/pgsrc/ReleaseNotes 2017-07-10 16:26:33 UTC (rev 10022) @@ -1,4 +1,4 @@ -Date: Wed, 24 May 2017 19:26:59 +0000 +Date: Mon, 10 Jul 2017 18:25:18 +0000 Mime-Version: 1.0 (Produced by PhpWiki 1.6.0) Content-Type: application/x-phpwiki; pagename=ReleaseNotes; @@ -26,6 +26,7 @@ * Valid HTML5 and CSS3 logos (in debug mode) * Better is_localhost() function (allow IPv6, allow Windows IIS). Patch by Thierry Nabeth. * Remove Fusionforge-specific files (g view.php wikiadmin.php wikilist.php) +* PDO patch by Sébastien Le Callonnec * Bugs: ** Make function IsSafeURL more strict ** Make XHTML ZIP Snapshot work again (broken since ~PhpWiki 1.5.3) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |