示例#1
0
} elseif (empty($_SESSION['mode'])) {
    $_SESSION['mode'] = 'view';
}
# create a new subfolder
if (!empty($_GET['newfolder'])) {
    $folder = $_GET['newfolder'];
    if (check_path($folder)) {
        $tree = add_branch($folder, new_folder($folder));
        # $path,$id
        header('location:index.php?p=admin&msg=' . $folder . ' ' . e('created', false) . '&token=' . TOKEN);
        exit;
    }
}
# get file from url
if (!empty($_GET['url']) && $_GET['url'] != '' && $_SESSION['curl']) {
    if ($content = file_curl_contents($_GET['url'])) {
        if (empty($_GET['filename'])) {
            $basename = _basename($_GET['url']);
        } else {
            $basename = no_special_char($_GET['filename']);
        }
        $folder_path = addslash_if_needed($_SESSION['upload_root_path'] . $_SESSION['upload_user_path'] . $_SESSION['current_path']);
        $filename = $folder_path . $basename;
        if (is_file($filename)) {
            $filename = $folder_path . rename_item($filename, $folder_path);
        }
        file_put_contents($filename, $content);
        $tree = add_branch($filename, addID($filename));
        header('location:index.php?p=admin&token=' . TOKEN);
        exit;
    } else {
示例#2
0
function download_and_check_integrity($file, $destination, $counter = 5)
{
    global $config;
    if (!($content = file_curl_contents($config['update_url'] . 'maj.php?f=' . $file))) {
        inlog('<em class="warning">!! file unreachable </em>' . $file);
        return false;
    }
    file_put_contents($destination . $file, $content);
    while (!md5_file($file) == $config['update_url'] . 'maj.php?f=' . $file . '&md5' && $counter <= 0) {
        inlog('<em class="warning">!!Integrity failure, retry </em>' . $dir . ' (n°' . $counter . ')');
        $counter--;
        $content = file_curl_contents($config['update_url'] . 'maj.php?f=' . $file);
        file_put_contents($destination . $file, $content);
    }
    if (!md5_file($file) == $config['update_url'] . 'maj.php?f=' . $file . '&md5') {
        inlog('<em class="warning">!!Integrity failure </em>');
        return false;
    } else {
        return $content;
    }
}