本文整理汇总了PHP中mysqli::quoteString方法的典型用法代码示例。如果您正苦于以下问题:PHP mysqli::quoteString方法的具体用法?PHP mysqli::quoteString怎么用?PHP mysqli::quoteString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类mysqli
的用法示例。
在下文中一共展示了mysqli::quoteString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _save
/**
* Create new file and write into it from file pointer.
* Return new file path or false on error.
*
* @param resource $fp file pointer
* @param string $dir target dir path
* @param string $name file name
* @param array $stat file stat (required by some virtual fs)
* @return bool|string
* @author Dmitry (dio) Levashov
**/
protected function _save($fp, $dir, $name, $stat)
{
if ($name === '') {
return false;
}
$this->clearcache();
$id = $this->_joinPath($dir, $name);
if ($id > 0) {
$this->rmTmb($stat);
}
rewind($fp);
$fstat = fstat($fp);
if (is_array($fstat) && isset($fstat['size'])) {
$size = $fstat['size'];
} else {
$size = 0;
}
$time = time();
$gid = 0;
$uid = (int) $this->x_uid;
$umask = $this->getUmask($dir, $gid);
$perm = $this->getDefaultPerm($umask);
$gids = join(',', $this->getGroupsByUid($uid));
$cut = $_SERVER['REQUEST_METHOD'] == 'POST' ? !empty($_POST['cut']) : !empty($_GET['cut']);
$local_path = !$cut && is_array($stat) && !empty($stat['_localpath']) ? $stat['_localpath'] : '';
$mime = $stat['mime'];
$w = $stat['width'];
$h = $stat['height'];
$sql = $id > 0 ? 'REPLACE INTO %s (`file_id`, `parent_id`, `name`, `size`, `ctime`, `mtime`, `perm`, `umask`, `uid`, `gid`, `mime`, `width`, `height`, `gids`, `local_path`) VALUES (' . $id . ', %d, %s, %d, %d, %d, "%s", "%s", %d, %d, "%s", %d, %d, "%s", %s)' : 'INSERT INTO %s (`parent_id`, `name`, `size`, `ctime`, `mtime`, `perm`, `umask`, `uid`, `gid`, `mime`, `width`, `height`, `gids`, `local_path`) VALUES (%d, %s, %d, %d, %d, "%s", "%s", %d, %d, "%s", %d, %d, "%s", %s)';
$sql = sprintf($sql, $this->tbf, (int) $dir, $this->db->quoteString($name), $size, $time, $time, $perm, $umask, $uid, $gid, $mime, $w, $h, $gids, $this->db->quoteString($local_path));
if ($this->query($sql)) {
if ($id < 1) {
$id = $this->db->getInsertId();
}
if ($local_path) {
return $id;
}
if ($local = $this->readlink($id, true)) {
if ($target = @fopen($local, 'wb')) {
while (!feof($fp)) {
fwrite($target, fread($fp, 8192));
}
fclose($target);
if ($this->mimeDetect === 'internal' && strpos($mime, 'image') === 0 && !getimagesize($local)) {
$this->_unlink($id);
return $this->setError(elFinder::ERROR_UPLOAD_FILE_MIME);
}
if ($this->options['autoResize'] && strpos($mime, 'image') === 0 && max($w, $h) > $this->options['autoResize']) {
if ($this->imgResize($local, $this->options['autoResize'], $this->options['autoResize'], true, true)) {
clearstatcache();
$size = filesize($local);
list($width, $height) = getimagesize($local);
$sql = 'UPDATE %s SET width=%d, height=%d, size=%d WHERE file_id=%d LIMIT 1';
$sql = sprintf($sql, $this->tbf, $width, $height, $size, $id);
$this->query($sql);
}
}
if ($size === 0) {
clearstatcache($local);
$size = filesize($local);
$sql = 'UPDATE %s SET size=%d WHERE file_id=%d LIMIT 1';
$sql = sprintf($sql, $this->tbf, $size, $id);
$this->query($sql);
}
$this->updateDirTimestamp($dir, $time, true);
return $id;
} else {
$this->_unlink($id);
}
}
}
return false;
}