Ejemplo n.º 1
0
Archivo: search.php Proyecto: rair/yacs
    $panels[] = array('extension', i18n::s('Extended search'), 'extensions_panel', $text);
}
// assemble all tabs
if (count($panels)) {
    $context['text'] .= Skin::build_tabs($panels);
}
// search at peering sites, but only on unconstrained request and on first page
include_once $context['path_to_root'] . 'servers/servers.php';
if (!$section_id && ($servers = Servers::list_for_search(0, 3, 'search'))) {
    // everything in a separate section
    $context['text'] .= Skin::build_block(i18n::s('At partner sites'), 'title');
    // query each server
    foreach ($servers as $server_url => $attributes) {
        list($server_search, $server_label) = $attributes;
        // a REST API that returns a RSS list
        $result = Call::list_resources($server_search, array('search' => $search));
        // error message
        if (!$result[0]) {
            $context['text'] .= $result[1];
        } else {
            $items = array();
            foreach ($result[1] as $item) {
                $suffix = '';
                if ($item['description']) {
                    $suffix .= ' - ' . $item['description'];
                }
                $suffix .= BR;
                $details = array();
                if ($item['pubDate']) {
                    $details[] = $item['pubDate'];
                }