Exemplo n.º 1
0
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
*/
require_once 'functions.php';
if (isset($_REQUEST["ajax"])) {
    $selectedpath = urldecode($_REQUEST["path"]);
    if ($selectedpath = checkpath($selectedpath, $uploadpath)) {
        $dirs = getDirTree(DOCUMENTROOT . $selectedpath, true, false);
    } else {
        die('0||' . $lang["loadfolder_error_1"]);
    }
} else {
    $selectedpath = $uploadpath;
}
print '<ul id="large_images" class="files clear">';
foreach ($dirs as $key => $value) {
    if ($value != "folder") {
        if (strtolower($value) == "png" || strtolower($value) == "jpg" || strtolower($value) == "jpeg" || strtolower($value) == "gif" || strtolower($value) == "bmp") {
            $htmlFiles .= sprintf('<li>
								  		<a href="%1$s" title="%2$s" class="image">
											<span class="begin"></span>
											<span class="filename">%2$s</span>
Exemplo n.º 2
0
            imagejpeg($thumb);
            break;
        case 'image/png':
            imagepng($thumb);
            break;
        case 'image/gif':
            imagegif($thumb);
            break;
        default:
            imagejpeg($thumb);
    }
}
if (empty($_GET['path'])) {
    die;
}
$szPath = toCanonical(realpath(FILE_PATH . $_GET['path']));
$szErrorMessage = checkpath($szPath);
if (!empty($szErrorMessage) || !is_readable($szPath)) {
    die($szErrorMessage);
}
$aInfo = getimagesize($szPath);
header("Content-type: {$aInfo['mime']}");
$szContent = file_get_contents($szPath);
// ���������� ���������� �� ��� �������� ������
if (isset($_GET['preview'])) {
    // ���� �� �� �������
    outputPreview($szContent, $aInfo['mime']);
} else {
    print $szContent;
}
// ������� ���������� �����
Exemplo n.º 3
0
if (substr($argv[1], 0, 7) != '--type=' || substr($argv[2], 0, 6) != '--src=' || substr($argv[3], 0, 6) != '--dst=') {
    die("wrong paramter\nuse " . $argv[0] . " --help\n");
}
if (isset($argv[4])) {
    die("wrong paramter\nuse " . $argv[0] . " --help\n");
}
$type = substr($argv[1], 7);
$src = substr($argv[2], 6);
$dst = substr($argv[3], 6);
if (!isset($zipper[$type])) {
    die("invaild zip type\nuse " . $argv[0] . " --help\n");
}
if (checkpath($src) == false) {
    die("invaild src\nuse " . $argv[0] . " --help\n");
}
if (checkpath($dst) == false) {
    die("invaild dst\nuse " . $argv[0] . " --help\n");
}
$src = $basedir . $src;
$dst = $basedir . $dst;
if (!file_exists($src)) {
    die("error: source file not exist\nuse " . $argv[0] . " --help\n");
}
if (!is_dir($dst)) {
    die("error: destination directory not exist\nuse " . $argv[0] . " --help\n");
}
if ($type == 'gzip' || $type == 'bzip2') {
    // zu dst-directory noch den dateinamen anh�ngen
    $filename = basename($src);
    if (strrpos($filename, '.') !== false) {
        $filename = substr($filename, 0, strrpos($filename, '.'));
Exemplo n.º 4
0
            echo 'error||' . translate("Deleting file failed!");
        }
        break;
    case "create_folder":
        $folderpath = urldecode($_POST["folderpath"]);
        $foldername = urldecode($_POST["foldername"]);
        //Check if foldername isn't empty
        if ($foldername == "") {
            echo 'error||' . translate("Creating new folder failed!");
            break;
        }
        //Check if folder name is valid
        if (!checkFolderName($foldername)) {
            echo 'error||' . translate("Creating new folder failed!");
            break;
        }
        //Check if folder path is valid
        if (!($folderpath = checkpath($folderpath, $uploadpath))) {
            echo 'error||' . translate("The folder path was tampered with!");
            break;
        }
        if (@mkdir(DOCUMENTROOT . $folderpath . $foldername)) {
            echo 'success||' . translate("A new folder was created!");
        } else {
            echo 'error||' . translate("Creating the new folder failed!");
        }
        break;
    case "settings":
        echo translate('Settings saved!');
        break;
}
Exemplo n.º 5
0
    }
    if (is_writeable($szPath)) {
        $f_header = fopen($szPath, 'w+');
        fputs($f_header, $_POST['content']);
        fclose($f_header);
        $szAlert = 'Данные изменены';
    } else {
        $szAlert = 'Файл защищен от записи';
    }
    $szHTTP_PATH = $_POST['path'];
} else {
    if (empty($_GET['path'])) {
        die;
    }
    $szPath = toCanonical(realpath(FILE_PATH . $_GET['path']));
    $szAlert = checkpath($szPath);
    if (!empty($szAlert)) {
        die($szAlert);
    }
    $szHTTP_PATH = $_GET['path'];
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> Viewing file [<?php 
echo htmlspecialchars($szHTTP_PATH['path']);
?>
]</TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="">
Exemplo n.º 6
0
function CreateDirectory($dirpath, $dirname, $uploadpath)
{
    //Check if folder name is valid
    if (!checkFolderName($dirname)) {
        return false;
    }
    //Check if folder path is valid
    if (!($dirpath = checkpath($dirpath, $uploadpath))) {
        return false;
    }
    //Create directory
    if (!rmkdir(DOCUMENTROOT . $dirpath . $dirname)) {
        return false;
    }
    return true;
}