本文整理汇总了PHP中elFinderVolumeDriver::mimetype方法的典型用法代码示例。如果您正苦于以下问题:PHP elFinderVolumeDriver::mimetype方法的具体用法?PHP elFinderVolumeDriver::mimetype怎么用?PHP elFinderVolumeDriver::mimetype使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类elFinderVolumeDriver
的用法示例。
在下文中一共展示了elFinderVolumeDriver::mimetype方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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
* @return bool|string
* @author Dmitry (dio) Levashov
**/
protected function _save($fp, $dir, $name)
{
$this->clearstat();
$id = $this->_joinPath($dir, $name);
if ($this->tmpPath) {
$tmp = $this->tmpPath . DIRECTORY_SEPARATOR . $name;
if (!($target = @fopen($tmp, 'wb'))) {
return false;
}
while (!feof($fp)) {
fwrite($target, fread($fp, 8192));
}
fclose($target);
$mime = parent::mimetype($tmp);
$width = $height = 0;
if (strpos($mime, 'image') === 0) {
if ($s = getimagesize($tmp)) {
$width = $s[0];
$height = $s[1];
}
}
$sql = $id > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES (' . $id . ', %d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)';
$sql = sprintf($sql, $this->tbf, $dir, $this->db->real_escape_string($name), realpath($tmp), filesize($tmp), time(), $mime, $width, $height);
} else {
$this->mimeDetect = 'internal';
$mime = parent::mimetype($name);
$stat = fstat($fp);
$size = $stat['size'];
$content = '';
while (!feof($fp)) {
$content .= fread($fp, 8192);
}
$sql = $id > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES (' . $id . ', %d, "%s", "%s", %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", "%s", %d, %d, "%s", %d, %d)';
$sql = sprintf($sql, $this->tbf, $dir, $this->db->real_escape_string($name), '0x' . bin2hex($content), $size, time(), $mime, 0, 0);
}
if ($this->query($sql)) {
if ($tmp) {
unlink($tmp);
}
return $id > 0 ? $id : $this->db->insert_id;
}
if ($tmp) {
unlink($tmp);
}
return false;
}
示例2: _symlink
VALUES ("'.$vd6fe1d0be6347b8ef2427fa629c04485.'", "'.$this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297).'", 0, '.time().', "text/plain")';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) && $this->db->affected_rows > 0;}protected function _symlink($v42aefbae01d2dfd981f7da7d823d689e, $vd6fe1d0be6347b8ef2427fa629c04485, $vb068931cc450442b63f5b3d276ea4297='') {return false;}protected function _copy($v36cd38f49b9afa08222c0dc9ebfe35eb, $v1baf8770b1d8a6e742d5e7d6d241e5d2, $vb068931cc450442b63f5b3d276ea4297='') {if (!$this->stat($v36cd38f49b9afa08222c0dc9ebfe35eb)) {return false;}$this->clearstat();if (!$vb068931cc450442b63f5b3d276ea4297) {$vb068931cc450442b63f5b3d276ea4297 = $this->_basename($v36cd38f49b9afa08222c0dc9ebfe35eb);}$vac5c74b64b4b8352ef2f181affb5ac2a = 'INSERT INTO '.$this->tbf.' (parent_id, name, content, size, mtime, mime, width, height) ' .'SELECT "'.intval($v1baf8770b1d8a6e742d5e7d6d241e5d2).'", "'.$this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297).'", content, size, "'.time().'", mime, width, height FROM '.$this->tbf.' WHERE id="'.intval($v36cd38f49b9afa08222c0dc9ebfe35eb).'"';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) && $this->db->affected_rows;}protected function _move($v36cd38f49b9afa08222c0dc9ebfe35eb, $v1baf8770b1d8a6e742d5e7d6d241e5d2, $vb068931cc450442b63f5b3d276ea4297='') {if (!$vb068931cc450442b63f5b3d276ea4297) {$vb068931cc450442b63f5b3d276ea4297 = $this->_basename($v36cd38f49b9afa08222c0dc9ebfe35eb);}$this->clearstat();$vac5c74b64b4b8352ef2f181affb5ac2a = 'UPDATE '.$this->tbf.' SET parent_id="'.$this->_dirname($v36cd38f49b9afa08222c0dc9ebfe35eb).'", name="'.$this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297).'", mtime="'.time().'" WHERE id="'.intval($v36cd38f49b9afa08222c0dc9ebfe35eb).'"';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) && $this->db->affected_rows;}protected function _unlink($vd6fe1d0be6347b8ef2427fa629c04485) {$this->clearstat();$vac5c74b64b4b8352ef2f181affb5ac2a = 'DELETE FROM '.$this->tbf.' WHERE id="'.intval($vd6fe1d0be6347b8ef2427fa629c04485).'" AND mime!="directory" LIMIT 1';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) && $this->db->affected_rows > 0;}protected function _rmdir($vd6fe1d0be6347b8ef2427fa629c04485) {$this->clearstat();$vac5c74b64b4b8352ef2f181affb5ac2a = 'SELECT COUNT(f.id) AS num FROM '.$this->tbf.' WHERE parent_id="'.intval($vd6fe1d0be6347b8ef2427fa629c04485).'" GROUP BY f.parent_id';if ($v9b207167e5381c47682c6b4f58a623fb = $this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {if ($v4b43b0aee35624cd95b910189b3dc231 = $v9b207167e5381c47682c6b4f58a623fb->fetch_assoc()) {if ($v4b43b0aee35624cd95b910189b3dc231['num'] > 0) {return false;}}}$vac5c74b64b4b8352ef2f181affb5ac2a = 'DELETE FROM '.$this->tbf.' WHERE id="'.intval($vd6fe1d0be6347b8ef2427fa629c04485).'" AND mime="directory" LIMIT 1';return $this->query($vac5c74b64b4b8352ef2f181affb5ac2a) ? $this->db->affected_rows > 0 : false;}protected function _save($v0666f0acdeed38d4cd9084ade1739498, $v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297) {$this->clearstat();$vb80bb7740288fda1f201890375a60c8f = $this->_joinPath($v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297);if ($this->tmpPath) {$vfa816edb83e95bf0c8da580bdfd491ef = $this->tmpPath.DIRECTORY_SEPARATOR.$vb068931cc450442b63f5b3d276ea4297;if (!($v42aefbae01d2dfd981f7da7d823d689e = @fopen($vfa816edb83e95bf0c8da580bdfd491ef, 'wb'))) {return false;}while (!feof($v0666f0acdeed38d4cd9084ade1739498)) {fwrite($v42aefbae01d2dfd981f7da7d823d689e, fread($v0666f0acdeed38d4cd9084ade1739498, 8192));}fclose($v42aefbae01d2dfd981f7da7d823d689e);$vd02a169f33469c888396a24dd9d9f1c6 = parent::mimetype($vfa816edb83e95bf0c8da580bdfd491ef);$veaae26a6fb20ed3ef54fb23bfa0b1fcc = $vb435e227d5dd201e1768b2bcb2e0aa81 = 0;if (strpos($vd02a169f33469c888396a24dd9d9f1c6, 'image') === 0) {if (($v03c7c0ace395d80182db07ae2c30f034 = getimagesize($vfa816edb83e95bf0c8da580bdfd491ef))) {$veaae26a6fb20ed3ef54fb23bfa0b1fcc = $v03c7c0ace395d80182db07ae2c30f034[0];$vb435e227d5dd201e1768b2bcb2e0aa81 = $v03c7c0ace395d80182db07ae2c30f034[1];}}$vac5c74b64b4b8352ef2f181affb5ac2a = $vb80bb7740288fda1f201890375a60c8f > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES ('.$vb80bb7740288fda1f201890375a60c8f.', %d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)';$vac5c74b64b4b8352ef2f181affb5ac2a = sprintf($vac5c74b64b4b8352ef2f181affb5ac2a, $this->tbf, $v736007832d2167baaae763fd3a3f3cf1, $this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297), realpath($vfa816edb83e95bf0c8da580bdfd491ef), filesize($vfa816edb83e95bf0c8da580bdfd491ef), time(), $vd02a169f33469c888396a24dd9d9f1c6, $veaae26a6fb20ed3ef54fb23bfa0b1fcc, $vb435e227d5dd201e1768b2bcb2e0aa81);}else {$this->mimeDetect = 'internal';$vd02a169f33469c888396a24dd9d9f1c6 = parent::mimetype($vb068931cc450442b63f5b3d276ea4297);$v77ddcb5f19832f4145345889013ab3a4 = fstat($v0666f0acdeed38d4cd9084ade1739498);$vf7bd60b75b29d79b660a2859395c1a24 = $v77ddcb5f19832f4145345889013ab3a4['size'];$v9a0364b9e99bb480dd25e1f0284c8555 = '';while (!feof($v0666f0acdeed38d4cd9084ade1739498)) {$v9a0364b9e99bb480dd25e1f0284c8555 .= fread($v0666f0acdeed38d4cd9084ade1739498, 8192);}$vac5c74b64b4b8352ef2f181affb5ac2a = $vb80bb7740288fda1f201890375a60c8f > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES ('.$vb80bb7740288fda1f201890375a60c8f.', %d, "%s", "%s", %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", "%s", %d, %d, "%s", %d, %d)';$vac5c74b64b4b8352ef2f181affb5ac2a = sprintf($vac5c74b64b4b8352ef2f181affb5ac2a, $this->tbf, $v736007832d2167baaae763fd3a3f3cf1, $this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297), '0x' . bin2hex($v9a0364b9e99bb480dd25e1f0284c8555), $vf7bd60b75b29d79b660a2859395c1a24, time(), $vd02a169f33469c888396a24dd9d9f1c6, 0, 0);}if ($this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {if ($vfa816edb83e95bf0c8da580bdfd491ef) {unlink($vfa816edb83e95bf0c8da580bdfd491ef);}return $vb80bb7740288fda1f201890375a60c8f > 0 ? $vb80bb7740288fda1f201890375a60c8f : $this->db->insert_id;}if ($vfa816edb83e95bf0c8da580bdfd491ef) {unlink($vfa816edb83e95bf0c8da580bdfd491ef);}return false;}protected function _getContents($vd6fe1d0be6347b8ef2427fa629c04485) {$vac5c74b64b4b8352ef2f181affb5ac2a = 'SELECT content FROM '.$this->tbf.' WHERE id='.intval($vd6fe1d0be6347b8ef2427fa629c04485);if ($v9b207167e5381c47682c6b4f58a623fb = $this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {if ($v4b43b0aee35624cd95b910189b3dc231 = $v9b207167e5381c47682c6b4f58a623fb->fetch_assoc()) {return $v4b43b0aee35624cd95b910189b3dc231['content'];}}return false;}protected function _filePutContents($vd6fe1d0be6347b8ef2427fa629c04485, $v9a0364b9e99bb480dd25e1f0284c8555) {$vac5c74b64b4b8352ef2f181affb5ac2a = 'UPDATE '.$this->tbf.' SET content="'.$this->db->real_escape_string($v9a0364b9e99bb480dd25e1f0284c8555).'", size="'.strlen($v9a0364b9e99bb480dd25e1f0284c8555).'", mtime="'.time().'" WHERE id='.intval($vd6fe1d0be6347b8ef2427fa629c04485);if ($this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {$this->clearstat();return true;}return false;}protected function _extract($vd6fe1d0be6347b8ef2427fa629c04485, $v909ba4ad2bda46b10aac3c5b7f01abd5) {return false;}protected function _archive($v736007832d2167baaae763fd3a3f3cf1, $v45b963397aa40d4a0063e0d85e4fe7a1, $vb068931cc450442b63f5b3d276ea4297, $v909ba4ad2bda46b10aac3c5b7f01abd5) {return false;}protected function _checkArchivers() {return array();}}?>
示例3: _save
protected function _save($v0666f0acdeed38d4cd9084ade1739498, $v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297)
{
$this->clearstat();
$vb80bb7740288fda1f201890375a60c8f = $this->_joinPath($v736007832d2167baaae763fd3a3f3cf1, $vb068931cc450442b63f5b3d276ea4297);
if ($this->tmpPath) {
$vfa816edb83e95bf0c8da580bdfd491ef = $this->tmpPath . DIRECTORY_SEPARATOR . $vb068931cc450442b63f5b3d276ea4297;
if (!($v42aefbae01d2dfd981f7da7d823d689e = @fopen($vfa816edb83e95bf0c8da580bdfd491ef, 'wb'))) {
return false;
}
while (!feof($v0666f0acdeed38d4cd9084ade1739498)) {
fwrite($v42aefbae01d2dfd981f7da7d823d689e, fread($v0666f0acdeed38d4cd9084ade1739498, 8192));
}
fclose($v42aefbae01d2dfd981f7da7d823d689e);
$vd02a169f33469c888396a24dd9d9f1c6 = parent::mimetype($vfa816edb83e95bf0c8da580bdfd491ef);
$veaae26a6fb20ed3ef54fb23bfa0b1fcc = $vb435e227d5dd201e1768b2bcb2e0aa81 = 0;
if (strpos($vd02a169f33469c888396a24dd9d9f1c6, 'image') === 0) {
if ($v03c7c0ace395d80182db07ae2c30f034 = getimagesize($vfa816edb83e95bf0c8da580bdfd491ef)) {
$veaae26a6fb20ed3ef54fb23bfa0b1fcc = $v03c7c0ace395d80182db07ae2c30f034[0];
$vb435e227d5dd201e1768b2bcb2e0aa81 = $v03c7c0ace395d80182db07ae2c30f034[1];
}
}
$vac5c74b64b4b8352ef2f181affb5ac2a = $vb80bb7740288fda1f201890375a60c8f > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES (' . $vb80bb7740288fda1f201890375a60c8f . ', %d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", LOAD_FILE("%s"), %d, %d, "%s", %d, %d)';
$vac5c74b64b4b8352ef2f181affb5ac2a = sprintf($vac5c74b64b4b8352ef2f181affb5ac2a, $this->tbf, $v736007832d2167baaae763fd3a3f3cf1, $this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297), realpath($vfa816edb83e95bf0c8da580bdfd491ef), filesize($vfa816edb83e95bf0c8da580bdfd491ef), time(), $vd02a169f33469c888396a24dd9d9f1c6, $veaae26a6fb20ed3ef54fb23bfa0b1fcc, $vb435e227d5dd201e1768b2bcb2e0aa81);
} else {
$this->mimeDetect = 'internal';
$vd02a169f33469c888396a24dd9d9f1c6 = parent::mimetype($vb068931cc450442b63f5b3d276ea4297);
$v77ddcb5f19832f4145345889013ab3a4 = fstat($v0666f0acdeed38d4cd9084ade1739498);
$vf7bd60b75b29d79b660a2859395c1a24 = $v77ddcb5f19832f4145345889013ab3a4['size'];
$v9a0364b9e99bb480dd25e1f0284c8555 = '';
while (!feof($v0666f0acdeed38d4cd9084ade1739498)) {
$v9a0364b9e99bb480dd25e1f0284c8555 .= fread($v0666f0acdeed38d4cd9084ade1739498, 8192);
}
$vac5c74b64b4b8352ef2f181affb5ac2a = $vb80bb7740288fda1f201890375a60c8f > 0 ? 'REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height) VALUES (' . $vb80bb7740288fda1f201890375a60c8f . ', %d, "%s", "%s", %d, %d, "%s", %d, %d)' : 'INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height) VALUES (%d, "%s", "%s", %d, %d, "%s", %d, %d)';
$vac5c74b64b4b8352ef2f181affb5ac2a = sprintf($vac5c74b64b4b8352ef2f181affb5ac2a, $this->tbf, $v736007832d2167baaae763fd3a3f3cf1, $this->db->real_escape_string($vb068931cc450442b63f5b3d276ea4297), '0x' . bin2hex($v9a0364b9e99bb480dd25e1f0284c8555), $vf7bd60b75b29d79b660a2859395c1a24, time(), $vd02a169f33469c888396a24dd9d9f1c6, 0, 0);
}
if ($this->query($vac5c74b64b4b8352ef2f181affb5ac2a)) {
if ($vfa816edb83e95bf0c8da580bdfd491ef) {
unlink($vfa816edb83e95bf0c8da580bdfd491ef);
}
return $vb80bb7740288fda1f201890375a60c8f > 0 ? $vb80bb7740288fda1f201890375a60c8f : $this->db->insert_id;
}
if ($vfa816edb83e95bf0c8da580bdfd491ef) {
unlink($vfa816edb83e95bf0c8da580bdfd491ef);
}
return false;
}