return array('files' => $files, 'dirs' => $dirs);
}
function GetDirs($path, $type)
{
    $ret = $sort = array();
    $files = listDirectory(fixPath($path), 0);
    foreach ($files as $f) {
        $fullPath = $path . '/' . $f;
        if (!is_dir(fixPath($fullPath)) || $f == '.' || $f == '..') {
            continue;
        }
        $tmp = getFilesNumber(fixPath($fullPath), $type);
        $ret[$fullPath] = array('path' => $fullPath, 'files' => $tmp['files'], 'dirs' => $tmp['dirs']);
        $sort[$fullPath] = $f;
    }
    natcasesort($sort);
    foreach ($sort as $k => $v) {
        $tmp = $ret[$k];
        echo ',{"p":"' . mb_ereg_replace('"', '\\"', $tmp['path']) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}';
        GetDirs($tmp['path'], $type);
    }
}
$type = empty($_GET['type']) ? '' : strtolower($_GET['type']);
if ($type != 'image' && $type != 'flash') {
    $type = '';
}
echo "[\n";
$tmp = getFilesNumber(fixPath(getFilesPath()), $type);
echo '{"p":"' . mb_ereg_replace('"', '\\"', getFilesPath()) . '","f":"' . $tmp['files'] . '","d":"' . $tmp['dirs'] . '"}';
GetDirs(getFilesPath(), $type);
echo "\n]";
Example #2
0
function checkPath($path){
  $ret = false;
  if(mb_strpos($path.'/', getFilesPath()) === 0)
    $ret = true;

  return $ret;
}
Example #3
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('UPLOAD');
checkAccess('UPLOAD');
$path = trim(empty($_POST['d']) ? getFilesPath() : $_POST['d']);
verifyPath($path);
$res = '';
if (is_dir(fixPath($path))) {
    if (!empty($_FILES['files']) && is_array($_FILES['files']['tmp_name'])) {
        $errors = $errorsExt = array();
        foreach ($_FILES['files']['tmp_name'] as $k => $v) {
            $filename = $_FILES['files']['name'][$k];
            $filename = RoxyFile::MakeUniqueFilename(fixPath($path), $filename);
            $filePath = fixPath($path) . '/' . $filename;
            if (!RoxyFile::CanUploadFile($filename)) {
                $errorsExt[] = $filename;
            } elseif (!move_uploaded_file($v, $filePath)) {
                $errors[] = $filename;
            }
            if (is_file($filePath)) {
Example #4
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('FILESLIST');
checkAccess('FILESLIST');
$path = empty($_GET['d']) ? getFilesPath() : $_GET['d'];
$type = empty($_GET['type']) ? '' : strtolower($_GET['type']);
if ($type != 'image' && $type != 'flash') {
    $type = '';
}
verifyPath($path);
$files = listDirectory(fixPath($path), 0);
natcasesort($files);
$str = '';
echo '[';
foreach ($files as $f) {
    $fullPath = $path . '/' . $f;
    if (!is_file(fixPath($fullPath)) || $type == 'image' && !RoxyFile::IsImage($f) || $type == 'flash' && !RoxyFile::IsFlash($f)) {
        continue;
    }
    $size = filesize(fixPath($fullPath));
Example #5
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('COPYFILE');
checkAccess('COPYFILE');
$path = trim(empty($_POST['f']) ? '' : $_POST['f']);
$newPath = trim(empty($_POST['n']) ? '' : $_POST['n']);
if (!$newPath) {
    $newPath = getFilesPath();
}
verifyPath($path);
verifyPath($newPath);
if (is_file(fixPath($path))) {
    $newPath = $newPath . '/' . RoxyFile::MakeUniqueFilename(fixPath($newPath), basename($path));
    if (copy(fixPath($path), fixPath($newPath))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_CopyFile'));
    }
} else {
    echo getErrorRes(t('E_CopyFileInvalisPath'));
}
Example #6
0
  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('FILESLIST');
checkAccess('FILESLIST');
$path = empty($_POST['d']) ? getFilesPath() : $_POST['d'];
$type = empty($_POST['type']) ? '' : strtolower($_POST['type']);
if ($type != 'image' && $type != 'flash') {
    $type = '';
}
verifyPath($path);
$files = listDirectory(fixPath($path), 0);
natcasesort($files);
$str = '';
echo '[';
foreach ($files as $f) {
    $fullPath = $path . '/' . $f;
    if (!is_file(fixPath($fullPath)) || $type == 'image' && !RoxyFile::IsImage($f) || $type == 'flash' && !RoxyFile::IsFlash($f)) {
        continue;
    }
    $size = filesize(fixPath($fullPath));
Example #7
0
  it under the terms of the GNU General Public License as published by
  the Free Software Foundation, either version 3 of the License.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program.  If not, see <http://www.gnu.org/licenses/>.

  Contact: Lyubomir Arsov, liubo (at) web-lobby.com
*/
include '../system.inc.php';
include 'functions.inc.php';
verifyAction('RENAMEDIR');
checkAccess('RENAMEDIR');
$path = trim(empty($_POST['d']) ? '' : $_POST['d']);
$name = trim(empty($_POST['n']) ? '' : $_POST['n']);
verifyPath($path);
if (is_dir(fixPath($path))) {
    if (fixPath($path . '/') == fixPath(getFilesPath() . '/')) {
        echo getErrorRes(t('E_CannotRenameRoot'));
    } elseif (rename(fixPath($path), dirname(fixPath($path)) . '/' . $name)) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_RenameDir') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_RenameDirInvalidPath'));
}