From: <var...@us...> - 2014-07-17 08:33:06
|
Revision: 8967 http://sourceforge.net/p/phpwiki/code/8967 Author: vargenau Date: 2014-07-17 08:33:04 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Fix variable names Modified Paths: -------------- trunk/lib/DbSession/PDO.php Modified: trunk/lib/DbSession/PDO.php =================================================================== --- trunk/lib/DbSession/PDO.php 2014-07-16 16:06:31 UTC (rev 8966) +++ trunk/lib/DbSession/PDO.php 2014-07-17 08:33:04 UTC (rev 8967) @@ -46,7 +46,7 @@ function quote($string) { - return $this->_backend->quote($sql); + return $this->_backend->quote($string); } function _disconnect() @@ -143,13 +143,13 @@ if (isa($dbh, 'ADODB_postgres64')) $sess_data = base64_encode($sess_data); - /* AffectedRows with sessions seems to be instable on certain platforms. + /* AffectedRows with sessions seems to be unstable on certain platforms. * Enable the safe and slow USE_SAFE_DBSESSION then. */ if (USE_SAFE_DBSESSION) { $this->_backend->beginTransaction(); $rs = $this->query("DELETE FROM $table" - . " WHERE sess_id=$qid"); + . " WHERE sess_id=$id"); $sth = $dbh->prepare("INSERT INTO $table" . " (sess_id, sess_data, sess_date, sess_ip)" . " VALUES (?, ?, ?, ?)"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-17 08:39:01
|
Revision: 8968 http://sourceforge.net/p/phpwiki/code/8968 Author: vargenau Date: 2014-07-17 08:38:53 +0000 (Thu, 17 Jul 2014) Log Message: ----------- PDO_FETCH_NUM --> PDO::FETCH_NUM; PDO uses class constants since PHP 5.1. Prior releases use global constants in the form PDO_PARAM_BOOL Modified Paths: -------------- trunk/lib/DbSession/PDO.php Modified: trunk/lib/DbSession/PDO.php =================================================================== --- trunk/lib/DbSession/PDO.php 2014-07-17 08:33:04 UTC (rev 8967) +++ trunk/lib/DbSession/PDO.php 2014-07-17 08:38:53 UTC (rev 8968) @@ -99,7 +99,7 @@ $dbh = $this->_connect(); $table = $this->_table; $sth = $dbh->prepare("SELECT sess_data FROM $table WHERE sess_id=?"); - $sth->bindParam(1, $id, PDO_PARAM_STR, 32); + $sth->bindParam(1, $id, PDO::PARAM_STR, 32); if ($sth->execute()) $res = $sth->fetchColumn(); else $res = ''; $this->_disconnect(); @@ -153,10 +153,10 @@ $sth = $dbh->prepare("INSERT INTO $table" . " (sess_id, sess_data, sess_date, sess_ip)" . " VALUES (?, ?, ?, ?)"); - $sth->bindParam(1, $id, PDO_PARAM_STR, 32); - $sth->bindParam(2, $sess_data, PDO_PARAM_LOB); - $sth->bindParam(3, $time, PDO_PARAM_INT); - $sth->bindParam(4, $GLOBALS['request']->get('REMOTE_ADDR'), PDO_PARAM_STR, 15); + $sth->bindParam(1, $id, PDO::PARAM_STR, 32); + $sth->bindParam(2, $sess_data, PDO::PARAM_LOB); + $sth->bindParam(3, $time, PDO::PARAM_INT); + $sth->bindParam(4, $GLOBALS['request']->get('REMOTE_ADDR'), PDO::PARAM_STR, 15); if ($result = $sth->execute()) { $this->_backend->commit(); } else { @@ -166,19 +166,19 @@ $sth = $dbh->prepare("UPDATE $table" . " SET sess_data=?, sess_date=?, sess_ip=?" . " WHERE sess_id=?"); - $sth->bindParam(1, $sess_data, PDO_PARAM_LOB); - $sth->bindParam(2, $time, PDO_PARAM_INT); - $sth->bindParam(3, $GLOBALS['request']->get('REMOTE_ADDR'), PDO_PARAM_STR, 15); - $sth->bindParam(4, $id, PDO_PARAM_STR, 32); + $sth->bindParam(1, $sess_data, PDO::PARAM_LOB); + $sth->bindParam(2, $time, PDO::PARAM_INT); + $sth->bindParam(3, $GLOBALS['request']->get('REMOTE_ADDR'), PDO::PARAM_STR, 15); + $sth->bindParam(4, $id, PDO::PARAM_STR, 32); $result = $sth->execute(); // implicit affected rows if ($result === false or $result < 1) { // false or int > 0 $sth = $dbh->prepare("INSERT INTO $table" . " (sess_id, sess_data, sess_date, sess_ip)" . " VALUES (?, ?, ?, ?)"); - $sth->bindParam(1, $id, PDO_PARAM_STR, 32); - $sth->bindParam(2, $sess_data, PDO_PARAM_LOB); - $sth->bindParam(3, $time, PDO_PARAM_INT); - $sth->bindParam(4, $GLOBALS['request']->get('REMOTE_ADDR'), PDO_PARAM_STR, 15); + $sth->bindParam(1, $id, PDO::PARAM_STR, 32); + $sth->bindParam(2, $sess_data, PDO::PARAM_LOB); + $sth->bindParam(3, $time, PDO::PARAM_INT); + $sth->bindParam(4, $GLOBALS['request']->get('REMOTE_ADDR'), PDO::PARAM_STR, 15); $result = $sth->execute(); } } @@ -200,7 +200,7 @@ $table = $this->_table; $dbh = $this->_connect(); $sth = $dbh->prepare("DELETE FROM $table WHERE sess_id=?"); - $sth->bindParam(1, $id, PDO_PARAM_STR, 32); + $sth->bindParam(1, $id, PDO::PARAM_STR, 32); $sth->execute(); $this->_disconnect(); return true; @@ -219,7 +219,7 @@ $threshold = time() - $maxlifetime; $dbh = $this->_connect(); $sth = $dbh->prepare("DELETE FROM $table WHERE sess_date < ?"); - $sth->bindParam(1, $threshold, PDO_PARAM_INT); + $sth->bindParam(1, $threshold, PDO::PARAM_INT); $sth->execute(); $this->_disconnect(); return true; @@ -236,7 +236,7 @@ if (!$sth->execute()) { return $sessions; } - while ($row = $sth->fetch(PDO_FETCH_NUM)) { + while ($row = $sth->fetch(PDO::FETCH_NUM)) { $data = $row[0]; $date = $row[1]; $ip = $row[2]; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-13 16:02:05
|
Revision: 10509 http://sourceforge.net/p/phpwiki/code/10509 Author: vargenau Date: 2021-08-13 16:02:02 +0000 (Fri, 13 Aug 2021) Log Message: ----------- Fix PDO DB sessions Modified Paths: -------------- trunk/lib/DbSession/PDO.php Modified: trunk/lib/DbSession/PDO.php =================================================================== --- trunk/lib/DbSession/PDO.php 2021-08-13 14:39:54 UTC (rev 10508) +++ trunk/lib/DbSession/PDO.php 2021-08-13 16:02:02 UTC (rev 10509) @@ -49,12 +49,10 @@ function & _connect() { $dbh = &$this->_dbh; - if (!$dbh or !is_object($dbh)) { - global $DBParams; - $db = new WikiDB_backend_PDO($DBParams); - $this->_dbh =& $db->_dbh; - $this->_backend =& $db; - } + global $DBParams; + $db = new WikiDB_backend_PDO($DBParams); + $this->_dbh =& $db->_dbh; + $this->_backend =& $db; return $dbh; } @@ -169,7 +167,7 @@ $sess_data = base64_encode($sess_data); $this->_backend->beginTransaction(); - $delete = $this->prepare("DELETE FROM $table WHERE sess_id=?"); + $delete = $dbh->prepare("DELETE FROM $table WHERE sess_id=?"); $delete->bindParam(1, $id, PDO::PARAM_STR, 32); $delete->execute(); $sth = $dbh->prepare("INSERT INTO $table" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2021-08-14 17:59:16
|
Revision: 10517 http://sourceforge.net/p/phpwiki/code/10517 Author: vargenau Date: 2021-08-14 17:59:15 +0000 (Sat, 14 Aug 2021) Log Message: ----------- lib/DbSession/PDO.php: bindParam with a variable Modified Paths: -------------- trunk/lib/DbSession/PDO.php Modified: trunk/lib/DbSession/PDO.php =================================================================== --- trunk/lib/DbSession/PDO.php 2021-08-14 14:54:57 UTC (rev 10516) +++ trunk/lib/DbSession/PDO.php 2021-08-14 17:59:15 UTC (rev 10517) @@ -161,6 +161,7 @@ $dbh = $this->_connect(); $table = $this->_table; $time = time(); + $remote_addr = $request->get('REMOTE_ADDR'); // postgres can't handle binary data in a TEXT field. if (is_a($dbh, 'ADODB_postgres64')) @@ -176,7 +177,7 @@ $sth->bindParam(1, $id, PDO::PARAM_STR, 32); $sth->bindParam(2, $sess_data, PDO::PARAM_LOB); $sth->bindParam(3, $time, PDO::PARAM_INT); - $sth->bindParam(4, $request->get('REMOTE_ADDR'), PDO::PARAM_STR, 15); + $sth->bindParam(4, $remote_addr, PDO::PARAM_STR, 15); if ($result = $sth->execute()) { $this->_backend->commit(); } else { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-17 09:33:29
|
Revision: 8971 http://sourceforge.net/p/phpwiki/code/8971 Author: vargenau Date: 2014-07-17 09:33:21 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Add braces Modified Paths: -------------- trunk/lib/DbSession/PDO.php Modified: trunk/lib/DbSession/PDO.php =================================================================== --- trunk/lib/DbSession/PDO.php 2014-07-17 09:11:09 UTC (rev 8970) +++ trunk/lib/DbSession/PDO.php 2014-07-17 09:33:21 UTC (rev 8971) @@ -100,17 +100,23 @@ $table = $this->_table; $sth = $dbh->prepare("SELECT sess_data FROM $table WHERE sess_id=?"); $sth->bindParam(1, $id, PDO::PARAM_STR, 32); - if ($sth->execute()) $res = $sth->fetchColumn(); - else $res = ''; + if ($sth->execute()) { + $res = $sth->fetchColumn(); + } else { + $res = ''; + } $this->_disconnect(); - if (!empty($res) and isa($dbh, 'ADODB_postgres64')) + if (!empty($res) and isa($dbh, 'ADODB_postgres64')) { $res = base64_decode($res); + } if (strlen($res) > 4000) { trigger_error("Overlarge session data! " . strlen($res) . " gt. 4000", E_USER_WARNING); $res = preg_replace('/s:6:"_cache";O:12:"WikiDB_cache".+}$/', "", $res); $res = preg_replace('/s:12:"_cached_html";s:.+",s:4:"hits"/', 's:4:"hits"', $res); - if (strlen($res) > 4000) $res = ''; + if (strlen($res) > 4000) { + $res = ''; + } } return $res; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <var...@us...> - 2014-07-17 12:51:12
|
Revision: 8973 http://sourceforge.net/p/phpwiki/code/8973 Author: vargenau Date: 2014-07-17 12:51:09 +0000 (Thu, 17 Jul 2014) Log Message: ----------- Fix PDO Modified Paths: -------------- trunk/lib/DbSession/PDO.php Modified: trunk/lib/DbSession/PDO.php =================================================================== --- trunk/lib/DbSession/PDO.php 2014-07-17 12:26:03 UTC (rev 8972) +++ trunk/lib/DbSession/PDO.php 2014-07-17 12:51:09 UTC (rev 8973) @@ -36,7 +36,7 @@ $this->_dbh =& $db->_dbh; $this->_backend =& $db; } - return $dbh->_dbh; + return $dbh; } function query($sql) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |