Beispiel #1
0
            $data['actors'] = $data['cast'];
            $data['imgurl'] = $data['coverurl'];
        }
        /*
                // load languages and config into Smarty
                tpl_language();
                tpl_edit($data);
                $content = $smarty->fetch('edit.tpl');
        #       file_append('log.txt', $content);
        
                echo $content;
        */
        exit;
    }
    // use subtitle for aka search
    $data = $ajax_autocomplete_title ? engineSearch($ajax_autocomplete_title, engineGetDefault()) : engineSearch($ajax_autocomplete_subtitle, engineGetDefault(), true);
    if ($ajax_type == 'json') {
        #        file_append('log.txt', $res);
        header("Content-Type: application/json");
        echo json_encode($data);
        exit;
    }
    foreach ($data as $item) {
        $text = preg_replace('/(' . $ajax_autocomplete_title . ')/i', '<em>\\1</em>', $item['title']);
        $text .= $item['year'] ? "<span class='informal'> (" . $item['year'] . ")</span>" : '';
        $ret .= "<li id='" . $item['id'] . "'>" . $text . "</li>";
    }
    $ret = "<ul>{$ret}</ul>";
    exit($ret);
}
// duplicate check
Beispiel #2
0
function ajax_render()
{
    global $smarty, $result;
    // add some delay for debugging
    if ($config['debug'] && $_SERVER['SERVER_ADDR'] == '127.0.0.1') {
        usleep(rand(200, 1000) * 1000);
    }
    // load languages and config into Smarty
    tpl_language();
    $content = $smarty->fetch('lookup_ajax.tpl');
    header('X-JSON: ' . json_encode(array('count' => count($result))));
    exit($content);
}
// determine default engine (first in list)
if (empty($engine)) {
    $engine = engineGetDefault();
}
// result array
$result = array();
// Undo url encoding. At this point we cannot be sure which encoding is present- either ISO from URL or UTF-8 from form subimssion. Make sure we have unicode again.
$find = html_entity_decode_all(urldecode($find));
if (!is_utf8($find)) {
    $find = utf8_encode($find);
}
switch ($engine) {
    case 'amazona2s':
        // amazona2s
        $smarty->assign('catalog', array('Books', 'Classical', 'DigitalMusic', 'DVD', 'Electronics', 'Magazines', 'Music', 'MusicTracks', 'UnboxVideo', 'VHS', 'Video', 'VideoGames'));
        if (empty($catalog)) {
            $catalog = 'DVD';
        }