예제 #1
0
파일: root.php 프로젝트: seanfbrown/jinzora
function drawPage($node)
{
    global $random_albums, $include_path;
    $display = new jzDisplay();
    $blocks = new jzBlocks();
    echo '<br>';
    $blocks->blockBodyOpen();
    if (isset($_GET['letter'])) {
        $nodes = $node->getAlphabetical($_GET['letter'], 'nodes', 2);
    } else {
        $nodes = $node->getSubNodes('nodes');
    }
    $tracks = $node->getSubNodes('tracks');
    // Now let's display the site description
    $news = $blocks->siteNews($node);
    if ($news != "") {
        echo "<br><center>" . $news . "<center>";
    }
    $cols = 4;
    $curCol = 1;
    $per_col = round(sizeof($nodes) / $cols);
    $i = 0;
    $percent = round(100 / $cols);
    echo "<table cellpadding=\"4\" width=\"100%\"><tr class=\"jz_col_table_tr\"><td class=\"jz_col_table\" valign=\"top\" width=\"{$percent}%\"><table>";
    foreach ($nodes as $el) {
        if ($i == $per_col && $curCol != $cols) {
            $curCol++;
            echo "</table></td><td class=\"jz_col_table\" valign=\"top\" width=\"{$percent}%\"><table width=\"100%\">";
            $i = 0;
        }
        echo "<tr><td>";
        $display->link($el);
        echo "</td></tr>";
        $i++;
    }
    echo "</table></td></tr></table>";
    if (!isset($_GET['letter'])) {
        $url = array();
        $url['letter'] = '#';
        echo "| <a href=\"" . urlize($url) . "\">#</a>";
        for ($let = 'A'; $let != 'Z'; $let++) {
            $url['letter'] = $let;
            echo " | <a href=\"" . urlize($url) . "\">" . $let . "</a>";
        }
        $url['letter'] = "*";
        echo " | <a href=\"" . urlize($url) . "\">ALL</a> |";
        echo "<br>";
        if (sizeof($tracks) > 0) {
            $blocks->trackTable($tracks, false, true);
        }
        if ($random_albums != "0") {
            echo "<br>";
            $blocks->randomAlbums($node, $node->getName());
        }
    }
    $blocks->blockBodyClose();
    echo "<br>";
}
예제 #2
0
function drawPage($node)
{
    global $random_albums, $include_path;
    $display = new jzDisplay();
    $blocks = new jzBlocks();
    $nodes = $node->getSubNodes('nodes');
    $tracks = $node->getSubNodes('tracks');
    // Now let's display the site description
    $news = $blocks->siteNews($node);
    if ($news != "") {
        echo "<br><center>" . $news . "<center>";
    }
    $cols = 4;
    $curCol = 1;
    $per_col = round(sizeof($nodes) / $cols);
    $i = 0;
    $percent = round(100 / $cols);
    echo "<table cellpadding=\"4\" width=\"100%\"><tr class=\"jz_col_table_tr\"><td class=\"jz_col_table\" valign=\"top\" width=\"{$percent}%\"><table width=\"100%\"><tr><td>";
    foreach ($nodes as $el) {
        if ($i == $per_col && $curCol != $cols) {
            $curCol++;
            echo "</td></tr></table></td><td class=\"jz_col_table\" valign=\"top\" width=\"{$percent}%\"><table width=\"100%\"><tr><td>";
            $i = 0;
        }
        $display->link($el);
        echo "</td></tr><tr><td>";
        $i++;
    }
    echo "</td></tr></table></td></tr></table>";
    echo "<br>";
    echo "<br>";
    if (sizeof($tracks) > 0) {
        $blocks->trackTable($tracks, false, true);
    }
    if ($random_albums != "0") {
        include_once $include_path . "frontend/blocks/random-albums.php";
        echo "<br>";
        $blocks->randomAlbums(&$node, $node->getName());
        echo "<br>";
    }
}
예제 #3
0
파일: blocks.php 프로젝트: jinzora/jinzora3
 /**
  * Draws the Featured Artist/Album Block
  * 
  * @author Ross Carlson
  * @version 01/19/05
  * @since 01/19/05
  * @param object $node The node that we are looking at so we can filter
  */
 function showFeatured($featured, $truncate = 150, $slimDisplay = false)
 {
     global $album_name_truncate, $img_tiny_play, $artist_truncate, $album_name_truncate, $cms_mode;
     // Let's set the featured width
     $featWidth = 250;
     // Should we just return?
     if (!is_array($featured)) {
         return;
     }
     // Let's make sure there are featured items
     // Now let's grab the featured artists
     shuffle($featured);
     $item = $featured[0];
     if ($item == "") {
         return;
     }
     // Let's setup our objects
     $display = new jzDisplay();
     $smarty = smartySetup();
     $title = word("Editors Pick") . ": ";
     $title2 = "<strong>" . $display->playLink($item, $img_tiny_play, $item->getName(), false, true) . $display->link($item, $display->returnShortName($item->getName(), $artist_truncate), word("Browse") . ": " . $item->getName(), false, true) . "</strong>";
     $smarty->assign('art', "");
     if (($art = $item->getMainArt("75x75")) != false) {
         $smarty->assign('art', $display->link($item, $display->returnImage($art, $item->getName(), 75, 75, "limit", false, false, "left", "3", "3"), false, false, true));
     }
     $smarty->assign('title', $title);
     $smarty->assign('title2', $title2);
     // Should we display the artist?
     if ($item->getPType() == "album") {
         $parent = $item->getParent();
         $smarty->assign('artist_play_button', $display->playLink($parent, $img_tiny_play, $parent->getName(), false, true));
         $smarty->assign('artist', $display->link($parent, $parent->getName(), $parent->getName(), false, true));
     }
     $desc_truncate = $truncate;
     $desc = $item->getDescription();
     $smarty->assign('description', $display->returnShortName($desc, $desc_truncate));
     $smarty->assign('read_more', "");
     if (strlen($desc) > $desc_truncate) {
         $url_array = array();
         $url_array['jz_path'] = $item->getPath("String");
         $url_array['action'] = "popup";
         $url_array['ptype'] = "readmore";
         $smarty->assign('read_more', '<a href="' . urlize($url_array) . '" onclick="openPopup(this, 450, 450); return false;"> - ' . word("read more") . '</a>');
     }
     $smarty->display(SMARTY_ROOT . 'templates/slick/block-editors-pick.tpl');
 }
