include_once './lib/config.php'; include_once './lib/functions.php'; include_once './lib/class.dlfile.php'; if (count($argv) >= 2) { print "\n"; printd("start\n"); $fileId = (int) $argv[1]; if (!$fileId) { exit; } $dbh = dbConnect(); $file = new dlfile($CONFIG['DB_HOST'], $CONFIG['DB_NAME'], $CONFIG['DB_USER'], $CONFIG['DB_PASS']); $hosters = getDbTable($dbh, 'hosters'); dbClose($dbh); if ($file->loadById($fileId)) { $file->packetLoad(); $packetDirBn = getPacketFilename($file->packet->get('id'), $file->packet->get('name')); $packetDownloadDir = 'downloads/loading/' . $packetDirBn; $packetFinishedDir = 'downloads/finished/' . $packetDirBn; printd("packet id: " . $file->packet->get('id') . "\n"); printd("file id: {$fileId}\n"); printd("download dir: '{$packetDownloadDir}'\n"); printd("speed: " . $file->packet->get('speed') . "\n"); printd("uri: '" . $file->get('uri') . "'\n"); if (!file_exists($packetDownloadDir)) { mkdir($packetDownloadDir); chmod($packetDownloadDir, 0755); } $thisHoster = null; foreach ($hosters as $id => $hostersThisHoster) { if (preg_match('/' . $hostersThisHoster['searchPattern'] . '/i', $file->get('uri'))) {