예제 #1
0
    /**
     * Shows the chart system
     * 
     * @author Ross Carlson
     * @version 01/26/05
     * @since 01/26/05
     * @param $node The node we are viewing so we can filter
     * @param $types The charts to display. Comma seperated list of:
     * topplayalbum, topplayartist, topdownalbum, newalbums, newartists, newtracks
     * recentplayalbum, recentplayartist, recentplaytrack,
     * topratedalbum, topratedartist, topviewartist, topplaytrack
     * @param $numItems The number of items we want to return (defaults to 5)
     * @param $format Should we format this or return raw data (defaults to true)
     * @param $opts an array of extra options (transitioning to new parameter scheme)
     * 
     */
    function showCharts($node, $types = false, $numItems = false, $format = true, $vertAlign = false, $opts = false)
    {
        global $album_name_truncate, $img_tiny_play, $img_tiny_play_dis, $jzUSER, $img_rss, $root_dir, $advanced_tooltips, $rss_in_charts, $num_items_in_charts, $chart_timeout_days, $chart_types;
        $be = new jzBackend();
        if ($be->hasFeature('charts') === false) {
            return;
        }
        // Let's setup our objects
        $blocks = new jzBlocks();
        $display = new jzDisplay();
        $nobr = true;
        if ($opts !== false) {
            if (isset($opts['allow_breaks'])) {
                $nobr = false;
            } else {
                $nobr = true;
            }
        }
        // Now let's do a loop creating all our blocks
        if ($types === false || $types == "") {
            if (isset($chart_types) && !isNothing($chart_types)) {
                $b = $chart_types;
            } else {
                $b = "topplayalbum,topplayartist,topviewartist,newalbums";
            }
        } else {
            $b = $types;
        }
        $bArray = explode(",", $b);
        for ($e = 0; $e < count($bArray); $e++) {
            // Now let's create our blocks
            $showPlays = false;
            switch ($bArray[$e]) {
                case "topplayalbum":
                    $func = "getMostPlayed";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "played-albums";
                    $title = word("Top Played Albums");
                    $distance = "album";
                    $showPlays = true;
                    $showDownload = false;
                    $rss = "most-played";
                    break;
                case "topplayartist":
                    $func = "getMostPlayed";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "played-artists";
                    $title = word("Top Played Artists");
                    $distance = "artist";
                    $showPlays = true;
                    $showDownload = false;
                    $rss = "most-played-artist";
                    break;
                case "topdownalbum":
                    $func = "getMostDownloaded";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "downloaded-albums";
                    $title = word("Top Downloaded Albums");
                    $distance = "album";
                    $showDownload = true;
                    $rss = "most-downloaded";
                    break;
                case "newalbums":
                    $func = "getRecentlyAdded";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "new-albums";
                    $title = word("New Albums");
                    $distance = "album";
                    $showDownload = false;
                    $rss = "last-added";
                    break;
                case "newartists":
                    $func = "getRecentlyAdded";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "new-artists";
                    $title = word("New Artists");
                    $distance = "artist";
                    $showDownload = false;
                    $rss = "last-added-artists";
                    break;
                case "newtracks":
                    $func = "getRecentlyAdded";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "new-tracks";
                    $title = word("New Tracks");
                    $distance = "track";
                    $showDownload = false;
                    $rss = "last-added-tracks";
                    break;
                case "recentplaytrack":
                    $func = "getRecentlyPlayed";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "recentplayed-tracks";
                    $title = word("Recently Played Tracks");
                    $distance = "track";
                    $showDownload = false;
                    $rss = "recentplayed-track";
                    break;
                case "topplaytrack":
                    $func = "getMostPlayed";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "played-tracks";
                    $title = word("Top Played Tracks");
                    $distance = "track";
                    $showDownload = false;
                    $rss = "most-played-tracks";
                    break;
                case "recentplayalbum":
                    $func = "getRecentlyPlayed";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "recentplayed-albums";
                    $title = word("Recently Played Albums");
                    $distance = "album";
                    $showDownload = false;
                    $rss = "recentplayed-album";
                    break;
                case "recentplayartist":
                    $func = "getRecentlyPlayed";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "recentplayed-artists";
                    $title = word("Recently Played Artists");
                    $distance = "artist";
                    $showDownload = false;
                    $rss = "recentplayed-artist";
                    break;
                case "topratedalbum":
                    $func = "getTopRated";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "toprated-albums";
                    $title = word("Top Rated Albums");
                    $distance = "album";
                    $showDownload = false;
                    $rss = "toprated-album";
                    break;
                case "topratedartist":
                    $func = "getTopRated";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "toprated-artists";
                    $title = word("Top Rated Artists");
                    $distance = "artist";
                    $showDownload = false;
                    $rss = "toprated-artist";
                    break;
                case "topviewartist":
                    $func = "getMostViewed";
                    $arr['action'] = "popup";
                    $arr['ptype'] = "topstuff";
                    $arr['tptype'] = "topviewed-artists";
                    $title = word("Most Viewed Artists");
                    $distance = "artist";
                    $showDownload = false;
                    $rss = "topviewed-artist";
                    break;
                default:
                    continue;
            }
            // Now let's get the data
            if ($distance == "track") {
                $returnType = "tracks";
            } else {
                $returnType = "nodes";
            }
            if ($numItems) {
                $num_items_in_charts = $numItems;
            }
            if ($chart_timeout_days > 0) {
                $be = new jzBackend();
                $data_id .= pathize('chart-' . $node->getPath("String")) . "-{$func}-{$distance}-{$num_items_in_charts}";
                if (($recent = $be->loadData($data_id, true)) === false) {
                    $recent = $node->{$func}($returnType, distanceTo($distance, $node), $num_items_in_charts);
                    $be->storeData($data_id, $recent, $chart_timeout_days);
                }
            } else {
                $recent = $node->{$func}($returnType, distanceTo($distance, $node), $num_items_in_charts);
            }
            // Now let's see if we got data
            if (count($recent) == 0) {
                continue;
            }
            ?>
			<td width="25%" valign="top">
				<?php 
            if ($format) {
                echo '<div id="slickMainBlockBody">';
            }
            ?>
				<table width="95%" cellpadding="0" cellspacing="0" border="0">
					<tr>
						<td width="100%" valign="middle">
				   <?php 
            if ($nobr) {
                echo '<nobr>';
            }
            ?>
							<?php 
            if ($format) {
                // Now let's display the link to the FULL top played list
                echo '<a onclick="openPopup(this, 300, 450); return false;" title="' . $title . '" href="' . urlize($arr) . '"><strong>' . $title . '</strong></a>';
                // Let's link to the RSS feed
                if ($rss_in_charts == "true") {
                    echo ' - <a href="' . $root_dir . '/rss.php?type=' . $rss;
                    if ($node->getLevel() != 0) {
                        echo '&root=' . $node->getPath("String");
                    }
                    echo '">' . $img_rss . '</a>';
                }
                echo '<br>';
            }
            // Now let's loop through the results
            for ($i = 0; $i < count($recent); $i++) {
                // Now let's create our node and get the properties
                $item = $artnode = $recent[$i];
                $album = $item->getName();
                $parent = $item->getAncestor("artist");
                if ($parent !== false) {
                    $artist = $parent->getName();
                }
                $albumDLCount = $item->getDownloadCount();
                $year = $item->getYear();
                $dispYear = "";
                if ($year != "-") {
                    $dispYear = " (" . $year . ")";
                }
                // Now let's create our links
                if ($distance == "track") {
                    $artnode = $item->getAncestor("album");
                    if (is_object($artnode)) {
                        $albumArr['jz_path'] = $artnode->getPath("String");
                        $gp = $item->getAncestor("artist");
                        if (is_object($gp)) {
                            $artistArr['jz_path'] = $gp->getPath("String");
                        } else {
                            $artistArr['jz_path'] = '';
                        }
                    } else {
                        $albumArr['jz_path'] = '';
                        $artistArr['jz_path'] = '';
                    }
                } else {
                    $albumArr['jz_path'] = $item->getPath("String");
                    if ($parent !== false) {
                        $artistArr['jz_path'] = $parent->getPath("String");
                    }
                }
                // Now let's create our short names
                $artistTitle = returnItemShortName($artist, $album_name_truncate);
                $albumTitle = returnItemShortName($album, $album_name_truncate);
                // Now let's display it
                if ($nobr) {
                    echo "<nobr>";
                }
                if (!$jzUSER->getSetting('stream')) {
                    echo $img_tiny_play_dis;
                } else {
                    $display->playLink($item, $img_tiny_play, $album);
                }
                // Ok, did they want advanced tooltips?
                if ($advanced_tooltips == "true") {
                    // Now let's set the hover code
                    $innerOver = "";
                    $showTip = false;
                    if (($art = $artnode->getMainArt("75x75")) != false) {
                        $innerOver .= $display->returnImage($art, $artnode->getName(), 75, 75, "limit", false, false, "left", "3", "3");
                        $showTip = true;
                        $bTitle = $artist . " - " . $album . $dispYear;
                    } else {
                        // Ok, no art so let's make this look better
                        $innerOver .= "<strong>" . $artist . "<br>" . $album . $dispYear . "</strong><br>";
                        $bTitle = $album . $dispYear;
                    }
                    $desc_truncate = 200;
                    $desc = $item->getDescription();
                    if (!isNothing($desc)) {
                        $innerOver .= $display->returnShortName($desc, $desc_truncate);
                        $showTip = true;
                    }
                    // Now let's fix up
                    $innerOver = str_replace("'", "", str_replace('"', "", $innerOver));
                    $bTitle = str_replace("'", "", str_replace('"', "", $bTitle));
                    if ($showTip) {
                        $title = $display->returnToolTip($innerOver, $bTitle);
                    } else {
                        $title = ' title="' . $artist . ' - ' . $album . $dispYear . '"';
                    }
                } else {
                    // Standard tooltips
                    $title = ' title="' . $artist . ' - ' . $album . $dispYear . '"';
                }
                echo ' <a ' . $title . ' href="' . urlize($albumArr) . '">' . $albumTitle;
                if ($showPlays) {
                    if ($bArray[$e] == "topplayalbum") {
                        $albumPlayCount = $item->getSubNodeCount('tracks', -1);
                        if ($albumPlayCount > 0) {
                            $albumPlayCount = ceil($item->getPlayCount() / $albumPlayCount);
                        }
                    } else {
                        $albumPlayCount = $item->getPlayCount();
                    }
                    echo ' (' . $albumPlayCount . ')';
                }
                if ($showDownload) {
                    echo ' (' . $albumDLCount . ')';
                }
                echo "</a><br>";
                if ($nobr) {
                    echo "</nobr>";
                }
            }
            if ($nobr) {
                echo '</nobr>';
            }
            ?>
						</td>
					</tr>
				</table>
				<?php 
            if ($format) {
                echo '</div>';
            }
            ?>
			</td>
			    <?php 
            if ($vertAlign) {
                echo '</tr><tr>';
            }
            ?>
		<?php 
        }
    }
