예제 #1
0
     $searchreq = array('limit' => $limit, 'type' => 'label', 'rule_1_input' => $search, 'rule_1_operator' => '2', 'rule_1' => 'name');
     $sres = Search::run($searchreq);
     // Litmit not reach, new search with another operator
     if (count($sres) < $limit) {
         $searchreq['limit'] = $limit - count($sres);
         $searchreq['rule_1_operator'] = '0';
         $sres = array_unique(array_merge($sres, Search::run($searchreq)));
     }
     foreach ($sres as $id) {
         $label = new Label($id);
         $label->format(false);
         $results[] = array('type' => T_('Labels'), 'link' => $label->link, 'label' => $label->name, 'value' => $label->name, 'rels' => '', 'image' => Art::url($label->id, 'label', null, 10));
     }
 }
 if ($target == 'missing_artist' && AmpConfig::get('wanted')) {
     $sres = Wanted::search_missing_artists($search);
     $i = 0;
     foreach ($sres as $r) {
         $results[] = array('type' => T_('Missing Artists'), 'link' => AmpConfig::get('web_path') . '/artists.php?action=show_missing&mbid=' . $r['mbid'], 'label' => $r['name'], 'value' => $r['name'], 'rels' => '', 'image' => '');
         $i++;
         if ($i >= $limit) {
             break;
         }
     }
 }
 if ($target == 'user' && AmpConfig::get('sociable')) {
     $searchreq = array('limit' => $limit, 'type' => 'user', 'rule_1_input' => $search, 'rule_1_operator' => '2', 'rule_1' => 'username');
     $sres = Search::run($searchreq);
     // Litmit not reach, new search with another operator
     if (count($sres) < $limit) {
         $searchreq['limit'] = $limit - count($sres);
예제 #2
0
파일: search.php 프로젝트: nioc/ampache
UI::show_header();
/**
 * action switch
 */
switch ($_REQUEST['action']) {
    case 'search':
        if ($_REQUEST['rule_1'] != 'missing_artist') {
            $browse = new Browse();
            require_once AmpConfig::get('prefix') . '/templates/show_search_form.inc.php';
            require_once AmpConfig::get('prefix') . '/templates/show_search_options.inc.php';
            $results = Search::run($_REQUEST);
            $browse->set_type($_REQUEST['type']);
            $browse->show_objects($results);
            $browse->store();
        } else {
            $wartists = Wanted::search_missing_artists($_REQUEST['rule_1_input']);
            require_once AmpConfig::get('prefix') . '/templates/show_missing_artists.inc.php';
            echo '<a href="http://musicbrainz.org/search?query=' . rawurlencode($_REQUEST['rule_1_input']) . '&type=artist&method=indexed" target="_blank">' . T_('View on MusicBrainz') . '</a><br />';
        }
        break;
    case 'save_as_smartplaylist':
        if (!Access::check('interface', 25)) {
            UI::access_denied();
            exit;
        }
        $playlist = new Search();
        $playlist->parse_rules(Search::clean_request($_REQUEST));
        $playlist->save();
        show_confirmation(T_('Search Saved'), sprintf(T_('Your Search has been saved as a Smart Playlist with name %s'), $playlist->name), AmpConfig::get('web_path') . "/browse.php?action=smartplaylist");
        break;
    case 'descriptor':