function pageTop($title = false, $endBreak = "true", $ratingItem = "") { global $this_page, $img_home, $quick_list_truncate, $img_random_play, $cms_mode, $random_play_amounts, $directory_level, $img_up_arrow, $header_drops, $genre_drop, $artist_drop, $album_drop, $quick_drop, $root_dir, $web_root, $song_drop, $audio_types, $video_types, $media_dir, $img_more, $img_random_play_dis, $url_seperator, $help_access, $jukebox, $jukebox_num, $disable_random, $jz_lang_file, $show_slimzora, $img_slim_pop, $allow_resample, $resampleRates, $default_random_type, $default_random_count, $display_previous, $echocloud, $display_recommended, $enable_requests, $enable_ratings, $enable_search, $enable_meta_search, $user_tracking_display, $user_tracking_admin_only, $site_title, $node, $jzUSER, $img_play, $img_playlist, $jinzora_skin, $include_path, $img_play_dis, $img_random_play_dis, $img_download_dis, $img_add_dis, $img_playlist_dis, $allow_filesystem_modify, $disable_leftbar, $allow_interface_choice, $allow_style_choice, $allow_language_choice, $show_now_streaming, $show_who_is_where, $show_user_browsing, $jukebox_height, $backend, $config_version, $allow_resample, $jukebox_display; // First let's include the settings for Netjuke include_once $include_path . "frontend/frontends/netjuke/settings.php"; // Let's see if they wanted to pass a title if (!$title) { $title = $site_title; } if (!isset($_GET['jz_path'])) { $_GET['jz_path'] = ""; } // Let's setup our objects $root =& new jzMediaNode(); $display =& new jzDisplay(); $blocks = new jzBlocks(); // First let's see if our session vars are set for the number of items if (!isset($_SESSION['jz_num_genres'])) { $_SESSION['jz_num_genres'] = $root->getSubNodeCount("nodes", distanceTo("genre")); } if (!isset($_SESSION['jz_num_artists'])) { $_SESSION['jz_num_artists'] = $root->getSubNodeCount("nodes", distanceTo("artist")); } if (!isset($_SESSION['jz_num_albums'])) { $_SESSION['jz_num_albums'] = $root->getSubNodeCount("nodes", distanceTo("album")); } if (!isset($_SESSION['jz_num_tracks'])) { $_SESSION['jz_num_tracks'] = $root->getSubNodeCount("tracks", -1); } ?> <a name="pageTop"></a> <?php }
function mklink($l) { global $arr; $arr['jz_level'] = distanceTo("artist"); $arr['jz_letter'] = $l; return urlize($arr); }
function doTemplate($node) { global $jzUSER, $display, $chart_size; $display =& new jzDisplay(); $smarty = mobileSmarty(); $smarty->assign('Play', word('Play')); $smarty->assign('Shuffle', word('Shuffle')); /** Playlists **/ $smarty->assign('Playlists', word('Playlists')); $editPage = array('page' => 'playlist'); $sm_lists = array(); $l = $jzUSER->loadPlaylist("session"); if ($l->length() > 0) { $sm_lists[] = array('name' => word("Quick List"), 'openPlayTag' => $display->getOpenPlayTag($l), 'editHREF' => urlize($editPage, array('playlist' => 'session')), 'isStatic' => true, 'openShuffleTag' => $display->getOpenPlayTag($l, true)); } $lists = $jzUSER->listPlaylists("static") + $jzUSER->listPlaylists("dynamic"); // use "all" to mix ordering foreach ($lists as $id => $plName) { $l = $jzUSER->loadPlaylist($id); $static = $l->getPLType() == 'static' ? true : false; $sm_lists[] = array('name' => $plName, 'openPlayTag' => $display->getOpenPlayTag($l), 'editHREF' => urlize($editPage, array('playlist' => $id)), 'isStatic' => $static, 'openShuffleTag' => $display->getOpenPlayTag($l, true)); } $smarty->assign('playlists', $sm_lists); /** Charts **/ /** * array of titles and lists */ $root = new jzMediaNode(); $charts = array(); /* recently added albums */ $chart = array(); $chart['title'] = word('New Albums'); $entries = array(); $list = $root->getRecentlyAdded('nodes', distanceTo('album'), $chart_size); for ($i = 0; $i < sizeof($list); $i++) { $entries[] = array('name' => $list[$i]->getName(), 'link' => urlize(array('jz_path' => $list[$i]->getPath("String"))), 'openPlayTag' => $display->getOpenPlayTag($list[$i])); } $chart['entries'] = $entries; $charts[] = $chart; /* recently played albums */ $chart = array(); $chart['title'] = word('Recently Played Albums'); $entries = array(); $list = $root->getRecentlyPlayed('nodes', distanceTo('album'), $chart_size); for ($i = 0; $i < sizeof($list); $i++) { $entries[] = array('name' => $list[$i]->getName(), 'link' => urlize(array('jz_path' => $list[$i]->getPath("String"))), 'openPlayTag' => $display->getOpenPlayTag($list[$i])); } $chart['entries'] = $entries; $charts[] = $chart; $smarty->assign('charts', $charts); jzTemplate($smarty, 'lists'); }
function seperateSimilar($array) { if (!is_array($array) || sizeof($array) == 0) { $ret = array(); $ret['nonmatches'] = array(); $ret['matches'] = array(); return $ret; } // We don't want more artists in the array than we came with. // The searching is what actually needs to be improved (with operator = "exact-or") $ret = array(); $root = new jzMediaNode(); $found = $root->search($array, "nodes", distanceTo('artist'), sizeof($array), "or"); $ret['matches'] = $found; // Now let's remove the matches: $matches = array(); foreach ($found as $e) { $matches[] = $e->getName(); } $nonmatches = array(); foreach ($array as $entry) { $foundit = false; foreach ($matches as $match) { if (0 == strcmp(strtolower($match), strtolower($entry))) { // Found it $foundit = true; break; } } if (!$foundit) { $nonmatches[] = $entry; } } $ret['nonmatches'] = $nonmatches; return $ret; }
<?php global $random_art_size; $display = new jzDisplay(); $sm = smartySetup(); if (!isset($node) || $random_albums <= 0) { return; } $art = array(); $artArray = $node->getSubNodes("nodes", distanceTo("album", $node), true, $random_albums, true); foreach ($artArray as $al) { $art[] = array('name' => $al->getName(), 'link' => urlize(array('jz_path' => $al->getPath("string"))), 'playlink' => $display->playlink($al, 'Play', false, false, true), 'art' => $display->returnImage($al->getMainArt($random_art_size . 'x' . $random_art_size), $al->getName(), $random_art_size, $random_art_size, "fixed")); } $sm->assign('albums', $art); jzTemplate($sm, 'randomAlbums');
function getCurNodeList() { global $sort_by_year, $node; $display =& new jzDisplay(); if (isset($_GET['jz_letter'])) { $root = new jzMediaNode(); $nodes = $root->getAlphabetical($_GET['jz_letter'], "nodes", distanceTo("artist")); } else { if (isset($_SESSION['JZ_CURRENT_MEDIA_LIST'])) { // Removed while coding //return $_SESSION['JZ_CURRENT_MEDIA_LIST']; } $nodes = $node->getSubNodes("nodes"); } if ($sort_by_year == "true") { sortElements($nodes, "year"); } else { sortElements($nodes, "name"); } $itemArray = array(); // Now let's loop through the nodes foreach ($nodes as $item) { $itemArray[] = array("name" => $item->getName(), "path" => $item->getPath(), "link" => $display->link($item, "VIEW", false, false, true), "playlink" => $display->playLink($item, "PLAY", false, false, true)); } $_SESSION['JZ_CURRENT_MEDIA_LIST'] = $itemArray; return $itemArray; }
<nobr> <?php echo word('Album'); ?> : </nobr> </td> <td width="70%" valign="top"> <!-- <select name="edit_item_parent" class="jz_select" style="width:185px;"> <?php // Now let's get all the items at this level $root = new jzMediaNode(); switch ($node->getPType()) { case "artist": $valArr = $root->getSubNodes("nodes", distanceTo("genre")); break; } for ($e = 0; $e < count($valArr); $e++) { echo '<option '; if ($valArr[$e]->getName() == $parent->getName()) { echo ' selected '; } echo 'value="' . $valArr[$e]->getName() . '">' . $valArr[$e]->getName() . "</option>\n"; } ?> </select>--> <?php echo $album->getName(); ?> </td>
/** * Displays the random albums block * @author Ross Carlson * @version 12/22/04 * @since 12/22/04 * @param object $node the node that we are looking at * @param string $level The level we are looking at, like a subartist */ function slickRandomAlbums(&$node, $level = "") { global $show_album_art, $random_albums, $random_per_slot, $random_albums, $random_per_slot, $random_rate, $row_colors, $root_dir, $jzUSER, $show_album_art, $random_art_size; // Should we show this? if ($show_album_art == "false") { return; } if ($_GET['action'] == "viewallart") { return; } // Now let's get a random amount of albums with album art $artArray = $node->getSubNodes("nodes", distanceTo("album", $node), true, $random_albums * $random_per_slot, true); if (count($artArray) == 0) { return; } $title = word("Random Albums"); if ($node->getName() != "") { $title = word("Random Albums") . " :: " . $node->getName(); } $url_array = array(); $url_array['jz_path'] = $node->getPath("String"); $url_array['action'] = "viewallart"; $showLink = '<a href="' . urlize($url_array) . '">' . word("View All Art") . '</a> '; // Should we be here???? if ($random_albums == "0" or $show_album_art == "false") { return; } // Let's setup the new display object $display =& new jzDisplay(); /* // WTF is this doing here? (BJD 6/21/06) // Let's make sure they didn't pass the data already if ($valArray){ $artArray = $valArray; } else { // Now let's get a random amount of albums with album art $artArray = $node->getSubNodes("nodes",distanceTo("album",$node),true,$random_albums*$random_per_slot,true); } // Now let's see how much we got back and make sure we just shouldn't return if (count($artArray) == 0){ return; } */ // Let's startup Smarty $smarty = smartySetup(); $smarty->assign('title', $title); $smarty->assign('showLink', $showLink); // Now let's display the template $smarty->display(SMARTY_ROOT . 'templates/slick/block-random-albums.tpl'); // Now let's add the Javascript for the rotations ?> <SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT"><!--\ //you may add your image file or text below $c=1; // Now let's create the variables <?php $c = 1; while ($c < $random_albums + 1) { echo "var imgItem" . $c . "=new Array()" . "\n"; $c++; } // Now let's build the first array with ALL the data so we can break it up later $c = 0; for ($i = 0; $i < count($artArray); $i++) { $albumName_long = $artArray[$i]->getName(); $albumName = returnItemShortName($albumName_long, 12); $albumLink = str_replace('"', "\\\"", $display->link($artArray[$i], $albumName, word("Browse") . ": " . $albumName_long, "jz_random_art_block", true)); $artist = $artArray[$i]->getNaturalParent(); $artistName_long = $artist->getName(); $artistName = returnItemShortName($artistName_long, 12); $artistLink = str_replace('"', "\\\"", $display->link($artist, $artistName, word("Browse") . ": " . $artistName_long, "jz_random_art_block", true)); $artsize = explode("x", $random_art_size); $art = $artArray[$i]->getMainArt($random_art_size); $imgSrc = str_replace('"', "'", $display->returnImage($art, $artistName_long, $artsize[0], $artsize[1], "fixed")); $item_link = str_replace('"', "'", $display->link($artArray[$i], $imgSrc, $albumName_long, "jz_random_art_block", true)); // Now, can they stream? if ($jzUSER->getSetting('stream')) { $playLink = str_replace('"', "\\\"", $display->playLink($artArray[$i], word("Play"), word("Play") . ": " . $albumName_long, "jz_random_art_block", true)); $randLink = str_replace('"', "\\\"", $display->playLink($artArray[$i], word("Play Random"), word("Play Random") . ": " . $albumName_long, "jz_random_art_block", true, true)); $dispLink = $playLink . " - " . $randLink; } else { $dispLink = ""; } // Let's make sure they aren'te view only $arrayVar = "<center>" . $artistLink . "<br>" . $albumLink . "<br>" . $item_link; if ($jzUSER->getSetting('stream')) { $arrayVar .= "<br>" . $dispLink . "</center>"; } $fullArray[] = $arrayVar; } // Now we need to get the different arrays $c = 1; $start = 0; while ($c < $random_albums + 1) { $dataArray = array_slice($fullArray, $start, $random_per_slot); for ($ctr = 0; $ctr < count($dataArray); $ctr++) { echo "imgItem" . $c . "[" . $ctr . "]=\"" . $dataArray[$ctr] . '"' . "\n"; } // Now let's move on $start = $start + $random_per_slot; $c++; } // Now let's create the functions $c = 1; while ($c < $random_albums + 1) { ?> var current<?php echo $c; ?> =0 <?php $c++; } $c = 1; while ($c < $random_albums + 1) { ?> var ns6=document.getElementById&&!document.all function changeItem<?php echo $c; ?> (){ if(document.layers){ document.layer1.document.write(imgItem<?php echo $c; ?> [current<?php echo $c; ?> ]) document.layer1.document.close() } if(ns6)document.getElementById("div<?php echo $c; ?> ").innerHTML=imgItem<?php echo $c; ?> [current<?php echo $c; ?> ] { if(document.all){ div<?php echo $c; ?> .innerHTML=imgItem<?php echo $c; ?> [current<?php echo $c; ?> ] } } if (current<?php echo $c; ?> ==<?php echo $random_per_slot - 1; ?> ) current<?php echo $c; ?> =0 else current<?php echo $c; ?> ++ <?php if ($random_per_slot != 1) { ?> setTimeout("changeItem<?php echo $c; ?> ()",<?php echo $random_rate; ?> ) <?php } ?> } <?php $c++; } $c = 1; while ($c < $random_albums + 1) { ?> changeItem<?php echo $c; ?> (); <?php $c++; } ?> //--> </script> <?php }
/** * Creates all of our statistics. * * @author Ben Dodson * @version 11/16/04 * @since 11/16/04 * @param $string specifically what to return, defaults to everything */ function generateStats($return = false) { $stats = array(); // have to do it... $elements = $this->getSubNodes("tracks", -1); $length = $size = $bitrate = $year = $yearc = $lengthc = $brc = $sizec = $tracks = 0; foreach ($elements as $track) { $tracks++; $meta = $track->getMeta(); if ($meta['length'] != '-' && $meta['length'] > 0) { $length += $meta['length']; $lengthc++; } if ($meta['size'] != '-' && $meta['size'] > 0) { $size += $meta['size']; $sizec++; } if ($meta['year'] != '-' && $meta['year'] > 1000) { $year += $meta['year']; $yearc++; } if ($meta['bitrate'] != '-' && $meta['bitrate'] > 0) { $bitrate += $meta['bitrate']; $brc++; } } if ($tracks == 0) { return false; } $stats['total_size'] = $size; $stats['total_length'] = $length; $stats['total_tracks'] = $tracks; $stats['avg_bitrate'] = @round($bitrate / $brc, 2); $stats['avg_length'] = @round($length / $lengthc, 0); $stats['avg_size'] = @round($size / $sizec, 2); $stats['avg_year'] = @round($year / $yearc, 2); $str = ""; // stringize stuff: $stats['avg_length_str'] = stringize_time($stats['avg_length']); $stats['total_length_str'] = stringize_time($stats['total_length']); $stats['total_size_str'] = stringize_size($stats['total_size']); // Now did we want to return something specific if ($return) { return $stats[$return]; } if (($d = distanceTo('genre', $this)) !== false) { $stats['total_genres'] = $this->getSubNodeCount('nodes', $d); } else { $stats['total_genres'] = 0; } if (($d = distanceTo('artist', $this)) !== false) { $stats['total_artists'] = $this->getSubNodeCount('nodes', $d); } else { $stats['total_artists'] = 0; } if (($d = distanceTo('album', $this)) !== false) { $stats['total_albums'] = $this->getSubNodeCount('nodes', $d); } else { $stats['total_albums'] = 0; } // nodes at track level are disks. if (($d = distanceTo('track', $this)) !== false) { $stats['total_disks'] = $this->getSubNodeCount('nodes', $d); } else { $stats['total_disks'] = 0; } $this->stats = $stats; }
echo '<input type="hidden" name="return" value="' . $_GET['return'] . '">'; } // See if they ran a search. if ($search != "") { // Now let's get all the genres from our backend $root =& new jzMediaNode(); $matches = $root->search($search, "nodes", distanceTo("artist")); // arrayify search. echo '<select name="' . jz_encode("chosenPath") . '"size="18" class="jz_select" style="width: 200px" onChange="submit()">'; for ($i = 0; $i < count($matches); $i++) { echo '<option value="' . jz_encode($matches[$i]->getPath("String")) . '">' . $matches[$i]->getName(); } echo "</select>"; } else { if (isset($_GET['i'])) { // Now let's get all the artists from our cache file $root =& new jzMediaNode(); $matches = $root->getAlphabetical($_GET['i'], "nodes", distanceTo("artist")); echo '<select name="' . jz_encode("chosenPath") . '"size="18" class="jz_select" style="width: 200px" onChange="submit()">'; for ($i = 0; $i < count($matches); $i++) { echo '<option value="' . jz_encode($matches[$i]->getPath("String")) . '">' . $matches[$i]->getName(); } echo '</select>'; } } echo "</form>"; echo "<br><br>"; $this->closeButton(); echo "</center>"; $this->closeBlock(); exit;
function standardPage(&$node) { global $jinzora_skin, $root_dir, $row_colors, $image_size, $desc_truncate, $image_dir, $jzSERVICES, $show_frontpage_items, $show_artist_alpha, $sort_by_year; // Let's setup the objects $blocks =& new jzBlocks(); $display =& new jzDisplay(); $fe =& new jzFrontend(); // Let's display the header $this->pageTop($node); // Now let's get the sub nodes to where we are if (isset($_GET['jz_letter'])) { $root = new jzMediaNode(); $nodes = $root->getAlphabetical($_GET['jz_letter'], "nodes", distanceTo("artist")); } else { if ($node->getLevel() == 0 && $show_frontpage_items == "false") { $nodes = array(); } else { $nodes = $node->getSubNodes("nodes"); } } // Now let's sort if ($sort_by_year == "true" and $node->getPType() == "artist") { sortElements($nodes, "year"); } else { sortElements($nodes, "name"); } echo '<form name="albumForm" method="POST" action="' . urlize() . '">'; echo '<input type="hidden" name="' . jz_encode('jz_list_type') . '" value="' . jz_encode('nodes') . '">'; // Now let's loop through the nodes $i = 0; foreach ($nodes as $item) { ?> <table width="100%" cellspacing="0" cellpadding="4"> <tr class="<?php $i = 1 - $i; echo $row_colors[$i]; ?> "> <td width="1%" valign="middle"> <input type="checkbox" name="jz_list[]" value="<?php echo jz_encode($item->getPath("String")); ?> "> </td> <td width="1%" valign="middle"> <?php $display->link($item, '<img src="' . $image_dir . 'folder.gif" border="0">'); ?> </td> <td width="96%" valign="middle"> <?php // Now let's link to this item $name = $item->getName(); if (!isNothing($item->getYear()) and $item->getPType() == "album") { $name .= " (" . $item->getYear() . ")"; } $display->link($item, $name); ?> </td> <td width="1%" valign="middle" nowrap align="right"> <?php // Now let's show the sub items if (($count = $item->getSubNodeCount("nodes")) != 0) { if ($count > 1) { $folder = word("folders"); } else { $folder = word("folder"); } $display->link($item, $count . " " . $folder); } else { if (($count = $item->getSubNodeCount("tracks")) != 0) { if ($count > 1) { $files = word("files"); } else { $files = word("file"); } $display->link($item, $count . " " . $files); } } ?> </td> <td width="1%" valign="middle" nowrap align="right"> <?php // Let's show a play button $display->playButton($item); echo " "; $display->randomPlayButton($item); ?> </td> </tr> <?php // Now do we hvae another row? if (($art = $item->getMainArt($image_size . "x" . $image_size)) != false or ($desc = $item->getDescription()) != "") { // Ok, we had stuff let's do a new row ?> <tr class="<?php echo $row_colors[$i]; ?> "> <td width="1%" valign="middle"> </td> <td width="99%" valign="middle" colspan="4"> <?php if ($art) { $display->link($item, $display->returnImage($art, $node->getName(), $image_size, $image_size, "limit", false, false, "left", "4", "4")); } echo $display->returnShortName($item->getDescription(), $desc_truncate); // Do we need the read more link? if (strlen($item->getDescription()) > $desc_truncate) { $url_array = array(); $url_array['jz_path'] = $item->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>'; } ?> </td> </tr> <?php } ?> </table> <table width="100%" cellspacing="0" cellpadding="0"><tr bgcolor="#D2D2D2"><td width="100%"></td></tr></table> <?php } // Now are there any tracks? if (isset($_GET['jz_letter'])) { $root = new jzMediaNode(); //$tracks = $root->getAlphabetical($_GET['jz_letter'],"tracks",-1); $tracks = array(); } else { $tracks = $node->getSubNodes("tracks"); } if (count($tracks) != 0) { $blocks->trackTable($tracks); } if (sizeof($nodes) > 0 || sizeof($tracks) > 0) { ?> <table width="100%" cellspacing="0" cellpadding="0"><tr height="2" style="background-image: url('<?php echo $image_dir; ?> row-spacer.gif');"><td width="100%"></td></tr></table> <table width="100%" cellspacing="0" cellpadding="3"> <tr class="and_head1"> <td width="100%"> <a style="cursor:hand" onClick="CheckBoxes('albumForm',true); return false;" href="javascript:;"><img src="<?php echo $image_dir; ?> check.gif" border="0"></a><a style="cursor:hand" onClick="CheckBoxes('albumForm',false); return false;" href="javascript:;"><img src="<?php echo $image_dir; ?> check-none.gif" border="0"></a> <?php $display->addListButton(); ?> <?php $display->hiddenVariableField('action', 'mediaAction'); ?> <?php $display->hiddenVariableField('path', $_GET['jz_path']); ?> <?php $url_array = array(); $url_array['action'] = "popup"; $url_array['ptype'] = "playlistedit"; echo '<a href="javascript:;" onClick="openPopup(' . "'" . urlize($url_array) . "'" . ',600,600); return false;"><img src="' . $image_dir . 'playlist.gif" border="0"></a>'; echo ' '; $display->playlistSelect(115, false, "all"); ?> </form> </td> </tr> </table> <?php } echo '</form>'; // Now let's close out $this->footer($node); }
$limit = 50; $title .= $limit . " " . word("Viewed Artists"); $type = "artist"; $func = "getMostViewed"; $showCount = "view"; break; } $this->displayPageTop("", $title); $this->openBlock(); // Now let's get the recently added items if ($type == "track") { $retType = "tracks"; } else { $retType = "nodes"; } $recent = $node->{$func}($retType, distanceTo($type, $node), $limit); // Now let's loop through the results for ($i = 0; $i < count($recent); $i++) { // Now let's create our node and get the properties $item = $recent[$i]; $album = $item->getName(); $parent = $item->getParent(); $artist = $parent->getName(); // Now let's create our links $albumArr['jz_path'] = $item->getPath("String"); $artistArr['jz_path'] = $parent->getPath("String"); // Now let's create our short names $artistTitle = returnItemShortName($artist, $album_name_truncate); $albumTitle = returnItemShortName($album, $album_name_truncate); // Now let's display it echo "<nobr>";
function drawPage(&$node) { global $media_dir, $skin, $hierarchy, $album_name_truncate, $web_root, $root_dir, $jz_MenuItemLeft, $jz_MenuSplit, $jz_MenuItemHover, $jz_MainItemHover, $jz_MenuItem, $disable_random, $allow_download, $allow_send_email, $amg_search, $echocloud, $include_path, $img_play, $img_random_play, $this_page, $img_check, $img_check_none, $jzUSER, $img_play_dis, $img_random_play_dis, $show_sampler, $show_similar, $show_radio, $show_album_art, $days_for_new, $img_new, $num_album_cols, $show_album_art, $art_size; $display =& new jzDisplay(); $blocks =& new jzBlocks(); $fe =& new jzFrontend(); handleFrontendOverrides(); ?> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <?php // Now what to show? if (isset($_GET['jz_path'])) { ?> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td" colspan="3"> <strong>ALBUMS BY <?php echo $display->link($node, $node->getName()); ?> </strong> </td> </tr> <?php $colwidth = floor(100 / $num_album_cols); $albums = $node->getSubNodes("nodes", distanceTo("album", $node)); $c = 0; foreach ($albums as $album) { // Now let's start our row if ($c % $num_album_cols == 0) { if ($c > 0) { echo '</tr>'; } echo '<tr>'; } echo '<td class="jz_nj_block_body" valign="top" width="' . $colwidth . '%">'; $display->playButton($album); echo " "; $linktext = $album->getName(); if ($show_album_art == "true") { if ($art = $album->getMainArt($art_size . 'x' . $art_size)) { $linktext .= '<br/>'; $linktext .= $display->returnImage($art); } } $display->link($album, $linktext, word("Browse: ") . $album->getName()); //echo " (". $album->getSubNodeCount("tracks"). ")"; echo '</td>'; $c++; } // Now let's finish out while ($c % $num_album_cols != 0) { echo '<td class="jz_nj_block_body"> </td>'; $c++; } ?> </tr> </table> <br> </td> <?php } else { /* ?> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td"> <strong>LATEST ARTISTS</strong> </td> </tr> <tr> <td class="jz_nj_block_body"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <?php // Now how many should we show? $show = round(((count($genres) / 3)) * 1.5); $blocks->showCharts($node,"newartists",$show,false,false); ?> </table> </td> </tr> </table> </td> <td align="center"> </td> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td"> <strong>LATEST ALBUMS</strong> </td> </tr> <tr> <td class="jz_nj_block_body"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <?php $show = round(((count($genres) / 3)) * 1.5); $blocks->showCharts($node,"newalbums",$show,false,false); ?> </table> </td> </tr> </table> </td> <?php */ } ?> </tr> </table> <br> <?php }
} // switch // Now let's display the data header("Content-type: text/xml"); echo '<?xml version="1.0" encoding="ISO-8859-1"?>' . "\n" . '<rdf:RDF' . "\n" . 'xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"' . "\n" . 'xmlns="http://purl.org/rss/1.0/"' . "\n" . 'xmlns:dc="http://purl.org/dc/elements/1.1/"' . "\n" . 'xmlns:slash="http://purl.org/rss/1.0/modules/slash/"' . "\n" . 'xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"' . "\n" . 'xmlns:admin="http://webns.net/mvcb/"' . "\n" . 'xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"' . "\n" . '>' . "\n" . '<channel rdf:about="http://www.jinzora.com">' . "\n" . '<title>Jinzora RSS</title>' . "\n" . '<link>http://www.jinzora.com</link>' . "\n" . "<description>Jinzora " . $title . "</description>\n" . "<items>\n" . "</items>\n" . '</channel>' . "\n"; if (isset($_GET['root'])) { $node = new jzMediaNode(stripSlashes($_GET['root'])); } else { $node = new jzMediaNode(); } if ($distance == "track") { $returnType = "tracks"; } else { $returnType = "nodes"; } $arr = $node->{$func}($returnType, distanceTo($distance, $node), 5); for ($i = 0; $i < count($arr); $i++) { // Now let's create the display $art = $arr[$i]->getMainArt(); $imgUrl = jzCreateLink($art, "image"); $urlArr = array(); $urlArr['action'] = "playlist"; $urlArr['jz_path'] = $arr[$i]->getPath("String"); if ($distance == "track") { $urlArr['type'] = "track"; } $title_add = ""; if ($showPlays) { $title_add = ' (' . $arr[$i]->getPlayCount() . ')'; } if ($showDownload) {
$root = new jzMediaNode($argv[3]); } else { $root = new jzMediaNode(); } switch ($argv[2]) { case "genre": case "genres": $list = $root->getSubNodes("nodes", distanceTo("genre", $root)); break; case "artist": case "artists": $list = $root->getSubNodes("nodes", distanceTo("artist", $root)); break; case "album": case "albums": $list = $root->getSubNodes("nodes", distanceTo("album", $root)); break; case "track": case "tracks": $list = $root->getSubNodes("tracks", -1); break; } if (isset($list)) { foreach ($list as $el) { echo $el->getName() . "\n"; } } break; case "search_metadata": if (isset($argv[2])) { $node = new jzMediaNode($argv[2]);
if (distanceTo("album", $node) !== false) { ?> <tr class="<?php echo $row_colors[$i]; $i = 1 - $i; ?> "> <td width="40%"> <?php echo word("Most Played Album"); ?> : </td> <td width="60%"> <?php $a = $node->getMostPlayed("nodes", distanceTo("album", $node), 1); if (sizeof($a) > 0) { if ($node->getPType() != "artist") { echo getInformation($a[0], "artist") . " - " . $a[0]->getName(); } else { echo $a[0]->getName(); } } ?> </td> </tr> <?php } ?> <tr class="<?php echo $row_colors[$i];
<?php global $this_page; $artArray = $node->getSubNodes("nodes", distanceTo("album", $node), false, -1, true); if (count($artArray) == 0) { return; } $display = new jzDisplay(); $smarty = smartySetup(); // Let's setup our page links $link = "Page: "; $link .= '<form action="' . $this_page . '" method="POST">' . "\n"; $link .= '<input type="hidden" name="' . jz_encode("action") . '" value="' . jz_encode("viewallart") . '">'; $link .= '<input type="hidden" name="' . jz_encode("jz_path") . '" value="' . jz_encode($node->getPath("String")) . '">'; $link .= '<select name="' . jz_encode("page") . '" class="jz_select" onChange="form.submit();">' . "\n"; $link .= '<option '; $_POST['page'] = isset($_POST['page']) ? $_POST['page'] : ''; if ($_POST['page'] == "RANDOM") { $link .= " selected "; } $link .= 'value="' . jz_encode("RANDOM") . '">' . word("Random") . '</option>' . "\n"; $link .= '<option '; if ($_POST['page'] == "ALL") { $link .= " selected "; } $link .= 'value="' . jz_encode("ALL") . '">' . word("All") . '</option>' . "\n"; $link .= '<option '; if ($_POST['page'] + 1 == 1 and $_POST['page'] != "ALL") { $link .= " selected "; } $link .= 'value="' . jz_encode("0") . '">1</option>' . "\n";
$media_dir_count = sizeof(explode("|", $_SESSION['all_media_paths'])) - 1; $mcms_type = $_POST['cms_type']; // Now let's get the backend data require_once $include_path . 'backend/backend.php'; $root_node =& new jzMediaNode(); if (distanceTo('genre') !== false) { $genres = $root_node->getSubNodeCount('nodes', distanceTo('genre')); } if (distanceTo('artist') !== false) { $artists = $root_node->getSubNodeCount('nodes', distanceTo('artist')); } if (distanceTo('album') !== false) { $albums = $root_node->getSubNodeCount('nodes', distanceTo('album')); } if (distanceTo('track') !== false) { $disks = $root_node->getSubNodeCount('nodes', distanceTo('track')); } $tracks = $root_node->getSubNodeCount('tracks', -1); $length = ""; $sql_type = isset($sql_type) ? $sql_type : "false"; $genres = isset($genres) ? $genres : "false"; $artists = isset($artists) ? $artists : "false"; $albums = isset($albums) ? $albums : "false"; $tracks = isset($tracks) ? $tracks : "false"; $disks = isset($disks) ? $disks : "false"; $user_agent = ""; if (isset($_SERVER['HTTP_USER_AGENT'])) { $user_agent = $_SERVER['HTTP_USER_AGENT']; } $webserver = ""; if (isset($_SERVER['SERVER_SOFTWARE'])) {
/** * Creates a random playlist * * @author Ben Dodson * @version 10/31/04 * @since 10/31/04 */ function generate($random_play_type, $random_play_number, $random_play_genre = false, $resample = false) { global $web_root, $root_dir, $media_dir, $audio_types, $this_site, $directory_level; $this->truncate(0); // Let's initalize some variables $final_ctr = 0; if ($random_play_genre !== false && $random_play_genre != "") { $node =& new jzMediaNode($random_play_genre); } else { $node =& new jzMediaNode(); } // Ok, now let's see what kind of random list they wanted switch (strtolower($random_play_type)) { case "songs": # Ok, they wanted some random songs $tracks = $node->getSubNodes("tracks", -1, true, $random_play_number * 6); $finalArray = array(); $c = 0; foreach ($tracks as $track) { // Now let's make sure it's an audio type if (preg_match("/\\.({$audio_types})\$/i", $track->getPath("String"))) { // Ok, it is let's add it to our final array $finalArray[] = $track; $c++; } // Now let's see if we should stop if ($c >= $random_play_number) { break; } } // Ok, now let's send this to the playlist generator $this->add($finalArray); $this->filter("audio"); return $this; break; case "albums": # Ok, they wanted some random Albums $albums = $node->getSubNodes("nodes", distanceTo("album", $node), true, $random_play_number); $this->add($albums); $this->filter("audio"); return $this; break; case "artists": # Ok, they wanted some random Artists $artists = $node->getSubNodes("nodes", distanceTo("artist", $node), true, $random_play_number); $this->add($artists); $this->filter("audio"); return $this; break; case "genres": # Ok, they wanted some random Genres $node =& new jzMediaNode(); $genres = $node->getSubNodes("nodes", distanceTo("genre", $node), true, $random_play_number); $this->add($genres); $this->filter("audio"); return $this; break; } }
echo "<strong>" . word("Import Stats") . "</strong><br>"; ?> '; --> </SCRIPT> <?php // Now let's show them how much they imported $root_node =& new jzMediaNode(); if (distanceTo('genre') !== false) { $genres = $root_node->getSubNodeCount('nodes', distanceTo('genre')); } if (distanceTo('artist') !== false) { $artists = $root_node->getSubNodeCount('nodes', distanceTo('artist')); } if (distanceTo('album') !== false) { $albums = $root_node->getSubNodeCount('nodes', distanceTo('album')); } $tracks = $root_node->getSubNodeCount('tracks', -1); $genres = isset($genres) ? $genres : "false"; $artists = isset($artists) ? $artists : "false"; $albums = isset($albums) ? $albums : "false"; $tracks = isset($tracks) ? $tracks : "false"; echo word("Genres") . ": " . $genres . "<br>"; echo word("Artists") . ": " . $artists . "<br>"; echo word("Albums") . ": " . $albums . "<br>"; echo word("Tracks") . ": " . $tracks . "<br><br>"; ?> <script language="javascript"> opener.location.reload(true); --> </SCRIPT>
function pageTop($title = false, $endBreak = "true", $ratingItem = "") { global $this_page, $img_home, $quick_list_truncate, $img_random_play, $cms_mode, $random_play_amounts, $directory_level, $img_up_arrow, $header_drops, $genre_drop, $artist_drop, $album_drop, $quick_drop, $root_dir, $web_root, $song_drop, $audio_types, $video_types, $media_dir, $img_more, $img_random_play_dis, $url_seperator, $help_access, $jukebox, $jukebox_num, $disable_random, $jz_lang_file, $show_slimzora, $img_slim_pop, $allow_resample, $resampleRates, $default_random_type, $default_random_count, $display_previous, $echocloud, $display_recommended, $enable_requests, $enable_ratings, $enable_search, $enable_meta_search, $user_tracking_display, $user_tracking_admin_only, $site_title, $node, $jzUSER, $img_play, $img_playlist, $jinzora_skin, $include_path, $img_play_dis, $img_random_play_dis, $img_download_dis, $img_add_dis, $img_playlist_dis, $allow_filesystem_modify, $disable_leftbar, $allow_interface_choice, $allow_style_choice, $allow_language_choice, $show_now_streaming, $show_who_is_where, $show_user_browsing, $jukebox_height, $backend, $config_version, $allow_resample, $jukebox_display; // First let's include the settings for Netjuke include_once $include_path . "frontend/frontends/netjuke/settings.php"; // Let's see if they wanted to pass a title if (!$title) { $title = $site_title; } if (!isset($_GET['jz_path'])) { $_GET['jz_path'] = ""; } // Let's setup our objects $root =& new jzMediaNode(); $display =& new jzDisplay(); $blocks = new jzBlocks(); // First let's see if our session vars are set for the number of items if (!isset($_SESSION['jz_num_genres'])) { $_SESSION['jz_num_genres'] = $root->getSubNodeCount("nodes", distanceTo("genre")); } if (!isset($_SESSION['jz_num_artists'])) { $_SESSION['jz_num_artists'] = $root->getSubNodeCount("nodes", distanceTo("artist")); } if (!isset($_SESSION['jz_num_albums'])) { $_SESSION['jz_num_albums'] = $root->getSubNodeCount("nodes", distanceTo("album")); } if (!isset($_SESSION['jz_num_tracks'])) { $_SESSION['jz_num_tracks'] = $root->getSubNodeCount("tracks", -1); } ?> <a name="pageTop"></a> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td align="center" class="jz_block_td"> <?php echo '<a href="' . urlize(array()) . '">'; echo '<strong>BROWSE</strong>'; echo '</a>'; ?> </td> <td align="center" class="jz_block_td"> <strong> <?php $urla = array(); $urla['action'] = "powersearch"; echo "<a href=\"" . urlize($urla) . "\">SEARCH</a>"; ?> </strong> </td> <td align="center" class="jz_block_td"> <strong> <?php $display->randomPlayButton($node, false, word("RANDOM")); ?> </strong> </td> <td align="center" class="jz_block_td"> <strong><?php $urla['action'] = "popup"; $urla['ptype'] = "playlistedit"; echo "<a href=\"" . urlize($urla) . "\" onclick=\"openPopup(this, 550, 600); return false;\">PLAYLISTS</a>"; ?> </strong> </td> <td align="center" class="jz_block_td"> <strong><?php $display->popupLink("preferences", "PREFERENCES"); ?> </strong> </td> <td align="center" class="jz_block_td"> <strong><?php $display->loginLink("LOGIN", "LOGOUT"); ?> </strong> </td> </tr> </table> <br> <table width="100%" cellpadding="0" cellspacing="0" border="0"> <tr> <?php // Can this user powersearch? if ($jzUSER->getSetting('powersearch')) { ?> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td"> <?php $url_search = array(); $url_search['action'] = "powersearch"; echo '<a href="' . urlize($url_search) . '">'; ?> <strong>QUICK SEARCH</strong></a> </td> </tr> <tr> <?php $onSubmit = ""; if ($jukebox == "true" && !defined('NO_AJAX_JUKEBOX')) { $onSubmit = 'onSubmit="return searchKeywords(this,\'' . htmlentities($this_page) . '\');"'; } if ($cms_mode == "true") { $method = "GET"; } else { $method = "POST"; } ?> <td class="jz_nj_block_body" align="center"> <form action="<?php echo $this_page; ?> " name="searchForm" method="<?php echo $method; ?> " <?php echo $onSubmit; ?> > <?php foreach (getURLVars($this_page) as $key => $val) { echo '<input type="hidden" name="' . htmlentities($key) . '" value="' . htmlentities($val) . '">'; } ?> <input type="text" name="search_query" class="jz_input" style="width:150px; font-size:10px; margin-bottom:3px;"> <br> <select class="jz_select" name="search_type" style="width:85px"> <option value="ALL"><?php echo word("All Media"); ?> </option> <?php if (distanceTo("artist") !== false) { echo '<option value="artists">' . word("Artists") . '</option>' . "\n"; } if (distanceTo("album") !== false) { echo '<option value="albums">' . word("Albums") . '</option>' . "\n"; } ?> <option value="tracks"><?php echo word("Tracks"); ?> </option> <option value="lyrics"><?php echo word("Lyrics"); ?> </option> </select> <input type="hidden" name="doSearch" value="true"> <input type="submit" class="jz_submit" name="doSearch" value="Go"> </form> </td> </tr> </table> </td> <?php // This ends the if they can powersearch statement } ?> <?php // Are they resampling? if ($display->wantResampleDropdown($node)) { $display->displayResampleDropdown($node); // PROBLEM: Currently can't use small jukebox and resampling. } if (checkPermission($jzUSER, "jukebox_queue") && ($jukebox_display == "small" or $jukebox_display == "minimal")) { ?> <td align="center"> </td> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td" width="100%" nowrap> <strong>PLAYBACK</strong> </td> </tr> <tr> <td class="jz_nj_block_body" align="left" width="1%" nowrap><div id="smallJukebox"> <?php $blocks->smallJukebox(false, "top"); ?> </div></td> </tr> </table> </td> <?php } ?> <td align="center"> </td> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td" colspan="3" width="100%" nowrap> <strong>CONTENT SUMMARY</strong> </td> </tr> <?php // Let's get the stats if (!isset($_SESSION['jz_total_tracks'])) { $root = new jzMediaNode(); $stats = $root->getStats(); $_SESSION['jz_total_tracks'] = $stats['total_tracks']; $_SESSION['jz_total_genres'] = $stats['total_genres']; $_SESSION['jz_total_artists'] = $stats['total_artists']; $_SESSION['jz_total_albums'] = $stats['total_albums']; $_SESSION['jz_total_size'] = $stats['total_size_str']; $_SESSION['jz_total_length'] = $stats['total_length']; } ?> <tr> <td class="jz_nj_block_body" align="center" width="1%" nowrap> <?php echo number_format($_SESSION['jz_total_tracks']); ?> Tracks </td> <td class="jz_nj_block_body" align="center" width="1%" nowrap> <?php echo number_format($_SESSION['jz_total_artists']); ?> Artists </td> <td class="jz_nj_block_body" align="center" width="1%" nowrap> <?php echo formatTime($_SESSION['jz_total_length']); ?> </td> </tr> <tr> <td class="jz_nj_block_body" align="center" width="1%" nowrap> <?php echo number_format($_SESSION['jz_total_albums']); ?> Albums </td> <td class="jz_nj_block_body" align="center" width="1%" nowrap> <?php echo number_format($_SESSION['jz_total_genres']); ?> Genres </td> <td class="jz_nj_block_body" align="center" width="1%" nowrap> <?php echo $_SESSION['jz_total_size']; ?> </td> </tr> </table> </td> <td align="center"> </td> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td"> <strong>ARTISTS A-Z <?php echo "(" . $_SESSION['jz_num_artists'] . ")"; ?> </strong> - <?php $urlar = array(); //$urlar['jz_path'] = $node->getPath("String"); $urlar['jz_level'] = distanceTo("artist"); $urlar['jz_letter'] = "*"; echo "<a href=\"" . urlize($urlar) . "\">" . word("All") . "</a>"; ?> </td> </tr> <tr> <td class="jz_nj_block_body" align="center"> <?php for ($let = 'A'; $let != 'Z'; $let++) { $urlar['jz_letter'] = $let; echo "<a href=\"" . urlize($urlar) . "\">" . $let . "</a> "; if ($let == 'L' or $let == 'X') { echo "<br>"; } } $urlar['jz_letter'] = "Z"; echo "<a href=\"" . urlize($urlar) . "\">Z</a> "; for ($let = '1'; $let != '10'; $let++) { $urlar['jz_letter'] = $let; echo "<a href=\"" . urlize($urlar) . "\">" . $let . "</a> "; } $urlar['jz_letter'] = "*"; echo "<a href=\"" . urlize($urlar) . "\">0</a> "; ?> </td> </tr> </table> </td> <td align="center"> </td> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td"> <strong>ALBUMS A-Z <?php echo "(" . $_SESSION['jz_num_albums'] . ")"; ?> </strong> - <?php $urlar['jz_level'] = distanceTo("album"); $urla['jz_letter'] = "*"; echo "<a href=\"" . urlize($urlar) . "\">" . word("All") . "</a>"; ?> </td> </tr> <tr> <td class="jz_nj_block_body" align="center"> <?php for ($let = 'A'; $let != 'Z'; $let++) { $urlar['jz_letter'] = $let; echo "<a href=\"" . urlize($urlar) . "\">" . $let . "</a> "; if ($let == 'L' or $let == 'X') { echo "<br>"; } } $urlar['jz_letter'] = "Z"; echo "<a href=\"" . urlize($urlar) . "\">Z</a> "; for ($let = '1'; $let != '10'; $let++) { $urlar['jz_letter'] = $let; echo "<a href=\"" . urlize($urlar) . "\">" . $let . "</a> "; } $urlar['jz_letter'] = "0"; echo "<a href=\"" . urlize($urlar) . "\">0</a> "; ?> </td> </tr> </table> </td> </tr> </table> <?php // Are they in Jukebox mode? if (checkPermission($jzUSER, "jukebox_queue") && $jukebox_display != "small" && $jukebox_display != "off") { ?> <br> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td align="center" class="jz_block_td"> <div id="jukebox"> <?php include jzBlock('jukebox'); ?> </div> </td> </tr> </table> <?php } ?> </td> </tr> </table> <?php }
/** * Displays the random albums block * @author Ross Carlson * @version 12/22/04 * @since 12/22/04 * @param object $node the node that we are looking at * @param string $level The level we are looking at, like a subartist */ function randomAlbums(&$node, $level = "", $valArray = false) { global $random_albums, $random_per_slot, $random_rate, $row_colors, $root_dir, $jzUSER, $show_album_art, $random_art_size; // Should we be here???? if ($random_albums == "0" or $show_album_art == "false") { return; } // Let's setup the new display object $display =& new jzDisplay(); // Let's make sure they didn't pass the data already if ($valArray) { $artArray = $valArray; } else { // Now let's get a random amount of albums with album art $artArray = $node->getSubNodes("nodes", distanceTo("album", $node), true, $random_albums * $random_per_slot, true); } // Now let's see how much we got back and make sure we just shouldn't return if (count($artArray) == 0) { return; } // Now let's display the images ?> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <?php // Now let's figure out how wide to make the colums if ($random_albums * $random_per_slot > count($artArray)) { // Now we've got to figure out how many we've got $numArt = count($artArray); if ($numArt > $random_albums) { $random_per_slot = round(count($artArray) / $random_albums - 0.49, 0); } else { $random_albums = count($artArray); $random_per_slot = 1; } } $colWidth = 100 / $random_albums; $c = 1; while ($c < $random_albums + 1) { echo '<td align="center" valign="middle" width="' . $colWidth . '">'; echo '<div id="div' . $c . '"></div>'; echo '</td>'; $c++; } ?> </tr> </table> <?php // Now let's add the Javascript for the rotations ?> <SCRIPT LANGUAGE=JAVASCRIPT TYPE="TEXT/JAVASCRIPT"><!--\ //you may add your image file or text below $c=1; // Now let's create the variables <?php $c = 1; while ($c < $random_albums + 1) { echo "var imgItem" . $c . "=new Array()" . "\n"; $c++; } // Now let's build the first array with ALL the data so we can break it up later $c = 0; for ($i = 0; $i < count($artArray); $i++) { $albumName_long = $artArray[$i]->getName(); $albumName = returnItemShortName($artArray[$i]->getName(), 12); $albumLink = str_replace('"', "\\\"", $display->link($artArray[$i], $albumName, word("Browse") . ": " . $albumName_long, "jz_random_art_block", true)); $artist = $artArray[$i]->getNaturalParent(); $artistName_long = $artist->getName(); $artistName = returnItemShortName($artist->getName(), 12); $artistLink = str_replace('"', "\\\"", $display->link($artist, $artistName, word("Browse") . ": " . $artistName_long, "jz_random_art_block", true)); $artsize = explode("x", $random_art_size); $imgSrc = str_replace('"', "'", $display->returnImage($artArray[$i]->getMainArt($random_art_size), $artArray[$i]->getName(), $artsize[0], $artsize[1], "fixed")); $item_link = str_replace('"', "'", $display->link($artArray[$i], $imgSrc, $albumName_long, "jz_random_art_block", true)); // Now, can they stream? if ($jzUSER->getSetting('stream')) { $playLink = str_replace('"', "\\\"", $display->playLink($artArray[$i], word("Play"), word("Play") . ": " . $albumName_long, "jz_random_art_block", true)); $randLink = str_replace('"', "\\\"", $display->playLink($artArray[$i], word("Play Random"), word("Play Random") . ": " . $albumName_long, "jz_random_art_block", true, true)); $dispLink = $playLink . " - " . $randLink; } else { $dispLink = ""; } // Let's make sure they aren'te view only $arrayVar = "<center>" . $artistLink . "<br>" . $albumLink . "<br>" . $item_link; if ($jzUSER->getSetting('stream')) { $arrayVar .= "<br>" . $dispLink . "</center>"; } $fullArray[] = $arrayVar; } // Now we need to get the different arrays $c = 1; $start = 0; while ($c < $random_albums + 1) { $dataArray = array_slice($fullArray, $start, $random_per_slot); for ($ctr = 0; $ctr < count($dataArray); $ctr++) { echo "imgItem" . $c . "[" . $ctr . "]=\"" . $dataArray[$ctr] . '"' . "\n"; } // Now let's move on $start = $start + $random_per_slot; $c++; } // Now let's create the functions $c = 1; while ($c < $random_albums + 1) { ?> var current<?php echo $c; ?> =0 <?php $c++; } $c = 1; while ($c < $random_albums + 1) { ?> var ns6=document.getElementById&&!document.all function changeItem<?php echo $c; ?> (){ if(document.layers){ document.layer1.document.write(imgItem<?php echo $c; ?> [current<?php echo $c; ?> ]) document.layer1.document.close() } if(ns6)document.getElementById("div<?php echo $c; ?> ").innerHTML=imgItem<?php echo $c; ?> [current<?php echo $c; ?> ] { if(document.all){ div<?php echo $c; ?> .innerHTML=imgItem<?php echo $c; ?> [current<?php echo $c; ?> ] } } if (current<?php echo $c; ?> ==<?php echo $random_per_slot - 1; ?> ) current<?php echo $c; ?> =0 else current<?php echo $c; ?> ++ <?php if ($random_per_slot != 1) { ?> setTimeout("changeItem<?php echo $c; ?> ()",<?php echo $random_rate; ?> ) <?php } ?> } <?php $c++; } $c = 1; while ($c < $random_albums + 1) { ?> changeItem<?php echo $c; ?> (); <?php $c++; } ?> //--> </script> <?php }
<?php if (!defined(JZ_SECURE_ACCESS)) { die('Security breach detected.'); } // Now let's get the sub nodes to where we are global $img_folder; if (isset($_GET['jz_letter'])) { $root = new jzMediaNode(); $nodes = $root->getAlphabetical($_GET['jz_letter'], "nodes", distanceTo("artist")); } else { if ($node->getLevel() == 0 && $show_frontpage_items == "false") { $nodes = array(); } else { $nodes = $node->getSubNodes("nodes"); } } // Now let's sort if ($sort_by_year == "true" and $node->getPType() == "artist") { sortElements($nodes, "year"); } else { sortElements($nodes, "name"); } $smarty->assign('form_action', urlize()); $smarty->assign('hidden_field', '<input type="hidden" name="' . jz_encode('jz_list_type') . '" value="' . jz_encode('nodes') . '">'); // Now let's loop through the nodes $i = 0; $c = 0; foreach ($nodes as $item) { $array[$i]['name'] = $item->getName(); $array[$i]['path'] = $item->getPath('string');
/** * * Generates an XML list of all artists * * @author Ross Carlson * @since 3/31/05 * @return Returns a XML formatted list of all genres * **/ function listAllSubNode($type, $params) { global $this_site, $root_dir, $jzSERVICES; $limit = $params['limit']; // Let's setup the display object $display = new jzDisplay(); // Let's echo out the XML header echoXMLHeader(); // Let's get all the nodes $node = new jzMediaNode(); // Now let's get each genre $nodes = $node->getSubNodes("nodes", distanceTo($type), false, $limit); sortElements($nodes, "name"); foreach ($nodes as $item) { echo ' <' . $type . ' name="' . xmlUrlClean($item->getName()) . '">' . "\n"; echo ' <link>' . $this_site . xmlUrlClean($display->link($item, false, false, false, true, true)) . '</link>' . "\n"; // Now did they want full details? if (isset($_REQUEST['full']) && $_REQUEST['full'] == "true") { if (($art = $item->getMainArt(false, true, "audio", true)) !== false) { $image = xmlUrlClean($display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true)); } else { $image = ""; } echo ' <image>' . $image . '</image>' . "\n"; echo ' <desc><![CDATA[' . $item->getDescription() . ']]></desc>' . "\n"; } // Now let's close out echo " </" . $type . ">\n"; flushdisplay(); } echoXMLFooter(); }
writeLogData('playback', "generated random playlist of " . $_POST['random_play_number'] . " tracks in {$timer} seconds."); } $pl->play(); exit; break; } } // Last thing: we want to draw a standard page, since we did not previously exit. // TODO: check for specialty pages (search,playlistmanager,etc) // Let's count how many of everything we have if (!isset($_SESSION['jz_num_genres'])) { $root =& new jzMediaNode(); $_SESSION['jz_num_genres'] = $root->getSubNodeCount("nodes", distanceTo("genre")); $_SESSION['jz_num_artists'] = $root->getSubNodeCount("nodes", distanceTo("artist")); $_SESSION['jz_num_albums'] = $root->getSubNodeCount("nodes", distanceTo("album")); $_SESSION['jz_num_tracks'] = $root->getSubNodeCount("nodes", distanceTo("track")); } // The header file defines our drawPage function. $maindiv = isset($_GET['maindiv']) || isset($_POST['maindiv']) ? true : false; // Let's check for security $blocks = new jzBlocks(); if ($blocks->checkForSecure()) { $smarty = smartySetup(); $smarty->assign('path', getcwd()); // Now let's include the template $smarty->display(SMARTY_ROOT . 'templates/slick/security-warning.tpl'); exit; } if (isset($_SESSION['current_interface'])) { $_SESSION['ref_interface'] = $_SESSION['current_interface']; } else {
$smarty->assign('method', "POST"); } if ($jukebox == "true" && !defined('NO_AJAX_JUKEBOX')) { $smarty->assign('searchOnSubmit', 'onSubmit="return searchKeywords(this,\'' . htmlentities($this_page) . '\');"'); } else { $smarty->assign('searchOnSubmit', ""); } $formFields = ""; foreach (getURLVars($this_page) as $key => $val) { $formFields .= '<input type="hidden" name="' . htmlentities($key) . '" value="' . htmlentities($val) . '">'; } $smarty->assign('formFields', $formFields); $formFields = ""; if (distanceTo("artist") !== false) { $searchFields .= '<option value="artists">' . word("Artists") . '</option>' . "\n"; } if (distanceTo("album") !== false) { $searchFields .= '<option value="albums">' . word("Albums") . '</option>' . "\n"; } $smarty->assign('optionFields', $formFields); $smarty->assign('searchFields', $searchFields); $smarty->assign('word_tracks', word('Tracks')); $smarty->assign('word_lyrics', word('Lyrics')); $smarty->assign('login_link', $display->loginLink(false, false, true, false, true)); if ($jzUSER->getSetting('edit_prefs') !== false) { $smarty->assign('prefs_link', $display->popupLink("preferences", word('Preferences'), true)); } else { $smarty->assign('prefs_link', ""); } $smarty->assign('randomizer', $blocks->randomGenerateSelector($node, word("Play:") . ' ', true)); jzTemplate($smarty, "page-header");
function generateStats() { $stats = array(); if ($this->getLevel() == 0) { $pathstring = ""; $fullpathstring = ""; } else { $pathstring = "path LIKE '" . jz_db_escape($this->getPath("String")) . "/%' AND "; $fullpathstring = "WHERE path LIKE '" . jz_db_escape($this->getPath("String")) . "/%'"; } $link = jz_db_connect(); $results = jz_db_query($link, "SELECT sum(filesize) FROM jz_tracks WHERE {$pathstring} filesize != '-' AND filesize > 0"); $stats['total_size'] = $results->data[0][0]; $results = jz_db_query($link, "SELECT sum(length) FROM jz_tracks WHERE {$pathstring} length != '-' AND length > 0"); $stats['total_length'] = $results->data[0][0]; $results = jz_db_query($link, "SELECT count(*) FROM jz_tracks {$fullpathstring}"); $stats['total_tracks'] = $tracks = $results->data[0][0]; $results = jz_db_query($link, "SELECT avg(bitrate) FROM jz_tracks WHERE {$pathstring} bitrate != '-' AND bitrate > 0"); $stats['avg_bitrate'] = round($results->data[0][0], 2); $results = jz_db_query($link, "SELECT avg(length) FROM jz_tracks WHERE {$pathstring} length != '-' AND length > 0"); $stats['avg_length'] = round($results->data[0][0], 0); $results = jz_db_query($link, "SELECT avg(filesize) FROM jz_tracks WHERE {$pathstring} filesize != '-' AND filesize > 0"); $stats['avg_size'] = round($results->data[0][0], 2); $results = jz_db_query($link, "SELECT avg(year) FROM jz_tracks WHERE {$pathstring} year != '-' AND year > 1000"); $stats['avg_year'] = round($results->data[0][0], 2); $str = ""; // stringize stuff: $stats['avg_length_str'] = stringize_time($stats['avg_length']); $stats['total_length_str'] = stringize_time($stats['total_length']); $stats['total_size_str'] = stringize_size($stats['total_size']); if (($d = distanceTo('genre', $this)) !== false) { $stats['total_genres'] = $this->getSubNodeCount('nodes', $d); } else { $stats['total_genres'] = 0; } if (($d = distanceTo('artist', $this)) !== false) { $stats['total_artists'] = $this->getSubNodeCount('nodes', $d); } else { $stats['total_artists'] = 0; } if (($d = distanceTo('album', $this)) !== false) { $stats['total_albums'] = $this->getSubNodeCount('nodes', $d); } else { $stats['total_albums'] = 0; } // nodes at track level are disks. if (($d = distanceTo('track', $this)) !== false) { $stats['total_disks'] = $this->getSubNodeCount('nodes', $d); } else { $stats['total_disks'] = 0; } $this->stats = $stats; return $stats; }
function standardPage(&$node) { global $show_artist_alpha, $truncate_length, $sort_by_year; // Let's setup the objects $blocks =& new jzBlocks(); $display =& new jzDisplay(); // Let's display the header $this->pageTop($node); // ARTIST ALPHA: in header or only for root? Put the following in pageTop for the first... if ($node->getLevel() == 0 && $show_artist_alpha == "true") { $blocks->alphabeticalList($node, "artist", 0); } // Now let's get the sub nodes to where we are if (isset($_GET['jz_letter'])) { $root = new jzMediaNode(); $nodes = $root->getAlphabetical($_GET['jz_letter'], "nodes", distanceTo("artist")); } else { $nodes = $node->getSubNodes("nodes"); } if ($sort_by_year == "true") { sortElements($nodes, "year"); } else { sortElements($nodes, "name"); } // Now let's loop through the nodes foreach ($nodes as $item) { // Now let's link to this item $name = $item->getName(); if (strlen($name) > $truncate_length) { $name = substr($name, 0, $truncate_length) . ".."; } if (!isNothing($item->getYear()) and $item->getPType() == "album") { $name .= " (" . $item->getYear() . ")"; } // Let's show a play button echo " ("; $display->playLink($item, "P", word("Play"), false, false, false); echo "-"; $display->playLink($item, "R", word("Play Random"), false, false, true); echo ") "; $display->link($item, $name); echo "<br>"; } // Now are there any tracks? $tracks = $node->getSubNodes("tracks"); if (count($tracks) != 0) { $blocks->trackTable($tracks); } // Now let's close out $this->footer($node); }
/** * Handle a search query from the GET/POST variables. * @author Ben Dodson */ function handleSearch($search_string = false, $search_type = false) { global $jzUSER; $root =& new jzMediaNode(); $timer = microtime_float(); if ($search_string === false) { $search_string = $_GET['search_query']; } if ($search_type === false) { $search_type = $_GET['search_type']; } $string_array = splitKeywords($search_string); $keywords = $string_array['keywords']; $string = $string_array['search']; if (isset($keywords['genres'])) { $locations[sizeof($locations)] = 'genre'; $search_type = "genres"; } if (isset($keywords['artists'])) { $locations[sizeof($locations)] = 'artist'; $search_type = "artists"; } if (isset($keywords['albums'])) { $locations[sizeof($locations)] = 'album'; $search_type = "albums"; } if (isset($keywords['tracks'])) { $locations[sizeof($locations)] = 'track'; $search_type = "tracks"; } if (isset($keywords['lyrics'])) { $search_type = "lyrics"; } if (isset($keywords['radio'])) { $search_type = "artists"; $max_res = 1; } else { if (isset($keywords['limit'])) { $max_res = $keywords['limit']; } else { $max_res = 100; } } switch (strtolower($search_type)) { case "all": $stype = "both"; $distance = -1; break; case "genres": case "genre": $stype = "nodes"; $distance = distanceTo("genre"); break; case "artists": case "artist": $stype = "nodes"; $distance = distanceTo("artist"); break; case "albums": case "album": $stype = "nodes"; $distance = distanceTo("album"); break; case "tracks": case "track": $stype = "tracks"; $distance = -1; break; case "lyrics": case "lyric": $stype = "lyrics"; $distance = -1; break; case "best": default: $stype = "both"; $distance = -1; $keywords['best'] = true; } if ($distance === false) { die("Could not search for {$search_type}."); } // Are they searching by ID explicitly? if (isset($keywords['id'])) { $stype = "id"; // We handle this differently than above in // case they set @genre and @id (or whatever). } /* if we have 2 locations, the closest to the root is our anchor and the further is our return type. */ if (sizeof($locations) > 1) { if ($locations[1] == 'track') { $r = 'tracks'; } else { $r = 'nodes'; } $limit = 1; if (isset($keywords['limit'])) { $limit = $keywords['limit']; } $results = $root->search($string, "nodes", distanceTo($locations[0]), 1, 'exact'); if (sizeof($results) > 0) { $results = $results[0]->getSubNodes($r, distanceTo($locations[1], $results[0]), true, $limit); } else { $results = $root->search($string, "nodes", distanceTo($locations[0]), 1); if (sizeof($results) > 0) { $results = $results[0]->getSubNodes($r, distanceTo($locations[1], $results[0]), true, $limit); } } } else { if (isset($keywords['play']) || isset($keywords['radio'])) { $results = $root->search($string, $stype, $distance, 1, 'exact'); if (sizeof($results) == 0) { $results = $root->search($string, $stype, $distance, 1); // better to limit 1 or $max_res? } } else { if (isset($keywords['best'])) { $results = $root->search($string, $stype, $distance, -1, 'exact'); if (sizeof($results) == 0) { $results = $root->search($string, $stype, $distance, $max_res); // better to limit 1 or $max_res? } } else { $results = $root->search($string, $stype, $distance, $max_res); } } } if (sizeof($results) == 0) { // Maybe a search by ID will work... $results = $root->search($string, "id", $distance, $max_res); if (sizeof($results) == 0) { return $results; } } $timer = round(microtime_float() - $timer, 2); writeLogData('search', "searched '{$search_type}' for '{$string}' in {$timer} seconds."); // What about keywords? if (isset($keywords['play']) && sizeof($results) > 0) { $pl = new jzPlaylist(); $pl->add($results); // if (isset($keywords['limit'])) { // $pl->flatten(); //} if (isset($keywords['random'])) { $pl = $pl->getSmartPlaylist($max_res); } else { if (isset($keywords['limit'])) { $pl->flatten(); $pl->truncate($max_res); } } $pl->play(); exit; } else { if (isset($keywords['radio'])) { $pl = new jzPlaylist(); $pl->add($results); $pl = $pl->getSmartPlaylist(50, "radio"); $pl->play(); exit; } } return $results; }
function drawPage(&$node) { global $cellspacing, $this_page, $img_play, $artist_truncate, $main_table_width, $img_random_play, $directory_level, $web_root, $root_dir, $img_more, $media_dir, $show_sub_numbers, $show_all_checkboxes, $img_more_dis, $img_play_dis, $img_random_play_dis, $url_seperator, $days_for_new, $img_rate, $enable_ratings, $enable_discussion, $img_discuss, $show_sub_numbers, $disable_random, $info_level, $enable_playlist, $track_play_only, $css, $skin, $bg_c, $text_c, $img_discuss_dis, $hierarchy, $random_albums, $frontend, $include_path, $cols_in_genre, $show_frontpage_items, $show_alphabet, $chart_types; // Let's see if the theme is set or not, and if not set it to the default //if (isset($_SESSION['cur_theme'])){ $_SESSION['cur_theme'] = $skin; } // Let's setup the display object $blocks =& new jzBlocks(); $display =& new jzDisplay(); $fe =& new jzFrontend(); ?> <table width="100%" cellpadding="5" cellspacing="0" border="0"> <tr> <td align="center" valign="top"> <?php // Now let's display the site description $news = $blocks->siteNews($node); if ($news != "") { ?> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td" colspan="3"> <strong><?php echo word("Site News"); ?> </strong> </td> </tr> <tr> <td class="jz_nj_block_body" width="33%"> <?php echo $news; ?> </td> </tr> </table> <br> <?php } ?> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td" colspan="3"> <?php $lvl = isset($_GET['jz_letter']) ? $_GET['jz_level'] + $node->getLevel() - 1 : $node->getLevel(); switch ($hierarchy[$lvl]) { case "genre": $pg_title = word("ALL GENRES"); break; case "artist": $pg_title = word("ALL ARTISTS"); break; case "album": $pg_title = word("ALL ALBUMS"); break; default: $pg_title = word("ALL GENRES"); break; } if (isset($_GET['jz_letter'])) { $genres = $node->getAlphabetical($_GET['jz_letter'], "nodes", $_GET['jz_level']); } else { $genres = $node->getSubNodes("nodes"); } // Now for the title if ($_GET['jz_path'] == "") { echo '<strong>' . $pg_title . ' (' . count($genres) . ")</strong>"; } else { echo '<strong>ARTISTS IN THIS GENRE ['; $display->link($node, $node->getName()); echo '] (' . $node->getSubNodeCount("nodes") . ")</strong>"; } ?> </td> </tr> <?php $c = 0; foreach ($genres as $genre) { // Now let's start our row if ($c == 0) { echo '<tr>'; } echo '<td class="jz_nj_block_body" nowrap width="33%">'; $display->playButton($genre); echo " "; $display->randomPlayButton($genre); echo " "; $display->link($genre, $display->returnShortName($genre->getName(), 15), word("Browse: ") . $genre->getName()); echo " (" . $genre->getSubNodeCount("both") . ")"; echo '</td>'; $c++; if ($c == 3) { $c = 0; } } // Now let's finish out if ($c != 0) { while ($c < 3) { echo '<td class="jz_nj_block_body"> </td>'; $c++; } } ?> </table> </td> <td align="center"> </td> <?php // Now what to show? if ($_GET['jz_path'] != "") { ?> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td" colspan="3"> <strong>ALBUMS IN THIS GENRE [<?php $display->link($node, $node->getName()); ?> ] (<?php echo $node->getSubNodeCount("nodes", 2); ?> )</strong> </td> </tr> <?php $albums = $node->getSubNodes("nodes", distanceTo("album", $node)); $c = 0; foreach ($albums as $album) { // Now let's start our row if ($c == 0) { echo '<tr>'; } echo '<td class="jz_nj_block_body" nowrap width="33%">'; $display->playButton($album); echo " "; $display->randomPlayButton($album); echo " "; $display->link($album, $display->returnShortName($album->getName(), 15), word("Browse: ") . $album->getName()); echo " (" . $album->getSubNodeCount("tracks") . ")"; echo '</td>'; $c++; if ($c == 3) { $c = 0; } } // Now let's finish out if ($c != 0) { while ($c < 3) { echo '<td class="jz_nj_block_body"> </td>'; $c++; } } ?> </table> </td> <?php } else { ?> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td"> <strong>LATEST ARTISTS</strong> </td> </tr> <tr> <td class="jz_nj_block_body"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <?php // Now how many should we show? $show = round(count($genres) / 3 * 1.5); $blocks->showCharts($node, "newartists", $show, false, false); ?> </table> </td> </tr> </table> </td> <td align="center"> </td> <td align="center" valign="top"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <tr> <td class="jz_block_td"> <strong>LATEST ALBUMS</strong> </td> </tr> <tr> <td class="jz_nj_block_body"> <table width="100%" cellpadding="3" cellspacing="0" border="0"> <?php $show = round(count($genres) / 3 * 1.5); $blocks->showCharts($node, "newalbums", $show, false, false); ?> </table> </td> </tr> </table> </td> <?php } ?> </tr> </table> <br> <?php }