예제 #2
0
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;
foreach ($tracks as $track) {
    // Let's get the tracks path
    $meta = $track->getMeta();
    $artist = $track->getAncestor("artist");
    // Now let's create the URL
    $tpArr = explode("?", $track->getFileName("user"));
    $path = $this_site . $root_dir . "/mediabroadcast.php/" . $tpArr[1] . "/" . $track->getName() . ".mp3";
    $path = str_replace("&", "&amp;", $path);
예제 #3
0
파일: blocks.php 프로젝트: jinzora/jinzora3
 /**
  * Draws the Featured Artist/Album Block
  * 
  * @author Ross Carlson
  * @version 01/19/05
  * @since 01/19/05
  * @param object $node The node that we are looking at so we can filter
  */
 function showFeatured($featured, $truncate = 150, $slimDisplay = false)
 {
     global $album_name_truncate, $img_tiny_play, $artist_truncate, $album_name_truncate, $cms_mode;
     // Let's set the featured width
     $featWidth = 250;
     // Should we just return?
     if (!is_array($featured)) {
         return;
     }
     // Let's make sure there are featured items
     // Now let's grab the featured artists
     shuffle($featured);
     $item = $featured[0];
     if ($item == "") {
         return;
     }
     // Let's setup our objects
     $display = new jzDisplay();
     $smarty = smartySetup();
     $title = word("Editors Pick") . ": ";
     $title2 = "<strong>" . $display->playLink($item, $img_tiny_play, $item->getName(), false, true) . $display->link($item, $display->returnShortName($item->getName(), $artist_truncate), word("Browse") . ": " . $item->getName(), false, true) . "</strong>";
     $smarty->assign('art', "");
     if (($art = $item->getMainArt("75x75")) != false) {
         $smarty->assign('art', $display->link($item, $display->returnImage($art, $item->getName(), 75, 75, "limit", false, false, "left", "3", "3"), false, false, true));
     }
     $smarty->assign('title', $title);
     $smarty->assign('title2', $title2);
     // Should we display the artist?
     if ($item->getPType() == "album") {
         $parent = $item->getParent();
         $smarty->assign('artist_play_button', $display->playLink($parent, $img_tiny_play, $parent->getName(), false, true));
         $smarty->assign('artist', $display->link($parent, $parent->getName(), $parent->getName(), false, true));
     }
     $desc_truncate = $truncate;
     $desc = $item->getDescription();
     $smarty->assign('description', $display->returnShortName($desc, $desc_truncate));
     $smarty->assign('read_more', "");
     if (strlen($desc) > $desc_truncate) {
         $url_array = array();
         $url_array['jz_path'] = $item->getPath("String");
         $url_array['action'] = "popup";
         $url_array['ptype'] = "readmore";
         $smarty->assign('read_more', '<a href="' . urlize($url_array) . '" onclick="openPopup(this, 450, 450); return false;"> - ' . word("read more") . '</a>');
     }
     $smarty->display(SMARTY_ROOT . 'templates/slick/block-editors-pick.tpl');
 }
예제 #4
0
<?php

global $random_art_size;
$display = new jzDisplay();
$sm = smartySetup();
if (!isset($node) || $random_albums <= 0) {
    return;
}
$art = array();
$artArray = $node->getSubNodes("nodes", distanceTo("album", $node), true, $random_albums, true);
foreach ($artArray as $al) {
    $art[] = array('name' => $al->getName(), 'link' => urlize(array('jz_path' => $al->getPath("string"))), 'playlink' => $display->playlink($al, 'Play', false, false, true), 'art' => $display->returnImage($al->getMainArt($random_art_size . 'x' . $random_art_size), $al->getName(), $random_art_size, $random_art_size, "fixed"));
}
$sm->assign('albums', $art);
jzTemplate($sm, 'randomAlbums');
예제 #5
0
// Now let's get the album and artist
$album = $track->getNaturalParent("album");
$artist = $album->getNaturalParent("artist");
$desc = $album->getDescription();
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);
    }
}
// Now let's get the art
$art = $album->getMainArt("200x200");
if ($art != "") {
    $albumArt = $display->returnImage($art, $album->getName(), 150, 150, "limit", false, false, "left", "3", "3");
} else {
    $art = $jzSERVICES->createImage($web_root . $root_dir . '/style/images/default.jpg', "200x200", $track->getName(), "audio", "true");
    $albumArt = '<img src="' . $this_site . $root_dir . "/" . $art . '" border="0" align="left" hspace="3" vspace="3">';
}
// Now let's setup Smarty
$smarty = smartySetup();
// Let's setup the Smarty variables
$smarty->assign('trackName', $track->getName());
$smarty->assign('albumName', $album->getName());
$smarty->assign('artistName', $artist->getName());
$smarty->assign('albumArt', $albumArt);
$smarty->assign('lyrics', $meta['lyrics']);
$smarty->assign('trackNum', $meta['number']);
$smarty->assign('albumDesc', $desc);
$smarty->assign('totalTracks', $_GET['totalTracks']);
예제 #6
0
파일: ajax.php 프로젝트: seanfbrown/jinzora
/** 
 * 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;
}
예제 #7
0
        $album = ucwords($node->getName());
        $parent = $node->getAncestor("artist");
        if ($parent) {
            $artist = ucwords($parent->getName());
        } else {
            $artist = "";
        }
        // Now let's display the art
        if (($art = $node->getMainArt("130x130")) == false) {
            $art = "style/images/default.jpg";
        }
        $display->link($parent, $artist, $artist, false, false, false, false, false, "_top");
        echo " - ";
        $display->link($node, $album, $album, false, false, false, false, false, "_top");
        echo "<br>";
        echo $display->returnImage($art, $node->getName(), "130", "130", "fit", false, false, "left", "5", "5");
        // Now let's get the review
        $desc = $node->getDescription();
        $desc_truncate = 375;
        echo $display->returnShortName($desc, $desc_truncate);
        if (strlen($desc) > $desc_truncate) {
            $url_array = array();
            $url_array['jz_path'] = $node->getPath("String");
            $url_array['action'] = "popup";
            $url_array['ptype'] = "readmore";
            echo ' <a href="' . urlize($url_array) . '" onclick="openPopup(this, 450, 450); return false;">...read more</a>';
        }
    }
}
?>
				</td>
예제 #8
0
    if ($_POST['page'] == "RANDOM") {
        $start = 1 * 24;
        shuffle($artArray);
        $artArray = array_slice($artArray, $start, 24);
    } elseif ($_POST['page'] == "ALL") {
        $artArray = $artArray;
    } else {
        $start = $_POST['page'] * 24;
        $artArray = array_slice($artArray, $start, 24);
    }
} else {
    $artArray = array_slice($artArray, 0, 24);
}
jzTemplate($smarty, "block-open");
flushdisplay();
$i = 0;
$c = 0;
foreach ($artArray as $item) {
    $array[$c]['image'] = $display->link($item, $display->returnImage($item->getMainArt("100x100"), $item->getName(), 100, 100, "fixed"), false, false, true);
    if ($i == 6) {
        $i = -1;
        $array[$c]['row'] = '</tr><tr>';
    } else {
        $array[$c]['row'] = "";
    }
    $i++;
    $c++;
}
$smarty->assign('items', $array);
jzTemplate($smarty, "show-all-art");
jzTemplate($smarty, "block-close");
예제 #9
0
 $album = $item->getName();
 $parent = $item->getParent();
 $artist = $parent->getName();
 // Now let's create our links
 $albumArr['jz_path'] = $item->getPath("String");
 $artistArr['jz_path'] = $parent->getPath("String");
 // Now let's create our short names
 $artistTitle = returnItemShortName($artist, $album_name_truncate);
 $albumTitle = returnItemShortName($album, $album_name_truncate);
 // Now let's display it
 echo "<nobr>";
 $display->playLink($item, $img_tiny_play, $album);
 // Now let's set the hover code
 $innerOver = "";
 if (($art = $item->getMainArt()) != false) {
     $innerOver .= $display->returnImage($art, $item->getName(), 75, 75, "limit", false, false, "left", "3", "3");
 }
 $desc_truncate = 200;
 $desc = $item->getDescription();
 $innerOver .= $display->returnShortName($desc, $desc_truncate);
 if (strlen($desc) > $desc_truncate) {
     $innerOver .= "...";
 }
 $innerOver = str_replace('"', "", $innerOver);
 $innerOver = str_replace("'", "", $innerOver);
 // Now let's return our tooltip
 $capTitle = $artist . " - " . $album;
 $overCode = $display->returnToolTip($innerOver, $capTitle);
 echo ' <a onClick="opener.location.href=\'' . urlize($albumArr) . '\';window.close();" ' . $overCode . 'href="javascript:void()">' . $albumTitle;
 $cval = false;
 // TODO: showCount values can be:
예제 #10
0
파일: api.php 프로젝트: jinzora/jinzora3
/**
 * Results is an array of nodes and tracks.
 * Prints results in a variety of formats.
 */
