Пример #1
0
 function drawBreadcrumbs($return = false)
 {
     global $img_up_arrow, $this_page;
     // Now let's create the breadcrumbs
     $bcArray = explode("/", $_SESSION['jz_path']);
     $node = new jzMediaNode($_SESSION['jz_path']);
     $display = new jzDisplay();
     $bcrumbs = "";
     $bcrumbs = $img_up_arrow . " ";
     $bcrumbs .= '<a href="' . str_replace("ajax_request.php", "index.php", $this_page) . '">' . word("Home") . '</a>';
     $bcrumbs .= "&nbsp;";
     // Now we need to cut the last item off the list
     $bcArray = array_slice($bcArray, 0, count($bcArray) - 1);
     // Now let's display the crumbs
     $path = "";
     for ($i = 0; $i < count($bcArray); $i++) {
         $bcrumbs .= $img_up_arrow . "&nbsp;";
         $path .= $bcArray[$i] . "/";
         $curPath = substr($path, 0, strlen($path) - 1);
         $arr = array();
         $arr['jz_path'] = $curPath;
         $link = str_replace("ajax_request.php", "index.php", urlize($arr));
         $bcrumbs .= '<a href="' . $link . '">' . $bcArray[$i] . '</a>';
         $bcrumbs .= "&nbsp;";
     }
     $mode = "GET";
     $bcrumbs .= '<form action="' . $this_page . '" method="' . $mode . '">';
     $bcrumbs .= '- <select style="width:100px" class="jz_select" name="' . jz_encode('jz_path') . '" onChange="form.submit();">';
     $parent = $node->getParent();
     $nodes = $parent->getSubNodes("nodes");
     foreach ($nodes as $child) {
         $path = $child->getPath("String");
         $bcrumbs .= '<option ';
         // Is this the current one?
         if ($child->getName() == $node->getName()) {
             $bcrumbs .= ' selected ';
         }
         $bcrumbs .= 'value="' . htmlentities(jz_encode($path)) . '">' . $display->returnShortName($child->getName(), 20) . '</option>';
     }
     $bcrumbs .= '</select>';
     $bcrumbs .= "</form>&nbsp;";
     if ($return) {
         return $bcrumbs;
     }
     echo $bcrumbs;
 }
Пример #2
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;
}
Пример #3
0
 function slickHeaderBlock($node = false, $title = false)
 {
     global $cms_mode, $genre_drop, $artist_drop, $this_page, $album_drop, $song_drop, $quick_drop, $jzUSER, $allow_resample;
     // Now are the forums post or get?
     // We have to post for CMSes
     if ($cms_mode == "true") {
         $mode = "POST";
     } else {
         $mode = "GET";
     }
     if (!$node) {
         $node = new jzMediaNode();
     }
     // Now let's display the header for the block
     if (!$title) {
         $title = "Browse";
         if ($node->getName() != "") {
             $parent = $node->getParent();
             if ($parent->getName() != "") {
                 $title .= " :: " . $parent->getName();
             }
             $title .= " :: " . $node->getName();
         }
     }
     // Let's startup Smarty
     $smarty = smartySetup();
     // Now let's assign our variables to smarty
     $smarty->assign('title', $title);
     $smarty->assign('breadcrumbs', $this->breadCrumbs());
     $smarty->assign('jz_bg_color', jz_bg_color);
     $smarty->assign('this_page', $this_page);
     $smarty->assign('mode', $mode);
     $smarty->assign('show_genre', false);
     if ($genre_drop != "false" && ($d = distanceTo("genre")) !== false && $d > 0) {
         $smarty->assign('show_genre', true);
     }
     $smarty->assign('genre_drop', $genre_drop);
     $smarty->assign('show_artist', false);
     if ($artist_drop != "false" && ($d = distanceTo("artist")) !== false && $d > 0) {
         $smarty->assign('show_artist', true);
     }
     $smarty->assign('artist_drop', $artist_drop);
     $smarty->assign('show_album', false);
     if ($album_drop != "false" && ($d = distanceTo("album")) !== false && $d > 0) {
         $smarty->assign('show_album', true);
     }
     $smarty->assign('album_drop', $album_drop);
     $smarty->assign('song_drop', $song_drop);
     $smarty->assign('quick_drop', $quick_drop);
     $smarty->assign('show_resample', $allow_resample);
     // Now let's display the template
     $smarty->display(SMARTY_ROOT . 'templates/slick/block-header.tpl');
 }
