Ejemplo n.º 1
0
 static function getJbArr()
 {
     global $jbArr;
     if (isset($jbArr)) {
         return $jbArr;
     }
     @(include_once $include_path . "jukebox/settings.php");
     /**
      * Get names of available 'quickboxes'
      */
     $backend = new jzBackend();
     $boxes = $backend->loadData('quickboxes');
     $newboxes = array();
     $clear_old = false;
     if ($boxes) {
         foreach ($boxes as $id => $box) {
             if ($box['poll_time'] * 5 + $box['active_time'] < time()) {
                 $clear_old = true;
                 continue;
             }
             $newboxes[$id] = $box;
             $jb = array('type' => 'quickbox');
             $jb['description'] = $id;
             $jbArr[] = $jb;
         }
         // clear old jukeboxes
         if ($clear_old) {
             $backend->storeData('quickboxes', $newboxes, 1);
         }
     }
     return $jbArr;
 }
Ejemplo n.º 2
0
/**
 * Returns an array of similar artists
 * 
 * @author Ross Carlson, Ben Dodson
 * @version 01/14/05
 * @since 01/14/05
 * @param $node The node for the artist/album
 * @param $limit Limit the number of results
 */
function SERVICE_SIMILAR_echocloud($element, $limit = false)
{
    if ($element === false) {
        return;
    }
    // Let's setup the backend to read the cache to see if we can just return it
    $be = new jzBackend();
    $data = $be->loadData("similar-data-" . $element->getName());
    $tArr = explode("\n", $data);
    // Now let's see if this is more than 1 week old, if so let's update
    if ($data !== false && $tArr[0] + 604800 > time()) {
        // Ok, the cache is less than 1 week old let's return it
        return unserialize($tArr[1]);
    }
    // Let's setup the root node
    $root = new jzMediaNode();
    $artist = $element->getName();
    $artist = preg_replace("/^{$artist}, *the\$/i", "The {$artist}", $artist);
    // Let's grab the data first
    $ec_con = returnEchocloudData($artist);
    if (!$ec_con) {
        return false;
    }
    // Let's make sure that opened ok and if so parse the data
    if ($ec_con != "" and strlen($ec_con) > 600) {
        // Ok, now let's clean up what we got back
        $ec_con = substr($ec_con, 0, strpos($ec_con, "</rs>"));
        $ec_con = substr($ec_con, strpos($ec_con, "</date>") + 7, strlen($ec_con));
        // Now let's split it out by each item
        $ecArray = explode("<r>", $ec_con);
        $nonMatch = "";
        $search_array = array();
        for ($i = 0; $i < count($ecArray); $i++) {
            if ($ecArray[$i] != "") {
                // Ok, now let's read the items
                $ecArtist = substr($ecArray[$i], 3, strlen($ecArray[$i]));
                $ecArtist = substr($ecArtist, 0, strpos($ecArtist, "<"));
                $ecArtist = str_replace("'", "", $ecArtist);
                if ($ecArtist != $artist and $ecArtist != "") {
                    $retArray[] = $ecArtist;
                }
            }
        }
        // Now we know all the artists that are 'similar'.
        // Now should we limit?
        if ($limit) {
            $retArray = @array_slice($retArray, 0, $limit);
        }
        // Now let's store this for later caching
        $be->storeData("similar-data-" . $element->getName(), time() . "\n" . serialize($retArray));
        // Now let's return
        return $retArray;
    }
    return false;
}
Ejemplo n.º 3
0
 /**
  * Shows the site news
  * 
  * @author Ross Carlson
  * @version 01/26/05
  * @since 01/26/05
  * @param $node the Node we are viewing
  */
 function siteNews($node)
 {
     // Let's setup our objects
     $be = new jzBackend();
     if (!is_object($node)) {
         return;
     }
     if ($node->getName() == "") {
         $news = "site-news";
     } else {
         $news = $node->getName() . "-news";
     }
     $news = $be->loadData($news);
     if ($news == "") {
         return;
     }
     // Now let's display the news
     return $news;
 }