function print_results($results, $format = 'xml', $trackfields = false, $nodefields = false, $queryMeta = false)
{
    global $this_site, $api_page;
    $display = new jzDisplay();
    $tracks = array();
    $nodes = array();
    // Now let's break our nodes and tracks out
    foreach ($results as $val) {
        // We look at objects as leafs or nodes
        // Leafs are the last branch on the tree
        // So those would be tracks/videos
        if ($val->isLeaf()) {
            $tracks[] = $val;
        } else {
            // Nodes are everything above the leafs
            // So albums, artists, and genres
            $nodes[] = $val;
        }
    }
    // Now let's output
    switch ($format) {
        case "xml":
            echoXMLHeader();
            echo "  <search>\n";
            echo "    <tracks>\n";
            // Now let's display the tracks
            if (sizeof($tracks) > 0) {
                foreach ($tracks as $track) {
                    // Let's get all the data for display
                    // The getMeta function lets us get all the metadata (length, bitrate, etc) from a tack
                    $meta = $track->getMeta();
                    // Now we go up from this item to get it's "ancestors"
                    // The reason we do this is to make sure we get the right thing
                    // for it, not just the one above.  This is important when using multidisk
                    // albums where their parent would be DISC1 not AlbumName
                    // You can do this recursively if you want
                    $album = $track->getAncestor("album");
                    $art = $album->getMainArt(false, true, "audio", true);
                    $artist = $album->getAncestor("artist");
                    $genre = $artist->getParent();
                    // Now let's display
                    echo "      <track>\n";
                    if (!is_array($trackfields) || in_array('id', $trackfields)) {
                        echo "        <id>" . xmlentities($track->getID()) . "</id>\n";
                    }
                    if (!is_array($trackfields) || in_array('name', $trackfields)) {
                        echo "        <name>" . xmlentities($meta['title']) . "</name>\n";
                    }
                    if (!is_array($trackfields) || in_array('metadata', $trackfields)) {
                        echo "        <metadata>\n";
                        echo "          <filename>" . xmlentities($meta['filename']) . "</filename>\n";
                        echo "          <tracknumber>" . xmlentities($meta['number']) . "</tracknumber>\n";
                        echo "          <length>" . xmlentities($meta['length']) . "</length>\n";
                        echo "          <bitrate>" . xmlentities($meta['bitrate']) . "</bitrate>\n";
                        echo "          <samplerate>" . xmlentities($meta['frequency']) . "</samplerate>\n";
                        echo "          <filesize>" . xmlentities($meta['size']) . "</filesize>\n";
                        echo "        </metadata>\n";
                    }
                    if (!is_array($trackfields) || in_array('album', $trackfields)) {
                        echo "        <album>" . xmlentities($album->getName()) . "</album>\n";
                    }
                    if (!is_array($trackfields) || in_array('artist', $trackfields)) {
                        echo "        <artist>" . xmlentities($artist->getName()) . "</artist>\n";
                    }
                    if (!is_array($trackfields) || in_array('genre', $trackfields)) {
                        echo "        <genre>" . xmlentities($genre->getName()) . "</genre>\n";
                    }
                    if (!is_array($trackfields) || in_array('path', $trackfields)) {
                        echo "        <path>" . xmlentities($track->getPath("string")) . "</path>\n";
                    }
                    if (!is_array($trackfields) || in_array('playlink', $trackfields)) {
                        echo "        <playlink>" . xmlentities($this_site . $track->getPlayHREF()) . "</playlink>\n";
                    }
                    if (!is_array($trackfields) || in_array('image', $trackfields)) {
                        echo "        <image>";
                        if ($art) {
                            echo xmlentities($display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true, true));
                        }
                        echo "        </image>\n";
                    }
                    if (!is_array($trackfields) || in_array('thumbnail', $trackfields)) {
                        echo "        <thumbnail>";
                        $art = $album->getMainArt('75x75', true, "audio", true);
                        if ($art) {
                            echo xmlentities($display->returnImage($art, false, 75, 75, "limit", false, false, false, false, false, "0", false, true, true));
                        }
                        echo "        </thumbnail>\n";
                    }
                    if (!is_array($trackfields) || in_array('type', $trackfields)) {
                        echo "        <type>" . xmlentities("Track") . "</type>\n";
                    }
                    echo "      </track>\n";
                }
            }
            echo "    </tracks>\n";
            echo "    <nodes>\n";
            // Now let's display the nodes
            if (sizeof($nodes) > 0) {
                foreach ($nodes as $node) {
                    // We do the same things here by getting item off the node
                    // $art would be the image for the item we're looking at
                    // In this case we want the art for the match we found
                    // This works on ALL objects if they have art
                    $art = $node->getMainArt(false, true, "audio", true);
                    $album = $node->getAncestor("album");
                    if ($album) {
                        $artist = $album->getAncestor("artist");
                    } else {
                        $artist = "";
                    }
                    echo "      <node>\n";
                    if (!is_array($nodefields) || in_array('id', $nodefields)) {
                        echo "        <id>" . xmlentities($node->getID()) . "</id>\n";
                    }
                    if (!is_array($nodefields) || in_array('name', $nodefields)) {
                        echo "        <name>" . xmlentities($node->getName()) . "</name>\n";
                    }
                    if (!is_array($nodefields) || in_array('type', $nodefields)) {
                        echo "        <type>" . xmlentities(ucwords($node->getPType())) . "</type>\n";
                    }
                    if (!is_array($nodefields) || in_array('link', $nodefields)) {
                        echo "        <link>" . xmlentities($this_site . $display->link($node, false, false, false, true, true)) . "</link>\n";
                    }
                    if ((!is_array($nodefields) || in_array('album', $nodefields)) && !empty($album)) {
                        echo "        <album>" . xmlentities($album->getName()) . "</album>\n";
                    }
                    if ((!is_array($nodefields) || in_array('artist', $nodefields)) && !empty($artist)) {
                        echo "        <artist>" . xmlentities($artist->getName()) . "</artist>\n";
                    }
                    if (!is_array($nodefields) || in_array('image', $nodefields)) {
                        echo "        <image>";
                        if ($art) {
                            echo xmlentities($display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true, true));
                        }
                        echo "        </image>\n";
                    }
                    if (!is_array($nodefields) || in_array('thumbnail', $nodefields)) {
                        echo "        <thumbnail>";
                        $art = $node->getMainArt('75x75', true, "audio", true);
                        if ($art) {
                            echo xmlentities($display->returnImage($art, false, 75, 75, "limit", false, false, false, false, false, "0", false, true, true));
                        }
                        echo "        </thumbnail>\n";
                    }
                    if (!is_array($nodefields) || in_array('playlink', $nodefields)) {
                        if ($node->getPType() == 'artist' || $node->getPType() == 'genre') {
                            echo "        <playlink>" . xmlentities($this_site . $node->getPlayHREF(true, 50)) . "</playlink>\n";
                        } else {
                            echo "        <playlink>" . xmlentities($this_site . $node->getPlayHREF()) . "</playlink>\n";
                        }
                    }
                    if (!is_array($nodefields) || in_array('path', $nodefields)) {
                        echo "        <path>" . xmlentities($node->getPath("string")) . "</path>\n";
                    }
                    if (!is_array($nodefields) || in_array('browse', $nodefields)) {
                        echo "        <browse>" . xmlentities($api_page . '&request=browse&jz_path=' . urlencode($node->getPath('string'))) . "</browse>\n";
                    }
                    echo "      </node>\n";
                }
            }
            echo "    </nodes>\n";
            echo "  </search>\n";
            echoXMLFooter();
            break;
        case "display":
            // Ok, let's redirect them to the search page
            header("Location: " . $this_site . "/index.php?doSearch=true&search_query=jam&search_type=ALL");
            break;
        case "json":
        case "jsonp":
            $jt = array();
            $jn = array();
            foreach ($tracks as $t) {
                $n = array();
                $meta = $t->getMeta();
                $album = $artist = $genre = false;
                $album = $t->getAncestor("album");
                if ($album) {
                    $artist = $album->getAncestor("artist");
                }
                if ($artist) {
                    $genre = $artist->getParent();
                }
                if ($album) {
                    $art = $album->getMainArt(false, true, "audio", true);
                }
                // Now let's display
                if (!is_array($trackfields) || in_array('image', $trackfields)) {
                    $n['image'] = $art ? $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true, true) : '';
                }
                if ($album) {
                    $art = $album->getMainArt('75x75', true, "audio", true);
                }
                if (!is_array($trackfields) || in_array('thumbnail', $trackfields)) {
                    $n['thumbnail'] = $art ? $display->returnImage($art, false, 75, 75, "limit", false, false, false, false, false, "0", false, true, true) : '';
                }
                if (!is_array($trackfields) || in_array('id', $trackfields)) {
                    $n['id'] = $t->getID();
                }
                if (!is_array($trackfields) || in_array('name', $trackfields)) {
                    $n['name'] = $meta['title'];
                }
                if (!is_array($trackfields) || in_array('album', $trackfields)) {
                    $n['album'] = $album ? $album->getName() : '';
                }
                if (!is_array($trackfields) || in_array('artist', $trackfields)) {
                    $n['artist'] = $artist ? $artist->getName() : '';
                }
                if (!is_array($trackfields) || in_array('genre', $trackfields)) {
                    $n['genre'] = $genre ? $genre->getName() : '';
                }
                if (!is_array($trackfields) || in_array('playlink', $trackfields)) {
                    $n['playlink'] = $this_site . $t->getPlayHREF();
                }
                if (!is_array($trackfields) || in_array('playlink', $trackfields)) {
                    $n['download'] = $this_site . $t->getDownloadHREF();
                }
                if (!is_array($trackfields) || in_array('metadata', $trackfields)) {
                    $n['metadata'] = $meta;
                }
                if (!is_array($trackfields) || in_array('path', $trackfields)) {
                    $n['path'] = $t->getPath("string");
                }
                if (!is_array($trackfields) || in_array('type', $trackfields)) {
                    $n['type'] = 'Track';
                }
                $jt[] = $n;
            }
            foreach ($nodes as $n) {
                $a = array();
                $album = $n->getAncestor("album");
                if ($album) {
                    $artist = $album->getAncestor("artist");
                }
                $art = $n->getMainArt(false, true, "audio", true);
                if (!is_array($nodefields) || in_array('id', $nodefields)) {
                    $a['id'] = $n->getID();
                }
                if (!is_array($nodefields) || in_array('name', $nodefields)) {
                    $a['name'] = $n->getName();
                }
                if (!is_array($nodefields) || in_array('type', $nodefields)) {
                    $a['type'] = ucwords($n->getPType());
                }
                if (!is_array($nodefields) || in_array('link', $nodefields)) {
                    $a['link'] = $this_site . $display->link($node, false, false, false, true, true);
                }
                if (!is_array($nodefields) || in_array('album', $nodefields)) {
                    $a['album'] = empty($album) ? '' : $album->getName();
                }
                if (!is_array($nodefields) || in_array('artist', $nodefields)) {
                    $a['artist'] = empty($artist) ? '' : $artist->getName();
                }
                if (!is_array($nodefields) || in_array('image', $nodefields)) {
                    $a['image'] = $art ? $display->returnImage($art, false, false, false, "limit", false, false, false, false, false, "0", false, true, true) : '';
                }
                $art = $n->getMainArt('75x75', true, "audio", true);
                if (!is_array($nodefields) || in_array('thumbnail', $nodefields)) {
                    $a['thumbnail'] = $art ? $display->returnImage($art, false, 75, 75, "limit", false, false, false, false, false, "0", false, true, true) : '';
                }
                if (!is_array($nodefields) || in_array('playlink', $nodefields)) {
                    if ($a['type'] == 'Artist' || $a['type'] == 'Genre') {
                        $a['playlink'] = $this_site . $n->getPlayHREF(true, 50);
                    } else {
                        $a['playlink'] = $this_site . $n->getPlayHREF();
                    }
                }
                if (!is_array($nodefields) || in_array('path', $nodefields)) {
                    $a['path'] = $n->getPath("string");
                }
                if (!is_array($nodefields) || in_array('browse', $nodefields)) {
                    $a['browse'] = $api_page . '&request=browse&jz_path=' . urlencode($n->getPath('string'));
                }
                $jn[] = $a;
            }
            $obj = array('tracks' => $jt, 'nodes' => $jn);
            if ($queryMeta !== false) {
                $obj['meta'] = $queryMeta;
            }
            if ($format == 'jsonp') {
                echo $_GET['jsoncallback'] . '(';
                echo json_encode($obj);
                echo ')';
            } else {
                echo json_encode($obj);
            }
            break;
        case 'plain':
        case 'text':
            foreach ($tracks as $t) {
                echo $t->getName() . "\n";
            }
            foreach ($nodes as $n) {
                echo $n->getName() . "\n";
            }
    }
}