/** * Play histories for users */ function userHistories() { global $api_page; $be = new jzBackend(); if (!isset($_REQUEST['forUser'])) { $users = $be->getUsersWithHistories(); $type = getFormatFromRequest(); switch ($type) { case "xml": echoXMLHeader(); echo " <search>\n"; echo " <tracks>\n"; echo " </tracks>\n"; echo " <nodes>\n"; foreach ($users as $u) { $playlink = xmlentities($api_page . '&request=userhistories&doplaylist=true&forUser='******'&ext=pl.m3u'); echo " <node>\n"; echo " <name>" . xmlentities("Played By " . $u) . "</name>\n"; echo " <type>" . xmlentities(ucwords("User-History")) . "</type>\n"; echo " <playlink>" . $playlink . "</playlink>\n"; echo " <image>"; echo " </image>\n"; //echo " <playlistid>"; //echo " </playlistid>\n"; echo " <thumbnail>"; echo " </thumbnail>\n"; //echo " <path>". xmlentities($pname). "</path>\n"; echo " <browse>" . xmlentities($api_page . '&request=userhistories&forUser='******'jsoncallback'] . '('; } $jt = array(); $jn = array(); foreach ($users as $u) { // hack for now. TODO: merge play histories into core. $playlink = $api_page . '&request=userhistories&doplaylist=true&forUser='******'&ext=pl.m3u'; $a = array(); $a['name'] = "Played By " . $u; $a['type'] = ucwords("User-History"); $a['playlink'] = $playlink; $a['image'] = ""; //$a['playlistid'] = $id; $a['thumbnail'] = ""; $a['browse'] = $api_page . '&request=userhistories&forUser='******'tracks' => $jt, 'nodes' => $jn)); if ($type == "jsonp") { echo ')'; } break; } return; } else { $for = $_REQUEST['forUser']; $h = $be->getPlayHistory($for); if ($_REQUEST['doplaylist']) { $pl = new jzPlaylist(); $pl->add($h); $pl->stream(); } else { $trackfields = isset($_REQUEST['track_fields']) ? explode(',', $_REQUEST['track_fields']) : false; $nodefields = isset($_REQUEST['node_fields']) ? explode(',', $_REQUEST['node']) : false; print_results($h, getFormatFromRequest(), $trackfields, $nodefields); } } }