Esempio n. 1
0
function getContentRange($size)
{
    $from = 0;
    $to = $size - 1;
    if (isset($_SERVER['HTTP_RANGE'])) {
        $split = explode("=", $_SERVER['HTTP_RANGE']);
        if (trim($split[0]) == "bytes") {
            if ($split[1][0] == '-') {
                if ($size !== false) {
                    $val = trim(substr($split[1], 1));
                    $from = $size - $val - 1;
                    // TODO: VERIFY THE -1 HERE
                }
            }
            if (strpos($split[1], '-') !== false) {
                $split2 = explode("-", $split[1]);
                if (isset($split2[1]) && !isNothing($split2[1])) {
                    $to = trim($split2[1]);
                }
                $from = trim($split2[0]);
            } else {
                $from = trim($split[1]);
            }
            if (empty($to)) {
                $to = $size - 1;
                // -1  because end byte is included
                //(From HTTP protocol:
                // 	'The last-byte-pos value gives the byte-offset of the
                // last byte in the range; that is, the byte positions specified are inclusive')
            }
            return array($from, $to);
        }
    }
    return false;
}
Esempio n. 2
0
/** 
 * Returns the AJAX code for currently playing info
 *
 * @author Ross Carlson
 * @since 8.21.05
 *
 **/
function returnCurrentInfo($mysid, $update)
{
    global $jzUSER, $jzSERVICES;
    $be = new jzBackend();
    $display = new jzDisplay();
    $track = $jzUSER->getCurrentlyPlayingTrack($mysid);
    if (is_object($track)) {
        $album = $track->getAncestor("album");
        $artist = $track->getAncestor("artist");
        if ($update != "false") {
            if (isset($_SESSION['currentinfo']) && $_SESSION['currentinfo'] == $track->getID()) {
                return;
            }
        }
        $_SESSION['currentinfo'] = $track->getID();
        echo '<table width="100%" cellpadding="2" cellspacing="0"><tr><td valign="top">';
        //echo $artist->getName(). " - ". $album->getName();
        $dispYear = "";
        if (!isNothing($track->getYear())) {
            $dispYear = " (" . $track->getYear() . ")";
        }
        $arr = array();
        $arr['jz_path'] = $artist->getPath("String");
        echo '<a href="javascript:;" onclick="window.opener.location.href = ' . "'" . str_replace("ajax_request", "index", urlize($arr)) . "'" . '; return false;">' . $artist->getName() . '</a>';
        echo " - ";
        echo $track->getName();
        echo "<br>";
        $arr = array();
        $arr['jz_path'] = $album->getPath("String");
        echo '<em><a href="javascript:;" onclick="window.opener.location.href = ' . "'" . str_replace("ajax_request", "index", urlize($arr)) . "'" . '; return false;">' . $album->getName() . $dispYear . '</a></em>';
        $art = $track->getMainArt('100x100');
        if (!$art) {
            $art = $album->getMainArt('100x100');
        }
        if ($art) {
            echo str_replace('"', '', $display->returnImage($art, "", 150, 150, "limit", false, false, "left", "3", "3"));
        }
        $lyrics_cols = 48;
        $meta = $track->getMeta();
        $desc = $album->getDescription();
        if ($desc != "") {
            echo "<br>" . $desc;
            $lyrics_cols = 22;
        }
        // Safe to do a lyrics search since the popup is not refreshed unnecessarily.
        if (isNothing($meta['lyrics'])) {
            $lyrics = $jzSERVICES->getLyrics($track);
            if (!isNothing($lyrics)) {
                $meta2 = array();
                $meta2['lyrics'] = $lyrics;
                $track->setMeta($meta2);
                $meta['lyrics'] = $lyrics;
            }
        }
        echo '</td><td valign="top">';
        $admin = checkPermission($jzUSER, 'admin', $track->getPath("String"));
        if (!isNothing($meta['lyrics']) || $admin) {
            $urlArr = array();
            $urlArr['jz_path'] = $track->getPath("String");
            $urlArr['action'] = "popup";
            $urlArr['ptype'] = "viewlyricsfortrack";
            //echo '<a href="'. str_replace("ajax_request","index",urlize($urlArr)). '" onclick="openPopup(this, 450, 450); return false;"><textarea class="jz_input" rows="14" style="border: 0px;" cols="22">'. $meta['lyrics']. '</textarea></a>';
            echo '<textarea id="lyricsbox" name="lyrics" class="jz_input" rows="14" style="border: 0px;" cols="' . $lyrics_cols . '">' . $meta['lyrics'] . '</textarea>';
            if ($admin) {
                echo '<br><input type="button" class="jz_submit" value="' . word('Update') . '" onClick="x_setLyrics(document.getElementById(' . "'lyricsbox'" . ').value,' . "'" . str_replace("'", "\\'", $track->getPath("String")) . "'" . ', alert_cb)">';
            }
        }
        echo '</td></tr></table>';
        return;
    }
    echo word("No track information found.");
}
Esempio n. 3
0
            $genre = getInformation($track[$i], "genre");
        }
        // Ok, we've got the data let's build our meta array
        if ($reGenre && !isNothing($genre)) {
            $meta['genre'] = $genre;
        }
        if ($reArtist && !isNothing($artist)) {
            $meta['artist'] = $artist;
        }
        if ($reAlbum && !isNothing($album)) {
            $meta['album'] = $album;
        }
        if ($reTrack && !isNothing($tNum)) {
            $meta['track'] = $tNum;
        }
        if ($reNumber && !isNothing($tName)) {
            $meta['title'] = $tName;
        }
        // Now let's display
        ?>
				<SCRIPT LANGUAGE=JAVASCRIPT><!--\
					t.innerHTML = '<nobr><?php 
        echo word("Track");
        ?>
: <?php 
        echo str_replace("'", "", $fName);
        ?>
</nobr>';
					tn.innerHTML = '<nobr><?php 
        echo word("Track Name");
        ?>
Esempio n. 4
0
/**
 * Returns the currently playing playlist
 * 
 * @author Ross Carlson
 * @version 2/9/05
 * @since 2/9/05
 * @param return Returns the currently playling playlist
 */
function getCurPlaylist()
{
    global $jbArr;
    $val = array();
    if (isset($jbArr[$_SESSION['jb_id']]['prefix']) && $jbArr[$_SESSION['jb_id']]['prefix'] == "http") {
        $arr = httpqRequest('getplaylistfile', array('delim' => ';;;'));
        $arr = explode(';;;', $arr);
        foreach ($arr as $i => $url) {
            if (false != ($id = getTrackIdFromURL($url))) {
                $track = new jzMediaTrack($id, 'id');
                $meta = $track->getMeta();
                $title = '';
                if (!isNothing($meta['artist'])) {
                    $title .= $meta['artist'];
                }
                if (!isNothing($meta['title'])) {
                    if (!isNothing($title)) {
                        $title .= ' - ';
                    }
                    $title .= $meta['title'];
                }
                if (isNothing($title)) {
                    $title = $track->getName();
                }
                $val[] = $title;
            } else {
                // $val[] = $url; // faster
                $val[] = httpqRequest('getplaylisttitle', array('index' => $i));
                // better
            }
        }
    } else {
        $val = explode(";;;", @file_get_contents("http://" . $jbArr[$_SESSION['jb_id']]['server'] . ":" . $jbArr[$_SESSION['jb_id']]['port'] . "/getplaylisttitle?p=" . $jbArr[$_SESSION['jb_id']]['password'] . "&delim=;;;"));
    }
    writeLogData("messages", "Winamp3: Returning the current playlist");
    return $val;
}
Esempio n. 5
0
    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 "&nbsp;";
            $display->randomPlayButton($item);
            ?>
							&nbsp;
						</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 '&nbsp;';
            $display->playlistSelect(115, false, "all");
            ?>
						
								</form>
						</td>
					</tr>
				</table>
				<?php 
        }
        echo '</form>';
        // Now let's close out
        $this->footer($node);
    }
