Example #1
0
function verifyPath($path)
{
    if (!checkPath($path)) {
        echo getErrorRes("Access to {$path} is denied") . ' ' . $path;
        exit;
    }
}
Example #2
0
                $errors[] = $filename;
            }
            if (is_file($filePath)) {
                @chmod($filePath, octdec(FILEPERMISSIONS));
            }
            if (RoxyFile::IsImage($filename) && (intval(MAX_IMAGE_WIDTH) > 0 || intval(MAX_IMAGE_HEIGHT) > 0)) {
                RoxyImage::Resize($filePath, $filePath, intval(MAX_IMAGE_WIDTH), intval(MAX_IMAGE_HEIGHT));
            }
        }
        if ($errors && $errorsExt) {
            $res = getSuccessRes(t('E_UploadNotAll') . ' ' . t('E_FileExtensionForbidden'));
        } elseif ($errorsExt) {
            $res = getSuccessRes(t('E_FileExtensionForbidden'));
        } elseif ($errors) {
            $res = getSuccessRes(t('E_UploadNotAll'));
        } else {
            $res = getSuccessRes();
        }
    } else {
        $res = getErrorRes(t('E_UploadNoFiles'));
    }
} else {
    $res = getErrorRes(t('E_UploadInvalidPath'));
}
?>
<script>
parent.fileUploaded(<?php 
echo $res;
?>
);
</script>
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('MOVEDIR');
checkAccess('MOVEDIR');
$path = trim(empty($_GET['d']) ? '' : $_GET['d']);
$newPath = trim(empty($_GET['n']) ? '' : $_GET['n']);
verifyPath($path);
verifyPath($newPath);
if (is_dir(fixPath($path))) {
    if (mb_strpos($newPath, $path) === 0) {
        echo getErrorRes(t('E_CannotMoveDirToChild'));
    } elseif (file_exists(fixPath($newPath) . '/' . basename($path))) {
        echo getErrorRes(t('E_DirAlreadyExists'));
    } elseif (rename(fixPath($path), fixPath($newPath) . '/' . basename($path))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_MoveDir') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_MoveDirInvalisPath'));
}
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('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 #5
0
verifyAction('COPYDIR');
checkAccess('COPYDIR');
$path = trim(empty($_GET['d']) ? '' : $_GET['d']);
$newPath = trim(empty($_GET['n']) ? '' : $_GET['n']);
verifyPath($path);
verifyPath($newPath);
function copyDir($path, $newPath)
{
    $items = listDirectory($path);
    if (!is_dir($newPath)) {
        mkdir($newPath, octdec(DIRPERMISSIONS));
    }
    foreach ($items as $item) {
        if ($item == '.' || $item == '..') {
            continue;
        }
        $oldPath = RoxyFile::FixPath($path . '/' . $item);
        $tmpNewPath = RoxyFile::FixPath($newPath . '/' . $item);
        if (is_file($oldPath)) {
            copy($oldPath, $tmpNewPath);
        } elseif (is_dir($oldPath)) {
            copyDir($oldPath, $tmpNewPath);
        }
    }
}
if (is_dir(fixPath($path))) {
    copyDir(fixPath($path . '/'), fixPath($newPath . '/' . basename($path)));
    echo getSuccessRes();
} else {
    echo getErrorRes(t('E_CopyDirInvalidPath'));
}
Example #6
0
  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('MOVEFILE');
checkAccess('MOVEFILE');
$path = trim(empty($_GET['f']) ? '' : $_GET['f']);
$newPath = trim(empty($_GET['n']) ? '' : $_GET['n']);
if (!$newPath) {
    $newPath = getFilesPath();
}
verifyPath($path);
verifyPath($newPath);
if (is_file(fixPath($path))) {
    if (file_exists(fixPath($newPath))) {
        echo getErrorRes(t('E_MoveFileAlreadyExists') . ' ' . basename($newPath));
    } elseif (rename(fixPath($path), fixPath($newPath))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_MoveFile') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_MoveFileInvalisPath'));
}
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'));
}
Example #8
0
  This program is free software: you can redistribute it and/or modify
  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('CREATEDIR');
checkAccess('CREATEDIR');
$path = trim(empty($_GET['d']) ? '' : $_GET['d']);
$name = trim(empty($_GET['n']) ? '' : $_GET['n']);
verifyPath($path);
if (is_dir(fixPath($path))) {
    if (mkdir(fixPath($path) . '/' . $name, octdec(DIRPERMISSIONS))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_CreateDirFailed') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_CreateDirInvalidPath'));
}
Example #9
0
  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('DELETEDIR');
checkAccess('DELETEDIR');
$path = trim(empty($_GET['d']) ? '' : $_GET['d']);
verifyPath($path);
if (is_dir(fixPath($path))) {
    if (fixPath($path . '/') == fixPath(getFilesPath() . '/')) {
        echo getErrorRes(t('E_CannotDeleteRoot'));
    } elseif (count(glob(fixPath($path) . "/*"))) {
        echo getErrorRes(t('E_DeleteNonEmpty'));
    } elseif (rmdir(fixPath($path))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_CannotDeleteDir') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_DeleteDirInvalidPath') . ' ' . $path);
}
Example #10
0
  For licensing, see LICENSE.txt or http://RoxyFileman.com/license

  This program is free software: you can redistribute it and/or modify
  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('DELETEFILE');
checkAccess('DELETEFILE');
$path = trim($_GET['f']);
verifyPath($path);
if (is_file(fixPath($path))) {
    if (unlink(fixPath($path))) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_DeletŠµFile') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_DeleteFileInvalidPath'));
}
Example #11
0
            }
            if ($isUploaded && RoxyFile::IsImage($filename) && (intval(MAX_IMAGE_WIDTH) > 0 || intval(MAX_IMAGE_HEIGHT) > 0)) {
                RoxyImage::Resize($filePath, $filePath, intval(MAX_IMAGE_WIDTH), intval(MAX_IMAGE_HEIGHT));
            }
        }
        if ($errors && $errorsExt) {
            $res = getSuccessRes(t('E_UploadNotAll') . ' ' . t('E_FileExtensionForbidden'));
        } elseif ($errorsExt) {
            $res = getSuccessRes(t('E_FileExtensionForbidden'));
        } elseif ($errors) {
            $res = getSuccessRes(t('E_UploadNotAll'));
        } else {
            $res = getSuccessRes();
        }
    } else {
        $res = getErrorRes(t('E_UploadNoFiles'));
    }
} else {
    $res = getErrorRes(t('E_UploadInvalidPath'));
}
if ($isAjax) {
    if ($errors || $errorsExt) {
        $res = getErrorRes(t('E_UploadNotAll'));
    }
    echo $res;
} else {
    echo '
<script>
parent.fileUploaded(' . $res . ');
</script>';
}
Example #12
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('RENAMEFILE');
checkAccess('RENAMEFILE');
$path = trim(empty($_GET['f']) ? '' : $_GET['f']);
$name = trim(empty($_GET['n']) ? '' : $_GET['n']);
verifyPath($path);
if (is_file(fixPath($path))) {
    if (!RoxyFile::CanUploadFile($name)) {
        echo getErrorRes(t('E_FileExtensionForbidden') . ' ".' . RoxyFile::GetExtension($name) . '"');
    } elseif (rename(fixPath($path), dirname(fixPath($path)) . '/' . $name)) {
        echo getSuccessRes();
    } else {
        echo getErrorRes(t('E_RenameFile') . ' ' . basename($path));
    }
} else {
    echo getErrorRes(t('E_RenameFileInvalidPath'));
}