Example #1
0
function doTemplate($node)
{
    global $jzUSER, $display, $chart_size;
    $display =& new jzDisplay();
    $smarty = mobileSmarty();
    $smarty->assign('Play', word('Play'));
    $smarty->assign('Shuffle', word('Shuffle'));
    /** Playlists **/
    $smarty->assign('Playlists', word('Playlists'));
    $editPage = array('page' => 'playlist');
    $sm_lists = array();
    $l = $jzUSER->loadPlaylist("session");
    if ($l->length() > 0) {
        $sm_lists[] = array('name' => word("Quick List"), 'openPlayTag' => $display->getOpenPlayTag($l), 'editHREF' => urlize($editPage, array('playlist' => 'session')), 'isStatic' => true, 'openShuffleTag' => $display->getOpenPlayTag($l, true));
    }
    $lists = $jzUSER->listPlaylists("static") + $jzUSER->listPlaylists("dynamic");
    // use "all" to mix ordering
    foreach ($lists as $id => $plName) {
        $l = $jzUSER->loadPlaylist($id);
        $static = $l->getPLType() == 'static' ? true : false;
        $sm_lists[] = array('name' => $plName, 'openPlayTag' => $display->getOpenPlayTag($l), 'editHREF' => urlize($editPage, array('playlist' => $id)), 'isStatic' => $static, 'openShuffleTag' => $display->getOpenPlayTag($l, true));
    }
    $smarty->assign('playlists', $sm_lists);
    /** Charts **/
    /**
     * array of titles and lists */
    $root = new jzMediaNode();
    $charts = array();
    /* recently added albums */
    $chart = array();
    $chart['title'] = word('New Albums');
    $entries = array();
    $list = $root->getRecentlyAdded('nodes', distanceTo('album'), $chart_size);
    for ($i = 0; $i < sizeof($list); $i++) {
        $entries[] = array('name' => $list[$i]->getName(), 'link' => urlize(array('jz_path' => $list[$i]->getPath("String"))), 'openPlayTag' => $display->getOpenPlayTag($list[$i]));
    }
    $chart['entries'] = $entries;
    $charts[] = $chart;
    /* recently played albums */
    $chart = array();
    $chart['title'] = word('Recently Played Albums');
    $entries = array();
    $list = $root->getRecentlyPlayed('nodes', distanceTo('album'), $chart_size);
    for ($i = 0; $i < sizeof($list); $i++) {
        $entries[] = array('name' => $list[$i]->getName(), 'link' => urlize(array('jz_path' => $list[$i]->getPath("String"))), 'openPlayTag' => $display->getOpenPlayTag($list[$i]));
    }
    $chart['entries'] = $entries;
    $charts[] = $chart;
    $smarty->assign('charts', $charts);
    jzTemplate($smarty, 'lists');
}
Example #2
0
function seperateSimilar($array)
{
    if (!is_array($array) || sizeof($array) == 0) {
        $ret = array();
        $ret['nonmatches'] = array();
        $ret['matches'] = array();
        return $ret;
    }
    // We don't want more artists in the array than we came with.
    // The searching is what actually needs to be improved (with operator = "exact-or")
    $ret = array();
    $root = new jzMediaNode();
    $found = $root->search($array, "nodes", distanceTo('artist'), sizeof($array), "or");
    $ret['matches'] = $found;
    // Now let's remove the matches:
    $matches = array();
    foreach ($found as $e) {
        $matches[] = $e->getName();
    }
    $nonmatches = array();
    foreach ($array as $entry) {
        $foundit = false;
        foreach ($matches as $match) {
            if (0 == strcmp(strtolower($match), strtolower($entry))) {
                // Found it
                $foundit = true;
                break;
            }
        }
        if (!$foundit) {
            $nonmatches[] = $entry;
        }
    }
    $ret['nonmatches'] = $nonmatches;
    return $ret;
}
Example #3
0
 /**
  * Sets the track's meta information.
  * $meta is an array of meta fields to set.
  * $mode specifies where to update the meta,
  * false means do it in the cache and in the id3.
  * 
  * @author Ben Dodson
  * @version 10/13/04
  * @since 10/13/04
  */
 function setMeta($meta, $mode = false, $displayOutput = false)
 {
     global $jzSERVICES, $allow_id3_modify, $backend, $hierarchy;
     if (is_array($hierarchy)) {
         $hstring = implode("/", $hierarchy);
     } else {
         $hstring = $hierarchy;
     }
     if ($mode == false) {
         // TODO: add variable to see if user allows ID3 updating.
         $this->setMeta($meta, "file");
         $this->setMeta($meta, "cache");
     }
     if ($mode == "cache") {
         $filecache = $this->readCache();
         if (isset($meta['title'])) {
             $filecache[7] = $meta['title'];
         }
         if (isset($meta['frequency'])) {
             $filecache[8] = $meta['frequency'];
         }
         if (isset($meta['comment'])) {
             $filecache[9] = $meta['comment'];
         }
         if (isset($meta['year'])) {
             $filecache[11] = $meta['year'];
         }
         if (isset($meta['size'])) {
             $filecache[13] = $meta['size'];
         }
         if (isset($meta['length'])) {
             $filecache[14] = $meta['length'];
         }
         if (isset($meta['genre'])) {
             $filecache[15] = $meta['genre'];
         }
         if (isset($meta['artist'])) {
             $filecache[16] = $meta['artist'];
         }
         if (isset($meta['album'])) {
             $filecache[17] = $meta['album'];
         }
         if (isset($meta['type'])) {
             $filecache[18] = $meta['type'];
         }
         if (isset($meta['lyrics'])) {
             $filecache[19] = $meta['lyrics'];
         }
         if (isset($meta['bitrate'])) {
             $filecache[20] = $meta['bitrate'];
         }
         if (isset($meta['number'])) {
             $filecache[21] = $meta['number'];
         }
         $this->writeCache($filecache);
         return true;
     } else {
         if ($mode == "direct") {
             $fname = $this->getPath("String");
         } else {
             $fname = $this->getFileName("host");
         }
         if ($backend == "id3-database" || $backend == "id3-cache") {
             $oldmeta = $this->getMeta("file");
         }
         // Ok, now we need to write the data to this file IF it's an MP3
         if ($allow_id3_modify == "true") {
             $status = $jzSERVICES->setTagData($fname, $meta);
         } else {
             $status = true;
         }
         if (!isset($meta['genre'])) {
             $meta['genre'] = $oldmeta['genre'];
         }
         if (!isset($meta['artist'])) {
             $meta['artist'] = $oldmeta['artist'];
         }
         if (!isset($meta['album'])) {
             $meta['album'] = $oldmeta['album'];
         }
         if (!isset($meta['filename'])) {
             $meta['filename'] = $oldmeta['filename'];
         }
         if ($backend == "id3-database" || $backend == "id3-cache") {
             if ($oldmeta['genre'] != $meta['genre'] && stristr($hstring, "genre") !== false || $oldmeta['artist'] != $meta['artist'] && stristr($hstring, "artist") !== false || $oldmeta['album'] != $meta['album'] && stristr($hstring, "album") !== false || $oldmeta['filename'] != $meta['filename']) {
                 // The media needs to be moved.
                 $arr = buildPath($meta);
                 $newpath = implode("/", $arr);
                 $root = new jzMediaNode();
                 $root->moveMedia($this, $newpath);
                 $this->reconstruct($newpath);
             }
         }
         return $status;
     }
 }