예제 #4
0
    function pageTop($node)
    {
        global $img_home, $jinzora_skin, $root_dir, $css, $this_page, $cms_mode, $jzUSER, $include_path, $desc_truncate, $image_size, $jinzora_url, $image_dir, $jukebox, $jzSERVICES, $jukebox_display, $cms_mode, $show_artist_alpha, $show_artist_list, $allow_resample;
        // Let's setup our objects
        $display = new jzDisplay();
        $blocks = new jzBlocks();
        $smarty = smartySetup();
        // Now let's make sure our Node is set and if not set one
        if (!is_object($node)) {
            $node = new jzMediaNode();
        }
        // Let's include the settings file
        include_once $include_path . 'frontend/frontends/mediacenter/settings.php';
        // Let's set some variables
        $smarty->assign('root_dir', $root_dir);
        // Ok, now let's include the first template
        $smarty->display(SMARTY_ROOT . 'templates/mediacenter/header.tpl');
        exit;
        $display->preHeader();
        $smarty->assign('this_page', $this_page);
        $smarty->assign('img_home', $img_home);
        $smarty->assign('cms_mode', $cms_mode);
        $smarty->assign('image_dir', $image_dir);
        $smarty->assign('jinzora_url', $jinzora_url);
        $smarty->display(SMARTY_ROOT . 'templates/mediacenter/header.tpl');
        // Now let's see if we should show the jukebox iframe
        $smarty->assign('jukebox_queue', false);
        if (checkPermission($jzUSER, "jukebox_queue")) {
            $smarty->assign('jukebox_queue', true);
            if ($jukebox_display == "small" or $jukebox_display == "minimal") {
                $smarty->assign('jukebox_display', "small");
            } else {
                $smarty->assign('jukebox_display', "full");
            }
        }
        $smarty->display(SMARTY_ROOT . 'templates/mediacenter/jukebox.tpl');
        // Let's show the news
        $siteNews = $blocks->siteNews($node);
        $smarty->assign('site_news', $siteNews);
        if ($siteNews != "") {
            $smarty->display(SMARTY_ROOT . 'templates/mediacenter/site-news.tpl');
        }
        // Now do we have art or image or desc at the album level
        if ($node->getPType() == "album") {
            if (($art = $node->getMainArt($image_size . "x" . $image_size)) != false or ($desc = $node->getDescription()) != "") {
                $desc = $node->getDescription();
                // Ok, let's display
                echo '<table width="100%" cellspacing="0" cellpadding="5">';
                echo '<tr class="and_head1">';
                echo '<td width="100%" align="left">';
                // Let's display the name
                $artist = $node->getAncestor('artist');
                echo "<strong>";
                if ($artist !== false) {
                    $display->link($artist, $artist->getName());
                    echo " - ";
                }
                echo $node->getName();
                if (!isNothing($node->getYear())) {
                    echo " (" . $node->getYear() . ")";
                }
                echo '</strong><br>';
                if ($art) {
                    if ($desc) {
                        $align = "left";
                    } else {
                        $align = "center";
                    }
                    $display->image($art, $node->getName(), $image_size, $image_size, "limit", false, false, $align, "4", "4");
                }
                if ($cms_mode == "false") {
                    echo '<div class="jz_artistDesc">';
                }
                echo $display->returnShortName($desc, $desc_truncate);
                // Do we need the read more link?
                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 ($cms_mode == "false") {
                    echo '</div>';
                }
                echo '</td></tr></table>';
            }
        }
        // Can this user powersearch?
        $on = true;
        if ($jzUSER->getSetting('powersearch') and $on == true) {
            if ($cms_mode == "true") {
                $method = "GET";
            } else {
                $method = "POST";
            }
            ?>
				
				<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>
			<?php 
        }
        ?>
			<?php 
        if (isset($_POST['jz_path'])) {
            $jzPath = $_POST['jz_path'];
        } else {
            $jzPath = $_GET['jz_path'];
        }
        // Now should we show this bar?
        $bcArray = explode("/", $jzPath);
        ?>
			<table width="100%" cellspacing="0" cellpadding="5">
				<tr class="and_head1">
					<td width="50%" valign="middle">
						<?php 
        $url = array();
        echo '<a href="' . urlize($url) . '"><img src="' . $image_dir . 'open-folder.gif" border="0"></a>';
        // Now let's see if we need the breadcrumbs
        unset($bcArray[count($bcArray) - 1]);
        $path = "";
        echo ' <a href="' . urlize($url) . '">' . word("Home") . '</a>';
        foreach ($bcArray as $item) {
            if ($item != "") {
                $path .= "/" . $item;
                $arr['jz_path'] = $path;
                echo ' / <a href="' . urlize($arr) . '">' . $item . '</a>';
            }
            unset($arr);
        }
        ?>
					</td>
					<td width="50%" valign="middle" align="right" nowrap="nowrap">
							<?php 
        if ($show_artist_list == "true") {
            ?>
								<?php 
            echo word("Artist") . ": ";
            ?>
								<form action="<?php 
            echo $this_page;
            ?>
" method="post">
								<?php 
            $display->hiddenPageVars();
            $display->dropdown("artist");
            ?>
								</form>
								&nbsp; | &nbsp;
							<?php 
        }
        ?>
							
				   			
				   			<?php 
        echo word('Search:');
        ?>
							<form action="<?php 
        echo $this_page;
        ?>
" method="<?php 
        echo $method;
        ?>
">
							<?php 
        foreach (getURLVars($this_page) as $key => $val) {
            echo '<input type="hidden" name="' . htmlentities($key) . '" value="' . htmlentities($val) . '">';
        }
        ?>
								<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="text" name="search_query" class="jz_input" style="width:125px; font-size:10px ">
								<input type="hidden" name="doSearch" value="true">
								<input type="submit" class="jz_submit" value="Go">
							</form>
							
							
					</td>
				</tr>
			</table>
				
			<?php 
        // Now let's see if we need the breadcrumbs
        if ($_GET['jz_path'] != "") {
            ?>
				<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="1%" valign="middle" nowrap>
							<?php 
            if ($cms_mode == "true") {
                $mode = "POST";
            } else {
                $mode = "GET";
            }
            $mode = "GET";
            if (isset($_POST['jz_path'])) {
                $bcArray = explode("/", $_POST['jz_path']);
            } else {
                $bcArray = explode("/", $_GET['jz_path']);
            }
            // Now we need to cut the last item off the list
            $bcArray = array_slice($bcArray, 0, count($bcArray) - 1);
            // Now let's display the dropdown for where we are
            echo '<form action="' . $this_page . '" method="' . $mode . '">' . "\n";
            echo '<select style="width:175px" class="jz_select" name="' . jz_encode('jz_path') . '" onChange="form.submit();">' . "\n";
            $parent = $node->getParent();
            $nodes = $parent->getSubNodes("nodes");
            sortElements($nodes);
            foreach ($nodes as $child) {
                $path = $child->getPath("String");
                echo '<option ';
                // Is this the current one?
                if ($child->getName() == $node->getName()) {
                    echo ' selected ';
                }
                echo 'value="' . jz_encode($path) . '">' . $display->returnShortName($child->getName(), 20) . '</option>' . "\n";
            }
            echo '</select>' . "\n";
            //$display->hiddenVariableField("jz_path");
            $display->hiddenPageVars();
            echo '<input type="hidden" name="frontend" value="' . $_GET['frontend'] . '">' . "\n";
            echo "</form>";
            ?>
						</td>
						<td valign="middle" nowrap>
							<?php 
            $display->playButton($node);
            echo "&nbsp;";
            $display->randomPlayButton($node);
            $url_array = array();
            $url_array['jz_path'] = $node->getPath("String");
            $url_array['action'] = "popup";
            $url_array['ptype'] = "iteminfo";
            echo ' <a onclick="openPopup(this, 450, 450); return false;" href="' . urlize($url_array) . '"><img src="' . $image_dir . 'more.gif" border="0"></a>';
            ?>
						</td>
					<?php 
            if ($display->wantResampleDropdown($node)) {
                ?>
					<td align="right">
						<?php 
                $display->displayResampleDropdown($node, word("Resample") . ": ");
                ?>
					</td>
				<?php 
            }
            ?>
				</tr>
				</table>
				<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>
				<?php 
        } else {
            if ($display->wantResampleDropdown($node)) {
                ?>
					<table width="100%" cellspacing="0" cellpadding="0"><tr>
					<td align="right">
						<?php 
                $display->displayResampleDropdown($node, word("Resample") . ": ");
                ?>
					</td>
				</tr></table>
				<?php 
            }
        }
        // ARTIST ALPHA: in header or only for root? Put the following in pageTop for the first...
        if ($show_artist_alpha == "true") {
            $blocks->alphabeticalList($node, "artist", 0);
        }
    }
