function qstr($s, $magic_quotes = false) { if (!$magic_quotes) { if (ADODB_PHPVER >= 0x4300) { if (is_resource($this->_connectionID)) { return "'" . mysql_real_escape_string($s, $this->_connectionID) . "'"; } } if ($this->replaceQuote[0] == '\\') { $s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s); } return "'" . str_replace("'", $this->replaceQuote, $s) . "'"; } // undo magic quotes for " $s = str_replace('\\"', '"', $s); return "'{$s}'"; }
/** * Correctly quotes a string so that all strings are escaped. We prefix and append * to the string single-quotes. * An example is $db->qstr("Don't bother",magic_quotes_runtime()); * * @param s the string to quote * @param [magic_quotes] if $s is GET/POST var, set to get_magic_quotes_gpc(). * This undoes the stupidity of magic quotes for GPC. * * @return quoted string to be sent back to database */ function qstr($s, $magic_quotes = false) { if (!$magic_quotes) { if ($this->replaceQuote[0] == '\\') { // only since php 4.0.5 $s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s); //$s = str_replace("\0","\\\0", str_replace('\\','\\\\',$s)); } return "'" . str_replace("'", $this->replaceQuote, $s) . "'"; } // undo magic quotes for " $s = str_replace('\\"', '"', $s); if ($this->replaceQuote == "\\'") { // ' already quoted, no need to change anything return "'{$s}'"; } else { // change \' to '' for sybase/mssql $s = str_replace('\\\\', '\\', $s); return "'" . str_replace("\\'", $this->replaceQuote, $s) . "'"; } }
function _decode($blob) { eval('$realblob="' . adodb_str_replace(array('"', '$'), array('\\"', '\\$'), $blob) . '";'); return $realblob; }
function qstr($s, $magic_quotes = false) { if (is_null($s)) { return 'NULL'; } if (!$magic_quotes) { if (PHP_VERSION >= 5) { return "'" . mysqli_real_escape_string($this->_connectionID, $s) . "'"; } if ($this->replaceQuote[0] == '\\') { $s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s); } return "'" . str_replace("'", $this->replaceQuote, $s) . "'"; } // undo magic quotes for " $s = str_replace('\\"', '"', $s); return "'{$s}'"; }
function BlobEncode($blob) { if (ADODB_PHPVER >= 0x5200) { return pg_escape_bytea($this->_connectionID, $blob); } if (ADODB_PHPVER >= 0x4200) { return pg_escape_bytea($blob); } /*92=backslash, 0=null, 39=single-quote*/ $badch = array(chr(92), chr(0), chr(39)); # \ null ' $fixch = array('\\\\134', '\\\\000', '\\\\047'); return adodb_str_replace($badch, $fixch, $blob); // note that there is a pg_escape_bytea function only for php 4.2.0 or later }
function qstr($s, $magic_quotes = false) { if (!$magic_quotes) { if (PHP_VERSION >= 5) return "'" . mysqli_real_escape_string($this->_connectionID, $s) . "'"; if ($this->replaceQuote[0] == '\\') $s = adodb_str_replace(array('\\',"\0"),array('\\\\',"\\\0"),$s); return "'".str_replace("'",$this->replaceQuote,$s)."'"; } // undo magic quotes for " $s = str_replace('\\"','"',$s); return "'$s'"; }
/** * Correctly quotes a string so that all strings are escaped. We prefix and append * to the string single-quotes. * An example is $db->qstr("Don't bother"); * * @param s the string to quote * * @return quoted string to be sent back to database */ public function qstr($s) { if ($this->replaceQuote[0] == '\\') { // only since php 4.0.5 $s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s); //$s = str_replace("\0","\\\0", str_replace('\\','\\\\',$s)); } return "'" . str_replace("'", $this->replaceQuote, $s) . "'"; }
function qstr($s, $magic_quotes = false) { if (!$magic_quotes) { if (ADODB_PHPVER >= 0x5000) { // $this->_connectionID = $this->mysqli_resolve_link($this->_connectionID); return "'" . mysqli_real_escape_string($this->_connectionID, $s) . "'"; } else { trigger_error("phpver < 5 not implemented", E_USER_ERROR); } if ($this->replaceQuote[0] == '\\') { $s = adodb_str_replace(array('\\', ""), array('\\\\', "\\"), $s); } return "'" . str_replace("'", $this->replaceQuote, $s) . "'"; } // undo magic quotes for " $s = str_replace('\\"', '"', $s); return "'{$s}'"; }
function _decode($blob) { if ($blob === NULL) return NULL; eval('$realblob="'.adodb_str_replace(array('"','$'),array('\"','\$'),$blob).'";'); return $realblob; }