Пример #1
0
     * download multiple files 
     * as .zip archive
     */
} elseif ($getfilelist && file_exists('shorten/' . $getfilelist . '.json')) {
    $datarray = json_decode(file_get_contents('shorten/' . $getfilelist . '.json'), true);
    $hash = $datarray['hash'];
    $time = $datarray['time'];
    $pass = $datarray['pass'];
    $passa = true;
    if ($pass) {
        $passa = false;
        if ($getpass && md5($getpass) === $pass) {
            $passa = true;
        }
    }
    if ($downloader->checkTime($time) == true && $passa === true) {
        $pieces = explode(",", $datarray['attachments']);
        if (count($pieces) > $maxfiles) {
            $_SESSION['error'] = $encodeExplorer->getString("too_many_files") . " " . $maxfiles;
            header('Location:' . $script_url);
            exit;
        }
        if (!file_exists('tmp')) {
            if (!mkdir('tmp', 0755)) {
                $_SESSION['error'] = "Cannot create a tmp dir for .zip files";
                header('Location:' . $script_url);
                exit;
            }
            if (!chmod('tmp', 0755)) {
                $_SESSION['error'] = "Cannot set CHMOD 755 to tmp dir";
                header('Location:' . $script_url);
Пример #2
0
$timeconfig = $setUp->getConfig('default_timezone');
$timezone = strlen($timeconfig) > 0 ? $timeconfig : "UTC";
date_default_timezone_set($timezone);
$downloader = new Downloader();
$utils = new Utils();
$logger = new Logger();
$actions = new Actions();
$getcloud = $_POST["setdel"];
$hash = filter_input(INPUT_POST, "h", FILTER_SANITIZE_STRING);
$doit = filter_input(INPUT_POST, "doit", FILTER_SANITIZE_STRING);
$time = filter_input(INPUT_POST, "t", FILTER_SANITIZE_STRING);
if ($doit != $time * 12) {
    die('Direct access not permitted');
}
$alt = $setUp->getConfig('salt');
$altone = $setUp->getConfig('session_name');
if ($hash && $time && $gateKeeper->isUserLoggedIn() && $gateKeeper->isAllowed('delete_enable')) {
    if (md5($alt . $time) === $hash && $downloader->checkTime($time) == true) {
        foreach ($getcloud as $pezzo) {
            if ($downloader->checkFile($pezzo) == true) {
                $myfile = "../" . urldecode(base64_decode($pezzo));
                $actions->deleteMulti($myfile);
            }
        }
        echo "ok";
    } else {
        echo "Action expired";
    }
} else {
    echo "Not enough data";
}
Пример #3
0
    $hpass = md5($pass);
} else {
    $hpass = false;
}
$saveData = array();
$saveData['pass'] = $hpass;
$saveData['time'] = $time;
$saveData['hash'] = $hash;
$saveData['attachments'] = $attachments;
$attachash = md5($time . $attachments . $pass);
// create the temporary directory
if (!is_dir('shorten')) {
    mkdir('shorten', 0755, true);
}
// save dowloadable link if it does not already exists
if (!file_exists('shorten/' . $attachash . '.json') || $pass !== false) {
    $fp = fopen('shorten/' . $attachash . '.json', 'w');
    fwrite($fp, json_encode($saveData));
    fclose($fp);
}
// remove old files
$shortens = glob("shorten/*.json");
foreach ($shortens as $shorten) {
    if (is_file($shorten)) {
        $filetime = filemtime($shorten);
        if ($downloader->checkTime($filetime) == false) {
            unlink($shorten);
        }
    }
}
echo $attachash;