Example #4
0
 if (stristr($image, "http://")) {
     if (substr($podcast_folder, 0, 1) != "/") {
         $dir = str_replace("\\", "/", getcwd()) . "/" . $podcast_folder . "/" . $title;
     } else {
         $dir = $podcast_folder . "/" . $title;
     }
     // Now let's create the directory we need
     makedir($dir);
     $imgFile = $dir . "/" . $title . ".jpg";
     $iData = file_get_contents($image);
     $handle = fopen($imgFile, "w");
     fwrite($handle, $iData);
     fclose($handle);
 }
 // Now let's create the node in the backend and assign it some values
 $newNode = new jzMediaNode($node->getPath("string") . "/" . $_POST['edit_podcast_path']);
 $newNode->addDescription($desc);
 $newNode->addMainArt($imgFile);
 // Now let's loop and look at each enclosure
 $i = 1;
 foreach ($retArray as $item) {
     // Let's grab it
     $track = getPodcastData($item, $title);
     if (stristr($track, ".mp3")) {
         // Now that we've got the link we need to add it to the backend
         $ext = substr($item['file'], strlen($item['file']) - 3, 3);
         $nTrack = trim(cleanFileName($item['title'] . "." . $ext));
         $pArr = explode("/", $_POST['edit_podcast_path']);
         $path = array();
         foreach ($pArr as $p) {
             $path[] = $p;
Example #5
0
/** 
 * Returns the AJAX code for the NSB
 *
 * @author Ross Carlson
 * @since 8.21.05
 *
 **/
function returnNowStreaming()
{
    global $jzUSER, $img_tiny_play, $im_tiny_play_dis, $css, $img_tiny_info, $skin, $root_dir, $include_path, $jzSERVICES, $who_is_where_height;
    $define_only = true;
    //include_once($include_path. $css);
    writeLogData("messages", "NSB: starting up");
    // Now let's figure out the height
    $be = new jzBackend();
    $display = new jzDisplay();
    $tracks = $be->getPlaying();
    $retVal = "";
    $count = 0;
    foreach ($tracks as $sid => $song) {
        // Let's make sure we got data
        if (count($song) != 0) {
            // Now let's setup for our links
            $url_array = array();
            $url_array['jz_path'] = $song['path'];
            $url_array['action'] = "playlist";
            $url_array['type'] = "track";
            $urlArr = array();
            $urlArr['session'] = $sid;
            $urlArr['action'] = "popup";
            $urlArr['ptype'] = "viewcurrentinfo";
            $infoLink = '<a href="' . str_replace("ajax_request", "index", urlize($urlArr)) . '" onclick="openPopup(this, 450, 300); return false;">' . $img_tiny_info . '</a>';
            $arr = array();
            $pArr = explode("/", $song['path']);
            unset($pArr[count($pArr) - 1]);
            $arr['jz_path'] = implode("/", $pArr);
            $songTrack = $display->returnShortName($song['track'], 15);
            /*
            if ($lyricsLink == ""){
            	$songTrack = $display->returnShortName($song['track'],15);
            } else {
            	$songTrack = $display->returnShortName($song['track'],13);
            }
            */
            $track = new jzMediaNode($song['path']);
            $item = $track->getParent();
            if ($item->getPType() == "disk") {
                $item = $item->getParent();
            }
            $album = $item->getName();
            $artParent = $item->getParent();
            $artist = $artParent->getName();
            $art = $item->getMainArt("75x75");
            if ($art) {
                $albumImage = str_replace("'", "\\'", str_replace('"', '', $display->returnImage($art, $album, 75, 75, "limit", false, false, "left", "3", "3")));
            } else {
                $albumImage = "";
            }
            $desc_truncate = 200;
            $desc = htmlentities(str_replace("'", "\\'", str_replace('"', '', $item->getDescription())));
            // Now let's set the title and body
            $title = htmlentities(str_replace("'", "\\'", str_replace('"', '', $artist . " - " . $song['track'])));
            $userName = $song['name'];
            if ($userName == "") {
                $userName = word("Anonymous");
            }
            if ($song['fullname'] != "") {
                $userName = $song['fullname'];
            }
            $body = "<strong>" . word("Streaming to: ") . $userName . "</strong><br>" . $albumImage . $display->returnShortName($desc, $desc_truncate);
            //$albumImage;
            $count++;
            if ($jzUSER->getSetting('stream')) {
                $retVal .= ' <a href="' . str_replace("ajax_request.php", "index.php", urlize($url_array)) . '"';
                if (checkPlayback() == "embedded") {
                    //$jzSERVICES = new jzServices();
                    $jzSERVICES->loadUserServices();
                    $retVal .= ' ' . $jzSERVICES->returnPlayerHref();
                }
                $retVal .= '>' . $img_tiny_play . '</a>' . $infoLink . '<a ' . $display->returnToolTip($body, $title) . ' target="_parent" href="' . str_replace("ajax_request", "index", urlize($arr)) . '">' . $songTrack . '</a><br>';
            } else {
                $retVal .= '' . $img_tiny_play_dis . '' . $infoLink . '<a ' . $display->returnToolTip($body, $title) . ' target="_parent" ' . $title . ' href="' . str_replace("ajax_request", "index", urlize($arr)) . '">' . $songTrack . '</a><br>';
            }
        }
    }
    if ($count == 1 or $count == 0) {
        $tCtr = "";
    } else {
        $tCtr = " (" . $count . ")";
    }
    $retVal = "<strong>" . word("Now Streaming") . $tCtr . "</strong><br />" . $retVal;
    $maxHeight = $who_is_where_height * 13 + 26;
    $style = "";
    if ($maxHeight < $count * 13 + 26) {
        $style = "<style>#whoiswhere{height: " . $maxHeight . "px;overflow:auto;}</style>";
    }
    $return = $style . $retVal;
    writeLogData("messages", "NSB: displaying data");
    echo $retVal;
    exit;
}
Example #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();
    }
Example #7
0
    /**
     * Displays the random playlist generator
     * 
     * @author Ross Carlson, Ben Dodson
     * @version 2/20/05
     * @since 2/20/05
     */
    function randomGenerateSelector($node, $header = false, $return = false)
    {
        global $this_page, $random_play_amounts, $quick_list_truncate, $default_random_type, $default_random_count, $jzUSER;
        $root = new jzMediaNode();
        $display = new jzDisplay();
        // Now, can they stream?
        if (!$jzUSER->getSetting('stream')) {
            return;
        }
        if ($return) {
            ob_start();
        }
        if ($header) {
            echo $header;
        } else {
            echo '<font size="1">' . word("Randomize selected") . '</font><br>';
        }
        ?>
		<form name="randomizer" action="<?php 
        echo $this_page;
        ?>
" method="post">
		<input type="hidden" name="<?php 
        echo jz_encode("action");
        ?>
" value="<?php 
        echo jz_encode("generateRandom");
        ?>
">
		<select name="<?php 
        echo jz_encode("random_play_number");
        ?>
" class="jz_select">
		<?php 
        $random_play = explode("|", $random_play_amounts);
        $ctr = 0;
        while (count($random_play) > $ctr) {
            echo '<option value="' . jz_encode($random_play[$ctr]) . '"';
            if ($random_play[$ctr] == $default_random_count) {
                echo " selected";
            }
            echo '>' . $random_play[$ctr] . '</option>' . "\n";
            $ctr = $ctr + 1;
        }
        echo '</select> ';
        echo '<select name="' . jz_encode("random_play_type") . '" class="jz_select" style="width:60px;">';
        $random_play_types = "Songs|Albums|Artists";
        $random_play = explode("|", $random_play_types);
        $ctr = 0;
        while (count($random_play) > $ctr) {
            // Let's make sure this isn't blank
            if ($random_play[$ctr] != "") {
                echo '<option value="' . jz_encode($random_play[$ctr]) . '"';
                if ($random_play[$ctr] == $default_random_type) {
                    echo " selected";
                }
                echo '>' . $random_play[$ctr] . '</option>' . "\n";
            }
            $ctr++;
        }
        echo '</select>';
        // Now let's let them pick a genre
        if (distanceTo("genre") !== false) {
            $curgenre = getInformation($node, 'genre');
            echo ' <select name="' . jz_encode("random_play_genre") . '" class="jz_select" style="width:75px;">';
            if ($curgenre === false) {
                echo '<option value="' . jz_encode("") . '" selected>All Genres</option>' . "\n";
            } else {
                echo '<option value="' . jz_encode("") . '">All Genres</option>' . "\n";
            }
            if (!isset($genreArray)) {
                // todo: use the genre array from the other dropdown
                // so we don't query twice.
                $genreArray = $root->getSubNodes("nodes", distanceTo("genre"));
            }
            for ($ctr = 0; $ctr < count($genreArray); $ctr++) {
                if ($genreArray[$ctr] != "") {
                    $title = returnItemShortName($genreArray[$ctr]->getName(), $quick_list_truncate);
                    echo '<option ';
                    // Now let's see if this is the genre we're looking at
                    if (!isset($genre)) {
                        $genre = "";
                    }
                    if (strtolower($title) == strtolower($genre)) {
                        echo 'selected';
                    }
                    echo ' value="' . jz_encode(htmlentities($genreArray[$ctr]->getPath("String"))) . '"';
                    if ($curgenre == $genreArray[$ctr]->getName()) {
                        echo ' selected';
                    }
                    echo '>' . $title . '</option>' . "\n";
                }
            }
            echo '</select>';
        }
        echo ' <input class="jz_submit" type="submit" name="submit_random" value="' . word("Go") . '"';
        if (!defined('NO_AJAX_JUKEBOX')) {
            echo ' onClick="return submitPlaybackForm(this,\'' . htmlentities($this_page) . '\')"';
        } else {
            if (checkPlayback() == "embedded") {
                echo ' onClick="' . $display->embeddedFormHandler('randomizer') . '"';
            }
        }
        echo '>';
        echo '</form>';
        echo '</nobr>';
        if ($return) {
            $var = ob_get_contents();
            ob_end_clean();
            return $var;
        }
    }
Example #8
0
    function pageTop($title = false, $endBreak = "true", $ratingItem = "")
    {
        global $this_page, $img_home, $quick_list_truncate, $img_random_play, $cms_mode, $random_play_amounts, $directory_level, $img_up_arrow, $header_drops, $genre_drop, $artist_drop, $album_drop, $quick_drop, $root_dir, $web_root, $song_drop, $audio_types, $video_types, $media_dir, $img_more, $img_random_play_dis, $url_seperator, $help_access, $jukebox, $jukebox_num, $disable_random, $jz_lang_file, $show_slimzora, $img_slim_pop, $allow_resample, $resampleRates, $default_random_type, $default_random_count, $display_previous, $echocloud, $display_recommended, $enable_requests, $enable_ratings, $enable_search, $enable_meta_search, $user_tracking_display, $user_tracking_admin_only, $site_title, $node, $jzUSER, $img_play, $img_playlist, $jinzora_skin, $include_path, $img_play_dis, $img_random_play_dis, $img_download_dis, $img_add_dis, $img_playlist_dis, $allow_filesystem_modify, $disable_leftbar, $allow_interface_choice, $allow_style_choice, $allow_language_choice, $show_now_streaming, $show_who_is_where, $show_user_browsing, $jukebox_height, $backend, $config_version, $allow_resample, $jukebox_display;
        // First let's include the settings for Netjuke
        include_once $include_path . "frontend/frontends/netjuke/settings.php";
        // Let's see if they wanted to pass a title
        if (!$title) {
            $title = $site_title;
        }
        if (!isset($_GET['jz_path'])) {
            $_GET['jz_path'] = "";
        }
        // Let's setup our objects
        $root =& new jzMediaNode();
        $display =& new jzDisplay();
        $blocks = new jzBlocks();
        // First let's see if our session vars are set for the number of items
        if (!isset($_SESSION['jz_num_genres'])) {
            $_SESSION['jz_num_genres'] = $root->getSubNodeCount("nodes", distanceTo("genre"));
        }
        if (!isset($_SESSION['jz_num_artists'])) {
            $_SESSION['jz_num_artists'] = $root->getSubNodeCount("nodes", distanceTo("artist"));
        }
        if (!isset($_SESSION['jz_num_albums'])) {
            $_SESSION['jz_num_albums'] = $root->getSubNodeCount("nodes", distanceTo("album"));
        }
        if (!isset($_SESSION['jz_num_tracks'])) {
            $_SESSION['jz_num_tracks'] = $root->getSubNodeCount("tracks", -1);
        }
        ?>
			<a name="pageTop"></a>
			<table width="100%" cellpadding="5" cellspacing="0" border="0">
				<tr>
					<td>
						<table width="100%" cellpadding="3" cellspacing="0" border="0">
							<tr>
								<td align="center" class="jz_block_td">
									<?php 
        echo '<a href="' . urlize(array()) . '">';
        echo '<strong>BROWSE</strong>';
        echo '</a>';
        ?>
								</td>
								<td align="center" class="jz_block_td">
									<strong>
								    <?php 
        $urla = array();
        $urla['action'] = "powersearch";
        echo "<a href=\"" . urlize($urla) . "\">SEARCH</a>";
        ?>
										</strong>
								</td>
								<td align="center" class="jz_block_td">
									<strong>
									<?php 
        $display->randomPlayButton($node, false, word("RANDOM"));
        ?>
									</strong>
								</td>
								<td align="center" class="jz_block_td">
									<strong><?php 
        $urla['action'] = "popup";
        $urla['ptype'] = "playlistedit";
        echo "<a href=\"" . urlize($urla) . "\" onclick=\"openPopup(this, 550, 600); return false;\">PLAYLISTS</a>";
        ?>
									</strong>
								</td>
								<td align="center" class="jz_block_td">
									<strong><?php 
        $display->popupLink("preferences", "PREFERENCES");
        ?>
									</strong>
								</td>
								<td align="center" class="jz_block_td">
									<strong><?php 
        $display->loginLink("LOGIN", "LOGOUT");
        ?>
</strong>
								</td>
							</tr>
						</table>
						<br>
						<table width="100%" cellpadding="0" cellspacing="0" border="0">
							<tr>

								<?php 
        // Can this user powersearch?
        if ($jzUSER->getSetting('powersearch')) {
            ?>
								<td align="center" valign="top">
									<table width="100%" cellpadding="3" cellspacing="0" border="0">
										<tr>
											<td class="jz_block_td">
												<?php 
            $url_search = array();
            $url_search['action'] = "powersearch";
            echo '<a href="' . urlize($url_search) . '">';
            ?>
												<strong>QUICK SEARCH</strong></a>
											</td>
										</tr>
										<tr>
								<?php 
            $onSubmit = "";
            if ($jukebox == "true" && !defined('NO_AJAX_JUKEBOX')) {
                $onSubmit = 'onSubmit="return searchKeywords(this,\'' . htmlentities($this_page) . '\');"';
            }
            if ($cms_mode == "true") {
                $method = "GET";
            } else {
                $method = "POST";
            }
            ?>
											<td class="jz_nj_block_body" align="center">
												<form action="<?php 
            echo $this_page;
            ?>
" name="searchForm" method="<?php 
            echo $method;
            ?>
" <?php 
            echo $onSubmit;
            ?>
>
												<?php 
            foreach (getURLVars($this_page) as $key => $val) {
                echo '<input type="hidden" name="' . htmlentities($key) . '" value="' . htmlentities($val) . '">';
            }
            ?>
													<input type="text" name="search_query" class="jz_input" style="width:150px; font-size:10px; margin-bottom:3px;">
													<br>
													<select class="jz_select" name="search_type" style="width:85px">
														<option value="ALL"><?php 
            echo word("All Media");
            ?>
</option>
														<?php 
            if (distanceTo("artist") !== false) {
                echo '<option value="artists">' . word("Artists") . '</option>' . "\n";
            }
            if (distanceTo("album") !== false) {
                echo '<option value="albums">' . word("Albums") . '</option>' . "\n";
            }
            ?>
														<option value="tracks"><?php 
            echo word("Tracks");
            ?>
</option>
														<option value="lyrics"><?php 
            echo word("Lyrics");
            ?>
</option>
													</select>
								                                        <input type="hidden" name="doSearch" value="true">
													<input type="submit" class="jz_submit" name="doSearch" value="Go">
												</form>
											</td>
										</tr>
									</table>
								</td>
								<?php 
            // This ends the if they can powersearch statement
        }
        ?>
								
								<?php 
        // Are they resampling?
        if ($display->wantResampleDropdown($node)) {
            $display->displayResampleDropdown($node);
            // PROBLEM: Currently can't use small jukebox and resampling.
        }
        if (checkPermission($jzUSER, "jukebox_queue") && ($jukebox_display == "small" or $jukebox_display == "minimal")) {
            ?>
									<td align="center">&nbsp; &nbsp;</td>
									<td align="center" valign="top">
										<table width="100%" cellpadding="3" cellspacing="0" border="0">
											<tr>
												<td class="jz_block_td" width="100%" nowrap>
													<strong>PLAYBACK</strong>
												</td>
											</tr>
											<tr>
												<td class="jz_nj_block_body" align="left" width="1%" nowrap><div id="smallJukebox">
													<?php 
            $blocks->smallJukebox(false, "top");
            ?>
												</div></td>
											</tr>
										</table>
									</td>
									<?php 
        }
        ?>
								
								
								
								<td align="center">&nbsp; &nbsp;</td>
								<td align="center" valign="top">
									<table width="100%" cellpadding="3" cellspacing="0" border="0">
										<tr>
											<td class="jz_block_td" colspan="3" width="100%" nowrap>
												<strong>CONTENT SUMMARY</strong>
											</td>
										</tr>
										<?php 
        // Let's get the stats
        if (!isset($_SESSION['jz_total_tracks'])) {
            $root = new jzMediaNode();
            $stats = $root->getStats();
            $_SESSION['jz_total_tracks'] = $stats['total_tracks'];
            $_SESSION['jz_total_genres'] = $stats['total_genres'];
            $_SESSION['jz_total_artists'] = $stats['total_artists'];
            $_SESSION['jz_total_albums'] = $stats['total_albums'];
            $_SESSION['jz_total_size'] = $stats['total_size_str'];
            $_SESSION['jz_total_length'] = $stats['total_length'];
        }
        ?>
										<tr>
											<td class="jz_nj_block_body" align="center" width="1%" nowrap>
												<?php 
        echo number_format($_SESSION['jz_total_tracks']);
        ?>
 Tracks
											</td>
											<td class="jz_nj_block_body" align="center" width="1%" nowrap>
												<?php 
        echo number_format($_SESSION['jz_total_artists']);
        ?>
 Artists
											</td>
											<td class="jz_nj_block_body" align="center" width="1%" nowrap>
												<?php 
        echo formatTime($_SESSION['jz_total_length']);
        ?>
											</td>
										</tr>
										<tr>
											<td class="jz_nj_block_body" align="center" width="1%" nowrap>
												<?php 
        echo number_format($_SESSION['jz_total_albums']);
        ?>
 Albums
											</td>
											<td class="jz_nj_block_body" align="center" width="1%" nowrap>
												<?php 
        echo number_format($_SESSION['jz_total_genres']);
        ?>
 Genres
											</td>
											<td class="jz_nj_block_body" align="center" width="1%" nowrap>
												<?php 
        echo $_SESSION['jz_total_size'];
        ?>
											</td>
										</tr>
									</table>
								</td>
								<td align="center">&nbsp; &nbsp;</td>
								<td align="center" valign="top">
									<table width="100%" cellpadding="3" cellspacing="0" border="0">
										<tr>
											<td class="jz_block_td">
												<strong>ARTISTS A-Z <?php 
        echo "(" . $_SESSION['jz_num_artists'] . ")";
        ?>
</strong> - 
												<?php 
        $urlar = array();
        //$urlar['jz_path'] = $node->getPath("String");
        $urlar['jz_level'] = distanceTo("artist");
        $urlar['jz_letter'] = "*";
        echo "<a href=\"" . urlize($urlar) . "\">" . word("All") . "</a>";
        ?>
											</td>
										</tr>
										<tr>
											<td class="jz_nj_block_body" align="center">
												<?php 
        for ($let = 'A'; $let != 'Z'; $let++) {
            $urlar['jz_letter'] = $let;
            echo "<a href=\"" . urlize($urlar) . "\">" . $let . "</a> ";
            if ($let == 'L' or $let == 'X') {
                echo "<br>";
            }
        }
        $urlar['jz_letter'] = "Z";
        echo "<a href=\"" . urlize($urlar) . "\">Z</a> ";
        for ($let = '1'; $let != '10'; $let++) {
            $urlar['jz_letter'] = $let;
            echo "<a href=\"" . urlize($urlar) . "\">" . $let . "</a> ";
        }
        $urlar['jz_letter'] = "*";
        echo "<a href=\"" . urlize($urlar) . "\">0</a>&nbsp;";
        ?>
											</td>
										</tr>
									</table>
								</td>
								<td align="center">&nbsp; &nbsp;</td>
								<td align="center" valign="top">
									<table width="100%" cellpadding="3" cellspacing="0" border="0">
										<tr>
											<td class="jz_block_td">
												<strong>ALBUMS A-Z <?php 
        echo "(" . $_SESSION['jz_num_albums'] . ")";
        ?>
</strong> - 
												<?php 
        $urlar['jz_level'] = distanceTo("album");
        $urla['jz_letter'] = "*";
        echo "<a href=\"" . urlize($urlar) . "\">" . word("All") . "</a>";
        ?>
											</td>
										</tr>
										<tr>
											<td class="jz_nj_block_body" align="center">
												<?php 
        for ($let = 'A'; $let != 'Z'; $let++) {
            $urlar['jz_letter'] = $let;
            echo "<a href=\"" . urlize($urlar) . "\">" . $let . "</a> ";
            if ($let == 'L' or $let == 'X') {
                echo "<br>";
            }
        }
        $urlar['jz_letter'] = "Z";
        echo "<a href=\"" . urlize($urlar) . "\">Z</a> ";
        for ($let = '1'; $let != '10'; $let++) {
            $urlar['jz_letter'] = $let;
            echo "<a href=\"" . urlize($urlar) . "\">" . $let . "</a> ";
        }
        $urlar['jz_letter'] = "0";
        echo "<a href=\"" . urlize($urlar) . "\">0</a>&nbsp;";
        ?>
											</td>
										</tr>
									</table>
								</td>
							</tr>
						</table>
						
						<?php 
        // Are they in Jukebox mode?
        if (checkPermission($jzUSER, "jukebox_queue") && $jukebox_display != "small" && $jukebox_display != "off") {
            ?>
							<br>
							<table width="100%" cellpadding="3" cellspacing="0" border="0">
								<tr>
									<td align="center" class="jz_block_td">
										<div id="jukebox">
							    <?php 
            include jzBlock('jukebox');
            ?>
							                        </div>
									</td>
								</tr>
							</table>
							<?php 
        }
        ?>
					</td>
				</tr>
			</table>
			
			<?php 
    }
Example #9
0
function drawPage(&$node)
{
    global $cellspacing, $this_page, $img_play, $artist_truncate, $main_table_width, $img_random_play, $directory_level, $web_root, $root_dir, $img_more, $media_dir, $show_sub_numbers, $show_all_checkboxes, $img_more_dis, $img_play_dis, $img_random_play_dis, $url_seperator, $days_for_new, $img_rate, $enable_ratings, $enable_discussion, $img_discuss, $show_sub_numbers, $disable_random, $info_level, $enable_playlist, $track_play_only, $css, $skin, $bg_c, $text_c, $img_discuss_dis, $hierarchy, $random_albums, $frontend, $include_path, $show_frontpage_items, $show_alphabet, $chart_types, $fe, $num_artist_cols, $show_artist_art, $art_size, $artist_art_size;
    // 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; }
    // if you were looking this, sorry for the hack ;)
    // Override icons and other styles:
    handleFrontendOverrides();
    // Let's setup the display object
    $blocks =& new jzBlocks();
    $display =& new jzDisplay();
    $fe =& new jzFrontend();
    ?>
		
		<table width="100%" cellpadding="5" cellspacing="0" border="0">
			<tr>
				<td align="center" valign="top">
					<?php 
    // Now let's display the site description
    /*$news = $blocks->siteNews($node);
    			if ($news <> ""){
    				?>
    				<table width="100%" cellpadding="3" cellspacing="0" border="0">
    					<tr>
    						<td class="jz_block_td" colspan="3">
    							<strong><?php echo word("Site News"); ?></strong>
    						</td>
    					</tr>
    					<tr>
    						<td class="jz_nj_block_body" width="33%">
    						<?php echo $news; ?>
    						</td>
    					</tr>
    				</table>
    				<br>
    		<?php
    			}*/
    $lvl = isset($_GET['jz_letter']) ? $_GET['jz_level'] + $node->getLevel() - 1 : $node->getLevel();
    $show_art = false;
    switch ($hierarchy[$lvl]) {
        case "genre":
            $pg_title = word("ALL GENRES");
            break;
        case "artist":
            $pg_title = word("ALL ARTISTS");
            if ($show_artist_art == "true") {
                $show_art = true;
                $my_art_size = $artist_art_size;
            }
            break;
        case "album":
            $pg_title = word("ALL ALBUMS");
            if ($show_album_art == "true") {
                $show_art = true;
                $my_art_size = $art_size;
            }
            break;
        default:
            $pg_title = word("ALL GENRES");
            break;
    }
    ?>
					<table width="100%" cellpadding="3" cellspacing="0" border="0">
						<tr>
					   <?php 
    if (isset($_GET['jz_charts'])) {
        $node = new jzMediaNode();
        chartHelper("newalbums");
        chartHelper("recentplayalbum");
        echo '</tr>';
        echo '<tr><td colspan="2">';
        include jzBlock('randomAlbums');
        echo '</td></tr>';
        return;
    }
    echo '<td class="jz_block_td" colspan="3">';
    if (isset($_GET['jz_letter'])) {
        $genres = $node->getAlphabetical($_GET['jz_letter'], "nodes", $_GET['jz_level']);
    } else {
        $genres = $node->getSubNodes("nodes");
    }
    // Now for the title
    if ($_GET['jz_path'] == "") {
        echo '<strong>' . $pg_title . "</strong>";
    } else {
        echo '<strong>ARTISTS IN ';
        $display->link($node, $node->getName());
        echo ' (' . $node->getSubNodeCount("nodes") . ")</strong>";
    }
    ?>
							</td>
						</tr>
						<?php 
    $colwidth = floor(100 / $num_artist_cols);
    $c = 0;
    foreach ($genres as $genre) {
        // Now let's start our row
        if ($c % $num_artist_cols == 0) {
            if ($c > 0) {
                echo '</tr>';
            }
            echo '<tr>';
        }
        echo '<td class="jz_nj_block_body" width="' . $colwidth . '%" valign="top">';
        $display->playButton($genre);
        echo " ";
        $linktext = $display->returnShortName($genre->getName(), 25);
        if ($show_art) {
            if ($art = $genre->getMainArt($my_art_size . 'x' . $my_art_size)) {
                $linktext .= '<br/>';
                $linktext .= $display->returnImage($art);
            }
        }
        $display->link($genre, $linktext, word("Browse: ") . $genre->getName());
        //echo " (". $genre->getSubNodeCount("both"). ")";
        echo '</td>';
        $c++;
    }
    // Now let's finish out
    while ($c % $num_artist_cols != 0) {
        echo '<td class="jz_nj_block_body">&nbsp;</td>';
        $c++;
    }
    ?>
					  </tr>
					</table>
				</td>
				<td align="center">&nbsp;</td>
				
				<?php 
    // Now what to show?
    if ($_GET['jz_path'] != "") {
        /*
        				?>
        <td align="center" valign="top">
        	<table width="100%" cellpadding="3" cellspacing="0" border="0">
        		<tr>
        			<td class="jz_block_td" colspan="3">
        				<strong>ALBUMS IN THIS GENRE [<?php $display->link($node,$node->getName()); ?>] (<?php echo $node->getSubNodeCount("nodes",2); ?>)</strong>
        			</td>
        		</tr>
        		<?php
        			$albums = $node->getSubNodes("nodes",distanceTo("album",$node));
        			$c=0;
        			foreach($albums as $album){
        				// Now let's start our row
        				if ($c == 0){echo '<tr>';}
        				
        				echo '<td class="jz_nj_block_body" nowrap width="33%">';
        				$display->playButton($album); 
        				echo " ";
        				$display->randomPlayButton($album);
        				echo " ";
        				$display->link($album, $display->returnShortName($album->getName(),15), word("Browse: "). $album->getName());						
        				echo " (". $album->getSubNodeCount("tracks"). ")";
        				echo '</td>';
        				$c++;
        				if ($c==3){$c=0;}
        			}
        			// Now let's finish out
        			if ($c <> 0){
        				while($c<3){
        					echo '<td class="jz_nj_block_body">&nbsp;</td>';
        					$c++;
        				}	
        			}
        		?>
        	</table>
        </td>
        				<?php
        */
    } else {
        /*
        				?>
        <td align="center" valign="top">
        	<table width="100%" cellpadding="3" cellspacing="0" border="0">
        		<tr>
        			<td class="jz_block_td">
        				<strong>LATEST ARTISTS</strong>
        			</td>
        		</tr>
        		<tr>
        			<td class="jz_nj_block_body">
        				<table width="100%" cellpadding="3" cellspacing="0" border="0">
        				<?php
        					// Now how many should we show?
        					$show = round(((count($genres) / 3)) * 1.5);
        					$blocks->showCharts($node,"newartists",$show,false,false);
        				?>
        				</table>
        			</td>
        		</tr>
        	</table>
        </td>
        <td align="center">&nbsp;</td>
        <td align="center" valign="top">
        	<table width="100%" cellpadding="3" cellspacing="0" border="0">
        		<tr>
        			<td class="jz_block_td">
        				<strong>LATEST ALBUMS</strong>
        			</td>
        		</tr>
        		<tr>
        			<td class="jz_nj_block_body">
        				<table width="100%" cellpadding="3" cellspacing="0" border="0">
        				<?php
        					$show = round(((count($genres) / 3)) * 1.5);
        					$blocks->showCharts($node,"newalbums",$show,false,false);
        				?>
        				</table>
        			</td>
        		</tr>
        	</table>
        </td>
        				<?php
        */
    }
    ?>
					
				
				
				
			</tr>
		</table>
		<br>
		<?php 
}
Example #10
0
         case "track":
         case "tracks":
             $list = $root->getSubNodes("tracks", -1);
             break;
     }
     if (isset($list)) {
         foreach ($list as $el) {
             echo $el->getName() . "\n";
         }
     }
     break;
 case "search_metadata":
     if (isset($argv[2])) {
         $node = new jzMediaNode($argv[2]);
     } else {
         $node = new jzMediaNode();
     }
     $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) {
         echo "Retrieving metadata for " . $item->getName() . ".\n";
         // Now let's see if this is an artist
         if ($item->getPType() == 'artist') {
             // Now do we want to look at this?
             // Ok, let's get data for this artist
             // Now let's get the data IF we should
             if ($item->getMainArt() == "" or $item->getDescription() == "") {
Example #11
0
										<?php 
    writeLogData("messages", "Jukebox block: Refreshing the jukebox display");
    ?>
										seconds = 1;
										updateJukebox(true);
									}
									setTimeout("displayCountdown()",1000);
								} 
								displayCountdown();
								--> 
							</script> 
							<?php 
}
// Now we need to return the path to the track that is playing so we can get the art and description for it
$filePath = $jb->getCurrentTrackPath();
$track = new jzMediaNode($filePath, "filename");
// Now let's make sure we are looking at a track for real
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";
Example #12
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;
     }
 }