Esempio n. 6
0
    /**
     * Displays the block for the album on the Album page
     *
     * @author Ben Dodson, Ross Carlson
     * @since 9/6/05
     * @version 9/6/05
     *
     **/
    function albumAlbumBlock($node = false)
    {
        global $album_name_truncate, $img_play, $cms_mode, $img_random_play, $img_play_dis, $img_random_play_dis, $jzUSER, $short_date, $enable_ratings, $show_album_clip_play, $img_clip;
        $display = new jzDisplay();
        // Does the cache file exist?
        if ($display->startCache("albumAlbumBlock", $node)) {
            return;
        }
        if (!defined('NO_AJAX_LINKS') && $node === false) {
            $node = new jzMediaNode($_SESSION['jz_path']);
        }
        $artSize = 100;
        $desc_truncate = 700;
        $desc = $node->getDescription();
        // Now let's purge the extra returns that might be at the beginning
        while (substr($desc, 0, 4) == "<br>" or substr($desc, 0, 6) == "<br />") {
            if (substr($desc, 0, 4) == "<br>") {
                $desc = substr($desc, 5);
            }
            if (substr($desc, 0, 6) == "<br />") {
                $desc = substr($desc, 7);
            }
        }
        if ($desc == "") {
            $artSize = 200;
        }
        $art = $node->getMainArt($artSize . "x" . $artSize);
        if ($art == false and $desc == "") {
            return;
        }
        // now let's set the title for this block
        $title = returnItemShortName($node->getName(), $album_name_truncate);
        // Now let's get the year
        $year = $node->getYear();
        $dispYear = "";
        if (!isnothing($year)) {
            $dispYear = " (" . $year . ")";
        }
        // Now let's setup our buttons for later
        $playButtons = "";
        $playButtons .= $display->playLink($node, $img_play, false, false, true) . $display->playLink($node, $img_random_play, false, false, true, true);
        // Now let's make sure they can stream
        if (!$jzUSER->getSetting('stream')) {
            $playButtons = $img_play_dis . $img_random_play_dis;
        }
        if ($show_album_clip_play == "true") {
            $playButtons .= $display->playLink($node, $img_clip, false, false, true, false, false, true);
        }
        if ($jzUSER->getSetting('download')) {
            $playButtons .= $display->downloadButton($node, false, true, true);
        } else {
            $playButtons .= $display->downloadButton($node, true, true, true);
        }
        $playButtons .= $display->podcastLink($node);
        if ($enable_ratings == "true") {
            $playButtons .= $display->rateButton($node, true);
        }
        $playButtons .= " &nbsp; ";
        // Let's open the block
        $this->blockHeader(word("Album") . ": " . $title . $dispYear . "&nbsp;", $playButtons);
        $this->blockBodyOpen();
        ?>
		<table width="100%" cellpadding="2" cellspacing="0" border="0">
			<tr>
				<td width="100%" <?php 
        if ($desc == "") {
            echo 'align="center"';
            $align = "";
        } else {
            $align = "left";
        }
        ?>
>
					<?php 
        // If there is no description let's make the art bigger
        $rating = $display->rating($node, true);
        if ($rating != "" and $desc == "") {
            echo $rating . "<br>";
        }
        if ($jzUSER->getSetting('stream')) {
            $display->playLink($node, $display->returnImage($art, $node->getName(), $artSize, $artSize, "fit", false, false, $align, "5", "5"));
        } else {
            $display->Image($art, $node->getName(), $artSize, $artSize, "fit", false, false, $align, "5", "5");
        }
        if ($cms_mode == "false") {
            echo '<span class="jz_artistDesc">';
        }
        if ($rating != "" and $desc != "") {
            echo $rating . "<br>";
        }
        $desc = str_replace("\n", '<p>', $desc);
        echo $display->returnShortName($desc, $desc_truncate);
        if (strlen($desc) > $desc_truncate) {
            $url_array = array();
            $url_array['jz_path'] = $node->getPath("String");
            $url_array['action'] = "popup";
            $url_array['ptype'] = "readmore";
            echo ' <a href="' . urlize($url_array) . '" onclick="openPopup(this, 450, 450); return false;">read more</a>';
        }
        if (!isNothing($node->getDateAdded()) && $node->getDateAdded() != "0") {
            echo "<br>" . word("Added") . ": " . date($short_date, $node->getDateAdded());
        }
        if ($cms_mode == "false") {
            echo '</span>';
        }
        ?>
				</td>
			</tr>
		</table>
		<?php 
        // let's close the block
        $this->blockBodyClose();
        $this->blockSpacer();
        // Now lets finish out the cache
        $display->endCache();
    }
Esempio n. 7
0
/**
 * Returns the currently playing track number
 * 
 * @author Ross Carlson
 * @version 2/9/05
 * @since 2/9/05
 * @param return Returns the currently playling track number
 */
