} /* // define search box $properties=array(); // The name of the text input form field $properties["name"]="pattern"; $properties["link"]=$config['rootUrl'] . "/search.php?language=any_language&station=$stationName"; $properties["title"]="Search for:"; $properties["description"]= $page->getlocalizedWithParams('search_in_station', $stationName); $rss_writer_object->addtextinput($properties); */ $rss .= "\n</channel>"; } elseif ($query) { // ***************** SERIALIZED QUERY **************** $advsearch = new sotf_AdvSearch(); $advsearch->Deserialize($query); // send results of advanced query given as string $rss .= "\n<channel>"; $queryTags = $advsearch->GetHumanReadable(); for ($i = 0; $i < count($queryTags); $i++) { // TODO: this is a rough solution if ($i == count($queryTags) - 1) { $queryTexts[] = $queryTags[$i][1] . ' ' . $queryTags[$i][2] . ' ' . $queryTags[$i][3]; } else { $queryTexts[] = $queryTags[$i][1] . ' ' . $queryTags[$i][2] . ' ' . $queryTags[$i][3] . ' ' . $queryTags[$i][0]; } } $queryText = implode(' ', $queryTexts); writeTag($rss, "title", "StreamOnTheFly query results"); writeTag($rss, "description", $queryText); writeTag($rss, "link", $config['rootUrl'] . "/advsearchresults.php?back=true&SQLquerySerial={$query}");
// -*- tab-width: 3; indent-tabs-mode: 1; -*- /* * $Id$ * Created for the StreamOnTheFly project (IST-2001-32226) * Authors: András Micsik, Máté Pataki, Tamás Déri * at MTA SZTAKI DSD, http://dsd.sztaki.hu */ require "init.inc.php"; require $config['classdir'] . "/sotf_AdvSearch.class.php"; $SQLquerySerial = sotf_Utils::getParameter('SQLquerySerial'); //the serialized query in the hidden field $advsearch = new sotf_AdvSearch(); //create new search object object with this array //if ($SQLquerySerial == "") //get old search query from session if none in url // $SQLquerySerial = $_SESSION["SQLquerySerial"]; //get array from session $SQLquery = $advsearch->Deserialize($SQLquerySerial); //deserialize the content of the hidden field if (sotf_Utils::getParameter('back') != NULL) { $_SESSION["SQLquerySerial"] = $SQLquerySerial; //save the new quey to the session $page->redirect("advsearch.php"); } $query = $advsearch->GetSQLCommand(); $max = $db->getAll("SELECT count(*) FROM (" . $query . ") as count"); //get the number of results $max = $max[0]["count"]; $limit = $page->splitList($max, "?SQLquerySerial={$SQLquerySerial}"); $result = $db->getAll($query . $limit["limit"]); $allfields = $advsearch->GetSQLfields(); //get all possible fileld names with translation $max = count($SQLquery);
/** For portal */ function getQueryResults($params) { global $config, $db; $query = xmlrpc_decoder($params->getParam(0)); $advsearch = new sotf_AdvSearch(); //create new search object object with this array $SQLquery = $advsearch->Deserialize($query); //deserialize the content of the hidden field $query = $advsearch->GetSQLCommand(); $results = $db->getAll($query . " LIMIT 30 OFFSET 0"); foreach ($results as $key => $result) { $icon = sotf_Blob::cacheIcon2($result); if ($icon) { $results[$key]['icon'] = $config['cacheUrl'] . "/" . $icon; } //TODO if no icon {$IMAGEDIR}/noicon.png $imageprefix???? $prg =& new sotf_Programme($result['id']); // audio files for programme $audioFiles = $prg->listAudioFiles('true'); $results[$key]['audioFiles'] = array(); $results[$key]['downloadFiles'] = array(); foreach ($audioFiles as $fileList) { if ($fileList['stream_access'] == "t") { $results[$key]['audioFiles'][] = $fileList; } if ($fileList['download_access'] == "t") { $results[$key]['downloadFiles'][] = $fileList; } } } $retval = xmlrpc_encoder($results); return new xmlrpcresp($retval); }
function getQueryResults($params) { global $config, $db; $query = xmlrpc_decode($params->getParam(0)); $advsearch = new sotf_AdvSearch(); //create new search object object with this array $SQLquery = $advsearch->Deserialize($query); //deserialize the content of the hidden field $query = $advsearch->GetSQLCommand(); $results = $db->getAll($query . " LIMIT 30 OFFSET 0"); foreach ($results as $key => $result) { $icon = sotf_Blob::cacheIcon($result['id']); $results[$key]['icon'] = $config['cacheUrl'] . "/" . $result['id'] . ".png"; //TODO if no icon {$IMAGEDIR}/noicon.png $imageprefix???? } $retval = xmlrpc_encode($results); return new xmlrpcresp($retval); }
$fromDay = date('Y-m-d', $dayInThePast); if ($page->loggedIn()) { // get users's playlist $playlist = new sotf_UserPlaylist(); $smarty->assign('PLAYLIST', $playlist->load()); // check if user has default query $advsearch = new sotf_AdvSearch(); $prefs = $user->getPreferences(); $defQuery = $prefs->getDefaultQuery(); } // show default query or new programmes $maxItemsIndexPage = $sotfVars->get("maxItemsIndexPage", 10); if ($defQuery) { $smarty->assign("DEF_QUERY", 1); debug("default query", $defQuery); $advsearch->Deserialize($defQuery); $query = $advsearch->GetSQLCommand(); debug("query", $query); //get the number of results $max = $db->getOne("SELECT count(*) FROM ( {$query} ) as foo "); $smarty->assign("DEF_QUERY_MAX", $max); $res = $db->limitQuery($query, 0, $maxItemsIndexPage); $hits = ''; while (DB_OK === $res->fetchInto($row)) { $row['icon'] = sotf_Blob::cacheIcon2($row); $hits[] = $row; } $smarty->assign("NEWS", $hits); } else { // get new programmes $smarty->assign('NEWS', sotf_Programme::getNewProgrammes($fromDay, $maxItemsIndexPage));