Example #13
0
 function removeDeadFiles($folder = false, $recursive = true)
 {
     $root = new jzMediaNode();
     $recursive_repeat = false;
     if ($folder !== false) {
         $fbase = "REG-" . pathize($folder);
     } else {
         $fbase = "REG";
     }
     $handle = opendir($this->data_dir);
     while ($file = readdir($handle)) {
         $fullpath = $this->data_dir . '/' . $file;
         if (false !== stristr($file, $fbase)) {
             if ($recursive || $file == $fbase) {
                 $modified = false;
                 $arr = unserialize(file_get_contents($fullpath));
                 foreach ($arr as $f => $info) {
                     if ($info['fs_sync'] == "true" && !file_exists($f)) {
                         $modified = true;
                         unset($arr[$f]);
                         if ($info['type'] == "track") {
                             $root->removeMedia(new jzMediaTrack($info['path']));
                         } else {
                             $root->removeMedia(new jzMediaNode($info['path']));
                             $recursive_repeat = true;
                         }
                     }
                 }
                 if ($modified) {
                     if (sizeof($arr) == 0) {
                         unlink($fullpath);
                     } else {
                         $handle2 = fopen($fullpath, "w");
                         fwrite($handle2, serialize($arr));
                         fclose($handle2);
                     }
                 }
             }
         }
     }
     if ($recursive_repeat) {
         $this->removeDeadFiles($folder, true);
     }
 }