Ejemplo n.º 4
0
                        echo '&nbsp;';
                        $this->closeButton();
                    }
                    $this->closeBlock();
                    return;
                }
            }
        }
    }
    $this->closeBlock();
    return;
}
// SELF-REGISTRATION:
if ($_GET['subaction'] == "registration") {
    $be = new jzBackend();
    $data = $be->loadData('registration');
    if (!is_array($data)) {
        $data = array();
    }
    $classes = $be->loadData('userclasses');
    if (!is_array($classes)) {
        $urla = array();
        $urla['action'] = "popup";
        $urla['ptype'] = "usermanager";
        $urla['subaction'] = "editclasses";
        $urla['subsubaction'] = "add";
        echo word("<p>You must set up a user template before enabling user registration.</p>");
        echo '<p><a href="' . urlize($urla) . '">' . word("Click here to do add a user template.") . '</a></p>';
        return;
    }
    if (isset($_POST['update_postsettings'])) {
Ejemplo n.º 5
0
    /**
     * Draws the login page.
     * 
     * @author Ben Dodson <*****@*****.**>
     * @version 11/3/04
     * @since 5/13/04
     */
    function loginPage($failed = false)
    {
        $display =& new jzDisplay();
        //$display->preHeader('Login',$this->width,$this->align);
        echo '<body onLoad="document.getElementById(\'loginform\').field1.focus();"></body>';
        $urla = array();
        $urla['jz_path'] = isset($_GET['jz_path']) ? $_GET['jz_path'] : '';
        ?>
				<style>
					body {
						background-color: #F5F5D0;
						background: #F5F5D0;
						font-family: Verdana, Sans;
						font-size: 10px;
						color: #9c9b9b;
						margin: 0 0 0 0;
					}
					td {
						font-family: Verdana, Sans;
						font-size: 10px;
					}
					submit {
						border: 1px solid black;
						background: #EFEFCC;
						color: #000000;
						font-size: 11px;
						border-width: 1px;
					}
					input {
						font-family: Verdana, Sans;
						color: #000000;
						background-color: #EFEFCC;
						font-size: 11px;
						border-width: 1px;
					}
				</style>
				    <script language="javascript" src="lib/md5.js"></script>
				    <script language="javascript">
				    function submitLogin() {
				      if (document.getElementById("loginform").doregister.value == 'true') {
					return true;
				      } else {
					// submit the other form
					// so we can submit a non-cleartext PW without changing browser's stored PW.
					document.getElementById("loginSecureForm").field1.value = 
					         document.getElementById("loginform").field1.value;

					document.getElementById("loginSecureForm").field2.value = 
					hex_md5(document.getElementById("loginform").field2.value);

					document.getElementById("loginSecureForm").remember.value =
					document.getElementById("loginform").remember.value;

					document.getElementById("loginSecureForm").submit();
					return false;
				      }
				    }
				    </script>
				<body style="background-color: #F5F5D0;">
				<table width="100%" height="100%" cellpadding="0" cellspacing="0" border="0" style="background-color: #F5F5D0;">
					<tr>
						<td align="center" height="100%" width="100%" style="background-color: #F5F5D0;">
							<?php 
        if ($failed) {
            echo "<center><strong><font color=white>Incorrect password</font></strong></center>";
        }
        ?>
							<form name="loginSecureForm" id="loginSecureForm" method="POST" action="<?php 
        echo urlize($urla);
        ?>
">
								<input type="hidden" name="field1" value="">
								<input type="hidden" name="field2" value="">
	                            <input type="hidden" name="remember" value="">
								<input type="hidden" name="<?php 
        echo jz_encode('action');
        ?>
" value="<?php 
        echo jz_encode('login');
        ?>
">
                            </form>
							<form name="loginform" id="loginform" method="POST" action="<?php 
        echo urlize($urla);
        ?>
" onsubmit="return submitLogin()">
								<input type="hidden" name="<?php 
        echo jz_encode('action');
        ?>
" value="<?php 
        echo jz_encode('login');
        ?>
">
								<?php 
        if (!$failed) {
            echo "<br><br><br>";
        }
        ?>
								<?php 
        echo word("Username");
        ?>
<br>
								<input size="18" type="text" class="jz_input" name="field1" style="width:146px;">
								<br>
								<?php 
        echo word("Password");
        ?>
<br>
								<input size="18" type="password" class="jz_input" name="field2" style="width:146px;">
								<br>
								<input type="checkbox" class="jz_checkbox" name="remember"> <?php 
        echo word("Remember me");
        ?>
								<br><br>
								<input class="jz_submit" type="submit" name="<?php 
        echo jz_encode('submit_login');
        ?>
" value="<?php 
        echo word("Login");
        ?>
">
								   <input type="hidden" name="doregister" value="false" />
								<?php 
        $be = new jzBackend();
        $data = $be->loadData('registration');
        if ($data['allow_registration'] == "true") {
            ?>
										&nbsp;<input class="jz_submit" type="submit" name="<?php 
            echo jz_encode('self_register');
            ?>
" value="<?php 
            echo word("Register");
            ?>
" onclick="document.getElementById('loginform').doregister.value='true'">
									<?php 
        }
        ?>

							</form>
							<br /><br />
							<img src="style/images/login-footer-logo.gif" border="0">
							<br /><br />
						</td>
					</tr>
				</table>
				</body>
			<?php 
        //this->footer();
    }
Ejemplo n.º 6
0
/** 
 * Returns the AJAX code for the Whow is where block
 *
 * @author Ross Carlson
 * @since 8.21.05
 *
 **/
function returnWhoisWhere()
{
    global $jzUSER, $img_tiny_play, $img_tiny_play_dis, $user_tracking_age, $css, $include_path, $root_dir, $who_is_where_height, $jzSERVICES;
    $define_only = true;
    writeLogData("messages", "WIWB: starting up");
    $display = new jzDisplay();
    $be = new jzBackend();
    // let's get the history
    $oldHist = $be->loadData('history');
    $dArr = explode("\n", $oldHist);
    $retVal = "";
    $count = 1;
    $home = 0;
    $ipList = "";
    for ($i = 0; $i < count($dArr); $i++) {
        $vArr = explode("|", $dArr[$i]);
        // Now let's make sure this isn't the current user and that it's not too old
        if (isset($vArr[3])) {
            $ago = $vArr[3] + $user_tracking_age * 60;
            if (($vArr[4] != $jzUSER->getName() or $vArr[4] == "Anonymous") and $vArr[6] != $_SESSION['sid'] and $ago - time() > 0 and !stristr($ipList, "|" . $vArr[7])) {
                $time = round((time() - $vArr[3]) / 60);
                if ($time < 1) {
                    $time = 1;
                }
                $ipList .= "|" . $vArr[7];
                // Now let's count
                $count++;
                writeLogData("messages", "WIWB: Ago: " . $time);
                // Let's setup the object from the path
                $item = new jzMediaNode($vArr[2]);
                // Let's setup our links
                $arr = array();
                $arr['jz_path'] = $vArr[2];
                if ($vArr[1] == "") {
                    $vArr[1] = "Home";
                    $home++;
                }
                $item = new jzMediaNode($arr['jz_path']);
                $art = $item->getMainArt("75x75");
                if ($art) {
                    $albumImage = str_replace('"', '', $display->returnImage($art, "", 75, 75, "limit", false, false, "left", "3", "3"));
                } else {
                    $albumImage = "";
                }
                $desc_truncate = 200;
                $desc = htmlentities(str_replace("'", "", str_replace("'", "", $item->getDescription())));
                $userName = $vArr[4];
                if ($userName == "") {
                    $userName = "******";
                }
                if ($vArr[5] != "") {
                    $userName = $vArr[5];
                }
                $body = "<strong>" . word("Viewing: ") . $userName . "</strong><br>" . word("Last seen") . ": " . $time . " " . word("minutes ago") . "<br>" . $albumImage . $display->returnShortName($desc, $desc_truncate);
                $title = str_replace("'", "", $vArr[1]);
                // Let's display
                if ($vArr[1] != "Home") {
                    if ($jzUSER->getSetting('stream')) {
                        $retVal .= ' <a href="' . urlize($arr) . '"';
                        if (checkPlayback() == "embedded") {
                            //$jzSERVICES = new jzServices();
                            $jzSERVICES->loadService("players", $jzUSER->getSetting("player"));
                            $retVal .= ' ' . $jzSERVICES->returnPlayerHref();
                        }
                        $retVal .= '>' . $img_tiny_play . '</a> <a target="_parent" ' . $display->returnToolTip($body, $title) . ' href="' . str_replace("ajax_request", "index", urlize($arr)) . '">' . $display->returnShortName($vArr[1], 15) . '</a><br>';
                    } else {
                        $retVal .= ' ' . $img_tiny_play_dis . ' <a target="_parent" ' . $display->returnToolTip($body, $title) . ' href="' . str_replace("ajax_request", "index", urlize($arr)) . '">' . $display->returnShortName($vArr[1], 15) . '</a><br>';
                    }
                }
            }
        }
    }
    if ($count == 1 or $count == 0) {
        $tCtr = "";
    } else {
        $tCtr = " (" . ($count - 1) . ")";
    }
    $return = "<strong>" . word("Who is Where") . $tCtr . "</strong><br />";
    if ($home > 0) {
        $arr = array();
        $arr['jz_path'] = "";
        $return .= '<a href="' . str_replace("ajax_request", "index", urlize($arr)) . '">Home (' . $home . ")</a><br>";
    }
    $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", "WIWB: displaying data");
    echo $return;
    exit;
}
Ejemplo n.º 7
0
 function moveMedia($element, $newpath)
 {
     $root = new jzMediaNode();
     $be = new jzBackend();
     $playpath = $element->getFilePath();
     $type = $element->isLeaf() ? "leaf" : "node";
     if (is_string($newpath)) {
         $path = explode("/", $newpath);
     } else {
         if (is_array($newpath)) {
             $path = $newpath;
         } else {
             return false;
         }
     }
     if ($type == "node") {
         return false;
     }
     $pc = $element->getPlayCount();
     $dc = $element->getDownloadCount();
     $vc = $element->getViewCount();
     $desc = $element->getDescription();
     $sdesc = $element->getShortDescription();
     $art = $element->getMainArt();
     $discussion = $element->getDiscussion();
     $rating = $element->getRating();
     $rating_count = $element->getRatingCount();
     if ($be->hasFeature('setID')) {
         $mid = $element->getID();
     }
     // TODO:
     // This does not work correctly with nodes yet.
     // You should pull the above data, then recursively move children,
     // then remove me, and finally set the data as below.
     // I did not do this yet (8/11/05) because I would not have been
     // able to test it. (for things like collisions,
     // and also how to handle the filesystem)
     // If the backend has a lookup file, update it.
     if ($element->isLeaf()) {
         $media_path = getMediaDir($element);
         $be = new jzBackend();
         $rl_name = 'reverse_lookup-' . str_replace(':', '', str_replace('\\', '-', str_replace('/', '-', $media_path)));
         $LOOKUP = $be->loadData($rl_name);
         if (is_array($LOOKUP)) {
             if (isset($LOOKUP[$element->getFilename("host")])) {
                 $LOOKUP[$element->getFilename("host")] = implode('/', $path);
                 $be->storeData($rl_name, $LOOKUP);
             }
         }
     }
     $this->removeMedia($element);
     if (false !== ($new = $root->inject($path, $playpath))) {
         $new->setPlayCount($pc);
         $new->setDownloadCount($dc);
         $new->setViewCount($vc);
         $new->addRating($rating, $rating_count);
         if ($be->hasFeature('setID')) {
             $new->setID($mid);
         }
         if (!isNothing($desc)) {
             $new->addDescription($desc);
         }
         if (!isNothing($sdesc)) {
             $new->addShortDescription($sdesc);
         }
         if (!isNothing($art)) {
             $new->addMainArt($art);
         }
         if ($discussion != array() && !isNothing($discussion)) {
             $new->addFullDiscussion($discussion);
         }
         return $new;
     }
 }
Ejemplo n.º 8
0
 function setHTTPAuthUser()
 {
     global $http_auth_anon_name, $http_auth_auto_create, $http_auth_newuser_template;
     if (isset($_SERVER['REMOTE_USER'])) {
         $username = $_SERVER['REMOTE_USER'];
     } else {
         $username = NOBODY;
     }
     if (isset($http_auth_anon_name) && $username == $http_auth_anon_name) {
         $username = NOBODY;
     }
     if (($this->id = $this->lookupUID($username)) != false) {
         return;
     }
     if (isset($http_auth_auto_create) && $http_auth_auto_create == "true" && $username != NOBODY) {
         // auto-create the user w/ random password
         $this->id = $this->addUser($username, uniqid('P'));
     }
     if ($this->id != false) {
         writeLogData("access", "created user entry for user '" . $username . "'");
         if (isset($http_auth_newuser_template) && $http_auth_newuser_template != "") {
             $be = new jzBackend();
             $classes = $be->loadData('userclasses');
             if (isset($classes[$http_auth_newuser_template])) {
                 $settings = array();
                 $settings['template'] = $http_auth_newuser_template;
                 $this->setSettings($settings, $this->id, true);
             }
         }
         return;
     }
     // convert user to nobody
     if (($this->id = $this->lookupUID(NOBODY)) === false) {
         // create NOBODY
         $this->id = $this->addUser(NOBODY, "");
     }
 }
Ejemplo n.º 9
0
 /**
  * Displays the login/logout link.
  *
  * @author Ben Dodson
  * @version 1/17/05
  * @since 1/17/05
  *
  */
 function loginLink($logintext = false, $logouttext = false, $registration = true, $regtext = false, $return_link = false)
 {
     global $jzUSER;
     $array = array();
     if ($jzUSER->getID() == $jzUSER->lookupUID('NOBODY')) {
         $array['action'] = "login";
         if ($logintext === false) {
             $text = word("Login");
         } else {
             $text = $logintext;
         }
     } else {
         $array['action'] = "logout";
         if ($logouttext === false) {
             $text = word("Logout");
         } else {
             $text = $logouttext;
         }
     }
     $string = "";
     $string .= '<a class="jz_header_table_href" href="' . urlize($array) . '">' . $text . '</a>';
     if ($jzUSER->getID() == $jzUSER->lookupUID('NOBODY')) {
         $be = new jzBackend();
         $data = $be->loadData('registration');
         if ($data['allow_registration'] == "true") {
             if ($regtext === false) {
                 $regtext = word("Register");
             }
             $array['action'] = "register";
             $string .= ' | ';
             $string .= '<a class="jz_header_table_href" href="' . urlize($array) . '">' . $regtext . '</a>';
         }
     }
     if ($return_link) {
         return $string;
     } else {
         echo $string;
     }
 }
Ejemplo n.º 10
0
/**
 * Returns an array of similar artists
 * 
 * @author Ross Carlson, Ben Dodson
 * @version 01/14/05
 * @since 01/14/05
 * @param $node The node for the artist/album
 * @param $limit Limit the number of results
 */
function SERVICE_SIMILAR_audioscrobbler($element, $limit = false)
{
    if ($element === false) {
        return;
    }
    $cachename = "similar-scrobbler-" . $element->getName();
    // Let's setup the backend to read the cache to see if we can just return it
    $be = new jzBackend();
    if (false !== ($data = $be->loadData($cachename))) {
        if ($limit && $limit > sizeof($data)) {
            return array_slice($data, 0, $limit);
        } else {
            return $data;
        }
    }
    $artist = $element->getName();
    if (stristr($artist, ", The") !== false) {
        $artist = str_replace(", The", "", $artist);
        $artist = "The " . $artist;
    }
    // Let's grab the data first
    $server = "ws.audioscrobbler.com";
    $page = "/1.0/artist/" . rawurlencode($artist) . "/similar.txt";
    $fp = @fsockopen($server, 80, $errno, $errstr, 2);
    if ($fp) {
        fputs($fp, "GET {$page} HTTP/1.1\r\nHost:{$server}\r\n\r\n");
        fputs($fp, "Connection: close\n\n");
        $data = "";
        $blnHeader = true;
        while (!feof($fp)) {
            if ($blnHeader) {
                if (fgets($fp, 1024) == "\r\n") {
                    $blnHeader = false;
                }
            } else {
                $data .= fread($fp, 1024);
            }
        }
        fclose($fp);
        if (stristr($data, 'No artist exists with this name')) {
            $sim_artists = array();
        } else {
            $sim_artists = array();
            $data = explode("\n", $data);
            foreach ($data as $entry) {
                $match = substr($entry, 0, strpos($entry, ','));
                if ($match > 50) {
                    // a decent match... let's add it.
                    $sim_artists[] = substr($entry, strpos($entry, ',', strpos($entry, ',') + 1) + 1);
                    // Get it after the second comma.
                } else {
                    break;
                }
            }
        }
    } else {
        return false;
    }
    // Now let's store this for later caching
    $be->storeData($cachename, $sim_artists, 7);
    // expires in 7 days
    // Now let's return
    if ($limit) {
        return array_slice($sim_artists, 0, $limit);
    } else {
        return $sim_artists;
    }
}
Ejemplo n.º 11
0
         $display->settingsTextbox("keyword_random", "keyword_random", $settings_array);
         $display->settingsTextbox("keyword_play", "keyword_play", $settings_array);
         $display->settingsTextbox("keyword_track", "keyword_track", $settings_array);
         $display->settingsTextbox("keyword_album", "keyword_album", $settings_array);
         $display->settingsTextbox("keyword_artist", "keyword_artist", $settings_array);
         $display->settingsTextbox("keyword_genre", "keyword_genre", $settings_array);
         $display->settingsTextbox("keyword_lyrics", "keyword_lyrics", $settings_array);
         $display->settingsTextbox("keyword_limit", "keyword_limit", $settings_array);
         $display->settingsTextbox("keyword_id", "keyword_id", $settings_array);
         break;
     case "extauth":
         $display->settingsCheckbox(word("Enable REMOTE_USER"), "http_auth_enable", $settings_array);
         $display->settingsTextbox(word("Anonymous REMOTE_USER"), "http_auth_anon_name", $settings_array);
         $display->settingsCheckbox(word("Auto-Create New Users"), "http_auth_auto_create", $settings_array);
         $be = new jzBackend();
         $keys = array_keys($be->loadData('userclasses'));
         $display->settingsDropdown(word("New User Template:"), 'http_auth_newuser_template', $keys, $settings_array);
         break;
     default:
         $this->closeBlock();
         return;
 }
 /*
 foreach ($settings_array as $key => $val) {
   // The settingsTextbox (and other) functions update the array for us
   // on a form submit. No other form handling is needed,
   // other than to write the data back to the file!
   // Plus, settings aren't modified if they aren't in the form.
   if ($key == "jinzora_skin") {
 		$display->settingsDropdownDirectory($key,$key,$include_dir."style","dir",$settings_array);
   } else if ($key == "frontend") {
Ejemplo n.º 12
0
 function loadSettings($my_id = false)
 {
     if ($my_id === false) {
         $id = $this->id;
     } else {
         $id = $my_id;
     }
     $dp = $this->data_dir . "/user_settings";
     $s = unserialize(file_get_contents($dp));
     if (!isset($s[$id])) {
         $s[$id] = array();
     }
     if ($my_id === false) {
         $mysettings = array();
         $settings = $s[$id];
         // Is the login invalid?
         if (!is_array($settings) || $settings == array()) {
             return $this->loadSettings($this->lookupUID(NOBODY));
         }
         if (isset($settings['template']) && $settings['template'] != "") {
             $be = new jzBackend();
             $classes = $be->loadData('userclasses');
             $newsettings = $classes[$settings['template']];
             $newsettings['name'] = $this->lookupName($id);
             /*
             				  if (isset($newsettings['edit_prefs']) && $newsettings['edit_prefs'] == true) {
             foreach ($settings as $key=>$val) {
               switch ($key) {
             					// Is it a user preference?
               case "email":
               case "fullname":
               case "frontend":
               case "theme":
               case "language":
               case "playlist_type":
               case "asuser":
               case "aspass":
               case "sort":
             					$newsettings[$key] = $val;
             					break;
               }
             }
             */
             foreach ($settings as $key => $val) {
                 $newsettings[$key] = $val;
             }
             $settings = $newsettings;
         }
         foreach ($settings as $key => $val) {
             if ($val != "") {
                 if ($val == "true") {
                     $mysettings[$key] = true;
                 } else {
                     if ($val == "false") {
                         $mysettings[$key] = false;
                     } else {
                         $mysettings[$key] = $val;
                     }
                 }
             }
         }
         $this->settings = $mysettings;
         $this->name = isset($this->settings['name']) ? $this->settings['name'] : word('Anonymous');
     }
     return $s[$id];
 }