function getCurPlayingTrack()
{
    global $jbArr;
    $serv1 = new SCXML();
    $serv1->set_host($jbArr[$_SESSION['jb_id']]['server']);
    $serv1->set_port($jbArr[$_SESSION['jb_id']]['port']);
    $serv1->set_password($jbArr[$_SESSION['jb_id']]['password']);
    $serv1->retrieveXML();
    $song_title = $serv1->fetchMatchingTag("SONGTITLE");
    if (isNothing($song_title)) {
        return false;
    }
    // Ok we need to find the current track then get that out of the playlist so we'll know where we are
    $pArray = getCurPlaylist();
    for ($i = 0; $i < count($pArray); $i++) {
        // Are we on it?
        if (stristr($pArray[$i], $song_title)) {
            $retVal = $i;
        }
    }
    return $retVal;
}
Esempio n. 8
0
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');
    $array[$i]['link'] = $display->link($item, $img_folder, false, false, true);
    $name = $item->getName();
    if (!isNothing($item->getYear()) and $item->getPType() == "album") {
        $name .= " (" . $item->getYear() . ")";
    }
    $array[$i]['name'] = $display->link($item, $name, false, false, true);
    if (($count = $item->getSubNodeCount("nodes")) != 0) {
        if ($count > 1) {
            $folder = word("folders");
        } else {
            $folder = word("folder");
        }
        $array[$i]['items'] = $display->link($item, $count . " " . $folder, false, false, true);
    } else {
        if (($count = $item->getSubNodeCount("tracks")) != 0) {
            if ($count > 1) {
                $files = word("files");
            } else {
Esempio n. 9
0
 function loadUserServices()
 {
     global $jzUSER, $embedded_player;
     if (!isNothing($jzUSER->getSetting('player'))) {
         $this->loadService("players", $jzUSER->getSetting('player'));
     } else {
         if ($embedded_player != "" && $embedded_player != "false") {
             $this->loadService("players", $embedded_player);
         }
     }
 }
Esempio n. 10
0
    /**
     * Searches for meta data of the given node but shows the results step by step
     * 
     * @author Ross Carlson
     * @version 01/18/05
     * @since 01/18/05
     * @param $node The node we are looking at
     */
    function stepMetaSearch($node)
    {
        global $jzSERVICES, $row_colors, $allow_id3_modify, $include_path, $allow_filesystem_modify;
        echo '<div id="artist"></div>';
        echo '<div id="arStatus"></div>';
        echo '<div id="count"></div>';
        echo '<div id="art"></div>';
        ?>
		<SCRIPT LANGUAGE=JAVASCRIPT><!--\
			ar = document.getElementById("artist");
			ars = document.getElementById("arStatus");
			c = document.getElementById("count");
			i = document.getElementById("art");
			-->
		</SCRIPT>
		<?php 
        flushdisplay();
        // Now let's search, first we need to get all the nodes from here down
        $nodes = $node->getSubNodes("nodes", -1);
        // Now let's add the node for what we are viewing
        $nodes = array_merge(array($node), $nodes);
        $total = count($nodes);
        $c = 0;
        $start = time();
        foreach ($nodes as $item) {
            ?>
			<SCRIPT LANGUAGE=JAVASCRIPT><!--\
				ar.innerHTML = '<nobr><?php 
            echo word("Item");
            ?>
: <?php 
            echo $item->getName();
            ?>
</nobr>';					
				ars.innerHTML = '<?php 
            echo word("Status: Searching...");
            ?>
';
				-->
			</SCRIPT>
			<?php 
            flushdisplay();
            // Is this an artist?
            if ($item->getPType() == 'artist') {
            }
            // Is this an album?
            if ($item->getPType() == 'album') {
                // Now let's loop all the services
                $sArr = array("jinzora", "yahoo", "rs", "musicbrainz", "google");
                foreach ($sArr as $service) {
                    ?>
					<SCRIPT><!--\
						ars.innerHTML = '<?php 
                    echo word("Searching") . ": " . $service;
                    ?>
'					
						-->
					</SCRIPT>
					<?php 
                    flushdisplay();
                    include_once $include_path . "services/services/metadata/" . $service . ".php";
                    $func = "SERVICE_GETALBUMMETADATA_" . $service;
                    $itemData = $func($item, false, "array");
                    if ($itemData['image'] != "") {
                        echo '<table width="100%" cellpadding="3" cellspacing="0" border="0"><tr><td>';
                        echo '<img width="75" align="left" src="' . $itemData['image'] . '" border="0">';
                        if (!isNothing($itemData['year'])) {
                            echo $itemData['year'] . "<br>";
                        }
                        if (!isNothing($itemData['rating'])) {
                            echo $itemData['rating'];
                        }
                        echo $itemData['review'];
                        echo '</td></tr><tr><td><input class="jz_submit" type="button" name="edit_download_image" value="' . word("Download") . " - " . $service . '">';
                        echo "<br><br></td></tr></table>";
                    }
                    unset($itemData);
                    flushdisplay();
                }
            }
        }
        ?>
		<br>
		<SCRIPT LANGUAGE=JAVASCRIPT><!--\
			ars.innerHTML = '&nbsp;';					
			c.innerHTML = '&nbsp;';								
			-->
		</SCRIPT>
		<?php 
        echo "<br><center>";
        $this->closeButton(true);
        exit;
    }
Esempio n. 11
0
 function moveMedia($element, $newpath)
 {
     $root = new jzMediaNode();
     $be = new jzBackend();
     $playpath = $element->getFilePath();
     $type = $element->isLeaf() ? "leaf" : "node";
     if (is_string($newpath)) {
         $path = explode("/", $newpath);
     } else {
         if (is_array($newpath)) {
             $path = $newpath;
         } else {
             return false;
         }
     }
     if ($type == "node") {
         return false;
     }
     $pc = $element->getPlayCount();
     $dc = $element->getDownloadCount();
     $vc = $element->getViewCount();
     $desc = $element->getDescription();
     $sdesc = $element->getShortDescription();
     $art = $element->getMainArt();
     $discussion = $element->getDiscussion();
     $rating = $element->getRating();
     $rating_count = $element->getRatingCount();
     if ($be->hasFeature('setID')) {
         $mid = $element->getID();
     }
     // TODO:
     // This does not work correctly with nodes yet.
     // You should pull the above data, then recursively move children,
     // then remove me, and finally set the data as below.
     // I did not do this yet (8/11/05) because I would not have been
     // able to test it. (for things like collisions,
     // and also how to handle the filesystem)
     // If the backend has a lookup file, update it.
     if ($element->isLeaf()) {
         $media_path = getMediaDir($element);
         $be = new jzBackend();
         $rl_name = 'reverse_lookup-' . str_replace(':', '', str_replace('\\', '-', str_replace('/', '-', $media_path)));
         $LOOKUP = $be->loadData($rl_name);
         if (is_array($LOOKUP)) {
             if (isset($LOOKUP[$element->getFilename("host")])) {
                 $LOOKUP[$element->getFilename("host")] = implode('/', $path);
                 $be->storeData($rl_name, $LOOKUP);
             }
         }
     }
     $this->removeMedia($element);
     if (false !== ($new = $root->inject($path, $playpath))) {
         $new->setPlayCount($pc);
         $new->setDownloadCount($dc);
         $new->setViewCount($vc);
         $new->addRating($rating, $rating_count);
         if ($be->hasFeature('setID')) {
             $new->setID($mid);
         }
         if (!isNothing($desc)) {
             $new->addDescription($desc);
         }
         if (!isNothing($sdesc)) {
             $new->addShortDescription($sdesc);
         }
         if (!isNothing($art)) {
             $new->addMainArt($art);
         }
         if ($discussion != array() && !isNothing($discussion)) {
             $new->addFullDiscussion($discussion);
         }
         return $new;
     }
 }
Esempio n. 12
0
 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);
 }
Esempio n. 13
0
function drawPage(&$node)
{
    global $media_dir, $jinzora_skin, $hierarchy, $album_name_truncate, $row_colors, $img_download, $img_more, $img_email, $img_play, $img_random_play, $img_rate, $img_discuss, $num_other_albums, $root_dir, $enable_ratings, $short_date, $jzUSER, $img_play_dis, $img_random_play_dis, $img_download_dis, $show_similar, $show_radio, $jzSERVICES, $show_album_art, $this_page, $num_track_cols;
    // Let's setup the new display object
    $display =& new jzDisplay();
    $blocks =& new jzBlocks();
    $fe =& new jzFrontend();
    $parent = $node->getAncestor("artist");
    handleFrontendOverrides();
    ?>
	

		  <table width="100%" cellpadding="5" cellspacing="0" border="0">
		     <tr>
		     <td>
		     <table width="100%" cellpadding="3" cellspacing="0" border="0">
		     <?php 
    $colwidth = floor(100 / $num_track_cols);
    $tracks = $node->getSubNodes('tracks', -1);
    $c = 1;
    $c2 = 0;
    echo '<tr><td class="jz_nj_block_body" colspan="2">';
    $artist = $tracks[0]->getAncestor("artist");
    if ($artist) {
        $display->playButton($artist);
        echo " ";
        $display->link($artist, $artist->getName());
    } else {
        echo $meta['artist'];
    }
    echo "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
    $display->playButton($node);
    echo " ";
    $display->link($node, $node->getName());
    ?>
		  </td></tr>
		  <tr>
		     <td class="jz_block_td" colspan="<?php 
    echo $num_track_cols;
    ?>
" nowrap>
		     <strong>Track Names</strong>
		     </td>
		     </tr>
		     
		     <form name="tracklist" method="POST" action="<?php 
    echo urlize(array());
    ?>
">
		     <input type="hidden" name="<?php 
    echo jz_encode("action");
    ?>
" value="<?php 
    echo jz_encode("mediaAction");
    ?>
">
		     <input type="hidden" name="<?php 
    echo jz_encode("jz_path");
    ?>
" value="<?php 
    echo htmlentities(jz_encode($node->getPath("String")));
    ?>
">
		     <input type="hidden" name="<?php 
    echo jz_encode("jz_list_type");
    ?>
" value="<?php 
    echo jz_encode("tracks");
    ?>
">
		     <input type="hidden" name="<?php 
    echo jz_encode("sendList");
    ?>
" value="<?php 
    echo jz_encode("true");
    ?>
">
		     <input type="hidden" name="randomize" value="false">
		     <?php 
    foreach ($tracks as $track) {
        $meta = $track->getMeta();
        $c = 2;
        if ($c2 % $num_track_cols == 0) {
            if ($c2 > 0) {
                echo '</tr>';
            }
            echo '<tr>';
        }
        echo '<td class="jz_nj_block_body" width="' . $colwidth . '%">';
        $display->playButton($track);
        echo " ";
        $dispname = '';
        $meta = $track->getMeta();
        if (!isNothing($meta['number'])) {
            $dispname .= $meta['number'] . ' ';
        }
        $dispname .= $track->getName();
        $display->playLink($track, $dispname, "Play " . $track->getName());
        echo '</td>';
        $c2++;
        if ($c2 % $num_track_cols == 0) {
            echo '</tr>';
        }
    }
    while ($c2 % $num_track_cols != 0) {
        $c2++;
        echo '<td class="jz_nj_block_body">&nbsp;</td>';
    }
    ?>
		     </tr>
		     </table>
			 </form>
			 </td>
			 </tr>
			 </table>
			 
			 <?php 
}
Esempio n. 14
0
function userManSettings($purpose, $settings = false, $subaction = false, $post = false)
{
    global $jzSERVICES, $resampleRates, $include_path;
    $be = new jzBackend();
    $display = new jzDisplay();
    $url_array = array();
    $url_array['action'] = "popup";
    $url_array['ptype'] = "usermanager";
    if ($subaction === false) {
        $url_array['subaction'] = "handleclass";
    } else {
        $url_array['subaction'] = $subaction;
    }
    // Why PHP pisses me off.
    foreach ($settings as $k => $v) {
        if ($v == "true") {
            $settings[$k] = true;
        } else {
            if ($v == "false") {
                $settings[$k] = false;
            } else {
                $settings[$k] = $v;
            }
        }
    }
    ?>
      <form method="POST" action="<?php 
    echo urlize($url_array);
    ?>
">
	 <input type="hidden" name="update_settings" value="true">
	 <?php 
    if (is_array($post)) {
        foreach ($post as $p => $v) {
            echo '<input type="hidden" name="' . $p . '" value="' . $v . '">';
        }
    }
    ?>
	 <table>
	 <?php 
    if ($purpose != "custom") {
        ?>
	 <tr><td width="30%" valign="top" align="right">
	 <?php 
        echo word("Template:");
        ?>
	 </td><td width="70%">
	     <?php 
        if ($purpose == "new") {
            ?>
	       <input name="classname" class="jz_input">
	       <?php 
        } else {
            if ($purpose == "update") {
                echo '<input type="hidden" name="classname" class="jz_input" value="' . $_POST['classname'] . '">';
                echo $_POST['classname'];
            }
        }
        ?>
	     </td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr>
					   <?php 
    }
    ?>
							<tr>
							<td width="30%" valign="top" align="right">
							<?php 
    echo word("Interface");
    ?>
:
	       </td>
		   <td width="70%">
		   <?php 
    $overCode = $display->returnToolTip(word("INTERFACE_NOTE"), word("Default Interface"));
    ?>
		   <select <?php 
    echo $overCode;
    ?>
 name="usr_interface" class="jz_select" style="width:135px;">
			 <?php 
    // Let's get all the interfaces
    $retArray = readDirInfo($include_path . "frontend/frontends", "dir");
    sort($retArray);
    for ($i = 0; $i < count($retArray); $i++) {
        echo '<option ';
        if ($settings['frontend'] == $retArray[$i]) {
            echo 'selected ';
        }
        echo 'value="' . $retArray[$i] . '">' . $retArray[$i] . '</option>' . "\n";
    }
    ?>
			</select>
			</td>
			</tr>
			<tr>
			<td width="30%" valign="top" align="right">
			<?php 
    echo word("Theme");
    ?>
:
			</td>
			<td width="70%">
			<?php 
    $overCode = $display->returnToolTip(word("THEME_NOTE"), word("Default Theme"));
    ?>
			<select <?php 
    echo $overCode;
    ?>
 name="usr_theme" class="jz_select" style="width:135px;">
			<?php 
    // Let's get all the interfaces
    $retArray = readDirInfo($include_path . "style", "dir");
    sort($retArray);
    for ($i = 0; $i < count($retArray); $i++) {
        if ($retArray[$i] == "images") {
            continue;
        }
        echo '<option ';
        if ($settings['theme'] == $retArray[$i]) {
            echo 'selected ';
        }
        echo 'value="' . $retArray[$i] . '">' . $retArray[$i] . '</option>' . "\n";
    }
    ?>
			</select>
			</td>
			</tr>
			<tr>
			<td width="30%" valign="top" align="right">
			<?php 
    echo word("Language");
    ?>
:
			</td>
			<td width="70%">
			<?php 
    $overCode = $display->returnToolTip(word("LANGUAGE_NOTE"), word("Default Language"));
    ?>
			<select <?php 
    echo $overCode;
    ?>
 name="usr_language" class="jz_select" style="width:135px;">
			<?php 
    // Let's get all the interfaces
    $languages = getLanguageList();
    for ($i = 0; $i < count($languages); $i++) {
        echo '<option ';
        if ($languages[$i] == $settings['language']) {
            echo ' selected ';
        }
        echo 'value="' . $languages[$i] . '">' . $languages[$i] . '</option>' . "\n";
    }
    ?>
							</select>
							    </td>
							    </tr>
							    <tr>
							    <td width="30%" valign="top" align="right">
							    <?php 
    echo word("Home Directory");
    ?>
:
							  </td>
							    <td width="70%">
								<?php 
    $overCode = $display->returnToolTip(word("HOMEDIR_NOTE"), word("User Home Directory"));
    ?>
							    <input <?php 
    echo $overCode;
    ?>
 type="input" name="home_dir" class="jz_input" value="<?php 
    echo $settings['home_dir'];
    ?>
">
							    </td>
							    </tr>
							    <tr>
							    <td width="30%" valign="middle" align="right">
							    <?php 
    echo word("Home Permissions");
    ?>
:
							  </td>
							    <td width="70%">
							    <br>
								<?php 
    $overCode = $display->returnToolTip(word("HOMEREAD_NOTE"), word("Read Home Directory"));
    $overCode2 = $display->returnToolTip(word("HOMEADMIN_NOTE"), word("Admin Home Directory"));
    $overCode3 = $display->returnToolTip(word("HOMEUPLOAD_NOTE"), word("Home Directory Upload"));
    ?>
							    <input <?php 
    echo $overCode;
    ?>
 type="checkbox" name="home_read" class="jz_input" <?php 
    if ($settings['home_read'] == true) {
        echo 'CHECKED';
    }
    ?>
> Read only from home directory<br>
							    <input <?php 
    echo $overCode2;
    ?>
 type="checkbox" name="home_admin" class="jz_input" <?php 
    if ($settings['home_admin'] == true) {
        echo 'CHECKED';
    }
    ?>
> Home directory admin<br>
							    <input <?php 
    echo $overCode3;
    ?>
 type="checkbox" name="home_upload" class="jz_input" <?php 
    if ($settings['home_upload'] == true) {
        echo 'CHECKED';
    }
    ?>
> Upload to home directory
							    <br><br>
							    </td>
							    </tr>
							    
							    <tr>
							    <td width="30%" valign="middle" align="right">
							    <?php 
    echo word("User Rights");
    ?>
:
							  </td>
							    <td width="70%">
								<?php 
    $overCode = $display->returnToolTip(word("VIEW_NOTE"), word("User can view media"));
    $overCode2 = $display->returnToolTip(word("STREAM_NOTE"), word("User can stream media"));
    $overCode3 = $display->returnToolTip(word("LOFI_NOTE"), word("User can access lo-fi tracks"));
    $overCode4 = $display->returnToolTip(word("DOWNLOAD_NOTE"), word("User can download"));
    $overCode5 = $display->returnToolTip(word("POWERSEARCH_NOTE"), word("User can power search"));
    $overCode6 = $display->returnToolTip(word("JUKEBOXQ_NOTE"), word("User can queue jukebox"));
    $overCode7 = $display->returnToolTip(word("JUKEBOXADMIN_NOTE"), word("User can admin jukebox"));
    $overCode8 = $display->returnToolTip(word("SITE_NOTE"), word("Site Admin"));
    $overCode9 = $display->returnToolTip(word("EDIT_NOTE"), word("Edit Preferences"));
    $overCode10 = $display->returnToolTip(word("FORCE_CLIPS_NOTE"), word("Force clip mode"));
    ?>
							    <input <?php 
    echo $overCode;
    ?>
 type="checkbox" name="view" class="jz_input" <?php 
    if ($settings['view'] == true) {
        echo 'CHECKED';
    }
    ?>
> View
							    <input <?php 
    echo $overCode2;
    ?>
 type="checkbox" name="stream" class="jz_input" <?php 
    if ($settings['stream'] == true) {
        echo 'CHECKED';
    }
    ?>
> Stream
							    <input <?php 
    echo $overCode3;
    ?>
 type="checkbox" name="lofi" class="jz_input" <?php 
    if ($settings['lofi'] == true) {
        echo 'CHECKED';
    }
    ?>
> Lo-Fi<br>
							    <input <?php 
    echo $overCode4;
    ?>
 type="checkbox" name="download" class="jz_input" <?php 
    if ($settings['download'] == true) {
        echo 'CHECKED';
    }
    ?>
> Download
							    <input <?php 
    echo $overCode5;
    ?>
 type="checkbox" name="powersearch" class="jz_input" <?php 
    if ($settings['powersearch'] == true) {
        echo 'CHECKED';
    }
    ?>
> Power Search<br>
							    <input <?php 
    echo $overCode6;
    ?>
 type="checkbox" name="jukebox_queue" class="jz_input" <?php 
    if ($settings['jukebox_queue'] == true) {
        echo 'CHECKED';
    }
    ?>
> Jukebox Queue
							    <input <?php 
    echo $overCode7;
    ?>
 type="checkbox" name="jukebox_admin" class="jz_input" <?php 
    if ($settings['jukebox_admin'] == true) {
        echo 'CHECKED';
    }
    ?>
> Jukebox Admin<br>
							    <input <?php 
    echo $overCode8;
    ?>
 type="checkbox" name="admin" class="jz_input" <?php 
    if ($settings['admin'] == true) {
        echo 'CHECKED';
    }
    ?>
> Site Admin
						        <input <?php 
    echo $overCode9;
    ?>
 type="checkbox" name="edit_prefs" class="jz_input" <?php 
    if ($settings['edit_prefs'] == true) {
        echo 'CHECKED';
    }
    ?>
> Edit Prefs
                                                        <input <?php 
    echo $overCode10;
    ?>
 type="checkbox" name="force_clips" class="jz_input" <?php 
    if ($settings['force_clips'] == true) {
        echo 'CHECKED';
    }
    ?>
> Clips Only
																										    <br><br>
							    </td>
							    </tr>
							    <tr>
								<td width="30%" valign="top" align="right">
							    <?php 
    echo word("Playlist Type");
    ?>
:
								</td><td width="70%">
								<?php 
    $overCode = $display->returnToolTip(word("PLAYLIST_NOTE"), word("Playlist Type"));
    ?>
								<select <?php 
    echo $overCode;
    ?>
 name="pltype" class="jz_select" style="width:135px;">
							 <?php 
    $list = $jzSERVICES->getPLTypes();
    foreach ($list as $p => $desc) {
        echo '<option value="' . $p . '"';
        if ($p == $settings['playlist_type']) {
            echo ' selected';
        }
        echo '>' . $desc . '</option>';
    }
    ?>
				    </select></td></tr>

							    <tr>
							    <td width="30%" valign="top" align="right">
							    <?php 
    echo word("Resample Rate");
    ?>
:
							  </td>
					<td width="70%">
					<?php 
    $overCode = $display->returnToolTip(word("RESAMPLE_NOTE"), word("Resample Rate"));
    $overCode2 = $display->returnToolTip(word("LOCK_NOTE"), word("Resample Rate Lock"));
    ?>
						<select <?php 
    echo $overCode;
    ?>
 name="resample" class="jz_select" style="width:50px;">
							<option value="">-</option>
							<?php 
    // Now let's create all the items based on their settings
    $reArr = explode("|", $resampleRates);
    for ($i = 0; $i < count($reArr); $i++) {
        echo '<option value="' . $reArr[$i] . '"';
        if ($settings['resample_rate'] == $reArr[$i]) {
            echo ' selected';
        }
        echo '>' . $reArr[$i] . '</option>' . "\n";
    }
    ?>
						</select> 
						    <input <?php 
    echo $overCode2;
    ?>
 type="checkbox" name="lockresample" class="jz_input" <?php 
    if ($settings['resample_lock'] == true) {
        echo 'CHECKED';
    }
    ?>
> <?php 
    echo word('Locked');
    ?>
					</td>
				</tr>
				<tr>
					<td width="30%" valign="top" align="right">
						<?php 
    echo word("External Player");
    ?>
:
					</td>
					<td width="70%">
						<?php 
    $overCode = $display->returnToolTip(word("PLAYER_NOTE"), word("External Player"));
    ?>
						<select <?php 
    echo $overCode;
    ?>
 name="player" class="jz_select" style="width:135px;">
							<option value=""> - </option>
							<?php 
    // Let's get all the interfaces
    $retArray = readDirInfo($include_path . "services/services/players", "file");
    sort($retArray);
    for ($i = 0; $i < count($retArray); $i++) {
        if (!stristr($retArray[$i], ".php") and !stristr($retArray[$i], "qt.")) {
            continue;
        }
        $val = substr($retArray[$i], 0, -4);
        echo '<option value="' . $val . '"';
        if ($settings['player'] == $val) {
            echo ' selected';
        }
        echo '>' . $val . '</option>' . "\n";
    }
    ?>
						</select>
					</td>
				</tr>
				<tr>
					<td width="30%" valign="top" align="right">
						<?php 
    echo word("Playback Limit");
    ?>
:
					</td>
					<td width="70%"><td></tr><tr><td></td><td>
					    <table><tr><td>
					    
						<?php 
    echo word("Limit:");
    echo '</td><td>';
    $overCode = $display->returnToolTip(word("Sets a streaming limit for users based on the size or number of songs played."), word("Playback Limit"));
    $cap_limit = $settings['cap_limit'];
    if (isNothing($cap_limit)) {
        $cap_limit = 0;
    }
    ?>
					        <input <?php 
    echo $overCode;
    ?>
 name="cap_limit" class="jz_select" style="width:35px;" value="<?php 
    echo $cap_limit;
    ?>
">
					</td></tr>
                                        <tr><td>					    
						<?php 
    echo word("Method:");
    echo '</td><td>';
    $overCode = $display->returnToolTip(word("Sets the method for limiting playback"), word("Limiting method"));
    $cap_method = $settings['cap_method'];
    ?>
					        <select name="cap_method" class="jz_select" <?php 
    echo $overCode;
    ?>
>
					       <option value="size"<?php 
    if ($cap_method == "size") {
        echo ' selected';
    }
    ?>
><?php 
    echo word('Size (MB)');
    ?>
</option>
					       <option value="number"<?php 
    if ($cap_method == "number") {
        echo ' selected';
    }
    ?>
><?php 
    echo word('Number');
    ?>
</option>
					</td></tr>
                                        <tr><td>
					    
						<?php 
    echo word("Duration:");
    echo '</td><td>';
    $overCode = $display->returnToolTip(word("How long the limit lasts, in days."), word("Limit duration"));
    $cap_duration = $settings['cap_duration'];
    if (isNothing($cap_duration)) {
        $cap_duration = 30;
    }
    ?>
					        <input <?php 
    echo $overCode;
    ?>
 name="cap_duration" class="jz_select" style="width:35px;" value="<?php 
    echo $cap_duration;
    ?>
">
					</td></tr>
										  </table>
				</tr>
								
				
				<tr>
					<td width="30%" valign="top">
					</td>
					<td width="70%">
					<input type="submit" name="handlUpdate" value="<?php 
    echo word("Save");
    ?>
" class="jz_submit">
					</td>
				</tr>
						    </table>
<?php 
}
Esempio n. 15
0
/**
 * Gets the track title from
 * its ID.
 */
function idToName($id)
{
    $track = new jzMediaTrack($id, 'id');
    $meta = $track->getMeta();
    $title = '';
    if (!isNothing($meta['artist'])) {
        $title .= $meta['artist'];
    }
    if (!isNothing($meta['title'])) {
        if (!isNothing($title)) {
            $title .= ' - ';
        }
        $title .= $meta['title'];
    }
    if (isNothing($title)) {
        $title = $track->getName();
    }
    return $title;
}
Esempio n. 16
0
 /**
  * Returns the track's metadata as an array with the following keys:
  *
  * title
  * bitrate
  * frequency
  * filename [excluding path]
  * size
  * year
  * comment
  * length
  * length_str
  * number
  * genre
  * artist
  * album
  * lyrics
  * type [extension]
  * 
  * These are taken mostly from the ID3.
  *
  * @author Ben Dodson
  * @version 6/7/04
  * @since 6/7/04
  */
 function getMeta($mode = "cache", $installer = false)
 {
     global $track_num_seperator, $root_dir, $web_root, $include_path, $jzSERVICES;
     $meta = array();
     $cache = $this->readCache();
     if ($mode == "cache" && $this->meta != array()) {
         return $this->meta;
     }
     if ($mode == "cache") {
         $meta['title'] = $cache[7];
         $meta['bitrate'] = $cache[20];
         $meta['frequency'] = $cache[8];
         $meta['filename'] = $cache[2];
         $meta['size'] = $cache[13];
         $meta['year'] = $cache[11];
         $meta['comment'] = $cache[9] == "-" ? "" : $cache[9];
         $meta['length'] = $len = $cache[14];
         $meta['number'] = $cache[21];
         $meta['genre'] = $cache[15];
         $meta['artist'] = $cache[16];
         $meta['album'] = $cache[17];
         $meta['lyrics'] = $cache[19] == "" || $cache[19] == "-" ? "" : $cache[19];
         $meta['type'] = $cache[18];
         if (isNothing($meta['type'])) {
             $meta = $this->getMeta("file");
             $this->setMeta($meta, "cache");
         }
     } else {
         // Get it from the file.
         // other backend functions use this to get the id3 before the file is cached.
         if ($mode == "direct") {
             $fname = $this->getPath("String");
         } else {
             $fname = $this->getFileName("host");
         }
         // Do our services exist?
         if (!$jzSERVICES) {
             include_once $include_path . 'services/class.php';
             $jzSERVICES = new jzServices();
             $jzSERVICES->loadStandardServices();
         }
         // Let's setup our tagdata service and return the tag data
         $meta = $jzSERVICES->getTagData($fname, $installer);
     }
     return $meta;
 }
Esempio n. 17
0
function drawPage(&$node)
{
    global $media_dir, $jinzora_skin, $hierarchy, $album_name_truncate, $row_colors, $img_download, $img_more, $img_email, $img_play, $img_random_play, $img_rate, $img_discuss, $num_other_albums, $root_dir, $enable_ratings, $short_date, $jzUSER, $img_play_dis, $img_random_play_dis, $img_download_dis, $show_similar, $show_radio, $jzSERVICES, $show_album_art, $this_page;
    // Let's setup the new display object
    $display =& new jzDisplay();
    $blocks =& new jzBlocks();
    $fe =& new jzFrontend();
    $parent = $node->getAncestor("artist");
    ?>
			
		<table width="100%" cellpadding="5" cellspacing="0" border="0">
			<tr>
				<td>
					<table width="100%" cellpadding="5" cellspacing="0" border="0">
						<tr>
							<td class="jz_block_td" nowrap colspan="4">
								<strong>SEARCH RESULTS AND OPTIONS</strong>
							</td>
						</tr>
						<tr>
							<?php 
    if (($art = $node->getMainArt("100x100")) !== false) {
        echo '<td width="1%" class="jz_nj_block_body" align="center" rowspan="2">';
        $display->playLink($node, $display->returnImage($art, $node->getName(), 100, 100, "fit"));
        echo '</td>';
    }
    ?>
							<td width="33%" class="jz_nj_block_body" align="center">
								<?php 
    echo $node->getSubNodeCount();
    ?>
 Track(s) Found.
							</td>
							<td width="33%" class="jz_nj_block_body" align="center">
								Page 1 of 1
							</td>
							<td width="33%" class="jz_nj_block_body" align="center">
								<?php 
    $stats = $node->getStats();
    echo $stats['total_length_str'];
    echo " for ";
    echo $stats['total_size_str'];
    ?>
							</td>
						</tr>
						<tr>
							<td width="25%" class="jz_nj_block_body" align="center">
								<a onClick="CheckBoxes('tracklist',true);" href="javascript:void()">Select All</a>
							</td>
							<td width="25%" class="jz_nj_block_body" align="center">
								<a onClick="CheckBoxes('tracklist',false);" href="javascript:void()">Release All</a>
							</td>
							<td width="25%" class="jz_nj_block_body" align="center">
									<a onClick="document.tracklist.randomize.value = 'false'; <?php 
    echo $display->embeddedFormHandler('tracklist');
    ?>
 document.tracklist.submit();" href="javascript:void()"><?php 
    echo word('Play');
    ?>
</a>
									 | 
									<a onClick="document.tracklist.randomize.value = 'true';  <?php 
    echo $display->embeddedFormHandler('tracklist');
    ?>
 document.tracklist.submit();" href="javascript:void()"><?php 
    echo word('Randomize');
    ?>
</a>
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		
		<table width="100%" cellpadding="5" cellspacing="0" border="0">
			<tr>
				<td>
					<table width="100%" cellpadding="5" cellspacing="0" border="0">
						<tr>
							<td width="25%" class="jz_nj_block_body" style="border-top: 1px solid black;">&nbsp;
							
							</td>
							<td width="25%" align="center" class="jz_nj_block_body" style="border-top: 1px solid black;">
								<a href="#pageBottom">To Bottom</a>
							</td>
							<td width="25%" class="jz_nj_block_body" style="border-top: 1px solid black;">&nbsp;
								
							</td>
							<td width="25%" class="jz_nj_block_body" style="border-top: 1px solid black;">&nbsp;
							
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>

		<table width="100%" cellpadding="5" cellspacing="0" border="0">
			<tr>
				<td>
					<table width="100%" cellpadding="3" cellspacing="0" border="0">
						<tr>
							<td class="jz_block_td" nowrap>
								<strong>Options</strong>
							</td>
							<td class="jz_block_td" nowrap>
								<strong>Track Name</strong>
							</td>
							<td class="jz_block_td" nowrap>
								<strong>Time</strong>
							</td>
							<td class="jz_block_td" nowrap>
								<strong>Artist</strong>
							</td>
							<td class="jz_block_td" nowrap>
								<strong>Album</strong>
							</td>
							<td class="jz_block_td" nowrap align="center">
								<strong>#</strong>
							</td>
							<td class="jz_block_td" nowrap>
								<strong>Genre</strong>
							</td>
						</tr>
						
						<form name="tracklist" method="POST" action="<?php 
    echo urlize(array());
    ?>
">
						<input type="hidden" name="<?php 
    echo jz_encode("action");
    ?>
" value="<?php 
    echo jz_encode("mediaAction");
    ?>
">
						<input type="hidden" name="<?php 
    echo jz_encode("jz_path");
    ?>
" value="<?php 
    echo htmlentities(jz_encode($node->getPath("String")));
    ?>
">
						<input type="hidden" name="<?php 
    echo jz_encode("jz_list_type");
    ?>
" value="<?php 
    echo jz_encode("tracks");
    ?>
">
							    <input type="hidden" name="<?php 
    echo jz_encode("sendList");
    ?>
" value="<?php 
    echo jz_encode("true");
    ?>
">
							    <input type="hidden" name="randomize" value="false">
						<?php 
    $tracks = $node->getSubNodes('tracks', -1);
    foreach ($tracks as $track) {
        $meta = $track->getMeta();
        echo '<tr><td nowrap width="1%" class="jz_nj_block_body" valign="top">';
        echo '<input type="checkbox" name="jz_list[]" value="' . jz_encode($track->getPath("String")) . '" style="width:10px;height:10px;">';
        $display->playButton($track);
        echo " ";
        $display->downloadButton($track);
        echo '</td><td class="jz_nj_block_body" >';
        $display->playLink($track, $track->getName(), "Play " . $track->getName());
        echo '</td><td width="1%" class="jz_nj_block_body" align="center">';
        echo convertSecMins($meta['length']);
        echo '</td><td class="jz_nj_block_body" >';
        $artist = $track->getAncestor("artist");
        if ($artist) {
            $display->playButton($artist);
            echo " ";
            $display->randomPlayButton($artist);
            echo " ";
            $display->link($artist, $artist->getName());
        } else {
            echo $meta['artist'];
        }
        echo '</td><td class="jz_nj_block_body" >';
        $display->playButton($node);
        echo " ";
        $display->randomPlayButton($node);
        echo " ";
        $display->downloadButton($node);
        echo " ";
        $display->link($node, $node->getName());
        echo '</td><td nowrap width="1%" align="center" class="jz_nj_block_body" >';
        echo $meta['number'];
        echo '</td><td class="jz_nj_block_body" >';
        if ($artist === false) {
            $genre = false;
        } else {
            $genre = $artist->getAncestor("genre");
        }
        if ($genre) {
            $display->playButton($genre);
            echo " ";
            $display->randomPlayButton($genre);
            echo " ";
            $display->link($genre, $genre->getName());
        } else {
            if (!isNothing($meta['genre'])) {
                echo $meta['genre'];
            } else {
                echo '&nbsp;';
            }
        }
        echo '</td></tr>';
    }
    ?>
					</table>
					</form>
				</td>
			</tr>
		</table>

		<table width="100%" cellpadding="5" cellspacing="0" border="0">
			<tr>
				<td>
					<table width="100%" cellpadding="5" cellspacing="0" border="0">
						<tr>
							<td width="25%" class="jz_nj_block_body" style="border-top: 1px solid black;">&nbsp;
							
							</td>
							<td width="25%" align="center" class="jz_nj_block_body" style="border-top: 1px solid black;">
								<a href="#pageTop">To Top</a>
							</td>
							<td width="25%" class="jz_nj_block_body" style="border-top: 1px solid black;">&nbsp;
								
							</td>
							<td width="25%" class="jz_nj_block_body" style="border-top: 1px solid black;">&nbsp;
							
							</td>
						</tr>
					</table>
				</td>
			</tr>
		</table>
		<?php 
}
Esempio n. 18
0
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, $enable_ratings, $truncate_artist_description, $sort_by_year, $cms_mode;
    $display =& new jzDisplay();
    $blocks =& new jzBlocks();
    $fe =& new jzFrontend();
    // 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; }
    $nodes = $node->getSubNodes("nodes");
    $tracks = $node->getSubNodes("tracks");
    echo '<br>';
    $blocks->blockBodyOpen();
    // Now let's setup the big table to display everything
    ?>
		<table width="100%" cellpadding="0" cellspacing="0" border="0">
			<tr>
				<td width="100%" valign="top" colspan="2">
					<?php 
    // Now let's include the menu system for the artist
    // First we'll need to setup some variables
    $play_all_artist = $display->link($node, false, false, false, true, true, false, true);
    $play_all_artist_rand = $display->link($node, false, false, false, true, true, true, true);
    $artist = $node->getName();
    // Now let's inlucde the artist menu
    include_once $include_path . "frontend/menus/artist-menu.php";
    ?>
				</td>
			</tr>
			<tr><td width="100%" valign="top" colspan="2" height="5"></td></tr>
			<tr>
				<td width="35%" valign="top">
					<!-- Let's show the albums -->
					<?php 
    // First let's sort this up
    if ($sort_by_year == "true") {
        sortElements($nodes, "year");
    } else {
        sortElements($nodes, "name");
    }
    foreach ($nodes as $child) {
        $display->playButton($child);
        $display->randomPlayButton($child);
        if ($enable_ratings == "true") {
            $display->rateButton($child);
        }
        echo '<input type="checkbox">';
        echo '&nbsp;';
        $year = $child->getYear();
        $dispYear = "";
        if (!isNothing($year)) {
            $dispYear = " (" . $year . ")";
        }
        $display->link($child, $display->returnShortName($child->getName(), $album_name_truncate) . $dispYear, $child->getName() . $dispYear);
        // *******************************
        // Need to know how to return NEW information HERE
        // *******************************
        echo "<br>";
    }
    include_once $include_path . 'frontend/frontends/classic/general.php';
    //displayArtistPLBar();
    echo "<br>";
    // Now let's show the art
    if (($art = $node->getMainArt('200x200')) !== false) {
        $display->image($art, $node->getName(), 200, 200, "limit", false, false, "left", "5", "5");
    }
    // Now let's show the description
    if ($cms_mode == "false") {
        echo '<span class="jz_artistDesc">';
    }
    $desc = $node->getDescription();
    echo $display->returnShortName($desc, $truncate_artist_description);
    if (strlen($desc) > $truncate_artist_description) {
        $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 '</span>';
    }
    ?>
				</td>
				<td width="65%" valign="top">
					<!-- Let's show the art -->
					<?php 
    // Ok, now let's set our table for the art
    echo '<table width="100%" cellpadding="5" cellspacing="0" border="0">';
    $c = 0;
    foreach ($nodes as $child) {
        $year = $child->getYear();
        $dispYear = "";
        if (!isNothing($year)) {
            $dispYear = " (" . $year . ")";
        }
        // Now let's see if we should start a row
        if ($c == 0) {
            echo '</tr><tr>';
        }
        // Now let's display the data
        echo '<td width="50%" align="center"><center>';
        if (($art = $child->getMainArt('200x200')) !== false) {
        } else {
            // TODO: Create the default image here IF they want it
            $art = "style/images/default.jpg";
        }
        $display->link($child, $display->returnShortName($child->getName(), $album_name_truncate) . $dispYear, $child->getName() . $dispYear, "jz_artist_album");
        echo '<br>';
        $display->link($child, $display->returnImage($art, $child->getName(), 200, false, "fit", false, false, false, false, false, "0", "jz_album_cover_picture"), $child->getName() . $dispYear);
        echo '<br><br></center></td>';
        // Now let's increment so we'll know where to make the table
        $c++;
        if ($c == 2) {
            $c = 0;
        }
    }
    echo '</table>';
    ?>
			
				</td>
			</tr>
		</table>
		<br>
		<?php 
    $blocks->trackTable($tracks, false);
    $blocks->blockBodyClose();
    echo '<br>';
}
Esempio n. 19
0
 // LYRICS SCAN:
 case "scan_lyrics":
     if (isset($argv[2])) {
         $node = new jzMediaNode($argv[2]);
     } else {
         $node = new jzMediaNode();
     }
     $tracks = $node->getSubNodes("tracks", -1);
     $nfound = 0;
     $nmissed = 0;
     $nskipped = 0;
     foreach ($tracks as $track) {
         $meta = $track->getMeta();
         if (isNothing($meta['lyrics'])) {
             $lyrics = $jzSERVICES->getLyrics($track);
             if (!isNothing($lyrics)) {
                 echo 'FOUND: ' . $track->getPath("String") . "\n";
                 $meta['lyrics'] = $lyrics;
                 $nfound++;
                 $track->setMeta($meta);
             } else {
                 echo 'NO MATCH: ' . $track->getPath("String") . "\n";
                 $nmissed++;
             }
         } else {
             echo 'SKIPPING: ' . $track->getPath("String") . "\n";
             $nskipped++;
         }
     }
     echo 'Found: ' . $nfound . "\n";
     echo 'Not Found: ' . $nmissed . "\n";