Example #14
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);
 }
Example #15
0
/**
 * 
 * Generates an XML list of all artists
 *
 * @author Ross Carlson
 * @since 3/31/05
 * @return Returns a XML formatted list of all genres
 * 
 **/
function listAllSubNode($type, $params)
{
    global $this_site, $root_dir, $jzSERVICES;
    $limit = $params['limit'];
    // Let's setup the display object
    $display = new jzDisplay();
    // Let's echo out the XML header
    echoXMLHeader();
    // Let's get all the nodes
    $node = new jzMediaNode();
    // Now let's get each genre
    $nodes = $node->getSubNodes("nodes", distanceTo($type), false, $limit);
    sortElements($nodes, "name");
    foreach ($nodes as $item) {
        echo '  <' . $type . ' name="' . xmlUrlClean($item->getName()) . '">' . "\n";
        echo '    <link>' . $this_site . xmlUrlClean($display->link($item, false, false, false, true, true)) . '</link>' . "\n";
        // Now did they want full details?
        if (isset($_REQUEST['full']) && $_REQUEST['full'] == "true") {
            if (($art = $item->getMainArt(false, true, "audio", true)) !== false) {
                $image = xmlUrlClean($display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true));
            } else {
                $image = "";
            }
            echo '    <image>' . $image . '</image>' . "\n";
            echo '    <desc><![CDATA[' . $item->getDescription() . ']]></desc>' . "\n";
        }
        // Now let's close out
        echo "  </" . $type . ">\n";
        flushdisplay();
    }
    echoXMLFooter();
}
Example #16
0
    function systemToolsDropdown($node)
    {
        global $this_page;
        if (!is_object($node)) {
            $node = new jzMediaNode();
        }
        ?>
 
			<form action="<?php 
        echo $this_page;
        ?>
" method="GET" name="toolsform">
				<select class="jz_select" name="action" style="width:125px" onChange="openPopup(this.form.action.options[this.selectedIndex].value, 450, 450, false, 'SystemTools')">
					<?php 
        // Now let's setup the values
        $url_array = array();
        $url_array['jz_path'] = $node->getPath("String");
        $url_array['action'] = "popup";
        ?>
					<option value="">System Tools</option>
					<option value="<?php 
        $url_array['ptype'] = "mediamanager";
        echo urlize($url_array);
        ?>
"><?php 
        echo word("Media Manager");
        ?>
</option>
					<option value="<?php 
        $url_array['ptype'] = "usermanager";
        echo urlize($url_array);
        ?>
"><?php 
        echo word("User Manager");
        ?>
</option>
					<option value="<?php 
        $url_array['ptype'] = "sitesettings";
        echo urlize($url_array);
        ?>
"><?php 
        echo word("Settings Manager");
        ?>
</option>
					<option value="<?php 
        $url_array['ptype'] = "sitenews";
        echo urlize($url_array);
        ?>
"><?php 
        echo word("Manage Site News");
        ?>
</option>
					<option value="<?php 
        $url_array['ptype'] = "nodestats";
        unset($url_array['jz_path']);
        echo urlize($url_array);
        ?>
"><?php 
        echo word("Show Full Site Stats");
        ?>
</option>
					<option value="<?php 
        $url_array['ptype'] = "dupfinder";
        echo urlize($url_array);
        ?>
"><?php 
        echo word("Duplicate Finder");
        ?>
</option>
				</select>
			</form>
			<?php 
    }
