src build elFinder-2.1-7c099d0

This commit is contained in:
nao-pon
2016-03-16 21:06:26 +09:00
parent e08fe22cfa
commit ef0dc76970
6 changed files with 27 additions and 27 deletions
+20 -20
View File
@@ -207,7 +207,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
* @author Dmitry (dio) Levashov
**/
protected function make($path, $name, $mime) {
$sql = 'INSERT INTO %s (`parent_id`, `name`, `size`, `mtime`, `mime`, `content`, `read`, `write`) VALUES ("%s", "%s", 0, %d, "%s", "", "%d", "%d")';
$sql = 'INSERT INTO %s (`parent_id`, `name`, `size`, `mtime`, `mime`, `content`, `read`, `write`) VALUES (\'%s\', \'%s\', 0, %d, \'%s\', \'\', \'%d\', \'%d\')';
$sql = sprintf($sql, $this->tbf, $path, $this->db->real_escape_string($name), time(), $mime, $this->defaults['read'], $this->defaults['write']);
// echo $sql;
return $this->query($sql) && $this->db->affected_rows > 0;
@@ -229,8 +229,8 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
$sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, IF(ch.id, 1, 0) AS dirs
FROM '.$this->tbf.' AS f
LEFT JOIN '.$this->tbf.' AS ch ON ch.parent_id=f.id AND ch.mime="directory"
WHERE f.parent_id="'.$path.'"
LEFT JOIN '.$this->tbf.' AS ch ON ch.parent_id=f.id AND ch.mime=\'directory\'
WHERE f.parent_id=\''.$path.'\'
GROUP BY f.id';
$res = $this->query($sql);
@@ -315,7 +315,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
$timeout = $this->options['searchTimeout']? $this->searchStart + $this->options['searchTimeout'] : 0;
if ($path != $this->root) {
$inpath = array(intval($path));
$dirs = $inpath = array(intval($path));
while($inpath) {
$in = '('.join(',', $inpath).')';
$inpath = array();
@@ -337,14 +337,14 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
$whrs = array();
foreach($mimes as $mime) {
if (strpos($mime, '/') === false) {
$whrs[] = sprintf('f.mime LIKE "%s/%%"', $this->db->real_escape_string($mime));
$whrs[] = sprintf('f.mime LIKE \'%s/%%\'', $this->db->real_escape_string($mime));
} else {
$whrs[] = sprintf('f.mime = "%s"', $this->db->real_escape_string($mime));
$whrs[] = sprintf('f.mime = \'%s\'', $this->db->real_escape_string($mime));
}
}
$whr = join(' OR ', $whrs);
} else {
$whr = sprintf('f.name RLIKE "%s"', $this->db->real_escape_string($q));
$whr = sprintf('f.name RLIKE \'%s\'', $this->db->real_escape_string($q));
}
if ($dirs) {
$whr = '(' . $whr . ') AND (`parent_id` IN (' . join(',', $dirs) . '))';
@@ -425,7 +425,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
* @author Dmitry (dio) Levashov
**/
protected function _joinPath($dir, $name) {
$sql = 'SELECT id FROM '.$this->tbf.' WHERE parent_id="'.$dir.'" AND name="'.$this->db->real_escape_string($name).'"';
$sql = 'SELECT id FROM '.$this->tbf.' WHERE parent_id=\''.$dir.'\' AND name=\''.$this->db->real_escape_string($name).'\'';
if (($res = $this->query($sql)) && ($r = $res->fetch_assoc())) {
$this->updateCache($r['id'], $this->_stat($r['id']));
@@ -526,8 +526,8 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
$sql = 'SELECT f.id, f.parent_id, f.name, f.size, f.mtime AS ts, f.mime, f.read, f.write, f.locked, f.hidden, f.width, f.height, IF(ch.id, 1, 0) AS dirs
FROM '.$this->tbf.' AS f
LEFT JOIN '.$this->tbf.' AS p ON p.id=f.parent_id
LEFT JOIN '.$this->tbf.' AS ch ON ch.parent_id=f.id AND ch.mime="directory"
WHERE f.id="'.$path.'"
LEFT JOIN '.$this->tbf.' AS ch ON ch.parent_id=f.id AND ch.mime=\'directory\'
WHERE f.id=\''.$path.'\'
GROUP BY f.id';
$res = $this->query($sql);
@@ -605,7 +605,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
if ($fp) {
if (($res = $this->query('SELECT content FROM '.$this->tbf.' WHERE id="'.$path.'"'))
if (($res = $this->query('SELECT content FROM '.$this->tbf.' WHERE id=\''.$path.'\''))
&& ($r = $res->fetch_assoc())) {
fwrite($fp, $r['content']);
rewind($fp);
@@ -685,7 +685,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
$sql = $id > 0
? sprintf('REPLACE INTO %s (id, parent_id, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden`) (SELECT %d, %d, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden` FROM %s WHERE id=%d)', $this->tbf, $id, $this->_dirname($id), $this->tbf, $source)
: sprintf('INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden`) SELECT %d, "%s", content, size, %d, mime, width, height, `read`, `write`, `locked`, `hidden` FROM %s WHERE id=%d', $this->tbf, $targetDir, $this->db->real_escape_string($name), time(), $this->tbf, $source);
: sprintf('INSERT INTO %s (parent_id, name, content, size, mtime, mime, width, height, `read`, `write`, `locked`, `hidden`) SELECT %d, \'%s\', content, size, %d, mime, width, height, `read`, `write`, `locked`, `hidden` FROM %s WHERE id=%d', $this->tbf, $targetDir, $this->db->real_escape_string($name), time(), $this->tbf, $source);
return $this->query($sql);
}
@@ -701,7 +701,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
* @author Dmitry (dio) Levashov
**/
protected function _move($source, $targetDir, $name) {
$sql = 'UPDATE %s SET parent_id=%d, name="%s" WHERE id=%d LIMIT 1';
$sql = 'UPDATE %s SET parent_id=%d, name=\'%s\' WHERE id=%d LIMIT 1';
$sql = sprintf($sql, $this->tbf, $targetDir, $this->db->real_escape_string($name), $source);
return $this->query($sql) && $this->db->affected_rows > 0 ? $source : false;
}
@@ -714,7 +714,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
* @author Dmitry (dio) Levashov
**/
protected function _unlink($path) {
return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime!="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows;
return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime!=\'directory\' LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows;
}
/**
@@ -725,7 +725,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
* @author Dmitry (dio) Levashov
**/
protected function _rmdir($path) {
return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime="directory" LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows;
return $this->query(sprintf('DELETE FROM %s WHERE id=%d AND mime=\'directory\' LIMIT 1', $this->tbf, $path)) && $this->db->affected_rows;
}
/**
@@ -776,8 +776,8 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
chmod($tmpfile, 0644);
$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)';
? '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), $this->loadFilePath($tmpfile), $size, time(), $mime, $w, $h);
$res = $this->query($sql);
@@ -797,8 +797,8 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
}
$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)';
? '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), $this->db->real_escape_string($content), $size, time(), $mime, $w, $h);
unset($content);
@@ -830,7 +830,7 @@ class elFinderVolumeMySQL extends elFinderVolumeDriver {
* @author Dmitry (dio) Levashov
**/
protected function _filePutContents($path, $content) {
return $this->query(sprintf('UPDATE %s SET content="%s", size=%d, mtime=%d WHERE id=%d LIMIT 1', $this->tbf, $this->db->real_escape_string($content), strlen($content), time(), $path));
return $this->query(sprintf('UPDATE %s SET content=\'%s\', size=%d, mtime=%d WHERE id=%d LIMIT 1', $this->tbf, $this->db->real_escape_string($content), strlen($content), time(), $path));
}
/**