Esempio n. 20
0
<?php

$smarty = smartySetup();
$display = new jzDisplay();
$desc = $node->getDescription();
if (isNothing($desc)) {
    return false;
}
if ($desc_truncate === false) {
    $desc_truncate = 700;
}
$smarty->assign('description', $display->returnShortName($desc, $desc_truncate));
$smarty->assign('read_more', "");
if (strlen($desc) > $desc_truncate) {
    $url_array = array();
    $url_array['jz_path'] = $node->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;">...read more</a>');
}
jzTemplate($smarty, 'description');
Esempio n. 21
0
 /**
  * Returns the track's metadata as an array with the following keys:
  *
  * title
  * bitrate
  * frequency
  * filename [excluding path]
  * size
  * year
  * comment
  * length
  * number
  * genre
  * artist
  * album
  * lyrics
  * type [extension]
  * 
  * These are taken mostly from the ID3.
  *
  * @author
  * @version
  * @since
  */
 function getMeta($mode = "cache")
 {
     global $sql_type, $sql_pw, $sql_usr, $sql_socket, $sql_db, $media_dirs;
     if ($mode == "cache" && $this->meta != array()) {
         return $this->meta;
     }
     if ($mode == "cache") {
         $meta = array();
         if (!($link = jz_db_connect())) {
             die("could not connect to database.");
         }
         $path = jz_db_escape($this->getPath("String"));
         $results = jz_db_query($link, "SELECT jz_tracks.*,jz_nodes.name,jz_nodes.descr FROM jz_tracks,jz_nodes \n\t\t\t\tWHERE jz_nodes.path = '{$path}' AND jz_nodes.path = jz_tracks.path");
         $meta['title'] = jz_db_unescape($results->data[0]['trackname']);
         $meta['bitrate'] = jz_db_unescape($results->data[0]['bitrate']);
         $meta['frequency'] = jz_db_unescape($results->data[0]['frequency']);
         $meta['filename'] = jz_db_unescape($results->data[0]['name']);
         $meta['size'] = jz_db_unescape($results->data[0]['filesize']);
         $meta['year'] = jz_db_unescape($results->data[0]['year']);
         $meta['comment'] = jz_db_unescape($results->data[0]['descr']);
         $meta['length'] = jz_db_unescape($results->data[0]['length']);
         $meta['number'] = jz_db_unescape($results->data[0]['number']);
         $meta['genre'] = jz_db_unescape($results->data[0]['genre']);
         $meta['artist'] = jz_db_unescape($results->data[0]['artist']);
         $meta['album'] = jz_db_unescape($results->data[0]['album']);
         $meta['lyrics'] = jz_db_unescape($results->data[0]['lyrics']);
         $meta['type'] = jz_db_unescape($results->data[0]['extension']);
         // Now let's get the ID
         $pArr = $this->getPath();
         unset($pArr[count($pArr) - 1]);
         $path = implode("/", $pArr);
         if (is_file($media_dirs . "/" . $path . "/album.id")) {
             $meta['id'] = file_get_contents($media_dirs . "/" . $path . "/album.id");
         }
         if (isNothing($meta['type'])) {
             $meta = parent::getMeta("file");
             $this->setMeta($meta, "cache");
         }
         if (isNothing($meta['artist'])) {
             $mnode = $this->getAncestor("artist");
             if ($mnode !== false) {
                 $meta['artist'] = $mnode->getName();
             }
         }
         if (isNothing($meta['length'])) {
             $meta['length'] = '';
         }
         return $meta;
     } else {
         return parent::getMeta($mode);
     }
 }
