Ejemplo n.º 1
0
if (preg_match("/(.*)downloads_clean.php\$/", $_SERVER['SCRIPT_FILENAME'], $m)) {
    @chdir($m[1]);
}
require "../adei.php";
global $ADEI;
global $TMP_PATH;
global $DOWNLOAD_DECAY_TIME;
$ADEI->RequireClass("download");
$dm = new DOWNLOADMANAGER();
//$dm->Logit("Clearing old downloads\n");
$dir = opendir("{$TMP_PATH}/downloads");
while ($file = readdir($dir)) {
    $fullname = "{$TMP_PATH}/downloads/{$file}";
    if (filetype($fullname) == "dir") {
        continue;
    }
    if (time() - fileatime($fullname) > $DOWNLOAD_DECAY_TIME) {
        $dotind = strrpos($file, '_');
        $download = substr($file, $dotind + 1, 32);
        $res = $dm->cache->GetDownloads($download);
        if ($res) {
            $row = mysql_fetch_assoc($res);
            if ($row["auto_delete"] == "true") {
                $dm->RemoveDownload($download, true);
            }
        } else {
            echo "Removing rogue file: {$file}\n";
            unlink($file);
        }
    }
}
Ejemplo n.º 2
0
<?php

header("Content-type: text/xml");
header("Cache-Control: no-cache, must-revalidate");
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
global $ADEI;
$ADEI->RequireClass("download");
try {
    $target = $_GET["target"];
    $dm = new DOWNLOADMANAGER();
    switch ($target) {
        case "dlmanager_add":
            $dm->AddDownload();
            break;
        case "dlmanager_remove":
            $dm->RemoveDownload();
            break;
        case "dlmanager_list":
            CreateDownloadXml($dm->GetDownloads(), $target);
            break;
        case "dlmanager_run":
            $dm->DlManagerRun();
            break;
        case "dlmanager_sort":
            $dm->SortBy();
            break;
        case "dlmanager_details":
            CreateDownloadXml($dm->GetDownloadDetails(), $target);
            break;
        case "dlmanager_download":
            $dm->GetFile();