Example #17
0
<?php

if (!defined(JZ_SECURE_ACCESS)) {
    die('Security breach detected.');
}
/**
* Displays the quick box to add an item to favorites
*
* @author Ross Carlson
* @since 12.17.05
* @version 12.17.05
* @param $path The node that we are viewing
**/
global $include_path, $jzUSER;
$node = new jzMediaNode($path);
$display = new jzDisplay();
$be = new jzBackend();
// Let's start the page header
$this->displayPageTop("", word("Adding to Favorites"));
$this->openBlock();
echo word("Adding") . ": " . $node->getName();
// Now let's add it
$this->closeBlock();
Example #18
0
function jzApi_nodes($argv)
{
    global $display;
    $ret = array();
    if (isset($argv["id"])) {
        $root = new jzMediaNode($argv["id"], "id");
    } else {
        $root = new jzMediaNode();
    }
    foreach ($root->getSubNodes("both") as $node) {
        if ($node instanceof jzMediaNode) {
            $ret[] = E($node->getName(), $node->getLevel() > 2 ? $node->getPlayHREF() : null, "nodes", array("id" => $node->getID()));
        } else {
            $ret[] = E($node->getName(), $node->getPlayHREF());
        }
    }
    return $ret;
}
Example #19
0
 function download()
 {
     global $include_path;
     include_once $include_path . 'lib/jzcomp.lib.php';
     include_once $include_path . 'lib/general.lib.php';
     $pl = $this;
     if ($pl->getPlType() == "dynamic") {
         $pl->handleRules();
     }
     $list = $pl->getList();
     if (sizeof($list) == 0) {
         return;
     }
     // Can we download it?
     if (!checkStreamLimit($list)) {
         echo word('Sorry, you have reached your download limit.');
         exit;
     }
     foreach ($list as $el) {
         $el->increaseDownloadCount();
     }
     $pl->flatten();
     $list = $pl->getList();
     $i = 0;
     $files = array();
     $m3u = "";
     $oldPath = "";
     $onepath = true;
     foreach ($list as $track) {
         $files[$i] = $track->getFileName("host");
         // Let's also create the m3u playlist for all this
         $tArr = explode("/", $files[$i]);
         $m3u .= "./" . $tArr[count($tArr) - 1] . "\n";
         $i++;
         // Now let's get the path and make sure we only see 1 unique path
         // If we see only one path we'll add art IF we can
         $pArr = $track->getPath();
         unset($pArr[count($pArr) - 1]);
         $path = implode("/", $pArr);
         if ($path != $oldPath and $oldPath != "") {
             $onepath = false;
         } else {
             $oldPath = $path;
         }
     }
     $name = $this->getName();
     if ($name === false || $name == "") {
         $name = "Playlist";
     }
     // Now should we add art?
     if ($onepath) {
         // Ok, let's create the node so we can get the art
         $artNode = new jzMediaNode($oldPath);
         if ($artNode->getMainArt() != "") {
             $i++;
             $files[$i] = $artNode->getMainArt();
         }
     }
     // Silly to send a 1 element playlist
     if (sizeof($files) > 1) {
         // Now let's write that to the temp dir
         $fileName = $include_path . "temp/playlist.m3u";
         $handle = @fopen($fileName, "w");
         @fwrite($handle, $m3u);
         @fclose($handle);
         $files[$i + 1] = $fileName;
     }
     // Now let's send it
     sendFileBundle($files, $name);
 }