Esempio n. 22
0
    function trackTable($tracks, $purpose = false)
    {
        global $media_dir, $jinzora_skin, $hierarchy, $album_name_truncate, $row_colors, $img_more, $img_email, $img_rate, $img_discuss, $num_other_albums, $enable_ratings, $this_site, $allow_clips, $root_dir, $jzUSER, $hide_id3_comments, $max_song_length, $enable_discussion, $max_song_name_length, $show_lyrics_links, $allow_send_email, $handle_compilations, $video_types, $show_track_numbers;
        if (sizeof($tracks) == 0) {
            return;
        }
        // Let's setup the new display object
        $display =& new jzDisplay();
        $tracks_only = array();
        foreach ($tracks as $track) {
            if (is_object($track)) {
                $tracks_only[] = $track;
            }
        }
        // Now let's see if this is a Audio, Video, or Photo node
        $video = true;
        foreach ($tracks_only as $track) {
            if (!preg_match("/\\.({$video_types})\$/i", $track->getDataPath())) {
                $video = false;
            }
        }
        if ($video) {
            $this->videoTable($tracks_only, $purpose);
            return;
        }
        // Let's figure out our settings:
        // First, set the defaults.
        $showNumbers = false;
        if ($show_track_numbers == "true") {
            $showNumbers = true;
        }
        $showArtist = false;
        $showAlbum = false;
        $showCheck = false;
        $showInfo = false;
        $showEmail = false;
        $showRate = false;
        $showDisc = false;
        $showAlbumNames = false;
        $trackTruncate = false;
        $showPlayCount = false;
        if ($enable_discussion == "true") {
            $showDisc = true;
        }
        $trackTruncate = $max_song_name_length;
        // Now adjust as needed:
        switch ($purpose) {
            case "generic":
                $showNumbers = false;
                break;
            case "album":
                $showCheck = true;
                $showInfo = true;
                $showPlayCount = true;
                $showEmail = true;
                break;
            case "search":
                $showCheck = true;
                $showArtist = true;
                $showInfo = true;
                $showEmail = true;
                $trackTruncate = 100;
                break;
            case "sample":
                // We only want to show album thumbs IF this artist has more than 1 album
                $parent = $tracks_only[0]->getParent();
                $gParent = $parent->getParent();
                $nodes = $gParent->getSubNodes("nodes");
                $showNumbers = false;
                $showAlbum = true;
                break;
            case "sample-all":
                $showNumbers = false;
                $showCheck = true;
                $showAlbumNames = true;
                $trackTruncate = 20;
                break;
        }
        if ($allow_send_email == "false") {
            $showEmail = false;
        }
        // Do we need to start the form
        if ($showCheck) {
            $node = $tracks_only[0]->getParent();
            ?>
			<form name="albumForm" action="<?php 
            echo urlize();
            ?>
" method="POST">
			<input type="hidden" name="<?php 
            echo jz_encode("action");
            ?>
" value="<?php 
            echo jz_encode("mediaAction");
            ?>
">
				<?php 
            if ($purpose != "search") {
                ?>
 
			  <input type="hidden" name="<?php 
                echo jz_encode("jz_path");
                ?>
" value="<?php 
                echo htmlentities(jz_encode($node->getPath("String")));
                ?>
">
				<?php 
            }
            ?>
			<input type="hidden" name="<?php 
            echo jz_encode("jz_list_type");
            ?>
" value="<?php 
            echo jz_encode("tracks");
            ?>
">
			<?php 
        }
        // Now let's setup the big table to display everything
        $i = 0;
        ?>
		  <table class="jz_track_table" width="100%" cellpadding="3" cellspacing="0" border="0">
		 <?php 
        $artists = array();
        if ($handle_compilations == "true") {
            foreach ($tracks_only as $child) {
                $a = $child->getMeta();
                if (!isNothing($a['artist'])) {
                    $artists[$a['artist']] = true;
                }
            }
        } else {
            foreach ($tracks_only as $child) {
                $a = $child->getAncestor('artist');
                if ($a !== false) {
                    $artists[strtoupper($a->getName())] = true;
                }
            }
        }
        if (sizeof($artists) > 1) {
            $multiArtist = true;
        } else {
            $multiArtist = false;
        }
        $first_label = true;
        foreach ($tracks as $child) {
            // is it a header?
            if (is_string($child)) {
                if (!$first_label) {
                    echo '<tr><td colspan="100">&nbsp;</td></tr>';
                }
                echo '<tr><td colspan="100">' . $child . '</td></tr>';
                $first_label = false;
                continue;
            }
            // Let's make sure this isn't a lofi track
            if (substr($child->getPath("String"), -9) == ".lofi.mp3" or substr($child->getPath("String"), -9) == ".clip.mp3") {
                continue;
            }
            // First let's grab all the tracks meta data
            $metaData = $child->getMeta();
            $album = $child->getParent();
            if (findPType($album) == "disk") {
                $album = $album->getParent();
            }
            $gParent = $album->getParent();
            $artist = getInformation($album, "artist");
            ?>
		   <tr class="<?php 
            echo $row_colors[$i];
            ?>
">
		   <?php 
            if ($showCheck and $jzUSER->getSetting('stream')) {
                $value = htmlentities(jz_encode($child->getPath("String")));
                ?>
		   <td width="1%" valign="top" class="jz_track_table_songs_td">
		   <input type="checkbox" name="jz_list[]" value="<?php 
                echo $value;
                ?>
">
		   </td>
		   <?php 
            }
            ?>
		   
		   <td width="99%" valign="top" class="jz_track_table_songs_td" nowrap>
		   	<?php 
            echo $display->playButton($child);
            ?>
			 <?php 
            // Now, is there a lofi version?
            $loFile = substr($child->getDataPath("String"), 0, -4) . ".lofi.mp3";
            if (is_file($loFile) and $jzUSER->getSetting('stream')) {
                $lofi = new jzMediaTrack(substr($child->getPath("String"), 0, -4) . ".lofi.mp3");
                //echo '<td width="1%" valign="top" class="jz_track_table_songs_td">';
                echo $display->lofiPlayButton($lofi);
                //echo '</td>';
            }
            ?>
			   <?php 
            // Now, is there a clip version?
            $loFile = substr($child->getDataPath("String"), 0, -4) . ".clip.mp3";
            if (is_file($loFile) || $allow_clips == "true") {
                //echo '<td width="1%" valign="top" class="jz_track_table_songs_td">';
                echo $display->clipPlayButton($child);
                //echo '</td>';
            }
            ?>
			   
		   <?php 
            echo $display->downloadButton($child);
            ?>
		   <?php 
            // Do they want ratings?
            if ($enable_ratings == "true") {
                $display->rateButton($child);
            }
            if ($showInfo) {
                echo " ";
                $display->infoButton($child);
            }
            if ($showEmail and $jzUSER->getSetting('stream')) {
                $display->emailButton($child);
            }
            ?>
		   <?php 
            if ($showDisc) {
                ?>
		   <a class="jz_track_table_songs_href" href=""><?php 
                $display->displayDiscussIcon($child);
                ?>
</a>
		   <?php 
            }
            ?>
		   <?php 
            if ($showArtist !== false) {
                $j = 0;
                while ($j < sizeof($hierarchy) && $hierarchy[$j] != 'artist') {
                    $j++;
                }
                if ($j < sizeof($hierarchy)) {
                    $parent = $child;
                    while ($parent->getLevel() > $j + 1) {
                        $parent = $parent->getParent();
                    }
                    $display->link($parent, $parent->getName(), $parent->getName(), "jz_track_table_songs_href");
                    echo " / ";
                }
            }
            // This is where we display the name
            if ($multiArtist) {
                if ($handle_compilations == "true") {
                    $artistName = $metaData['artist'];
                    if (isNothing($artistName)) {
                        $artist = $child->getAncestor("artist");
                        if ($artist !== false) {
                            $artistName = $artist->getName();
                        }
                    }
                } else {
                    $artist = $child->getAncestor("artist");
                    if ($artist !== false) {
                        $artistName = $artist->getName();
                    }
                }
                if (isset($artistName)) {
                    $tName = $child->getName();
                    unset($artistName);
                } else {
                    $tName = $child->getName();
                }
            } else {
                $tName = $child->getName();
            }
            if ($trackTruncate) {
                $tName = returnItemShortName($tName, $trackTruncate);
            }
            if ($purpose == "search") {
                $album = $child->getAncestor("album");
                $display->link($album, $album->getName(), $album->getName(), "jz_track_table_songs_href");
                echo " / ";
            }
            if ($showNumbers) {
                echo $metaData['number'] . " -&nbsp;";
            }
            if ($jzUSER->getSetting('stream')) {
                if ($showAlbum) {
                    $descName = $album->getName() . " - " . $child->getName();
                } else {
                    $descName = $child->getName();
                }
                // $tName = $child->getName();
                $display->link($child, $tName, $descName, "jz_track_table_songs_href");
            } else {
                echo $tName;
            }
            // Did they want to see lyrics links?
            if ($show_lyrics_links == "true") {
                if ($metaData['lyrics'] != "") {
                    $urlArr = array();
                    $urlArr['jz_path'] = $child->getPath("String");
                    $urlArr['action'] = "popup";
                    $urlArr['ptype'] = "viewlyricsfortrack";
                    echo '<a href="' . urlize($urlArr) . '" onclick="openPopup(this, 450, 450); return false;"> - ' . word("Lyrics") . '</a>';
                }
            }
            // Now let's show the description if there is one
            if ($short_desc = $child->getShortDescription() and $hide_id3_comments == "false") {
                echo "<br>" . $short_desc;
            }
            if ($description = $child->getDescription()) {
                echo "<br>" . $description;
            }
            // Do they want ratings?
            /*if ($enable_ratings == "true"){
               		//$rating = $display->displayRating($child,true);
            		if ($rating){
            			//echo "<br>". $rating;
            		}
            		//unset($rating);
               }*/
            ?>
		   </td>
		   
		   <?php 
            $lyricsSearch = false;
            if (isset($_POST['search_type'])) {
                if ($_POST['search_type'] == "lyrics") {
                    $lyricsSearch = $_POST['search_query'];
                }
            }
            if (isset($_GET['search_type'])) {
                if ($_GET['search_type'] == "lyrics") {
                    $lyricsSearch = $_GET['search_query'];
                }
            }
            if ($lyricsSearch) {
                // Now let's get the lyrics back
                $lyrics = $child->getLyrics();
                // Now let's parse it out
                $lyrics = str_replace("Lyrics Provided by: Leo's Lyrics\nhttp://www.leoslyrics.com", "", $lyrics);
                $start = strpos(strtolower($lyrics), strtolower($lyricsSearch)) - 20;
                if ($start < 0) {
                    $start = 0;
                }
                $lyrics = "&nbsp; &nbsp; &nbsp; &nbsp;(..." . substr($lyrics, $start, strlen($lyricsSearch) + 40) . "...)";
                $lyrics = highlight($lyrics, $lyricsSearch);
                echo '<td width="6%" align="center" valign="top" class="jz_track_table_songs_td" nowrap>';
                echo $lyrics;
                echo '</td>';
            }
            ?>
		   
		   
		   <?php 
            if ($showAlbumNames) {
                echo '<td width="1%" class="jz_track_table_songs_td" nowrap>';
                $display->link($album, returnItemShortName($album->getName(), 20), $album->getName(), "jz_track_table_songs_href");
                echo '</td>';
            }
            ?>
		   
			<?php 
            if ($showPlayCount) {
                echo '<td width="1%" align="center" valign="top" class="jz_track_table_songs_td" nowrap>';
                if ($child->getPlayCount() != 0) {
                    echo $child->getPlayCount() . " " . word("Plays");
                } else {
                    echo " - ";
                }
                echo '</td>';
            }
            ?>
		   
		   
		   <td width="6%" align="center" valign="top" class="jz_track_table_songs_td" nowrap>
		   &nbsp; <?php 
            echo convertSecMins($metaData['length']);
            ?>
 &nbsp;
		   </td>
		   </tr>
		   <?php 
            $i = 1 - $i;
            unset($gParent);
            unset($album);
        }
        // Now let's set a field with the number of checkboxes that were here
        echo "</table>";
        // Now let's show the playlist bar if we should
        if ($showCheck) {
            $this->blockSpacer();
            $this->playlistBar();
            echo "</form>";
        }
    }