Пример #4
0
/**
 * 
 * Echos out the XML header information
 *
 * @author Ross Carlson
 * @since 3/31/05
 * 
 **/
function getCurrentTrack()
{
    global $jzUSER, $this_site, $root_dir;
    // What kind of output?
    if (isset($_REQUEST['type'])) {
        $type = $_REQUEST['type'];
    } else {
        $type = "xml";
    }
    // Now let's set the width
    if (isset($_REQUEST['imagesize'])) {
        $imagesize = $_REQUEST['imagesize'] . "x" . $_REQUEST['imagesize'];
    } else {
        $imagesize = "150x150";
    }
    // Now let's see when to stop
    if (isset($_REQUEST['count'])) {
        $total = $_REQUEST['count'];
    } else {
        $total = 1;
    }
    // Let's start the page
    if ($type == "xml") {
        echoXMLHeader();
    }
    // Now let's get the data
    $be = new jzBackend();
    $ar = $be->getPlaying();
    $display = new jzDisplay();
    $fullList = "";
    $found = false;
    foreach ($ar as $user => $tracks) {
        $name = $jzUSER->getSetting("full_name");
        if ($name == "") {
            $name = $jzUSER->lookupName($user);
            // that's the user name
        }
        $i = 0;
        foreach ($tracks as $time => $song) {
            // Now let's make sure this is the right user
            if ($name == $jzUSER->getName()) {
                // Now let's make sure we don't list this twice
                if (stristr($fullList, $song['path'] . "-" . $name . "\n")) {
                    continue;
                }
                $fullList .= $song['path'] . "-" . $name . "\n";
                // Now let's create the objects we need
                $node = new jzMediaNode($song['path']);
                $track = new jzMediaTrack($song['path']);
                $album = $node->getParent();
                $artist = $album->getParent();
                $meta = $track->getMeta();
                // Now, now let's echo out the data
                switch ($type) {
                    case "xml":
                        echo "  <item>\n";
                        echo "    <title>" . $this_site . xmlUrlClean($meta['title']) . "</title>\n";
                        echo "    <album>\n";
                        echo "      <name>" . $this_site . xmlUrlClean($album->getName()) . "</name>\n";
                        echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                        echo "    </album>\n";
                        echo "    <artist>\n";
                        echo "      <name>" . $this_site . xmlUrlClean($artist->getName()) . "</name>\n";
                        echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                        echo "    </artist>\n";
                        echo "  </item>\n";
                        break;
                    case "html":
                        if (isset($_REQUEST['align'])) {
                            if ($_REQUEST['align'] == "center") {
                                echo "<center>";
                            }
                        }
                        echo $meta['title'] . "<br>";
                        echo $album->getName() . "<br>";
                        echo $this_site . $display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                        echo $artist->getName() . "<br>";
                        echo $display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                        break;
                    case "mt":
                        $art = $album->getMainArt($imagesize, true, "audio", true);
                        if ($art) {
                            // Now let's try to get the link from the amazon meta data service
                            if ($_REQUEST['amazon_id'] != "") {
                                $jzService = new jzServices();
                                $jzService->loadService("metadata", "amazon");
                                $id = $jzService->getAlbumMetadata($album, false, "id");
                                echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">';
                            }
                            $display->image($art, $album->getName(), 150, false, "limit");
                            if ($_REQUEST['amazon_id'] != "") {
                                echo '</a>';
                            }
                            echo "<br>";
                        }
                        echo $meta['title'] . "<br>";
                        if ($_REQUEST['amazon_id'] != "") {
                            $jzService = new jzServices();
                            $jzService->loadService("metadata", "amazon");
                            $id = $jzService->getAlbumMetadata($album, false, "id");
                            echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">' . $album->getName() . "</a><br>";
                        } else {
                            echo $album->getName() . "<br>";
                        }
                        echo $artist->getName() . "<br>";
                        break;
                }
                $found = true;
                // Now should we stop?
                $i++;
                if ($i >= $total) {
                    break;
                }
            }
        }
    }
    if (!$found) {
        // Ok, we didn't find anything so let's get the last thing they played...
        $be = new jzBackend();
        $history = explode("\n", $be->loadData("playhistory-" . $jzUSER->getID()));
        $track = new jzMediatrack($history[count($history) - 1]);
        $album = $track->getParent();
        $artist = $album->getParent();
        $meta = $track->getMeta();
        // Now, now let's echo out the data
        switch ($type) {
            case "xml":
                echo "  <item>\n";
                echo "    <title>" . $this_site . xmlUrlClean($meta['title']) . "</title>\n";
                echo "    <album>\n";
                echo "      <name>" . $this_site . xmlUrlClean($album->getName()) . "</name>\n";
                echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                echo "    </album>\n";
                echo "    <artist>\n";
                echo "      <name>" . $this_site . xmlUrlClean($artist->getName()) . "</name>\n";
                echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                echo "    </artist>\n";
                echo "  </item>\n";
                break;
            case "html":
                if (isset($_REQUEST['align'])) {
                    if ($_REQUEST['align'] == "center") {
                        echo "<center>";
                    }
                }
                echo $meta['title'] . "<br>";
                echo $album->getName() . "<br>";
                echo $this_site . $display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                echo $artist->getName() . "<br>";
                echo $display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                break;
            case "mt":
                if (isset($_REQUEST['align'])) {
                    if ($_REQUEST['align'] == "center") {
                        echo "<center>";
                    }
                }
                $art = $album->getMainArt($imagesize, true, "audio", true);
                if ($art) {
                    // Now let's try to get the link from the amazon meta data service
                    if ($_REQUEST['amazon_id'] != "") {
                        $jzService = new jzServices();
                        $jzService->loadService("metadata", "amazon");
                        $id = $jzService->getAlbumMetadata($album, false, "id");
                        echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">';
                    }
                    $display->image($art, $album->getName(), 150, false, "limit");
                    if ($_REQUEST['amazon_id'] != "") {
                        echo '</a>';
                    }
                    echo "<br>";
                }
                echo $meta['title'] . "<br>";
                if ($_REQUEST['amazon_id'] != "") {
                    $jzService = new jzServices();
                    $jzService->loadService("metadata", "amazon");
                    $id = $jzService->getAlbumMetadata($album, false, "id");
                    echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">' . $album->getName() . "</a><br>";
                } else {
                    echo $album->getName() . "<br>";
                }
                echo $artist->getName() . "<br>";
                break;
        }
    }
    // Now let's close out
    switch ($type) {
        case "xml":
            echoXMLFooter();
            break;
        case "html":
            echo '<a target="_blank" title="Jinzora :: Free Your Media!" href="http://www.jinzora.com"><img src="http://www.jinzora.com/downloads/button-stream.gif" border="0"></a>';
            break;
        case "mt":
            echo '<a target="_blank" title="Jinzora :: Free Your Media!" href="http://www.jinzora.com"><img src="http://www.jinzora.com/downloads/button-stream.gif" border="0"></a>';
            break;
    }
    if (isset($_REQUEST['align'])) {
        if ($_REQUEST['align'] == "center") {
            echo "</center>";
        }
    }
}