Example #20
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);
    }
Example #21
0
<?php

if (!defined(JZ_SECURE_ACCESS)) {
    die('Security breach detected.');
}
/**
* Scans the users system for newly added media
* 
* @author Ross Carlson
* @version 01/18/05
* @since 01/18/05
* @param $node The node we are looking at
*/
global $backend;
if ($backend == "id3-cache" || $backend == "id3-database") {
    $node = new jzMediaNode();
    // Root only, just to be sure...
}
// First let's display the top of the page and open the main block
$title = $node->getName();
if ($title == "") {
    $title = word("Root Level");
}
$this->displayPageTop("", "Scanning for new media in: " . $title);
$this->openBlock();
// Let's show them the form
if (!isset($_POST['edit_scan_now'])) {
    $url_array = array();
    $url_array['action'] = "popup";
    $url_array['ptype'] = "scanformedia";
    $url_array['jz_path'] = $_GET['jz_path'];
Example #22
0
 /**
  * Draws the search results page.
  * 
  * @author Ben Dodson
  * @version 12/18/04
  * @since 11/20/04
  */
 function searchResults($string, $type, $power_search = false)
 {
     global $cms_type, $jzSERVICES;
     $display =& new jzDisplay();
     $blocks =& new jzBlocks();
     $tracks = array();
     $nodes = array();
     // remember, $this is a frontend.
     // This has to go before SQL querries.
     // If our keywords say to play the results
     // we cannot print any HTML.
     if ($power_search === false) {
         $check = splitKeywords($string);
         if (!muteOutput($check['keywords'])) {
             $display->preheader('Search Results', $this->width, $this->align);
             $this->pageTop('Search Results');
         }
         $results = handleSearch($string, $type);
         if (sizeof($results) == 0 && muteOutput($check['keywords'])) {
             $display->preheader('Search Results', $this->width, $this->align);
             $this->pageTop('Search Results');
         }
     } else {
         // Power search:
         $display->preheader('Search Results', $this->width, $this->align);
         $this->pageTop('Search Results');
         $root = new jzMediaNode();
         $results = $root->powerSearch();
     }
     echo '<table width="100%" cellpadding="3"><tr><td>';
     foreach ($results as $val) {
         if ($val->isLeaf()) {
             $tracks[] = $val;
         } else {
             $nodes[] = $val;
         }
     }
     // show the page
     if (sizeof($tracks) > 0) {
         $blocks->blockHeader(sizeof($tracks) . " " . word("Matching Tracks") . " " . word("for search") . ' "' . $_POST['search_query'] . '"');
         $blocks->blockBodyOpen();
         $blocks->trackTable($tracks, "search");
         $blocks->blockBodyClose();
         $blocks->blockSpacer();
     }
     if (sizeof($nodes) > 0) {
         $blocks->blockHeader(sizeof($nodes) . " " . word("Other Matches") . " " . word("for search") . ' "' . $_POST['search_query'] . '"');
         $blocks->blockBodyOpen();
         $blocks->nodeTable($nodes, "search");
         $blocks->blockBodyClose();
         $blocks->blockSpacer();
     }
     if (sizeof($nodes) == 0 && sizeof($tracks) == 0) {
         $blocks->blockHeader(word("No matches found"));
     }
     $this->footer();
     $jzSERVICES->cmsClose();
 }
Example #23
0
<?php

if (!defined(JZ_SECURE_ACCESS)) {
    die('Security breach detected.');
}
// Now let's get the sub nodes to where we are
global $img_folder;
if (isset($_GET['jz_letter'])) {
    $root = new jzMediaNode();
    $nodes = $root->getAlphabetical($_GET['jz_letter'], "nodes", distanceTo("artist"));
} else {
    if ($node->getLevel() == 0 && $show_frontpage_items == "false") {
        $nodes = array();
    } else {
        $nodes = $node->getSubNodes("nodes");
    }
}
// Now let's sort
if ($sort_by_year == "true" and $node->getPType() == "artist") {
    sortElements($nodes, "year");
} else {
    sortElements($nodes, "name");
}
$smarty->assign('form_action', urlize());
$smarty->assign('hidden_field', '<input type="hidden" name="' . jz_encode('jz_list_type') . '" value="' . jz_encode('nodes') . '">');
// Now let's loop through the nodes
$i = 0;
$c = 0;
foreach ($nodes as $item) {
    $array[$i]['name'] = $item->getName();
    $array[$i]['path'] = $item->getPath('string');
Example #24
0
function SERVICE_IMPORTMEDIA_id3tags($node, $root_path = false, $flags = array())
{
    global $ext_graphic, $default_art, $audio_types, $video_types;
    $be = new jzBackend();
    $root = new jzMediaNode();
    if (isset($flags['recursive']) && $flags['recursive'] === false || $root_path === false) {
        /*
        if ($node === false) { $node = new jzMediaNode(); }
        $tracks = $node->getSubNodes("tracks");
        foreach ($tracks as $track) {
        	$fname = $track->getFileName("host");
        	$entry = $be->lookupFile($fname);
        	if (!is_array($entry)) {
        		echo "Error in SERVICE_IMPORTMEDIA_id3tags. File added but does not exist in registry.";
        		return;
        	}
        	if ($entry['fs_sync'] && !file_exists($fname)) {
        		$be->unregisterFile($fname);
        		$root->removeMedia($track);
        	}
        	// TODO: CHECK THE ABOVE!!! CHECK UNREGISTERFILE!
        	// TODO: check modified time and move file if needed.
        }
        */
        return false;
    }
    $directory_list = array();
    $directory_list[] = $root_path;
    if (isset($flags['showstatus']) && $flags['showstatus'] && !(is_string($flags['showstatus']) && $flags['showstatus'] == "cli")) {
        $_SESSION['jz_import_full_progress'] = 0;
    }
    while (sizeof($directory_list) > 0) {
        $cur_dir = array_shift($directory_list);
        if (isset($flags['showstatus']) && is_string($flags['showstatus']) && $flags['showstatus'] == "cli") {
            echo word("Scanning: %s", $cur_dir) . "\n";
        }
        $bestImage = "";
        $albums = array();
        $track_paths = array();
        $track_filenames = array();
        $track_metas = array();
        if (!($handle = opendir($cur_dir))) {
            continue;
        }
        //die("Could not access directory $dir");
        while ($file = readdir($handle)) {
            if ($file == "." || $file == "..") {
                continue;
            }
            $fullpath = $cur_dir . "/" . $file;
            if (is_dir($fullpath)) {
                $directory_list[] = $fullpath;
            } else {
                if (preg_match("/\\.({$ext_graphic})\$/i", $file) && !stristr($file, ".thumb.")) {
                    // An image
                    if (@preg_match("/({$default_art})/i", $file)) {
                        $bestImage = $fullpath;
                    } else {
                        if ($bestImage == "") {
                            $bestImage = $fullpath;
                        }
                    }
                } else {
                    if (preg_match("/\\.({$audio_types})\$/i", $file) || preg_match("/\\.({$video_types})\$/i", $file)) {
                        $entry = $be->lookupFile($fullpath);
                        if (isset($flags['showstatus']) && $flags['showstatus'] && !(is_string($flags['showstatus']) && $flags['showstatus'] == "cli")) {
                            if ($_SESSION['jz_import_full_progress'] % 50 == 0 or $_SESSION['jz_import_full_progress'] == 0 or $_SESSION['jz_import_full_progress'] == 1) {
                                showStatus();
                            }
                            $_SESSION['jz_import_full_progress']++;
                        }
                        if (is_array($entry) && $entry['added'] < filemtime($fullpath)) {
                            // moved file
                            $track =& new jzMediaTrack($fullpath);
                            $track->playpath = $fullpath;
                            $meta = $track->getMeta("file");
                            $arr = array();
                            if (isset($meta['genre'])) {
                                $arr['genre'] = $meta['genre'];
                            }
                            if (isset($meta['subgenre'])) {
                                $arr['subgenre'] = $meta['subgenre'];
                            }
                            if (isset($meta['artist'])) {
                                $arr['artist'] = $meta['artist'];
                            }
                            if (isset($meta['album'])) {
                                $arr['album'] = $meta['album'];
                            }
                            if (isset($meta['disk'])) {
                                $arr['disk'] = $meta['disk'];
                            }
                            if (isset($meta['filename'])) {
                                $arr['track'] = $meta['filename'];
                            }
                            $old = new jzMediaTrack($entry['path']);
                            $child = $root->moveMedia($old, $arr);
                            if ($child !== false) {
                                $album = $child->getAncestor("album");
                                if ($album !== false) {
                                    $albums[$album->getPath("String")] = true;
                                }
                            }
                        } else {
                            if ($entry === false || isset($flags['force']) && $flags['force'] === true) {
                                // Set path so when getFileName is called and the filepath was not found,
                                // we get the correct path.
                                $track =& new jzMediaTrack($fullpath);
                                $track->playpath = $fullpath;
                                $meta = $track->getMeta("file");
                                $arr = array();
                                if (isset($meta['genre'])) {
                                    $arr['genre'] = $meta['genre'];
                                }
                                if (isset($meta['subgenre'])) {
                                    $arr['subgenre'] = $meta['subgenre'];
                                }
                                if (isset($meta['artist'])) {
                                    $arr['artist'] = $meta['artist'];
                                }
                                if (isset($meta['album'])) {
                                    $arr['album'] = $meta['album'];
                                }
                                if (isset($meta['disk'])) {
                                    $arr['disk'] = $meta['disk'];
                                }
                                if (isset($meta['filename'])) {
                                    $arr['track'] = $meta['filename'];
                                }
                                $track_paths[] = $arr;
                                $track_filenames[] = $fullpath;
                                $track_metas[] = $meta;
                            }
                        }
                    }
                }
            }
        }
        // while reading dir
        $art_dir = dirname(__FILE__) . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . ".." . DIRECTORY_SEPARATOR . "data" . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR;
        if (sizeof($track_paths) > 0) {
            $results = $root->bulkInject($track_paths, $track_filenames, $track_metas);
            for ($i = 0; $i < sizeof($results); $i++) {
                if ($results[$i] !== false) {
                    $album = $results[$i]->getAncestor("album");
                    if ($album !== false) {
                        $albums[$album->getPath("String")] = true;
                        $newalbum = new jzMediaNode($album->getPath("String"));
                        // If we have album art in the tag, add it.
                        if ($track_metas[$i]['pic_data'] != "") {
                            $artloc = realpath($art_dir) . DIRECTORY_SEPARATOR . "art_" . $newalbum->getID() . ".jpg";
                            if ($artloc !== false) {
                                $filehandle = fopen($artloc, "wb");
                                fwrite($filehandle, $track_metas[$i]['pic_data']);
                                fclose($filehandle);
                                $newalbum->addMainArt("data" . DIRECTORY_SEPARATOR . "images" . DIRECTORY_SEPARATOR . "art_" . $newalbum->getID() . ".jpg");
                            }
                        }
                    }
                }
            }
        }
    }
    if (isset($flags['showstatus']) && is_string($flags['showstatus']) && $flags['showstatus'] == "cli") {
        echo word("Scanning for removed media.") . "\n";
    }
    $be->removeDeadFiles();
}
Example #25
0
 * Code Purpose: Takes a given path and generates a Podcast feed for it
 * Created: 9.24.03 by Ross Carlson
 *
 * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
$include_path = getcwd() . "/";
@(include_once 'system.php');
@(include_once 'settings.php');
include_once $include_path . "lib/general.lib.php";
include_once $include_path . 'services/class.php';
include_once 'backend/backend.php';
include_once 'frontend/display.php';
$jzSERVICES = new jzServices();
$jzSERVICES->loadStandardServices();
$display = new jzDisplay();
// Now let's get the node so we can get the tracks
$node = new jzMediaNode($_GET['jz_path']);
$par = $node->getAncestor("artist");
$artist = $par->getName();
$tracks = $node->getSubNodes("tracks", -1);
// Now let's display the header
header("Content-type: application/xml");
echo '<?xml version="1.0" encoding="utf-8"?>' . "\n" . '<rss xmlns:itunes="http://www.itunes.com/DTDs/Podcast-1.0.dtd" version = "2.0">' . "\n" . '<channel>' . "\n" . '  <atom:link rel="self" type="application/rss+xml" title="Jinzora - ' . str_replace("&", "&amp;", $artist . " - " . $node->getName()) . '" href="' . $this_site . $_SERVER['REQUEST_URI'] . '" xmlns:atom="http://purl.org/atom/ns#" />' . "\n" . '  <title>Jinzora - ' . str_replace("&", "&amp;", $artist . " - " . $node->getName()) . '</title>' . "\n" . '  <link>http://www.jinzora.com/</link>' . "\n" . '  <language>en-us</language>' . "\n" . '  <generator>Jinzora http://www.jinzora.com/</generator>' . "\n";
if (($art = $node->getMainArt("200x200")) != false) {
    echo '  <itunes:image rel="image" type="video/jpeg" href="' . str_replace("&", "&amp;", $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true)) . '">' . $node->getName() . '</itunes:image>' . "\n";
    echo '  <itunes:link rel="image" type="video/jpeg" href="' . str_replace("&", "&amp;", $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true)) . '">' . $node->getName() . '</itunes:link>' . "\n";
}
if (($desc = $node->getDescription()) != false) {
    echo '  <description><![CDATA[' . $desc . ']]></description>' . "\n";
}
// Now let's loop through the tracks
$i = 0;
Example #26
0
function SERVICE_IMPORTMEDIA_filesystem($node, $root_path = false, $flags = array())
{
    global $ext_graphic, $audio_types, $video_types, $playlist_types, $default_art;
    if (!isset($playlist_types)) {
        $playlist_types = "m3u";
    }
    global $importerLevel;
    if (!isset($importerLevel)) {
        $importerLevel = 0;
    }
    $be = new jzBackend();
    if ($root_path !== false) {
        $folder = $root_path;
    } else {
        $folder = $node->getFilePath();
    }
    $bestImage = "";
    // TODO: FIX THE PARAMETER HERE FOR 3.0
    $thisPath = array_values($flags['path']);
    $parent = new jzMediaNode($thisPath);
    if (isset($flags['showstatus']) && $flags['showstatus'] && !(is_string($flags['showstatus']) && $flags['showstatus'] == "cli")) {
        if (!isset($_SESSION['jz_import_full_progress'])) {
            $_SESSION['jz_import_full_progress'] = 0;
        }
    }
    if (!($handle = opendir($folder))) {
        echo 'SERVICE_IMPORTMEDIA_filesystem: could not open ' . $folder;
        return false;
    }
    if (isset($flags['showstatus']) && is_string($flags['showstatus']) && $flags['showstatus'] == "cli") {
        echo word("Scanning: %s", $folder) . "\n";
    }
    $track_paths = array();
    $track_filenames = array();
    $track_metas = array();
    while ($file = readdir($handle)) {
        if (importSkipFile($file)) {
            continue;
        }
        $fullpath = $folder . '/' . $file;
        if (is_dir($fullpath)) {
            $entry = $be->lookupFile($fullpath);
            if ($entry === false || isset($flags['recursive']) && $flags['recursive']) {
                $flags2 = $flags;
                if (sizeof($flags2['hierarchy']) == 0) {
                    $val = 'disk';
                } else {
                    $val = array_shift($flags2['hierarchy']);
                    if ($val == 'track') {
                        $val = "disk";
                    }
                }
                $flags2['path'][$val] = $file;
                $flags2['recursive'] = true;
                $importerLevel++;
                SERVICE_IMPORTMEDIA_filesystem($node, $fullpath, $flags2);
                $importerLevel--;
            }
        } else {
            if (preg_match("/\\.({$ext_graphic})\$/i", $file) && !stristr($file, ".thumb.")) {
                // An image
                if (@preg_match("/({$default_art})/i", $file)) {
                    $bestImage = $fullpath;
                } else {
                    if ($bestImage == "") {
                        $bestImage = $fullpath;
                    }
                }
            } else {
                if (preg_match("/\\.({$playlist_types})\$/i", $file)) {
                    $ext = substr($file, strrpos($file, '.') + 1);
                    if (0 == strcasecmp($ext, 'm3u')) {
                        $m3u_lines = file($fullpath);
                        $is_local_m3u = false;
                        foreach ($m3u_lines as $line) {
                            if ($line == '#') {
                                // TODO: get metadata.
                                continue;
                            } else {
                                if (false === strpos($line, '://')) {
                                    $is_local_m3u = true;
                                    break;
                                }
                                $mediaref = $line;
                                $medianame = $mediaref;
                                while ($medianame[strlen($medianame) - 1] == '/') {
                                    $medianame = substr($medianame, 0, strlen($medianame) - 1);
                                }
                                $medianame = substr($medianame, strrpos($medianame, '/') + 1);
                                $mypath = $flags['path'];
                                $mypath['track'] = $medianame;
                                $track_paths[] = $mypath;
                                $track_filenames[] = $mediaref;
                                $track_metas[] = array();
                            }
                        }
                    }
                } else {
                    if (preg_match("/\\.({$audio_types})\$/i", $file) || preg_match("/\\.({$video_types})\$/i", $file)) {
                        $entry = $be->lookupFile($fullpath);
                        if (isset($flags['showstatus']) && !(is_string($flags['showstatus']) && $flags['showstatus'] == "cli")) {
                            if ($_SESSION['jz_import_full_progress'] % 50 == 0 or $_SESSION['jz_import_full_progress'] == 0 or $_SESSION['jz_import_full_progress'] == 1) {
                                showStatus();
                            }
                            $_SESSION['jz_import_full_progress']++;
                        }
                        if (isset($flags['force']) && $flags['force'] || !is_array($entry)) {
                            $mypath = $flags['path'];
                            $mypath['track'] = $file;
                            if (isset($flags['readtags']) && $flags['readtags']) {
                                $track =& new jzMediaTrack($fullpath);
                                $track->playpath = $fullpath;
                                $meta = $track->getMeta("file");
                            } else {
                                $meta = false;
                            }
                            $track_paths[] = $mypath;
                            $track_filenames[] = $fullpath;
                            $track_metas[] = $meta;
                        }
                    }
                }
            }
        }
    }
    $node->bulkInject($track_paths, $track_filenames, $track_metas);
    if ($bestImage != "") {
        $parent->addMainArt($bestImage);
    }
    $be->registerFile($folder, $thisPath);
    if ($parent->getFilePath() != $folder) {
        $parent->setFilePath($folder);
    }
    if ($importerLevel == 0) {
        $be->removeDeadFiles($folder, $flags['recursive']);
    }
}
Example #27
0
function getCurNodeList()
{
    global $sort_by_year, $node;
    $display =& new jzDisplay();
    if (isset($_GET['jz_letter'])) {
        $root = new jzMediaNode();
        $nodes = $root->getAlphabetical($_GET['jz_letter'], "nodes", distanceTo("artist"));
    } else {
        if (isset($_SESSION['JZ_CURRENT_MEDIA_LIST'])) {
            // Removed while coding
            //return $_SESSION['JZ_CURRENT_MEDIA_LIST'];
        }
        $nodes = $node->getSubNodes("nodes");
    }
    if ($sort_by_year == "true") {
        sortElements($nodes, "year");
    } else {
        sortElements($nodes, "name");
    }
    $itemArray = array();
    // Now let's loop through the nodes
    foreach ($nodes as $item) {
        $itemArray[] = array("name" => $item->getName(), "path" => $item->getPath(), "link" => $display->link($item, "VIEW", false, false, true), "playlink" => $display->playLink($item, "PLAY", false, false, true));
    }
    $_SESSION['JZ_CURRENT_MEDIA_LIST'] = $itemArray;
    return $itemArray;
}
Example #28
0
    ?>