Esempio n. 23
0
function drawPage(&$node)
{
    global $media_dir, $jinzora_skin, $hierarchy, $album_name_truncate, $jzUSER;
    $display =& new jzDisplay();
    $blocks =& new jzBlocks();
    $fe =& new jzFrontend();
    $nodes = $node->getSubNodes("nodes");
    $tracks = $node->getSubNodes("tracks");
    echo '<br>';
    $blocks->blockBodyOpen();
    ?>
			<table width="100%">
			<tr valign="top"><td width="60%">
		<?php 
    if (($art = $node->getMainArt()) !== false) {
        $display->image($art, $node->getName(), 250, false, "limit", false, false, "left");
        $blocks->description($node);
    } else {
        if (false === $blocks->description($node)) {
            echo '&nbsp;';
        }
    }
    ?>
			</td><td align="right">
		<?php 
    echo "<b>" . $node->getName() . "</b> ";
    $display->playButton($node);
    //echo "&nbsp";
    $display->randomPlayButton($node);
    echo "<br><br>";
    foreach ($nodes as $album) {
        $year = $album->getYear();
        if (!isNothing($year)) {
            $display->link($album, $album->getName() . " (" . $album->getYear() . ")");
        } else {
            $display->link($album, $album->getName());
        }
        echo "&nbsp";
        $display->playButton($album);
        //echo "&nbsp";
        $display->randomPlayButton($album);
        if ($jzUSER->getSetting('download') === true) {
            $display->downloadButton($album);
        }
        echo "<br>";
    }
    ?>
			</td></tr>
			<tr><td colspan="2" align="left">
			<br><br>
			<table cellpadding="2"><tr><td>
		<?php 
    $i = 0;
    foreach ($nodes as $album) {
        if (($art = $album->getMainArt('150x150')) !== false) {
            if ($i > 0 && $i % 5 == 0) {
                echo "</td></tr><tr><td>";
            }
            echo "<td width=\"150\">";
            $display->link($album, $display->returnImage($art, $album->getName(), 150, false, "fixed"));
            echo "</td>";
            $i++;
        }
    }
    echo "</td></tr>";
    ?>
					
			</table>
			</td></tr></table>
		<?php 
    if (sizeof($tracks) > 0) {
        echo '<br>';
        $blocks->trackTable($tracks, false);
    }
    $blocks->blockBodyClose();
    echo '<br>';
}
Esempio n. 24
0
/**
 * Compares elements by track number
 *
 * @author Ben Dodson
 * @version 5/27/05
 * @since 5/27/05
 **/