예제 #5
0
if (false !== $track && $track->getPath() != "") {
    $node = $track->getAncestor("album");
    if ($node) {
        // Now let's set what we'll need
        $album = ucwords($node->getName());
        $parent = $node->getAncestor("artist");
        if ($parent) {
            $artist = ucwords($parent->getName());
        } else {
            $artist = "";
        }
        // Now let's display the art
        if (($art = $node->getMainArt("130x130")) == false) {
            $art = "style/images/default.jpg";
        }
        $display->link($parent, $artist, $artist, false, false, false, false, false, "_top");
        echo " - ";
        $display->link($node, $album, $album, false, false, false, false, false, "_top");
        echo "<br>";
        echo $display->returnImage($art, $node->getName(), "130", "130", "fit", false, false, "left", "5", "5");
        // Now let's get the review
        $desc = $node->getDescription();
        $desc_truncate = 375;
        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>';
        }
예제 #6
0
    if ($_POST['page'] == "RANDOM") {
        $start = 1 * 24;
        shuffle($artArray);
        $artArray = array_slice($artArray, $start, 24);
    } elseif ($_POST['page'] == "ALL") {
        $artArray = $artArray;
    } else {
        $start = $_POST['page'] * 24;
        $artArray = array_slice($artArray, $start, 24);
    }
} else {
    $artArray = array_slice($artArray, 0, 24);
}
jzTemplate($smarty, "block-open");
flushdisplay();
$i = 0;
$c = 0;
foreach ($artArray as $item) {
    $array[$c]['image'] = $display->link($item, $display->returnImage($item->getMainArt("100x100"), $item->getName(), 100, 100, "fixed"), false, false, true);
    if ($i == 6) {
        $i = -1;
        $array[$c]['row'] = '</tr><tr>';
    } else {
        $array[$c]['row'] = "";
    }
    $i++;
    $c++;
}
$smarty->assign('items', $array);
jzTemplate($smarty, "show-all-art");
jzTemplate($smarty, "block-close");
예제 #7
0
파일: api.php 프로젝트: jinzora/jinzora3
/**
 * Results is an array of nodes and tracks.
 * Prints results in a variety of formats.
 */