">
						<td width="30%" valign="top">
							<nobr>
								<?php 
    echo word('Album');
    ?>
:
							</nobr>
						</td>
						<td width="70%" valign="top">
							<!--
							<select name="edit_item_parent" class="jz_select" style="width:185px;">
								<?php 
    // Now let's get all the items at this level
    $root = new jzMediaNode();
    switch ($node->getPType()) {
        case "artist":
            $valArr = $root->getSubNodes("nodes", distanceTo("genre"));
            break;
    }
    for ($e = 0; $e < count($valArr); $e++) {
        echo '<option ';
        if ($valArr[$e]->getName() == $parent->getName()) {
            echo ' selected ';
        }
        echo 'value="' . $valArr[$e]->getName() . '">' . $valArr[$e]->getName() . "</option>\n";
    }
    ?>
							</select>-->
							<?php 
Example #29
0
function handleUserInit()
{
    global $jzSERVICES, $jzUSER, $jz_language, $node, $skin, $include_path, $css, $image_dir, $my_frontend, $fe, $jz_path, $web_path, $USER_SETTINGS_OVERRIDE;
    writeLogData("messages", "Index: Testing the language file for security and including");
    $USER_SETTINGS_OVERRIDE = array();
    // for use by user agents
    checkUserAgent();
    handleSetLanguage();
    handleSetFrontend();
    writeLogData("messages", "Index: Testing the theme file for security and including");
    handleSetTheme();
    handleJukeboxVars();
    if (!($node === false)) {
        if (!($dir = $jzUSER->getSetting('home_dir')) === false && $jzUSER->getSetting('home_read') === true) {
            if (strpos(strtolower($jz_path), strtolower($dir)) === false) {
                $jz_path = "";
            }
        }
        $node = new jzMediaNode($jz_path);
        if (isset($_GET['depth'])) {
            $node->setNaturalDepth($_GET['depth']);
        } else {
            doNaturalDepth($node);
        }
    }
    // Let's setup our stylesheet and icons
    // Should this be moved to display.php:preHeader()?
    if (stristr($skin, "/")) {
        $css = $include_path . "{$skin}/default.php";
        $image_dir = $web_path . "{$skin}/";
    } else {
        $css = $include_path . "style/{$skin}/default.php";
        $image_dir = $web_path . "style/{$skin}/";
    }
}
Example #30
0
$this->openBlock();
// Now let's see if they searched
if (isset($_POST['searchDupArtists']) or isset($_POST['searchDupAlbums']) or isset($_POST['searchDupTracks'])) {
    // Ok, let's search, but for what?
    if (isset($_POST['searchDupArtists'])) {
        $distance = distanceTo("artist");
        $what = "nodes";
    }
    if (isset($_POST['searchDupAlbums'])) {
        $distance = distanceTo("album");
        $what = "nodes";
    }
    // Ok, now we need to get a list of ALL artist so we can show possible dupes
    echo word("Retrieving full list...") . "<br><br>";
    flushdisplay();
    $root = new jzMediaNode();
    $artArray = $root->getSubNodes($what, $distance);
    for ($i = 0; $i < count($artArray); $i++) {
        $valArray[] = $artArray[$i]->getName();
    }
    echo word("Scanning full list...") . "<br><br>";
    flushdisplay();
    $found = $root->search($valArray, $what, $distance, sizeof($valArray), "exact");
    foreach ($found as $e) {
        $matches[] = $e->getName();
        echo $e->getName() . '<br>';
        flushdisplay();
    }
    $this->closeBlock();
    exit;
}