function compareNumber($a, $b)
{
    if ($a->isLeaf() === false && $b->isLeaf() === false) {
        return compareNodes($a, $b);
    }
    $ad = $a->getAncestor("album");
    $bd = $b->getAncestor("album");
    $adArtist = $a->getAncestor("artist");
    $bdArtist = $b->getAncestor("artist");
    if ($ad !== false && $bd !== false && strtoupper($ad->getName()) != strtoupper($bd->getName()) || $adArtist !== false && $bdArtist !== false && strtoupper($adArtist->getName()) != strtoupper($bdArtist->getName())) {
        if ($ad === false || $bd === false) {
            return compareNodes($a, $b);
        }
        return compareNodes($ad, $bd);
    }
    if (($ad = $a->getAncestor("disk")) != ($bd = $b->getAncestor("disk"))) {
        if ($ad !== false && $bd !== false) {
            // both from disks.
            return compareNodes($ad, $bd);
        }
        if ($ad === false) {
            // $a NOT from a disk, but b is.
            return 1;
        }
        return -1;
    }
    if ($a->isLeaf() === false) {
        return 1;
    }
    if ($b->isLeaf() === false) {
        return -1;
    }
    $am = $a->getMeta();
    $bm = $b->getMeta();
    if (isNothing($am['number']) && isNothing($bm['number']) || $am['number'] == $bm['number']) {
        return compareNodes($a, $b);
    }
    if (isNothing($am['number'])) {
        return 1;
    }
    if (isNothing($bm['number'])) {
        return -1;
    }
    return $am['number'] < $bm['number'] ? -1 : 1;
}
Esempio n. 25
0
    die('Security breach detected.');
}
global $node;
// 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();
        // Let's display the name
        $artist = $node->getAncestor('artist');
        $smarty->assign('artist_link', "");
        if ($artist !== false) {
            $smarty->assign('artist_link', $display->link($artist, $artist->getName(), false, false, true));
        }
        $smarty->assign('album_name', $node->getName());
        $smarty->assign('album_year', "");
        if (!isNothing($node->getYear())) {
            $smarty->assign('album_year', $node->getYear());
        }
        $smarty->assign('album_art', "");
        if ($art) {
            if ($desc) {
                $align = "left";
            } else {
                $align = "center";
            }
            $smarty->assign('album_art', $display->returnImage($art, $node->getName(), $image_size, $image_size, "limit", false, false, $align, "4", "4"));
        }
        $smarty->assign('album_desc', $display->returnShortName($desc, $desc_truncate));
        // Do we need the read more link?
        $smarty->assign('read_more', "");
        if (strlen($desc) > $desc_truncate) {