<?php

if (!defined(JZ_SECURE_ACCESS)) {
    die('Security breach detected.');
}
/**
* Sends a transcoded file bundle
*
* @author Ross Carlson
* @since 06/10/05
* @version 06/10/05
*
**/
global $include_path, $node;
// Now let's include the libraries
include_once $include_path . 'lib/jzcomp.lib.php';
// Now we have an array of files let's use them to create the download
sendFileBundle(unserialize($_GET['jz_files']), $node->getName());
exit;
Example #2
0
 function download()
 {
     global $include_path;
     include_once $include_path . 'lib/jzcomp.lib.php';
     include_once $include_path . 'lib/general.lib.php';
     $pl = $this;
     if ($pl->getPlType() == "dynamic") {
         $pl->handleRules();
     }
     $list = $pl->getList();
     if (sizeof($list) == 0) {
         return;
     }
     // Can we download it?
     if (!checkStreamLimit($list)) {
         echo word('Sorry, you have reached your download limit.');
         exit;
     }
     foreach ($list as $el) {
         $el->increaseDownloadCount();
     }
     $pl->flatten();
     $list = $pl->getList();
     $i = 0;
     $files = array();
     $m3u = "";
     $oldPath = "";
     $onepath = true;
     foreach ($list as $track) {
         $files[$i] = $track->getFileName("host");
         // Let's also create the m3u playlist for all this
         $tArr = explode("/", $files[$i]);
         $m3u .= "./" . $tArr[count($tArr) - 1] . "\n";
         $i++;
         // Now let's get the path and make sure we only see 1 unique path
         // If we see only one path we'll add art IF we can
         $pArr = $track->getPath();
         unset($pArr[count($pArr) - 1]);
         $path = implode("/", $pArr);
         if ($path != $oldPath and $oldPath != "") {
             $onepath = false;
         } else {
             $oldPath = $path;
         }
     }
     $name = $this->getName();
     if ($name === false || $name == "") {
         $name = "Playlist";
     }
     // Now should we add art?
     if ($onepath) {
         // Ok, let's create the node so we can get the art
         $artNode = new jzMediaNode($oldPath);
         if ($artNode->getMainArt() != "") {
             $i++;
             $files[$i] = $artNode->getMainArt();
         }
     }
     // Silly to send a 1 element playlist
     if (sizeof($files) > 1) {
         // Now let's write that to the temp dir
         $fileName = $include_path . "temp/playlist.m3u";
         $handle = @fopen($fileName, "w");
         @fwrite($handle, $m3u);
         @fclose($handle);
         $files[$i + 1] = $fileName;
     }
     // Now let's send it
     sendFileBundle($files, $name);
 }