mashxml){ require_once('di/xml_domit_parser.php'); } $this->mashxml =& new DOMIT_Document(); } function fetch_xml($url){ $fd[0]=false; $this->loadDOMIT();//$this->mashxml =& new DOMIT_Document(); $this->mashxml->useHTTPClient(true); if(!$this->mashxml->loadXML($url)){return $fd;} //ensure that there are childNodes before bothering to work with the childNodes array if (!$this->mashxml->documentElement->hasChildNodes()){return $fd;} //get a reference to the childNodes collection of the document element $myChildNodes =& $this->mashxml->documentElement->childNodes; //get the total number of childNodes for the document element $numChildren =& $myChildNodes[2]->childCount; //get a reference to the i childNode $dataNode =& $myChildNodes[2]->childNodes; if($numChildren>0){ //$fd=array(); for ($i = 0; $i < $numChildren; $i++) { $unit=& $dataNode[$i]; //echo out the node to browser $fd[$i]['id']=$unit->getAttribute("id"); $fd[$i]['title']=$unit->firstChild->getData(); $fd[$i]['size']=$unit->getAttribute("size"); $fd[$i]['part']=$unit->getAttribute("part"); $fd[$i]['totalparts']=$unit->getAttribute("totalparts"); $fd[$i]['nzburl']=sprintf($this->nzbbaseURL,$fd[$i]['id']); } return $fd; } return $fd; } function fetch_mysql($title,$days='3',$group='',$results='10'){ $fd[0]=false; $q=$this->sql->advancedsearch($title,0,$results,$days,'date','DESC',$group,$minsize,$maxsize,$nfo,$collection); $this->db->query($q); if($this->db->num_rows()>0){ $i=0; while($this->db->next_record()) { $fd[$i]['id']=$this->db->Record['key'];//$unit->getAttribute("id"); $fd[$i]['title']=$this->db->Record['subject']; $fd[$i]['size']=$this->uf->fuzzysize($this->db->Record['size']); $fd[$i]['part']=$this->db->Record['parts']; $fd[$i]['totalparts']=$this->db->Record['totalparts']; $fd[$i]['nzburl']=sprintf($this->nzbbaseURL,$fd[$i]['id']); $i++; } return $fd; } return $fd; } /* Return value format: rss title: $bm->rssdetails['title'] rss url: $bm->rssdetails['source'] $mash[$k]['link'] (rss item related link) $mash[$k]['title']=(rss item title) $mash[$k]['result']= (XML data below) [$i]['id']=$unit->getAttribute("id"); [$i]['title']=$unit->firstChild->getData(); [$i]['size']=$unit->getAttribute("size"); [$i]['part']=$unit->getAttribute("part"); [$i]['totalparts']=$unit->getAttribute("totalparts"); [$i]['nzburl'] */ function mashup($rq,$local=false){ require_once('mp/rss_fetch.inc'); if(!@$mashrss=fetch_rss($rq['url'])){ return false; } $this->rssdetails['title']=$mashrss->channel['title']; $this->rssdetails['source']=$rq['url']; $mash=array(); foreach ($mashrss->items as $k=>$item) { $mash[$k]['link']=$item['link']; $mash[$k]['title']=$item['title']; $title=$item['title']; if($this->forceallterms){ $title=preg_replace("/(?:^|\s)(?=\w)/U"," +",$title); $title=preg_replace("/['`\)\(!:]/U","",$title); } if($local){ $mash[$k]['result']=$this->fetch_mysql( $title,$rq['age'],$rq['group'],$rq['results'] ); }else{ $mash[$k]['result']= $this->fetch_xml( $this->mashxmlsource. '?format=xml&a='.$rq['age']. '&r='.$rq['results']. '&g='.urlencode($rq['group']). '&q='.urlencode($title) ); } } return $mash; } } ?>