Пример #1
0
 public function index()
 {
     $query = $this->params()->get("query");
     $category = $this->params()->get("category");
     $format = $this->params()->get("format");
     $source = $this->params()->get("source");
     $language = $this->params()->get("language");
     //$id = null, $name = null, array $language = null, array $format = null, array $source = null, $category = -1)
     if ($query != null) {
         $watcher = new SearchWatcher(null, $query, array($language), array($format), array($source), array($category));
         $newzbin = new Newzbin();
         $this->results = $newzbin->search($watcher);
         $this->picnic()->view()->useTemplate("search/results");
     }
 }
Пример #2
0
 public function check()
 {
     $term = $this->toSearchTerm();
     if ($term != null && $term != "") {
         $marker = $this->getMarker();
         // search newzbin
         $newzbin = new Newzbin();
         $results = $newzbin->search($this, $marker);
         $result = null;
         $r = array();
         foreach ($results as $report) {
             if ($report->state == "Report is complete") {
                 $r[] = $report;
             }
         }
         if ($this->toSearchTerm() != $term) {
             $r2 = $this->check();
             if ($r2 != null) {
                 $r = array_merge($r, $r2);
             }
         }
         if ($r != null && sizeof($r) > 0) {
             //echo "HERE";
             //PicnicUtils::dump($r);
         }
         return $r;
     } else {
         return null;
     }
 }