Ejemplo n.º 13
0
$display = new jzDisplay();
$be = new jzBackend();
// Did they want to update a podcast
if (isset($_GET['feed_path'])) {
    if ($_GET['sub_action'] == "update") {
        $_POST['edit_podcast_add'] = "TRUE";
        $_POST['edit_podcast_path'] = $_GET['feed_path'];
        $_POST['edit_podcast_title'] = $_GET['feed_title'];
        $_POST['edit_podcast_url'] = $_GET['feed_url'];
        $_POST['edit_podcast_max'] = $_GET['feed_number'];
    }
}
// Did the subscribe?
if (isset($_POST['edit_podcast_add'])) {
    // Let's track this podcast
    $pData = $be->loadData("podcast");
    $i = count($pData) + 1;
    $pArr[$i]['title'] = $_POST['edit_podcast_title'];
    $pArr[$i]['url'] = $_POST['edit_podcast_url'];
    $pArr[$i]['path'] = $_POST['edit_podcast_path'];
    $pArr[$i]['number'] = $_POST['edit_podcast_max'];
    if (is_array($pData)) {
        $add = true;
        foreach ($pData as $data) {
            if ($data['title'] == $_POST['edit_podcast_title']) {
                $add = false;
            }
        }
        if ($add) {
            $nArr = array_merge($pData, $pArr);
            $be->storeData("podcast", $nArr);
Ejemplo n.º 14
0
// Did they submit the form to edit the news?
if (isset($_POST['updateSiteNews'])) {
    // Now let's store the data
    $be->storeData($news, nl2br(str_replace("<br />", "", $_POST['siteNewsData'])));
}
// Let's show the form to edit with
$arr = array();
$arr['action'] = "popup";
$arr['ptype'] = "sitenews";
$arr['jz_path'] = $_GET['jz_path'];
echo '<form action="' . urlize($arr) . '" method="POST">';
?>
		<br>
		<center>
			<textarea name="siteNewsData" cols="60" rows="20" class="jz_input"><?php 
echo $be->loadData($news);
?>
</textarea>
			<br><br>
			<input type="submit" value="<?php 
echo word("Update News");
?>
" name="<?php 
echo jz_encode("updateSiteNews");
?>
" class="jz_submit">
			&nbsp;
			<?php 
$this->closeButton(false);
?>
		</center>
Ejemplo n.º 15
0
/**
 * 
 * Echos out the XML header information
 *
 * @author Ross Carlson
 * @since 3/31/05
 * 
 **/
function getCurrentTrack()
{
    global $jzUSER, $this_site, $root_dir;
    // What kind of output?
    if (isset($_REQUEST['type'])) {
        $type = $_REQUEST['type'];
    } else {
        $type = "xml";
    }
    // Now let's set the width
    if (isset($_REQUEST['imagesize'])) {
        $imagesize = $_REQUEST['imagesize'] . "x" . $_REQUEST['imagesize'];
    } else {
        $imagesize = "150x150";
    }
    // Now let's see when to stop
    if (isset($_REQUEST['count'])) {
        $total = $_REQUEST['count'];
    } else {
        $total = 1;
    }
    // Let's start the page
    if ($type == "xml") {
        echoXMLHeader();
    }
    // Now let's get the data
    $be = new jzBackend();
    $ar = $be->getPlaying();
    $display = new jzDisplay();
    $fullList = "";
    $found = false;
    foreach ($ar as $user => $tracks) {
        $name = $jzUSER->getSetting("full_name");
        if ($name == "") {
            $name = $jzUSER->lookupName($user);
            // that's the user name
        }
        $i = 0;
        foreach ($tracks as $time => $song) {
            // Now let's make sure this is the right user
            if ($name == $jzUSER->getName()) {
                // Now let's make sure we don't list this twice
                if (stristr($fullList, $song['path'] . "-" . $name . "\n")) {
                    continue;
                }
                $fullList .= $song['path'] . "-" . $name . "\n";
                // Now let's create the objects we need
                $node = new jzMediaNode($song['path']);
                $track = new jzMediaTrack($song['path']);
                $album = $node->getParent();
                $artist = $album->getParent();
                $meta = $track->getMeta();
                // Now, now let's echo out the data
                switch ($type) {
                    case "xml":
                        echo "  <item>\n";
                        echo "    <title>" . $this_site . xmlUrlClean($meta['title']) . "</title>\n";
                        echo "    <album>\n";
                        echo "      <name>" . $this_site . xmlUrlClean($album->getName()) . "</name>\n";
                        echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                        echo "    </album>\n";
                        echo "    <artist>\n";
                        echo "      <name>" . $this_site . xmlUrlClean($artist->getName()) . "</name>\n";
                        echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                        echo "    </artist>\n";
                        echo "  </item>\n";
                        break;
                    case "html":
                        if (isset($_REQUEST['align'])) {
                            if ($_REQUEST['align'] == "center") {
                                echo "<center>";
                            }
                        }
                        echo $meta['title'] . "<br>";
                        echo $album->getName() . "<br>";
                        echo $this_site . $display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                        echo $artist->getName() . "<br>";
                        echo $display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                        break;
                    case "mt":
                        $art = $album->getMainArt($imagesize, true, "audio", true);
                        if ($art) {
                            // Now let's try to get the link from the amazon meta data service
                            if ($_REQUEST['amazon_id'] != "") {
                                $jzService = new jzServices();
                                $jzService->loadService("metadata", "amazon");
                                $id = $jzService->getAlbumMetadata($album, false, "id");
                                echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">';
                            }
                            $display->image($art, $album->getName(), 150, false, "limit");
                            if ($_REQUEST['amazon_id'] != "") {
                                echo '</a>';
                            }
                            echo "<br>";
                        }
                        echo $meta['title'] . "<br>";
                        if ($_REQUEST['amazon_id'] != "") {
                            $jzService = new jzServices();
                            $jzService->loadService("metadata", "amazon");
                            $id = $jzService->getAlbumMetadata($album, false, "id");
                            echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">' . $album->getName() . "</a><br>";
                        } else {
                            echo $album->getName() . "<br>";
                        }
                        echo $artist->getName() . "<br>";
                        break;
                }
                $found = true;
                // Now should we stop?
                $i++;
                if ($i >= $total) {
                    break;
                }
            }
        }
    }
    if (!$found) {
        // Ok, we didn't find anything so let's get the last thing they played...
        $be = new jzBackend();
        $history = explode("\n", $be->loadData("playhistory-" . $jzUSER->getID()));
        $track = new jzMediatrack($history[count($history) - 1]);
        $album = $track->getParent();
        $artist = $album->getParent();
        $meta = $track->getMeta();
        // Now, now let's echo out the data
        switch ($type) {
            case "xml":
                echo "  <item>\n";
                echo "    <title>" . $this_site . xmlUrlClean($meta['title']) . "</title>\n";
                echo "    <album>\n";
                echo "      <name>" . $this_site . xmlUrlClean($album->getName()) . "</name>\n";
                echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                echo "    </album>\n";
                echo "    <artist>\n";
                echo "      <name>" . $this_site . xmlUrlClean($artist->getName()) . "</name>\n";
                echo "      <image>" . $this_site . xmlUrlClean($display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true)) . "</image>\n";
                echo "    </artist>\n";
                echo "  </item>\n";
                break;
            case "html":
                if (isset($_REQUEST['align'])) {
                    if ($_REQUEST['align'] == "center") {
                        echo "<center>";
                    }
                }
                echo $meta['title'] . "<br>";
                echo $album->getName() . "<br>";
                echo $this_site . $display->returnImage($album->getMainArt(false, true, "audio", true), $album->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                echo $artist->getName() . "<br>";
                echo $display->returnImage($artist->getMainArt(false, true, "audio", true), $artist->getName(), false, false, "limit", false, false, false, false, false, "0", false, true, true) . "<br>";
                break;
            case "mt":
                if (isset($_REQUEST['align'])) {
                    if ($_REQUEST['align'] == "center") {
                        echo "<center>";
                    }
                }
                $art = $album->getMainArt($imagesize, true, "audio", true);
                if ($art) {
                    // Now let's try to get the link from the amazon meta data service
                    if ($_REQUEST['amazon_id'] != "") {
                        $jzService = new jzServices();
                        $jzService->loadService("metadata", "amazon");
                        $id = $jzService->getAlbumMetadata($album, false, "id");
                        echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">';
                    }
                    $display->image($art, $album->getName(), 150, false, "limit");
                    if ($_REQUEST['amazon_id'] != "") {
                        echo '</a>';
                    }
                    echo "<br>";
                }
                echo $meta['title'] . "<br>";
                if ($_REQUEST['amazon_id'] != "") {
                    $jzService = new jzServices();
                    $jzService->loadService("metadata", "amazon");
                    $id = $jzService->getAlbumMetadata($album, false, "id");
                    echo '<a target="_blank" href="http://www.amazon.com/exec/obidos/tg/detail/-/' . $id . '/' . $_REQUEST['amazon_id'] . '/">' . $album->getName() . "</a><br>";
                } else {
                    echo $album->getName() . "<br>";
                }
                echo $artist->getName() . "<br>";
                break;
        }
    }
    // Now let's close out
    switch ($type) {
        case "xml":
            echoXMLFooter();
            break;
        case "html":
            echo '<a target="_blank" title="Jinzora :: Free Your Media!" href="http://www.jinzora.com"><img src="http://www.jinzora.com/downloads/button-stream.gif" border="0"></a>';
            break;
        case "mt":
            echo '<a target="_blank" title="Jinzora :: Free Your Media!" href="http://www.jinzora.com"><img src="http://www.jinzora.com/downloads/button-stream.gif" border="0"></a>';
            break;
    }
    if (isset($_REQUEST['align'])) {
        if ($_REQUEST['align'] == "center") {
            echo "</center>";
        }
    }
}
Ejemplo n.º 16
0
function doUserBrowsing($node)
{
    global $jzUSER;
    $jzBackend = new jzBackend();
    $oldHist = $jzUSER->loadData('history');
    $jzUSER->storeData('history', $node->getPType() . "|" . $node->getName() . "|" . $node->getPath("String") . "|" . time() . "\n" . substr($oldHist, 0, 5000));
    $oldHist = $jzBackend->loadData('history');
    // Now let's find the history for this user
    $dArr = explode("\n", $oldHist);
    for ($i = 0; $i < count($dArr); $i++) {
        $vArr = explode("|", $dArr[$i]);
        if ($vArr[6] == $_SESSION['sid']) {
            unset($dArr[$i]);
        }
    }
    $oldHist = implode("\n", $dArr);
    $jzBackend->storeData('history', $node->getPType() . "|" . $node->getName() . "|" . $node->getPath("String") . "|" . time() . "|" . $jzUSER->getName() . "|" . $jzUSER->getSetting('fullname') . "|" . $_SESSION['sid'] . "|" . $_SERVER['REMOTE_ADDR'] . "\n" . substr($oldHist, 0, 50000));
}
Ejemplo n.º 17
0
 * 
 * - Code Purpose -
 * Builds a zero-configuration jukebox
 *
 * @since 2/9/05
 * @author Ben Dodson <*****@*****.**>
 */
// Quickbox instance
$POLL_TIME = 2;
// blech
$include_path = '../';
require_once '../jzBackend.php';
$be = new jzBackend();
// Get a semi-unique ID
$id = getMyId();
$boxes = $be->loadData('quickboxes');
if (!isset($boxes[$id])) {
    $box = array('id' => $id);
} else {
    $box = $boxes[$id];
}
$box['active_time'] = time();
$box['poll_time'] = $POLL_TIME;
if (isset($_REQUEST['update_pos'])) {
    $box['pos'] = $_REQUEST['update_pos'];
}
$boxes[$id] = $box;
$be->storeData('quickboxes', $boxes, 1);
//$be->storeData('quickboxes',array(),1); // clear
if (isset($_REQUEST['update']) && !isset($_REQUEST['update_pos'])) {
    require_once dirname(__FILE__) . '/../lib/json.php';