Code Duplication    Length = 16-16 lines in 5 locations

lib/elFinderVolumeBox.class.php 1 location

@@ 1736-1751 (lines=16) @@
1733
     *
1734
     * @author Dmitry (dio) Levashov
1735
     **/
1736
    protected function _filePutContents($path, $content)
1737
    {
1738
        $res = false;
1739
1740
        if ($local = $this->getTempFile($path)) {
1741
            if (file_put_contents($local, $content, LOCK_EX) !== false
1742
            && ($fp = fopen($local, 'rb'))) {
1743
                clearstatcache();
1744
                $res = $this->_save($fp, $path, '', []);
1745
                fclose($fp);
1746
            }
1747
            file_exists($local) && unlink($local);
1748
        }
1749
1750
        return $res;
1751
    }
1752
1753
    /**
1754
     * Detect available archivers.

lib/elFinderVolumeDropbox.class.php 1 location

@@ 1330-1345 (lines=16) @@
1327
     * @return bool
1328
     * @author Dmitry (dio) Levashov
1329
     **/
1330
    protected function _filePutContents($path, $content)
1331
    {
1332
        $res = false;
1333
1334
        if ($local = $this->getTempFile($path)) {
1335
            if (file_put_contents($local, $content, LOCK_EX) !== false
1336
            && ($fp = fopen($local, 'rb'))) {
1337
                clearstatcache();
1338
                $res = $this->_save($fp, $path, '', []);
1339
                fclose($fp);
1340
            }
1341
            file_exists($local) && unlink($local);
1342
        }
1343
1344
        return $res;
1345
    }
1346
1347
    /**
1348
     * Detect available archivers.

lib/elFinderVolumeDropbox2.class.php 1 location

@@ 1359-1374 (lines=16) @@
1356
     *
1357
     * @author Naoki Sawada
1358
     **/
1359
    protected function _filePutContents($path, $content)
1360
    {
1361
        $res = false;
1362
1363
        if ($local = $this->getTempFile($path)) {
1364
            if (file_put_contents($local, $content, LOCK_EX) !== false
1365
            && ($fp = fopen($local, 'rb'))) {
1366
                clearstatcache();
1367
                $res = $this->_save($fp, $path, '', []);
1368
                fclose($fp);
1369
            }
1370
            file_exists($local) && unlink($local);
1371
        }
1372
1373
        return $res;
1374
    }
1375
1376
    /**
1377
     * Detect available archivers.

lib/elFinderVolumeGoogleDrive.class.php 1 location

@@ 1932-1947 (lines=16) @@
1929
     *
1930
     * @author Dmitry (dio) Levashov
1931
     **/
1932
    protected function _filePutContents($path, $content)
1933
    {
1934
        $res = false;
1935
1936
        if ($local = $this->getTempFile($path)) {
1937
            if (file_put_contents($local, $content, LOCK_EX) !== false
1938
            && ($fp = fopen($local, 'rb'))) {
1939
                clearstatcache();
1940
                $res = $this->_save($fp, $path, '', []);
1941
                fclose($fp);
1942
            }
1943
            file_exists($local) && unlink($local);
1944
        }
1945
1946
        return $res;
1947
    }
1948
1949
    /**
1950
     * Detect available archivers.

lib/elFinderVolumeOneDrive.class.php 1 location

@@ 1687-1702 (lines=16) @@
1684
     *
1685
     * @author Dmitry (dio) Levashov
1686
     **/
1687
    protected function _filePutContents($path, $content)
1688
    {
1689
        $res = false;
1690
1691
        if ($local = $this->getTempFile($path)) {
1692
            if (file_put_contents($local, $content, LOCK_EX) !== false
1693
            && ($fp = fopen($local, 'rb'))) {
1694
                clearstatcache();
1695
                $res = $this->_save($fp, $path, '', []);
1696
                fclose($fp);
1697
            }
1698
            file_exists($local) && unlink($local);
1699
        }
1700
1701
        return $res;
1702
    }
1703
1704
    /**
1705
     * Detect available archivers.