/**
 * Show category list.
 */
function fetchCategories()
{
    $template = new KinotoTemplate();
    //Get site cookie hash
    $hash = getSiteHash();
    //Get principal page and parse categories side bar
    $content = file_get_contents("http://kino.to/Genre.html", false, getExplorerContext($hash));
    //$newlines = array("\t","\n","\r","\x20\x20","\0","\x0B");
    //$content = str_replace($newlines, "", utf8_decode( $content) );
    preg_match_all("/<td class\\=\"Title\"><a href\\=\"(.*)\">(.*)<\\/a><\\/td>/U", $content, $div, PREG_SET_ORDER);
    $template->setSearch(array(resourceString("search_by") . "...", resourceString("search_by") . "...", "rss_command://search", SCRAPER_URL . "movies.php?search=%s" . URL_AMP . "title=" . base64_encode(resourceString("search_by") . "...") . URL_AMP . "PHPSESID=" . session_id(), ""));
    $template->addItem("Kinofilme", "", SCRAPER_URL . "movies.php?type=" . base64_encode("est") . URL_AMP . "title=" . base64_encode($link[2]) . URL_AMP . "PHPSESID=" . session_id(), "");
    $template->addItem("Popular", "", SCRAPER_URL . "movies.php?type=" . base64_encode("pop") . URL_AMP . "title=" . base64_encode($link[2]) . URL_AMP . "PHPSESID=" . session_id(), "");
    $template->addItem("Neuste Filme", "", SCRAPER_URL . "movies.php?type=" . base64_encode("nov") . URL_AMP . "title=" . base64_encode($link[2]) . URL_AMP . "PHPSESID=" . session_id(), "");
    foreach ($div as $link) {
        $template->addItem(utf8_decode($link[2]), "", SCRAPER_URL . "movies.php?type=" . base64_encode("http://kino.to" . $link[1]) . URL_AMP . "title=" . base64_encode($link[2]) . URL_AMP . "PHPSESID=" . session_id(), "");
    }
    $template->generateView(KinotoTemplate::VIEW_CATEGORY, "kino.to");
}