/** * Displays the block for the album on the Album page * * @author Ben Dodson, Ross Carlson * @since 9/6/05 * @version 9/6/05 * **/ function albumAlbumBlock($node = false) { global $album_name_truncate, $img_play, $cms_mode, $img_random_play, $img_play_dis, $img_random_play_dis, $jzUSER, $short_date, $enable_ratings, $show_album_clip_play, $img_clip; $display = new jzDisplay(); // Does the cache file exist? if ($display->startCache("albumAlbumBlock", $node)) { return; } if (!defined('NO_AJAX_LINKS') && $node === false) { $node = new jzMediaNode($_SESSION['jz_path']); } $artSize = 100; $desc_truncate = 700; $desc = $node->getDescription(); // Now let's purge the extra returns that might be at the beginning while (substr($desc, 0, 4) == "<br>" or substr($desc, 0, 6) == "<br />") { if (substr($desc, 0, 4) == "<br>") { $desc = substr($desc, 5); } if (substr($desc, 0, 6) == "<br />") { $desc = substr($desc, 7); } } if ($desc == "") { $artSize = 200; } $art = $node->getMainArt($artSize . "x" . $artSize); if ($art == false and $desc == "") { return; } // now let's set the title for this block $title = returnItemShortName($node->getName(), $album_name_truncate); // Now let's get the year $year = $node->getYear(); $dispYear = ""; if (!isnothing($year)) { $dispYear = " (" . $year . ")"; } // Now let's setup our buttons for later $playButtons = ""; $playButtons .= $display->playLink($node, $img_play, false, false, true) . $display->playLink($node, $img_random_play, false, false, true, true); // Now let's make sure they can stream if (!$jzUSER->getSetting('stream')) { $playButtons = $img_play_dis . $img_random_play_dis; } if ($show_album_clip_play == "true") { $playButtons .= $display->playLink($node, $img_clip, false, false, true, false, false, true); } if ($jzUSER->getSetting('download')) { $playButtons .= $display->downloadButton($node, false, true, true); } else { $playButtons .= $display->downloadButton($node, true, true, true); } $playButtons .= $display->podcastLink($node); if ($enable_ratings == "true") { $playButtons .= $display->rateButton($node, true); } $playButtons .= " "; // Let's open the block $this->blockHeader(word("Album") . ": " . $title . $dispYear . " ", $playButtons); $this->blockBodyOpen(); ?> <table width="100%" cellpadding="2" cellspacing="0" border="0"> <tr> <td width="100%" <?php if ($desc == "") { echo 'align="center"'; $align = ""; } else { $align = "left"; } ?> > <?php // If there is no description let's make the art bigger $rating = $display->rating($node, true); if ($rating != "" and $desc == "") { echo $rating . "<br>"; } if ($jzUSER->getSetting('stream')) { $display->playLink($node, $display->returnImage($art, $node->getName(), $artSize, $artSize, "fit", false, false, $align, "5", "5")); } else { $display->Image($art, $node->getName(), $artSize, $artSize, "fit", false, false, $align, "5", "5"); } if ($cms_mode == "false") { echo '<span class="jz_artistDesc">'; } if ($rating != "" and $desc != "") { echo $rating . "<br>"; } $desc = str_replace("\n", '<p>', $desc); echo $display->returnShortName($desc, $desc_truncate); if (strlen($desc) > $desc_truncate) { $url_array = array(); $url_array['jz_path'] = $node->getPath("String"); $url_array['action'] = "popup"; $url_array['ptype'] = "readmore"; echo ' <a href="' . urlize($url_array) . '" onclick="openPopup(this, 450, 450); return false;">read more</a>'; } if (!isNothing($node->getDateAdded()) && $node->getDateAdded() != "0") { echo "<br>" . word("Added") . ": " . date($short_date, $node->getDateAdded()); } if ($cms_mode == "false") { echo '</span>'; } ?> </td> </tr> </table> <?php // let's close the block $this->blockBodyClose(); $this->blockSpacer(); // Now lets finish out the cache $display->endCache(); }
include_once $include_path . "lib/general.lib.php"; include_once $include_path . 'services/class.php'; include_once 'backend/backend.php'; include_once 'frontend/display.php'; $jzSERVICES = new jzServices(); $jzSERVICES->loadStandardServices(); $display = new jzDisplay(); // Now let's get the node so we can get the tracks $node = new jzMediaNode($_GET['jz_path']); $par = $node->getAncestor("artist"); $artist = $par->getName(); $tracks = $node->getSubNodes("tracks", -1); // Now let's display the header header("Content-type: application/xml"); echo '<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<rss xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd" version = "2.0">' . "\n" . '<channel>' . "\n" . ' <atom:link rel="self" type="application/rss+xml" title="Jinzora - ' . str_replace("&", "&", $artist . " - " . $node->getName()) . '" href="' . $this_site . $_SERVER['REQUEST_URI'] . '" xmlns:atom="http://purl.org/atom/ns#" />' . "\n" . ' <title>Jinzora - ' . str_replace("&", "&", $artist . " - " . $node->getName()) . '</title>' . "\n" . ' <link>http://www.jinzora.com/</link>' . "\n" . ' <language>en-us</language>' . "\n" . ' <generator>Jinzora http://www.jinzora.com/</generator>' . "\n"; if (($art = $node->getMainArt("200x200")) != false) { echo ' <itunes:image rel="image" type="video/jpeg" href="' . str_replace("&", "&", $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true)) . '">' . $node->getName() . '</itunes:image>' . "\n"; echo ' <itunes:link rel="image" type="video/jpeg" href="' . str_replace("&", "&", $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true)) . '">' . $node->getName() . '</itunes:link>' . "\n"; } if (($desc = $node->getDescription()) != false) { echo ' <description><![CDATA[' . $desc . ']]></description>' . "\n"; } // Now let's loop through the tracks $i = 0; foreach ($tracks as $track) { // Let's get the tracks path $meta = $track->getMeta(); $artist = $track->getAncestor("artist"); // Now let's create the URL $tpArr = explode("?", $track->getFileName("user")); $path = $this_site . $root_dir . "/mediabroadcast.php/" . $tpArr[1] . "/" . $track->getName() . ".mp3";
/** * Returns the AJAX code for the Whow is where block * * @author Ross Carlson * @since 8.21.05 * **/ function returnWhoisWhere() { global $jzUSER, $img_tiny_play, $img_tiny_play_dis, $user_tracking_age, $css, $include_path, $root_dir, $who_is_where_height, $jzSERVICES; $define_only = true; writeLogData("messages", "WIWB: starting up"); $display = new jzDisplay(); $be = new jzBackend(); // let's get the history $oldHist = $be->loadData('history'); $dArr = explode("\n", $oldHist); $retVal = ""; $count = 1; $home = 0; $ipList = ""; for ($i = 0; $i < count($dArr); $i++) { $vArr = explode("|", $dArr[$i]); // Now let's make sure this isn't the current user and that it's not too old if (isset($vArr[3])) { $ago = $vArr[3] + $user_tracking_age * 60; if (($vArr[4] != $jzUSER->getName() or $vArr[4] == "Anonymous") and $vArr[6] != $_SESSION['sid'] and $ago - time() > 0 and !stristr($ipList, "|" . $vArr[7])) { $time = round((time() - $vArr[3]) / 60); if ($time < 1) { $time = 1; } $ipList .= "|" . $vArr[7]; // Now let's count $count++; writeLogData("messages", "WIWB: Ago: " . $time); // Let's setup the object from the path $item = new jzMediaNode($vArr[2]); // Let's setup our links $arr = array(); $arr['jz_path'] = $vArr[2]; if ($vArr[1] == "") { $vArr[1] = "Home"; $home++; } $item = new jzMediaNode($arr['jz_path']); $art = $item->getMainArt("75x75"); if ($art) { $albumImage = str_replace('"', '', $display->returnImage($art, "", 75, 75, "limit", false, false, "left", "3", "3")); } else { $albumImage = ""; } $desc_truncate = 200; $desc = htmlentities(str_replace("'", "", str_replace("'", "", $item->getDescription()))); $userName = $vArr[4]; if ($userName == "") { $userName = "******"; } if ($vArr[5] != "") { $userName = $vArr[5]; } $body = "<strong>" . word("Viewing: ") . $userName . "</strong><br>" . word("Last seen") . ": " . $time . " " . word("minutes ago") . "<br>" . $albumImage . $display->returnShortName($desc, $desc_truncate); $title = str_replace("'", "", $vArr[1]); // Let's display if ($vArr[1] != "Home") { if ($jzUSER->getSetting('stream')) { $retVal .= ' <a href="' . urlize($arr) . '"'; if (checkPlayback() == "embedded") { //$jzSERVICES = new jzServices(); $jzSERVICES->loadService("players", $jzUSER->getSetting("player")); $retVal .= ' ' . $jzSERVICES->returnPlayerHref(); } $retVal .= '>' . $img_tiny_play . '</a> <a target="_parent" ' . $display->returnToolTip($body, $title) . ' href="' . str_replace("ajax_request", "index", urlize($arr)) . '">' . $display->returnShortName($vArr[1], 15) . '</a><br>'; } else { $retVal .= ' ' . $img_tiny_play_dis . ' <a target="_parent" ' . $display->returnToolTip($body, $title) . ' href="' . str_replace("ajax_request", "index", urlize($arr)) . '">' . $display->returnShortName($vArr[1], 15) . '</a><br>'; } } } } } if ($count == 1 or $count == 0) { $tCtr = ""; } else { $tCtr = " (" . ($count - 1) . ")"; } $return = "<strong>" . word("Who is Where") . $tCtr . "</strong><br />"; if ($home > 0) { $arr = array(); $arr['jz_path'] = ""; $return .= '<a href="' . str_replace("ajax_request", "index", urlize($arr)) . '">Home (' . $home . ")</a><br>"; } $maxHeight = $who_is_where_height * 13 + 26; $style = ""; if ($maxHeight < $count * 13 + 26) { $style = "<style>#whoiswhere{height: " . $maxHeight . "px;overflow:auto;}</style>"; } $return .= $style . $retVal; writeLogData("messages", "WIWB: displaying data"); echo $return; exit; }
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); }
/** * Returns the subnodes as an array. A $distance of -1 means do it recursively. * * @author Ben Dodson * @version 6/4/04 * @since 6/4/04 */ function getSubNodes($type = 'nodes', $distance = false, $random = false, $limit = 0, $hasArt = false) { if ($distance === false) { $distance = $this->getNaturalDepth(); } // alias: if ($type == "tracks") { $type = "leaves"; } // 2 cases: $search = array(); $vals = array(); // 1) recursive if ($distance <= 0) { $node = $this; $search[] = $node; while ($search != array()) { $node = array_pop($search); $cache = $node->readCache("nodes"); if ($nodearray = $cache[7]) { foreach ($nodearray as $name) { $search[] =& new jzMediaNode($node->getPath("String") . "/" . $name); if ($type == "nodes" || $type == "both") { $me = new jzMediaNode($node->getPath("String") . "/" . $name); if ($hasArt) { if ($me->getMainArt() != "-" && $me->getMainArt() !== false) { $vals[] = $me; } } else { $vals[] = $me; } } } } if ($type == "leaves" || $type == "both") { if ($trackarray = $cache[8]) { foreach ($trackarray as $track) { $vals[] =& new jzMediaTrack($node->getPath("String") . "/" . $track); } } } } } else { $i = 1; $node = $this; $search[] = $node; while ($distance != $i) { $i++; $temp = array(); while ($search != array()) { $node = array_pop($search); $cache = $node->readCache("nodes"); if ($nodearray = $cache[7]) { foreach ($nodearray as $name) { $temp[] =& new jzMediaNode($node->getPath("String") . "/" . $name); } } } $search = $temp; } foreach ($search as $node) { $cache = $node->readCache("nodes"); if ($type == "both" || $type == "nodes") { if ($nodearray = $cache[7]) { foreach ($nodearray as $name) { $me = new jzMediaNode($node->getPath("String") . "/" . $name); if ($hasArt) { if ($me->getMainArt() != "-" && $me->getMainArt() !== false) { $vals[] = $me; } } else { $vals[] = $me; } } } } if ($type == "both" || $type == "leaves") { if ($trackarray = $cache[8]) { foreach ($trackarray as $track) { $vals[] =& new jzMediaTrack($node->getPath("String") . "/" . $track); } } } } } if ($random === true) { srand((double) microtime() * 1000000); shuffle($vals); } else { if ($random === false) { usort($vals, "compareNodes"); } else { // do nothing. } } if ($limit > 0 && $limit < sizeof($vals)) { $final = array(); for ($i = 0; $i < $limit; $i++) { $final[] = $vals[$i]; } return $final; } else { return $vals; } }