当前位置: 首页>>代码示例>>PHP>>正文


PHP mysqli::quoteString方法代码示例

本文整理汇总了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;
 }
开发者ID:nao-pon,项目名称:xelfinder,代码行数:84,代码来源:driver.class.php


注:本文中的mysqli::quoteString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。