/frontend/display.php
PHP | 3219 lines | 2052 code | 366 blank | 801 comment | 517 complexity | 11d4534f2cc9625a3be12f4edcf97bb6 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <?php if (!defined(JZ_SECURE_ACCESS)) die ('Security breach detected.');
- /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
- * JINZORA | Web-based Media Streamer
- *
- * Jinzora is a Web-based media streamer, primarily desgined to stream MP3s
- * (but can be used for any media file that can stream from HTTP).
- * Jinzora can be integrated into a CMS site, run as a standalone application,
- * or integrated into any PHP website. It is released under the GNU GPL.
- *
- * Jinzora Author:
- * Ross Carlson: ross@jasbone.com
- * http://www.jinzora.org
- * Documentation: http://www.jinzora.org/docs
- * Support: http://www.jinzora.org/forum
- * Downloads: http://www.jinzora.org/downloads
- * License: GNU GPL <http://www.gnu.org/copyleft/gpl.html>
- *
- * Contributors:
- * Please see http://www.jinzora.org/modules.php?op=modload&name=jz_whois&file=index
- *
- * Code Purpose: This page contains all the album display related functions
- * Created: 9.24.03 by Ross Carlson
- *
- * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
- /**
- * Pulls the correct PHP code for a given block.
- * Attempts to use the given frontend,
- * but falls back to code in frontend/blocks.
- *
- * The usual call is: include(jzBlock("name"));
- * We do this because doing the include inside this function
- * can mess with variables required by the block code.
- *
- * @author Ben Dodson
- * @ since 8/21/2006
- */
- function jzBlock($block) {
- global $fe;
- if (false !== strstr($block,'..') ||
- false !== strstr($block,'/') ||
- false !== strstr($block,'\\')) {
- die("Security breach detected (jzBlock)");
- }
-
- if (file_exists($file = dirname(__FILE__).'/frontends/'.$fe->name.'/blocks/'.$block.'.php')) {
- return $file;
- } else {
- return dirname(__FILE__).'/blocks/'.$block.'.php';
- }
- }
-
- function jzTemplate($smarty, $template) {
- global $fe;
- if (false !== strstr($template,'..') ||
- false !== strstr($template,'/') ||
- false !== strstr($template,'\\')) {
- die("Security breach detected (jzTemplate)");
- }
-
- if (file_exists($file = dirname(__FILE__).'/frontends/'.$fe->name.'/templates/'.$template.'.tpl')) {
- $smarty->display($file);
- }
- else if (file_exists($file = SMARTY_ROOT. 'templates/'.$fe->name.'/'. $template. '.tpl')) {
- $smarty->display($file);
- } else {
- $smarty->display(SMARTY_ROOT. 'templates/blocks/'. $template. '.tpl');
- }
- }
-
-
- /**
- * Handles the code for a popup function. Similar to
- * the block-handling function.
- *
- * @author Ben Dodson
- * @ since 8/21/2006
- */
- function jzPopup($block) {
- global $include_path;
- if (false !== strstr($block,'..') ||
- false !== strstr($block,'/') ||
- false !== strstr($block,'\\')) {
- die("Security breach detected (jzBlock)");
- }
-
- return $include_path.'popups/'.$block.'.php';
- }
-
- class jzDisplay {
-
- /**
- * Constructor for the class.
- *
- * @author Ben Dodson
- * @version 10/27/04
- * @since 10/27/04
- */
- function jzDisplay() {
-
- }
-
- function startCache($func, $params, $age = false){
- if (func_num_args() > 2) {
- $moreargs = func_get_args();
- $moreags = array_slice($moreargs,2);
- } else {
- $moreargs = false;
- }
- return $this->_internalCacheFunc(true,$func,$params,$moreargs,$age);
- }
-
- function endCache(){
- return $this->_internalCacheFunc(false);
- }
-
- // This function is internal to the cache functions.
- // We use this so we can create a static variable across both functions.
- function _internalCacheFunc($start, $func = false, $params = false, $moreargs = false, $age = false) {
- global $cache_age_days,$gzip_page_cache,$enable_page_caching;
- static $signature_stack = array();
- if ($enable_page_caching == "false") {
- return false;
- }
-
- if ($start) {
- // START THE CACHE
- $cacheFile = $this->createCachedPageName($func,$params,$moreargs);
-
- // Did they specify an age?
- if ($age && is_numeric($age)){
- $cache_age_days = $age;
- }
-
- if (is_file($cacheFile) and (time() - filemtime($cacheFile)) < ($cache_age_days * 86400)){
- if ($gzip_page_cache == "true"){
- $fp = gzopen($cacheFile,'r');
- gzpassthru($fp);
- } else {
- include_once($cacheFile);
- }
- return true;
- } else {
- if (is_object($params)){
- writeLogData("messages","Cache: Building cache for: ". $params->getName(). " type: ". $func);
- }
- ob_start();
- array_push($signature_stack,$cacheFile);
- }
- } else {
- // END THE CACHE
- $cacheFile = array_pop($signature_stack);
- if ($gzip_page_cache == "true"){
- $fp = gzopen($cacheFile, 'w');
- gzwrite($fp, ob_get_contents());
- gzclose($fp);
- } else {
- $fp = fopen($cacheFile, 'w');
- fwrite($fp, ob_get_contents());
- fclose($fp);
- }
- ob_end_flush();
- }
- }
- function createCachedPageName($func,$params,$moreargs){
- global $web_root, $root_dir, $jzUSER, $security_key, $skin, $my_frontend, $enable_page_caching;
-
- if ($enable_page_caching == "false") {
- return false;
- }
-
- $signature = $skin . $my_frontend . $security_key . $func . serialize($params);
-
- if ($moreargs !== false) {
- for ($i = 0; $i < sizeof($moreargs); $i++) {
- $signature .= $moreargs[$i];
- }
- }
- $name="";
- if (is_object($params)){
- $name = ".". md5($params->getName());
- }
-
- // Let's create the page
- $pName = $web_root. $root_dir. "/temp/cache/". md5($signature . "-". $jzUSER->getID()). $name. ".html";
-
- // Now do we need to kill this file?
- if ($_SESSION['jz_purge_file_cache'] == "true"){
- @unlink($pName);
- }
-
- return $pName;
- }
-
- function purgeCachedPage($node){
- global $web_root, $root_dir, $jzUSER,$include_path;
- $name="";
- if (is_object($node)){
- $name = md5($node->getName());
- }
- if (0 == strlen($name)) {
- return;
- }
- $d = @dir($include_path . "temp/cache");
- if ($d !== false) {
- while (false !== ($entry = $d->read())) {
- if (stristr($entry,$name)){
- @unlink($include_path."temp/cache/". $entry);
- }
- }
- }
- }
-
- /*
- * Displays the shopping purchase button using the shopping service
- *
- * @author Ross Carlson
- * @since 12.02.05
- * @version 12.02.05
- * @param $node The node we are looking at
- **/
- function purchaseButton($node){
- global $enable_shopping, $jzSERVICES;
-
- // Is shopping enabled?
- if ($enable_shopping <> "true"){
- return;
- }
-
- // Let's create the shopping service
- echo $jzSERVICES->createShoppingLink($node);
- }
-
-
- /*
- * Displays a button to allow the user to add this item to their favorites
- *
- * @author Ross Carlson
- * @since 12.17.05
- * @version 12.17.05
- * @param $node The node they are adding
- **/
- function addToFavButton($node, $return = false){
- global $img_add_fav, $enable_favorites;
-
- if ($enable_favorites <> "true"){return;}
-
- $arr = array();
- $arr['action'] = "popup";
- $arr['ptype'] = "addtofavorites";
- $arr['jz_path'] = $node->getPath("String");
-
- $retVal = '<a onClick="openPopup(' . "'". urlize($arr) ."'" . ',350,150); return false;" href="javascript:;">';
- $retVal .= $img_add_fav;
- $retVal .= "</a>";
-
- if ($return){
- return $retVal;
- } else {
- echo $retVal;
- }
- }
-
- /*
- * Displays the media mangement dropdown
- *
- * @author Ross Carlson
- * @since 4.16.05
- * @version 4.16.05
- * @param $array An array of the names of the tabs
- **/
- function displayTabs($array){
- ?>
- <style>
- .tab{
- border: thin solid <?php echo jz_fg_color; ?>;
- position: absolute;
- top: 40;
- width: 140;
- text-align: center;
- color: <?php echo jz_font_color; ?>;
- font-weight: bold;
- padding: 3;
- cursor: pointer;
- cursor: hand;
- }
- .panel{
- position: absolute;
- top: 70;
- width: 95%;
- z-index: 1;
- visibility: hidden;
- overflow: auto;
- }
- </style>
- <script language="JavaScript">
- var currentPanel;
-
- function showPanel(panelNum) {
- //hide visible panel, show selected panel,
- //set tab
- if (currentPanel != null) {
- hidePanel();
- }
- document.getElementById('panel'+panelNum).style.visibility = 'visible';
- currentPanel = panelNum;
- setState(panelNum);
- }
-
- function hidePanel() {
- //hide visible panel, unhilite tab
- document.getElementById('panel'+currentPanel).style.visibility = 'hidden';
- document.getElementById('tab'+currentPanel).style.backgroundColor = '<?php echo jz_pg_bg_color; ?>';
- document.getElementById('tab'+currentPanel).style.color = '<?php echo jz_font_color; ?>';
- }
-
- function setState(tabNum) {
- if (tabNum==currentPanel) {
- document.getElementById('tab'+tabNum).style.backgroundColor = '<?php echo jz_fg_color; ?>';
- document.getElementById('tab'+tabNum).style.color = '<?php echo jz_font_color; ?>';
- } else {
- document.getElementById('tab'+tabNum).style.backgroundColor = '<?php echo jz_pg_bg_color; ?>';
- document.getElementById('tab'+tabNum).style.color = '<?php echo jz_font_color; ?>';
- }
- }
-
- function hover(tab) {
- tab.style.backgroundColor = '<?php echo jz_fg_color; ?>';
- }
- </script>
- <?php
- $i=1;
- $c=5;
- foreach ($array as $item){
- echo '<div id="tab'. $i. '" class="tab" style="left: '. $c. ';" onClick="showPanel('. $i. ');" onMouseOver="hover(this);" onMouseOut="setState('. $i. ')">'. $item. '</div>';
- $c=$c+147;
- $i++;
- }
- }
-
- /*
- * Displays the media mangement dropdown
- *
- * @author Ross Carlson
- * @since 4.16.05
- * @version 4.16.05
- * @param $node The node we are looking at
- **/
- 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
- }
-
-
- /*
- * Displays the media mangement dropdown
- *
- * @author Ross Carlson
- * @since 4.16.05
- * @version 4.16.05
- * @param $node The node we are looking at
- **/
- function mediaManagementDropdown($node){
- global $jzUSER, $allow_filesystem_modify, $resize_images, $enable_podcast_subscribe, $root_dir;
- ?>
- <form action="<?php echo $root_dir. "/popup.php"; ?>" method="GET" name="mediamanform">
- <select class="jz_select" name="action" style="width:125px" onChange="openPopup(this.form.action.options[this.selectedIndex].value, 400, 400, false, 'MediaManagement')">
- <?php
- // Now let's setup the values
- $url_array = array();
- $url_array['jz_path'] = $node->getPath("String");
- $url_array['action'] = "popup";
- ?>
- <option value=""><?php echo word("Media Management"); ?></option>
- <option value="<?php $url_array['ptype'] = "scanformedia"; echo urlize($url_array); ?>"><?php echo word("Rescan Media"); ?></option>
- <?php
- // Can they add media?
- if (checkPermission($jzUSER,"upload",$node->getPath("String")) and $allow_filesystem_modify == "true") {
- ?>
- <option value="<?php $url_array['ptype'] = "uploadmedia"; echo urlize($url_array); ?>"><?php echo word("Add Media"); ?></option>
- <?php
- }
- ?>
- <?php
- if ($node->getPType() == "album"){
- ?>
- <option value="<?php $url_array['ptype'] = "bulkedit"; echo urlize($url_array); ?>"><?php echo word("Bulk Edit"); ?></option>
- <?php
- }
- ?>
- <option value="<?php $url_array['ptype'] = "addlinktrack"; echo urlize($url_array); ?>"><?php echo word("Add Link Track"); ?></option>
-
-
- <?php
- if ($enable_podcast_subscribe == "true"){
- ?>
- <option value="<?php $url_array['ptype'] = "addpodcast"; echo urlize($url_array); ?>"><?php echo word("Podcast Manager"); ?></option>
- <?php
- }
- ?>
-
- <option value="<?php $url_array['ptype'] = "setptype"; echo urlize($url_array); ?>"><?php echo word("Set Page Type"); ?></option>
- <option value="<?php $url_array['ptype'] = "searchlyrics"; echo urlize($url_array); ?>"><?php echo word("Retrieve Lyrics"); ?></option>
- <option value="<?php $url_array['ptype'] = "getmetadata"; echo urlize($url_array); ?>"><?php echo word("Retrieve Meta Data"); ?></option>
- <?php
- if ($node->getPType() == "album"){
- ?>
- <option value="<?php $url_array['ptype'] = "getalbumart"; echo urlize($url_array); ?>"><?php echo word("Search for Album Art"); ?></option>
- <?php
- }
- ?>
- <?php
- if ($resize_images == "true"){
- ?>
- <option value="<?php $url_array['ptype'] = "resizeart"; echo urlize($url_array); ?>"><?php echo word("Resize All Art"); ?></option>
- <?php
- }
- ?>
- <option value="<?php $url_array['ptype'] = "autorenumber"; echo urlize($url_array); ?>"><?php echo word("Auto Renumber"); ?></option>
- <?php
- if (($jzUSER->getSetting('admin') === true || $jzUSER->getSetting('home_admin') == true)
- and ($node->getPType() == "artist" or $node->getPType() == "album")) {
- ?>
- <option value="<?php $url_array['ptype'] = "iteminfo"; echo urlize($url_array); ?>"><?php echo word("Item Information"); ?></option>
- <?php
- }
- ?>
- <option value="<?php $url_array['ptype'] = "retagger"; echo urlize($url_array); ?>"><?php echo word("Retag Tracks"); ?></option>
- <?php
- if ($node->getPType() == "artist" or $node->getPType() == "album"){
- // Ok, is it already featured?
- if (!$node->isFeatured()){
- $url_array['ptype'] = "addfeatured";
- echo '<option value="'. urlize($url_array). '">'. word("Add to Featured"). '</option>';
- } else {
- $url_array['ptype'] = "removefeatured";
- echo '<option value="'. urlize($url_array). '">'. word("Remove from Featured"). '</option>';
- }
- }
- ?>
- <?php
- $url_array['ptype'] = "artfromtags";
- echo '<option value="'. urlize($url_array). '">'. word("Pull art from Tag Data"). '</option>';
- ?>
-
- <?php
- if ($node->getPType() == "album"){
- ?>
- <option value="<?php $url_array['ptype'] = "pdfcover"; echo urlize($url_array); ?>"><?php echo word("Create PDF Cover"); ?></option>
- <!--<option value="<?php $url_array['ptype'] = "burncd"; echo urlize($url_array); ?>"><?php echo word("Burn CD"); ?></option>-->
- <?php
- }
- ?>
- </select>
- </form>
- <?php
- }
-
-
- /*
- * Displays the browse dropdown boxes
- *
- * @author Ross Carlson
- * @since 4.16.05
- * @version 4.16.05
- **/
- function displayBrowseDropdown(){
- global $this_page, $hierarchy;
-
- $lvls = @implode("|",$hierarchy);
- ?>
- <form action="<?php echo $this_page; ?>" method="GET">
- <?php
- $this->hiddenPageVars();
- ?>
- <select class="jz_select" name="action" style="width:125px" onChange="openPopup(this.form.action.options[this.selectedIndex].value, 250, 400, false, 'MediaManagement')">
- <?php
- // Now let's setup the values
- $url_array = array();
- $url_array['action'] = "popup";
- ?>
- <option value=""><?php echo word("Browse"); ?></option>
- <?php
- if (stristr($lvls,"genre")){
- echo '<option value="';
- $url_array['ptype'] = "genre";
- echo urlize($url_array). '">'. word("All Genres"). ' ('. number_format($_SESSION['jz_num_genres']). ')</option>'. "\n";
- }
-
- if (stristr($lvls,"artist")){
- echo '<option value="';
- $url_array['ptype'] = "artist";
- echo urlize($url_array). '">'. word("All Artists"). ' ('. number_format($_SESSION['jz_num_artists']). ')</option>'. "\n";
- }
-
- if (stristr($lvls,"album")){
- echo '<option value="';
- $url_array['ptype'] = "album";
- echo urlize($url_array). '">'. word("All Albums"). ' ('. number_format($_SESSION['jz_num_albums']). ')</option>'. "\n";
- }
-
- echo '<option value="';
- $url_array['ptype'] = "track";
- echo urlize($url_array). '">'. word("All Tracks"). ' ('. number_format($_SESSION['jz_num_tracks']). ')</option>'. "\n";
- ?>
- </select>
- </form>
- <?php
- }
-
-
- /*
- * Returns the HTML code for a fancy Overlib tooltip
- *
- * @author Ross Carlson
- * @since 4.05.05
- * @version 4.05.05
- * @param $path The path in the filesystem or the URL to the image
- **/
- function returnToolTip($body, $title){
- $overCode = "'". $body. "', CAPTION, '<nobr>". $title. "</nobr>', DELAY, 300, HAUTO, VAUTO, CAPCOLOR, '". jz_font_color. "', BORDER, 2, BGCOLOR, '". jz_pg_bg_color. "', TEXTCOLOR, '". jz_font_color. "', FGCOLOR, '". jz_fg_color. "'";
- return ' onmouseover="return overlib('. $overCode. ');" onmouseout="return nd();"';
- }
-
- /*
- * Returns the text for the deminesions of an image
- *
- * @author Ross Carlson
- * @since 3.18.05
- * @version 3.18.05
- * @param $path The path in the filesystem or the URL to the image
- **/
- function returnImageDimensions($path){
- $image = @imagecreatefromjpeg($path);
- if ($image){
- return imagesx($image). "x". imagesy($image);
- } else {
- return false;
- }
- }
-
- /*
- * Displays the discussion icon
- *
- * @author Ross Carlson
- * @since 3.18.05
- * @version 3.18.05
- * @param $node The item (node) we are viewing
- **/
- function displayDiscussIcon($node){
- global $img_discuss, $img_discuss_dis;
-
- $item = new jzMediaElement($node->getPath('String'));
-
- $arr = array();
- $arr['action'] = "popup";
- $arr['ptype'] = "discussitem";
- $arr['jz_path'] = $item->getPath("String");
-
- echo '<a onClick="openPopup(' . "'". urlize($arr) ."'" . ',450,300); return false;" href="javascript:;">';
- if ($item->getDiscussion() == ""){
- echo $img_discuss_dis;
- } else {
- echo $img_discuss;
- }
- echo "</a>";
- }
-
- /*
- * Displays the previous artists/album this user has browsed
- *
- * @author Ben Dodson
- * @since 2/2/05
- * @version 2/2/05
- * @param $node The node we are viewing
- * @param $type The type of drop down to return, Artist or Album
- **/
- function displayPrevDropdown($node, $type){
- global $jzUSER, $this_page, $cms_mode;
-
- // Let's start the form
- echo '<form action="'. $this_page. '" method="GET">'. "\n";
- $this->hiddenPageVars();
- echo '<select style="width:125px" class="jz_select" name="'. jz_encode('jz_path'). '" onChange="form.submit();">';
- if ($type == "artist"){
- echo '<option value="">'. word("Previous Artists"). '</option>';
- }
- if ($type == "album"){
- echo '<option value="">'. word("Previous Albums"). '</option>';
- }
-
- // Now let's load the users history
- $oldHist = $jzUSER->loadData('history');
-
- // Now let's parse that our
- $hArr = explode("\n",$oldHist);
- $allArtists = "";
- for ($i=0; $i < count($hArr); $i++){
- // Now let's break that out
- $dArr = explode("|",$hArr[$i]);
- if ($dArr[0] == $type and !stristr($allArtists,"|". $dArr[1]) and ($node->getName() <> $dArr[1])){
- // Now let's display the option
- echo '<option value="'. jz_encode($dArr[2]). '">'. $dArr[1]. '</option>';
- $allArtists .= "|". $dArr[1];
- }
- }
- echo '</select>';
- echo '</form>';
- }
- /* Starts a settings table.
- *
- * @author Ben Dodson
- * @since 2/2/05
- * @version 2/2/05
- *
- **/
- function openSettingsTable($action) {
- echo '<table>';
- echo '<form action="'.$action.'" method="POST">'."\n";
- }
- /* Closes a settings table.
- *
- * @author Ben Dodson
- * @since 2/2/05
- * @version 2/2/05
- * @param writeable: if the file isn't writeable, don't show the update button.
- **/
- function closeSettingsTable($writeable = true) {
- echo '<tr><td colspan="2">';
- echo '<table align="center"><tr width="50%"><td>';
- if ($writeable) {
- echo '<input type="submit" class="jz_submit" name="update_postsettings" value="Update">';
- } else {
- echo " ";
- }
- echo '</td><td width="50%">';
- //echo '<input type="submit" value="Close" name="close" onClick="window.close();opener.location.reload(true);" class="jz_submit">';
- echo " ";
- echo '</td></tr></table></tr>';
- echo '</form></table>'."\n";
- }
- /**
- * Completely handles a field for a setting.
- * This function will display a checkbox.
- * for a certain variable.
- * It also updates the $settings_file variable to modify the setting.
- *
- * @author Ben Dodson
- * @version 3/10/05
- * @since 3/10/05
- **/
- function settingsCheckbox($label, $varname, &$settings_array, $show_complete = true) {
- // See if the array needs to be updated (from a form submit)
- $fieldname = "edit_" . $varname;
- if (isset($_POST[$fieldname])) {
- $settings_array[$varname] = "true";
- if ($show_complete === false) {
- return;
- }
- } else if (isset($_POST['update_postsettings'])) {
- // Form was submitted and the box was unchecked; it's false.
- $settings_array[$varname] = "false";
- if ($show_complete === false) {
- return;
- }
- }
- echo '<tr><td align="right" valign="top" width="30%">'."\n";
- echo $label . ' ';
- echo '</td><td align="left" width="70%">';
- echo '<input type="checkbox" name="'.$fieldname.'" class="jz_checkbox"';
- if (isset($settings_array[$varname]) &&
- ($settings_array[$varname] === true || $settings_array[$varname] == "true")) {
- echo ' checked';
- }
- echo '>';
- echo "</td></tr>\n";
- }
-
- /**
- * Completely handles a field for a setting.
- * This function will display a form field
- * for a certain variable.
- * It also updates the $settings_file variable to modify the setting.
- *
- * @author Ben Dodson
- * @version 2/2/05
- * @since 2/2/05
- **/
- function settingsTextbox($label, $varname, &$settings_array, $show_complete = true) {
- // See if the array needs to be updated (from a form submit)
- $fieldname = "edit_" . $varname;
- if (isset($_POST[$fieldname])) {
- $settings_array[$varname] = $_POST[$fieldname];
- if ($show_complete === false) {
- return;
- }
- }
- echo '<tr><td align="right" valign="top" width="30%">'."\n";
- echo $label . ' ';
- echo '</td><td align="left" width="70%">';
- echo '<input name="'.$fieldname.'" class="jz_input"';
- if (isset($settings_array[$varname])) {
- echo ' value="' . htmlentities($settings_array[$varname]) . '"';
- }
- echo '>';
- echo "</td></tr>\n";
- }
- /**
- * Completely handles a field for a setting.
- * This function will display a dropdown
- * for a certain variable with given options.
- * The options are in an array, IE array(field1, field2)
- * It also updates the $settings_file variable to modify the setting.
- *
- * @author Ben Dodson
- * @version 2/2/05
- * @since 2/2/05
- **/
- function settingsDropdown($label, $varname, $options, &$settings_array, $show_complete = true) {
- // See if the array needs to be updated (from a form submit)
- $fieldname = "edit_" . $varname;
- if (isset($_POST[$fieldname])) {
- $settings_array[$varname] = $_POST[$fieldname];
- if ($show_complete === false) {
- return;
- }
- }
- echo '<tr><td align="right" valign="top" width="30%">'."\n";
- echo $label . ' ';
- echo '</td><td align="left" width="70%">';
- echo '<select name="'.$fieldname.'" class="jz_input">';
- foreach ($options as $type) {
- echo '<option value="'.htmlentities($type).'"';
- if ($settings_array[$varname] == $type) {
- echo " selected";
- }
- echo '>' . $type . '</option>';
- }
- echo '</select>';
- echo "</td></tr>\n";
- }
- /**
- * Completely handles a field for a setting.
- * This function will display a dropdown
- * for a certain variable with given options.
- * The options are the contents of directory $dir
- * $type is either "dir" or "file"
- *
- * @author Ben Dodson
- * @version 2/2/05
- * @since 2/2/05
- **/
- function settingsDropdownDirectory($label, $varname, $directory, $type = "dir", &$settings_array, $show_complete = true) {
- // See if the array needs to be updated (from a form submit)
- $fieldname = "edit_" . $varname;
- if (isset($_POST[$fieldname])) {
- $settings_array[$varname] = $_POST[$fieldname];
- if ($show_complete === false) {
- return;
- }
- }
- echo '<tr><td align="right" valign="top" width="30%">'."\n";
- echo $label . ' ';
- echo '</td><td align="left" width="70%">';
- echo '<select name="'.$fieldname.'" class="jz_input">';
- $entries = readDirInfo($directory,$type);
-
- foreach ($entries as $entry) {
- if ($entry == "CVS") {
- continue;
- }
- if ($type == "file") {
- $entry = str_replace(".php","",$entry);
- }
- echo '<option value="'.htmlentities($entry).'"';
- if ($settings_array[$varname] == $entry) {
- echo " selected";
- }
- echo '>';
- echo $entry;
- echo '</option>';
- }
- echo '</select>';
- echo "</td></tr>\n";
- }
- /**
- * Ugly PHP Scripty way to get a link
- * for a jukebox action. Returns an open
- * tag that performs a jukebox action
- * (play/pause/etc.).
- *
- * @author Ben Dodson
- * @since 1/7/08
- **/
- function getOpenJukeboxActionTag($type) {
- if (defined('NO_AJAX_JUKEBOX')) {
- $arr = array();
- $arr['action'] = "jukebox";
- $arr['subaction'] = "jukebox-command";
- $arr['command'] = $type;
- $arr['ptype'] = "jukebox";
- $arr['jz_path'] = isset($_GET['jz_path']) ? $_GET['jz_path'] : '';
-
- if (isset($_GET['frame'])){
- $arr['frame'] = $_GET['frame'];
- }
- return '<a href="'. urlize($arr). '"';
- } else {
- // AJAX:
- return '<a href="javascript:;" onClick="sendJukeboxRequest(\''.$type.'\'); return false;"';
- }
- }
- /**
- * Displays the Jukebox play button
- *
- *
- * @author Ross Carlson
- * @version 2/9/05
- * @since 2/9/05
- * @param $node the Node we are looking at
- * @param $type The type of button to display
- */
- function displayJukeboxButton($type){
- global $img_jb_play, $img_jb_pause, $img_jb_stop,
- $img_jb_previous, $img_jb_next, $img_jb_random_play,
- $img_jb_clear,$img_jb_repeat,$img_jb_no_repeat;
- $image = 'img_jb_'.$type;
- $aTag = $this->getOpenJukeboxActionTag($type);
- echo $aTag . '>'.$$image.'</a>';
- }
-
- /*
- * Checks to see if the resample dropdown should be shown.
- * Also sets the variables required for resampling.
- *
- * @author Ben Dodson
- * @since 8/16/2006
- */
- function wantResampleDropdown($node) {
- global $allow_resample, $resampleRates, $this_page, $jzUSER, $no_resample_subnets;
-
- if ($allow_resample <> "true"){return false;}
-
- if (!checkPermission($jzUSER,'stream',$node->getPath("String"))) {
- return false;
- }
- if (checkPlayback() == "jukebox") {
- return false;
- }
- if (isset($no_resample_subnets) && $no_resample_subnets <> "" && preg_match("/^${no_resample_subnets}$/", $_SERVER['REMOTE_ADDR'])) {
- return false;
- }
-
- // Now let's see if they set the resample rate
- if (isset($_POST['jz_resample'])){
- // Ok, its set so let's set the session var for it
- $_SESSION['jz_resample_rate'] = $_POST['jz_resample'];
- }
- if (isset($_SESSION['jz_resample_rate'])){
- if ($_SESSION['jz_resample_rate'] == ""){
- unset($_SESSION['jz_resample_rate']);
- }
- }
- if ($jzUSER->getSetting('resample_lock')){
- $_SESSION['jz_resample_rate'] = $jzUSER->getSetting('resample_rate');
- return false;
- }
-
- return true;
- }
-
- /**
- * Displays the resample dropdown box and related code
- *
- *
- * @author Ross Carlson
- * @version 11/21/04
- * @since 11/21/04
- * @param $node The node that we are getting the rating for
- */
- function displayResampleDropdown($node, $title = true, $return = false){
- global $allow_resample, $resampleRates, $this_page, $jzUSER,$fe;
-
-
- // First let's see if we should not show this
- if (!$this->wantResampleDropdown($node)) {
- return;
- }
-
- if ($return) {
- ob_start();
- }
-
- $smarty = smartySetup();
-
- if ($title !== false){
- if ($title === true) {
- $title = "";
- $title .= '<font style="font-size:11px">';
- $title .= word("Resample Rate:");
- $title .= '</font><br>';
- }
- }
- $smarty->assign('title',$title);
-
- $arr = array();
- $arr['jz_path'] = $_GET['jz_path'];
- if (defined('NO_AJAX')) {
- $smarty->assign('onchange','form.submit()');
- } else {
- $smarty->assign('onchange',"return setResample(document.getElementById('resamplerate').value);");
- }
-
- $smarty->assign('form_action',urlize($arr));
-
- if (isset($_SESSION['jz_resample_rate'])){
- $smarty->assign('cur_rate',$_SESSION['jz_resample_rate']);
- } else {
- $smarty->assign('cur_rate','');
- }
-
- $smarty->assign('resample_rates',explode("|",$resampleRates));
-
- jzTemplate($smarty, 'block-resample');
-
- if ($return) {
- $var = ob_get_contents();
- ob_end_clean();
- return $var;
- }
- }
- /**
- * The dropdown for the interface selector
- *
- * @author Ben Dodson
- * @version 3/17/05
- * @since 3/17/05
- *
- **/
- function interfaceDropdown() {
- global $this_page,$include_path;
-
- ?>
- <form action=<?php echo $_SERVER['PHP_SELF'] ?> method="GET" name="interface">
- <?php
- $this->hiddenVariableField("jz_path");
- //$this->hiddenVariableField("theme");
- $this->hiddenPageVars();
- ?>
- <select class="jz_select" name="<?php echo jz_encode("set_frontend"); ?>" style="width:125px" onChange="submit();" >
- <option value=""><?php echo word('Interface') ?></option>
- <?php
- // Now let's get all the possibles
- $retArray = readDirInfo($include_path. "frontend/frontends","dir");
- sort($retArray);
- for ($c=0; $c < count($retArray); $c++){
- $entry = $retArray[$c];
- // Let's make sure this isn't the local directory we're looking at
- if ($entry == "." || $entry == ".." || $entry == "CVS" || $entry == "jukezora") { continue;}
- echo '<option value="'. jz_encode(str_replace(".php","",$entry)). '">'. str_replace(".php","",$entry). '</option>'. "\n";
- }
- ?>
- </select>
- </form>
- <?php
- }
-
- /**
- * The dropdown for the language selector.
- *
- * @author Ben Dodson
- * @since 3/17/05
- * @version 3/17/05
- *
- **/
- function languageDropdown() {
- global $web_root,$root_dir,$this_page;
- ?>
- <form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="GET" name="language">
- <?php
- $this->hiddenVariableField("jz_path");
- $this->hiddenPageVars();
- // Now let's get all the possibles
- $languages = getLanguageList();
- ?>
- <select class="jz_select" name="<?php echo jz_encode("set_language"); ?>" style="width:125px" onChange="submit()">
- <option value="">Language</option>
- <?php
- foreach ($languages as $language) {
- echo '<option value="'. jz_encode(str_replace(".php","",$language)). '">'. str_replace(".php","",$language). '</option>'. "\n";
- }
- ?>
- </select>
- </form>
- <?php
- }
-
- /**
- * The dropdown for the style selector.
- *
- * @author Ben Dodson
- * @since 3/17/05
- * @version 3/17/05
- *
- **/
- function styleDropdown() {
- global $this_page,$include_path, $cms_mode;
-
- // Not in CMS mode...
- if ($cms_mode == "true"){
- return;
- }
-
- ?>
- <form action="<?php echo $this_page; ?>" method="GET" name="style">
- <?php
- $this->hiddenVariableField('jz_path');
- $this->hiddenPageVars();
- $this->hiddenVariableField('frontend');
- ?>
- <select class="jz_select" name="<?php echo jz_encode("set_theme"); ?>" style="width:125px" onChange="submit()">
- <option value=""><?php echo word("Style"); ?></option>
- <?php
- // Now let's get all the possibles
- $retArray = readDirInfo($include_path. "style","dir");
- sort($retArray);
- for ($c=0; $c < count($retArray); $c++){
- $entry = $retArray[$c];
- // Let's make sure this isn't the local directory we're looking at
- if ($entry == "." || $entry == "..") { continue;}
- if (!stristr($entry,"images") and !stristr($entry,"cms-theme") and !stristr($entry,"CVS")){
- echo '<option value="'. jz_encode(str_replace(".php","",$entry)). '">'. str_replace(".php","",$entry). '</option>'. "\n";
- }
- }
- ?>
- </select>
- </form>
- <?php
- return;
- ?>
- <script>
- function setActiveStyleSheet(title) {
- var i, a, main;
- for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
- if(a.getAttribute("rel").indexOf("style") != -1
- && a.getAttribute("title")) {
- a.disabled = true;
- if(a.getAttribute("title") == title) a.disabled = false;
- }
- }
- }
-
- function selectStyle (vCookieName, vSelection) {
- //WRITE COOKIE
- //makeCookie(vCookieName, vSelection, 90, '/');
- //ACTIVE SELECTED ALTERNAT STYLE SHEET
- setActiveStyleSheet(vSelection)
- }
-
- if (document.cookie.indexOf('layout=')!=-1) {
- css = readCookie('layout');
- //ACTIVATE SELECTED STYLE SHEET
- setActiveStyleSheet(css)
- }
- </script>
- <select class="jz_select" onchange="var v=this.options[this.selectedIndex].value; if (v != '') selectStyle('style', v);" style="width:125px" >
- <option value=""><?php echo word("Style"); ?></option>
- <?php
- $styles = readDirInfo($include_path. "style", "dir");
- foreach ($styles as $style){
- echo '<option value="'. $style. '">'. ucwords($style). '</option>';
- }
- ?>
- </select>
- <?php
- }
- /**
- * Displays the button to allow for an item to be rated
- *
- *
- * @author Ross Carlson
- * @version 11/20/04
- * @since 11/20/04
- * @param $node The node that we are getting the rating for
- * @param $return Should we return the code or echo (default to echo)
- */
- function rateButton($node, $return = false){
- global $img_rate, $jzUSER, $img_rate_dis, $enable_ratings;
-
- // First off can they rate?
- if (!$jzUSER->getSetting('stream')){
- return;
- }
- if ($enable_ratings <> "true"){
- return;
- }
-
- $arr = array();
- $arr['action'] = "popup";
- $arr['ptype'] = "rateitem";
- $arr['jz_path'] = $node->getPath("String");
-
- $retVal = '<a onClick="openPopup(' . "'". urlize($arr) ."'" . ',350,150); return false;" href="javascript:;">';
- $retVal .= $img_rate;
- $retVal .= "</a>";
-
- if ($return){
- return $retVal;
- } else {
- echo $retVal;
- }
- }
-
- function emailButton($node) {
- global $img_email,$this_site;
- $arr = array();
- $arr['action'] = "playlist";
- $arr['jz_path'] = $node->getPath("String");
- if ($node->isLeaf()) {
- $arr['type'] = "track";
- }
- $link = $this_site. urlencode(urlize($arr));
-
- $artist = getInformation($node,"artist");
- $album = getInformation($node,"album");
- // hack : make 'album' trackname if that's what we're playing.
- if ($node->isLeaf()) {
- $album = $node->getName();
- }
- $mailLink = "mailto:?subject=". $artist. " - ". $album. "&body=Click to play ".
- $artist. " - ". $album . ":%0D%0A%0D%0A".
- $link. "%0D%0A%0D%0APowered%20by%20Jinzora%20%0D%0AJinzora%20::%20Free%20Your%20Media%0D%0Ahttp://www.jinzora.org";
- ?>
- <a class="jz_track_table_songs_href" href="<?php echo $mailLink; ?>"><?php echo $img_email; ?></a>
- <?php
- }
- /**
- * Displays or returns the rating for an object
- *
- *
- * @author Ross Carlson
- * @version 11/20/04
- * @since 11/20/04
- * @param $node The node that we are getting the rating for
- * @param $return Return the data or display (true = return)
- */
- function rating($node, $return = false){
- global $img_star_full, $img_star_half_empty, $img_star_left, $img_star_right, $img_star_full_empty, $include_path, $img_star_full_raw, $img_star_empty_raw;
-
- // Let's increment the counter
- $_SESSION['jz_stars_group']++;
-
- // Let's grab the rating from the node
- $rating = estimateRating($node->getRating());
-
- // First lets see if we should just return if this is nothing
- if (!$rating){return;}
-
- // Now let's start the rating icon
- $retVal .= $img_star_left;
- $total_rating = $rating;
-
- for ($i = floor($rating); $i > 0; $i--){
- $retVal .= $img_star_full;
- }
- if ($rating - floor($rating) > 0.25){
- $retVal .= $img_star_half_empty;
- }
- // Now we need to finish this off to make 5
- for ($i = ceil($rating); $i < 5; $i++) {
- $retVal .= $img_star_full_empty;
- }
-
- // Now let's finish it off
- $retVal .= $img_star_right;
-
- if ($return){
- return $retVal;
- } else {
- echo $retVal;
- }
- }
- // strlen() that ignores html text
- function plaintextStrlen( $text ) {
- $stripped = preg_replace( '/<.*?>/', "", $text );
- return strlen( $stripped );
- }
- // substr() that ignores html text
- // TODO: change this so that the signature matches that of substr (e.g., add $begin)
- function plaintextSubstr( $text, $end ) {
- if ($text === false) return false;
- // Only need to search starting from the first html tag
- $currentPos = strpos( $text, "<" );
- if( !$currentPos || $currentPos > $end ) {
- // Plain text (or html occurs after $end); just return a substring
- return substr( $text, 0, $end );
- }
- // Number of chars of non-body data we've seen so far
- $nonDisplayTextCounter = 0;
- // Used to keep track of whether we're looking at plain text or tag body text
- $inTagBody = false;
- $textFullLength = strlen( $text );
- while( $currentPos <= $textFullLength ) {
- // CASE 1: Tag opening
- if( $text[$currentPos] == '<' ) {
- if( !$inTagBody ) {
- $inTagBody = true;
- $nonDisplayTextCounter++;
- } else {
- // This is only reachable for malformatted html, e.g. "<a = <stuff>"
- writeLogData( "messages", "Warning: found possibly malformatted open tag." );
- }
- // CASE 2: Tag closing
- } else if( $text[$currentPos] == '>' ) {
- if( $inTagBody ) {
- $inTagBody = false;
- $nonDisplayTextCounter++;
- } else {
- // Malformatted html (e.g. "<b> stuff >") or real greater-than symbol meaning
- writeLogData( "messages", "Warning: found possibly malformatted close tag." );
- }
- // Case 3: plain text, either body text or tag text
- } else {
- if( $inTagBody ) {
- $nonDisplayTextCounter++;
- }
- }
- // Stop once we find $end characters
- if( ($currentPos-$nonDisplayTextCounter) == $end ) {
- break;
- }
- $currentPos++;
- }
- return substr( $text, 0, $currentPos);
- }
-
- /**
- * Returns a shortened version of the given $text.
- *
- *
- * @author Ross Carlson
- * @version 11/17/04
- * @since 11/17/04
- * @param $text string The text that we want to truncate
- * @param $length int The length for the text to be truncated to
- */
- function returnShortName($text, $length){
- if ($text === false) return false;
- if( $this->plaintextStrlen( $text ) <= $length ) {
- return $text;
- } else {
- // Ok, we need to make sure we don't break within a tag
- $shortName = $this->plaintextSubstr( $text, $length );
- $retText = substr($text,0,strlen( $shortName ) );
- while (strrpos($retText,">") < strrpos($retText,"<")){
- // Ok, we were in a tag, so we need to increase until we aren't
- $length = $length -1;
- $retText = substr($text,0,$length);
- }
- return trim($retText). "...";
- }
- }
-
- /**
- * Displays a link for the node. (or a playlink for the path)
- *
- *
- * @author Ben Dodson
- * @version 11/4/04
- * @since 11/4/04
- */
- function link($node, $text = false, $title = false, $class = false, $return = false, $linkonly = false, $playRandom = false, $playlist = false, $target = false) {
- if (!is_object($node)) {
- return false;
- }
- $arr = array();
- $arr['jz_path'] = $node->getPath("String");
- if ($node->isLeaf()) {
- $this->playLink($node, $text, $title, $class, $return);
- return;
- }
- if ($playRandom){
- $arr['mode'] = "random";
- }
- if ($playlist){
- $arr['action'] = "playlist";
- }
- if (isset($_GET['frame'])){
- $arr['frame'] = $_GET['frame'];
- }
-
- if (!defined('NO_AJAX_LINKS')) {
- $arr['maindiv'] = "true";
- }
-
- // Let's start the link
- if (!$linkonly){
- if (defined('NO_AJAX_LINKS')) {
- $linkText = '<a href="' . urlize($arr). '"';
- } else {
- $linkText = '<a href="javascript:maindiv(\''.urlencode(urlize($arr)).'\')"';
- }
- } else {
- if (defined('NO_AJAX_LINKS')) {
- $linkText = urlize($arr);
- } else {
- $linkText = 'javascript:maindiv(\''.urlencode(urlize($arr)).'\')';
- }
- return $linkText;
- }
-
- // Did they pass text or do we need to figure it out?
- if (!$text) {
- $text = $node->getName();
- if (!$node->isLeaf())
- if ($node->getSubNodeCount() <> 0)
- $text .= " (" . $node->getSubNodeCount() . ")";
- }
- // Did they pass a title?
- if ($title){
- $linkText .= ' title="'. $title. '" alt="'. $title. '"';
- }
-
- // Did they pass a class?
- if ($class){
- $linkText .= ' class="'. $class. '"';
- }
-
- // Did they want a target?
- if ($target){
- $linkText .= ' target="'. $target. '"';
- }
-
- // Now let's finish out
- $linkText .= '>'. $text. '</a>';
-
- // Now let's echo it out
- if (!$return){
- echo $linkText;
- } else {
- return $linkText;
- }
- }
-
- /**
- * Displays a link for the node. (or a playlink for the path)
- *
- *
- * @author Ben Dodson
- * @version 11/30/04
- * @since 11/30/04
- * @param $node Object the node we are looking at
- * @param $test String The text for the link
- * @param $title String The title of the line
- * @param $class String the class for the link
- * @param $return Bolean Return or not (defalt to false)
- */
- // returns an assoc array with keys 'href' and 'onclick'
- function getOpenAddToListTag($e) {
- if ($e->isLeaf()) {
- $type = 'track';
- } else {
- $type = 'node';
- }
- return "<a href=\"\" onclick=\"ajax_direct_call('".urlize(array('action'=>'addToPlaylist','jz_path'=>$e->getPath('String'),'type'=>$type))."',updatePlaylist_cb); return false;\" ";
- }
- function getOpenPlayTag($node, $random = false, $limit = 0) {
- global $jzUSER,$jzSERVICES,$jukebox;
- if (!is_object($node)){return;}
-
- // do they have permissions or should we just do text?
- if ($node instanceof jzMediaElement && !checkPermission($jzUSER,"play",$node->getPath("String"))) {
- return null;
- }
- $href = $node->getPlayHREF($random,$limit);
- // Let's start the link
- if (defined('NO_AJAX_JUKEBOX') || $jukebox == "false") {
- $linkText = '<a href="' . $href. '"';
- // Now are they using a popup player?
- if (checkPlayback() == "embedded"){
- // Ok, let's put the popup in the href
- // We need to get this from the embedded player
- $linkText .= $jzSERVICES->returnPlayerHref();
- }
- } else {
- $linkText = '<a href="'. htmlentities($href) . '"';
- $linkText .= "onclick=\"return playbackLink('".htmlentities($href)."')\"";
- }
- return $linkText;
- }
-
-
- function playLink($node, $text = false, $title = false, $class = false, $return = false, $random = false, $linkOnly = false, $clips = false, $limit = 0) {
- global $jzUSER, $jzSERVICES,$jukebox;
- $linkText = $this->getOpenPlayTag($node,$random,$limit);
- if ($linkText == null) return null;
- // Did they pass a title?
- if ($title){
- $linkText .= ' title="'. $title. '" alt="'. $title. '"';
- }
- if ($class){
- $linkText .= ' class="'. $class. '"';
- }
-
- // Now let's finish out
- $linkText .= '>'. $text. '</a>';
-
- // Now let's echo it out
- if (!$return){
- echo $linkText;
- } else {
- return $linkText;
- }
- }
-
-
- /**
- * Displays a podcast link for a node
- *
- *
- * @author Ross Carlson
- * @version 7/8/2005
- * @since 7/8/2005
- * @param $node Object the node we are looking at
- */
- function podcastLink($node, $return = true) {
- global $root_dir, $img_podcast, $enable_podcast, $web_dirs, $this_site;
-
- if (!is_object($node)){return;}
- if ($enable_podcast <> "true"){return;}
-
- $site = str_replace("http://","",$this_site);
- $site = str_replace("https://","",$site);
-
- if ($return){
- return '<a href="itpc://'. $site. $root_dir. '/podcast.rss?jz_path='. $node->getPath("String"). '">'. $img_podcast. '</a>';
- } else {
- echo '<a href="itpc://'. $site. $root_dir. '/podcast.rss?jz_path='. $node->getPath("String"). '">'. $img_podcast. '</a>';
- }
- }
-
-
- /**
- * Displays a download button for the node or track or playlist.
- *
- *
- * @author Ross Carlson
- * @version 12/01/04
- * @since 12/01/04
- */
- function downloadButton($node, $return = false, $returnImage = false, $showSize = false, $linkOnly = false) {
- global $img_download, $img_download_dis, $jzUSER, $jzSERVICES, $allow_resample_downloads, $allow_resample, $display_downloads;
- if ($display_downloads == "false") {
- return;
- }
- if (!$jzUSER->getSetting('download')){
- if ($return){
- return $img_download_dis;
- } else {
- echo $img_download_dis;
- return;
- }
- }
- if (!($node->getType() == "jzPlaylist" || $node->isLeaf() || $node->getPType() == "album")) return;
- $arr = array();
- $arr['action'] = "download";
-
- if (isset($_GET['frame'])){
- $arr['frame'] = $_GET['frame'];
- }
- if ($node->getType() == "jzPlaylist") {
- $arr['type'] = "playlist";
- $arr['jz_pl_id'] = $node->getID();
- } else {
- $arr['jz_path'] = $node->getPath("String");
- if ($node->isLeaf()) {
- $arr['type'] = "track";
- }
- }
- // NOTE: be careful because this could be a downloadButton for a jzPlaylist.
- //$fileExt = substr($node->getPath("String"),-3);
-
- // Now let's get the stats so we'll know how big this album is
- if ($showSize){
- $size = $node->getStats("total_size_str");
- }
-
- // Now, do we need to make this a popup page?
- // This is used for transcoding downloading
- // First is this an album or a track?
- if ($node->getType() <> "jzPlaylist"){
- if (!$node->isLeaf()){
- // Ok, it's an album so we need to get the first track from it
- // We'll assume all the tracks are the same format
- $tracks = $node->getSubNodes("tracks",-1,false,1);
- // Now let's make sure we got data back
- if (is_object($tracks[0])){
- $trackPath = $tracks[0]->getPath("string");
- } else {
- $trackPath = NULL;
- }
- } else {
- $trackPath = $node->getPath("String");
- }
- }
- if ($jzSERVICES->isResampleable($trackPath) and $allow_resample_downloads == "true" and $allow_resample == "true"){
- $arr['action'] = "popup";
- $arr['ptype'] = "downloadtranscode";
- $arr['jz_path'] = $node->getPath("String");
- $popupAddon = ' target="_blank" onclick="openPopup(this, 400, 400); return false;" ';
- } else {
- $popupAddon = "";
- }
-
- if ($linkOnly){
- return urlize($arr);
- }
-
- if (!$return){
- $message = word("Download"). ": ". $node->getName();
- if (isset($size)){
- $message .= " : ". $size;
- }
- if ($returnImage) {
- return '<a title="'. $message. '" href="'. urlize($arr) . '" '. $popupAddon. '>' . $img_download . '</a>';
- }
- echo '<a title="'. $message. '" href="'. urlize($arr). '"'. $popupAddon. '>';
- echo $img_download;
- echo "</a>";
- } else {
- if ($returnImage) {
- return '<a title="'. $message. '" href="'. urlize($arr) . '" '. $popupAddon. '>'. $img_download. '</a>';
- } else {
- return urlize($arr);
- }
- }
- }
-
- /**
- * Displays a clip play button for the node or track or playlist.
- *
- *
- * @author Ross Carlson
- * @version 3/07/05
- * @since 3/07/05
- * @param $node the Node we are looking at
- */
- function clipPlayButton($node) {
- global $img_clip, $jzUSER, $jzSERVICES;
-
- if ($node->getType() == "jzPlaylist" || !$node->isLeaf()) {
- return;
- }
- $arr = array();
- $arr['action'] = "playlist";
- if (isset($_GET['frame'])){
- $arr['frame'] = $_GET['frame'];
- }
-
- $arr['jz_path'] = $node->getPath("String");
- $arr['type'] = "track";
- $arr['clip'] = "true";
- echo '<a href="' . urlize($arr) . '"';
- // Now are they using a popup player?
- if (checkPlayback() == "embedded"){
- // Ok, let's put the popup in the href
- echo $jzSERVICES->returnPlayerHref();
- }
- echo '>';
- echo $img_clip;
- echo "</a>";
- }
-
-
- /**
- * Displays a lofi play button for the node or track or playlist.
- *
- *
- * @author Ross C…
Large files files are truncated, but you can click here to view the full file