function print_results($results, $format = 'xml', $trackfields = false, $nodefields = false, $queryMeta = false)
{
    global $this_site, $api_page;
    $display = new jzDisplay();
    $tracks = array();
    $nodes = array();
    // Now let's break our nodes and tracks out
    foreach ($results as $val) {
        // We look at objects as leafs or nodes
        // Leafs are the last branch on the tree
        // So those would be tracks/videos
        if ($val->isLeaf()) {
            $tracks[] = $val;
        } else {
            // Nodes are everything above the leafs
            // So albums, artists, and genres
            $nodes[] = $val;
        }
    }
    // Now let's output
    switch ($format) {
        case "xml":
            echoXMLHeader();
            echo "  <search>\n";
            echo "    <tracks>\n";
            // Now let's display the tracks
            if (sizeof($tracks) > 0) {
                foreach ($tracks as $track) {
                    // Let's get all the data for display
                    // The getMeta function lets us get all the metadata (length, bitrate, etc) from a tack
                    $meta = $track->getMeta();
                    // Now we go up from this item to get it's "ancestors"
                    // The reason we do this is to make sure we get the right thing
                    // for it, not just the one above.  This is important when using multidisk
                    // albums where their parent would be DISC1 not AlbumName
                    // You can do this recursively if you want
                    $album = $track->getAncestor("album");
                    $art = $album->getMainArt(false, true, "audio", true);
                    $artist = $album->getAncestor("artist");
                    $genre = $artist->getParent();
                    // Now let's display
                    echo "      <track>\n";
                    if (!is_array($trackfields) || in_array('id', $trackfields)) {
                        echo "        <id>" . xmlentities($track->getID()) . "</id>\n";
                    }
                    if (!is_array($trackfields) || in_array('name', $trackfields)) {
                        echo "        <name>" . xmlentities($meta['title']) . "</name>\n";
                    }
                    if (!is_array($trackfields) || in_array('metadata', $trackfields)) {
                        echo "        <metadata>\n";
                        echo "          <filename>" . xmlentities($meta['filename']) . "</filename>\n";
                        echo "          <tracknumber>" . xmlentities($meta['number']) . "</tracknumber>\n";
                        echo "          <length>" . xmlentities($meta['length']) . "</length>\n";
                        echo "          <bitrate>" . xmlentities($meta['bitrate']) . "</bitrate>\n";
                        echo "          <samplerate>" . xmlentities($meta['frequency']) . "</samplerate>\n";
                        echo "          <filesize>" . xmlentities($meta['size']) . "</filesize>\n";
                        echo "        </metadata>\n";
                    }
                    if (!is_array($trackfields) || in_array('album', $trackfields)) {
                        echo "        <album>" . xmlentities($album->getName()) . "</album>\n";
                    }
                    if (!is_array($trackfields) || in_array('artist', $trackfields)) {
                        echo "        <artist>" . xmlentities($artist->getName()) . "</artist>\n";
                    }
                    if (!is_array($trackfields) || in_array('genre', $trackfields)) {
                        echo "        <genre>" . xmlentities($genre->getName()) . "</genre>\n";
                    }
                    if (!is_array($trackfields) || in_array('path', $trackfields)) {
                        echo "        <path>" . xmlentities($track->getPath("string")) . "</path>\n";
                    }
                    if (!is_array($trackfields) || in_array('playlink', $trackfields)) {
                        echo "        <playlink>" . xmlentities($this_site . $track->getPlayHREF()) . "</playlink>\n";
                    }
                    if (!is_array($trackfields) || in_array('image', $trackfields)) {
                        echo "        <image>";
                        if ($art) {
                            echo xmlentities($display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true, true));
                        }
                        echo "        </image>\n";
                    }
                    if (!is_array($trackfields) || in_array('thumbnail', $trackfields)) {
                        echo "        <thumbnail>";
                        $art = $album->getMainArt('75x75', true, "audio", true);
                        if ($art) {
                            echo xmlentities($display->returnImage($art, false, 75, 75, "limit", false, false, false, false, false, "0", false, true, true));
                        }
                        echo "        </thumbnail>\n";
                    }
                    if (!is_array($trackfields) || in_array('type', $trackfields)) {
                        echo "        <type>" . xmlentities("Track") . "</type>\n";
                    }
                    echo "      </track>\n";
                }
            }
            echo "    </tracks>\n";
            echo "    <nodes>\n";
            // Now let's display the nodes
            if (sizeof($nodes) > 0) {
                foreach ($nodes as $node) {
                    // We do the same things here by getting item off the node
                    // $art would be the image for the item we're looking at
                    // In this case we want the art for the match we found
                    // This works on ALL objects if they have art
                    $art = $node->getMainArt(false, true, "audio", true);
                    $album = $node->getAncestor("album");
                    if ($album) {
                        $artist = $album->getAncestor("artist");
                    } else {
                        $artist = "";
                    }
                    echo "      <node>\n";
                    if (!is_array($nodefields) || in_array('id', $nodefields)) {
                        echo "        <id>" . xmlentities($node->getID()) . "</id>\n";
                    }
                    if (!is_array($nodefields) || in_array('name', $nodefields)) {
                        echo "        <name>" . xmlentities($node->getName()) . "</name>\n";
                    }
                    if (!is_array($nodefields) || in_array('type', $nodefields)) {
                        echo "        <type>" . xmlentities(ucwords($node->getPType())) . "</type>\n";
                    }
                    if (!is_array($nodefields) || in_array('link', $nodefields)) {
                        echo "        <link>" . xmlentities($this_site . $display->link($node, false, false, false, true, true)) . "</link>\n";
                    }
                    if ((!is_array($nodefields) || in_array('album', $nodefields)) && !empty($album)) {
                        echo "        <album>" . xmlentities($album->getName()) . "</album>\n";
                    }
                    if ((!is_array($nodefields) || in_array('artist', $nodefields)) && !empty($artist)) {
                        echo "        <artist>" . xmlentities($artist->getName()) . "</artist>\n";
                    }
                    if (!is_array($nodefields) || in_array('image', $nodefields)) {
                        echo "        <image>";
                        if ($art) {
                            echo xmlentities($display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true, true));
                        }
                        echo "        </image>\n";
                    }
                    if (!is_array($nodefields) || in_array('thumbnail', $nodefields)) {
                        echo "        <thumbnail>";
                        $art = $node->getMainArt('75x75', true, "audio", true);
                        if ($art) {
                            echo xmlentities($display->returnImage($art, false, 75, 75, "limit", false, false, false, false, false, "0", false, true, true));
                        }
                        echo "        </thumbnail>\n";
                    }
                    if (!is_array($nodefields) || in_array('playlink', $nodefields)) {
                        if ($node->getPType() == 'artist' || $node->getPType() == 'genre') {
                            echo "        <playlink>" . xmlentities($this_site . $node->getPlayHREF(true, 50)) . "</playlink>\n";
                        } else {
                            echo "        <playlink>" . xmlentities($this_site . $node->getPlayHREF()) . "</playlink>\n";
                        }
                    }
                    if (!is_array($nodefields) || in_array('path', $nodefields)) {
                        echo "        <path>" . xmlentities($node->getPath("string")) . "</path>\n";
                    }
                    if (!is_array($nodefields) || in_array('browse', $nodefields)) {
                        echo "        <browse>" . xmlentities($api_page . '&request=browse&jz_path=' . urlencode($node->getPath('string'))) . "</browse>\n";
                    }
                    echo "      </node>\n";
                }
            }
            echo "    </nodes>\n";
            echo "  </search>\n";
            echoXMLFooter();
            break;
        case "display":
            // Ok, let's redirect them to the search page
            header("Location: " . $this_site . "/index.php?doSearch=true&search_query=jam&search_type=ALL");
            break;
        case "json":
        case "jsonp":
            $jt = array();
            $jn = array();
            foreach ($tracks as $t) {
                $n = array();
                $meta = $t->getMeta();
                $album = $artist = $genre = false;
                $album = $t->getAncestor("album");
                if ($album) {
                    $artist = $album->getAncestor("artist");
                }
                if ($artist) {
                    $genre = $artist->getParent();
                }
                if ($album) {
                    $art = $album->getMainArt(false, true, "audio", true);
                }
                // Now let's display
                if (!is_array($trackfields) || in_array('image', $trackfields)) {
                    $n['image'] = $art ? $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true, true) : '';
                }
                if ($album) {
                    $art = $album->getMainArt('75x75', true, "audio", true);
                }
                if (!is_array($trackfields) || in_array('thumbnail', $trackfields)) {
                    $n['thumbnail'] = $art ? $display->returnImage($art, false, 75, 75, "limit", false, false, false, false, false, "0", false, true, true) : '';
                }
                if (!is_array($trackfields) || in_array('id', $trackfields)) {
                    $n['id'] = $t->getID();
                }
                if (!is_array($trackfields) || in_array('name', $trackfields)) {
                    $n['name'] = $meta['title'];
                }
                if (!is_array($trackfields) || in_array('album', $trackfields)) {
                    $n['album'] = $album ? $album->getName() : '';
                }
                if (!is_array($trackfields) || in_array('artist', $trackfields)) {
                    $n['artist'] = $artist ? $artist->getName() : '';
                }
                if (!is_array($trackfields) || in_array('genre', $trackfields)) {
                    $n['genre'] = $genre ? $genre->getName() : '';
                }
                if (!is_array($trackfields) || in_array('playlink', $trackfields)) {
                    $n['playlink'] = $this_site . $t->getPlayHREF();
                }
                if (!is_array($trackfields) || in_array('playlink', $trackfields)) {
                    $n['download'] = $this_site . $t->getDownloadHREF();
                }
                if (!is_array($trackfields) || in_array('metadata', $trackfields)) {
                    $n['metadata'] = $meta;
                }
                if (!is_array($trackfields) || in_array('path', $trackfields)) {
                    $n['path'] = $t->getPath("string");
                }
                if (!is_array($trackfields) || in_array('type', $trackfields)) {
                    $n['type'] = 'Track';
                }
                $jt[] = $n;
            }
            foreach ($nodes as $n) {
                $a = array();
                $album = $n->getAncestor("album");
                if ($album) {
                    $artist = $album->getAncestor("artist");
                }
                $art = $n->getMainArt(false, true, "audio", true);
                if (!is_array($nodefields) || in_array('id', $nodefields)) {
                    $a['id'] = $n->getID();
                }
                if (!is_array($nodefields) || in_array('name', $nodefields)) {
                    $a['name'] = $n->getName();
                }
                if (!is_array($nodefields) || in_array('type', $nodefields)) {
                    $a['type'] = ucwords($n->getPType());
                }
                if (!is_array($nodefields) || in_array('link', $nodefields)) {
                    $a['link'] = $this_site . $display->link($node, false, false, false, true, true);
                }
                if (!is_array($nodefields) || in_array('album', $nodefields)) {
                    $a['album'] = empty($album) ? '' : $album->getName();
                }
                if (!is_array($nodefields) || in_array('artist', $nodefields)) {
                    $a['artist'] = empty($artist) ? '' : $artist->getName();
                }
                if (!is_array($nodefields) || in_array('image', $nodefields)) {
                    $a['image'] = $art ? $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true, true) : '';
                }
                $art = $n->getMainArt('75x75', true, "audio", true);
                if (!is_array($nodefields) || in_array('thumbnail', $nodefields)) {
                    $a['thumbnail'] = $art ? $display->returnImage($art, false, 75, 75, "limit", false, false, false, false, false, "0", false, true, true) : '';
                }
                if (!is_array($nodefields) || in_array('playlink', $nodefields)) {
                    if ($a['type'] == 'Artist' || $a['type'] == 'Genre') {
                        $a['playlink'] = $this_site . $n->getPlayHREF(true, 50);
                    } else {
                        $a['playlink'] = $this_site . $n->getPlayHREF();
                    }
                }
                if (!is_array($nodefields) || in_array('path', $nodefields)) {
                    $a['path'] = $n->getPath("string");
                }
                if (!is_array($nodefields) || in_array('browse', $nodefields)) {
                    $a['browse'] = $api_page . '&request=browse&jz_path=' . urlencode($n->getPath('string'));
                }
                $jn[] = $a;
            }
            $obj = array('tracks' => $jt, 'nodes' => $jn);
            if ($queryMeta !== false) {
                $obj['meta'] = $queryMeta;
            }
            if ($format == 'jsonp') {
                echo $_GET['jsoncallback'] . '(';
                echo json_encode($obj);
                echo ')';
            } else {
                echo json_encode($obj);
            }
            break;
        case 'plain':
        case 'text':
            foreach ($tracks as $t) {
                echo $t->getName() . "\n";
            }
            foreach ($nodes as $n) {
                echo $n->getName() . "\n";
            }
    }
}