function input($url, $pos = "")
{
    $t_html = cacheurl($url);
    preg_match_all('/<entry>(.*?)<\\/entry>/si', $t_html, $row);
    foreach ($row[1] as $mov) {
        preg_match('/<title (.*?)>(.*?)<\\/title>/i', $mov, $matches);
        $tmp_array['title'] = reducehtml($matches[2]);
        preg_match("/<link(.*?)href='(.*?)'\\/>/i", $mov, $matches);
        $tmp_array['url'] = $matches[2];
        preg_match("/<content(.*?)>(.*?)<\\/content>/i", $mov, $matches);
        $tmp_array['details'] = $matches[2];
        preg_match("/duration seconds='(\\d+)'/i", $mov, $matches);
        $tmp_array['size'] = $matches[1];
        preg_match("/<published>(.*?)<\\/published>/is", $mov, $matches);
        $tmp_array['time'] = strtotime($matches[1]);
        #		$tmp_array['size']=$tmp_array['dauer']*40000;
        $tmp_array['type'] = "file";
        if ($pos != "") {
            $txt = md5($pos . "/" . $tmp_array['title']);
            if (file_exists("fav/" . $txt)) {
                $tmp_array['title'] = "x" . $tmp_array['title'];
            }
        }
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function trailer($url, $sub = false)
{
    $html = cacheurl($url);
    preg_match_all('|<a href="/media/trailer/view/flash/(\\d+)/"(?:.*?)title="(.*?)">|', $html, $matches);
    foreach ($matches[1] as $key => $row) {
        $tmp_array['url'] = "http://www.moviemaze.de/media/trailer/view/flash/" . $matches[1][$key] . "/";
        $tmp_array['title'] = str_replace(" als Flash ansehen", "", reducehtml($matches[2][$key]));
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function input($url)
{
    $t_html = cacheurl($url);
    preg_match_all('|<listitem>(.*?)</listitem>|si', $t_html, $row);
    foreach ($row[1] as $mov) {
        $tmp_array = preger(array("videoid", "thema", "headline", "date", "thumb"), $mov);
        $tmp_array['time'] = strtotime($tmp_array['date']);
        $tmp_array['title'] = reducehtml($tmp_array['thema'] . " " . $tmp_array['headline']);
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function input($url)
{
    $t_html = cacheurl($url, false);
    # echo $t_html;
    preg_match_all('/<item>(.*?)<\\/item>/si', $t_html, $row);
    foreach ($row[1] as $mov) {
        $tmp_array['title'] = reducehtml(preger("title", $mov));
        preg_match('/url="(.*?)"/is', $mov, $matches);
        $tmp_array['url'] = $matches[1];
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function tvtotal_video_list($url)
{
    $page = cacheurl($url);
    preg_match_all('|href="(/tvtotal/videos/player/(?:.*?))"(.*?)alt="(.*?)"|', $page, $links);
    foreach ($links[3] as $key => $name) {
        $tmp_array['title'] = reducehtml($name);
        $tmp_array['url'] = "http://tvtotal.prosieben.de" . $links[1][$key];
        preg_match('|contentId=(\\d+)|', $tmp_array['url'], $id);
        $tmp_array['id'] = $id[1];
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function input()
{
    $t_html = cacheurl('http://www.shoutcast.com/sbin/newtvlister.phtml?alltv=1');
    preg_match_all('|<station(?:.*?)></station>|si', $t_html, $row);
    foreach ($row[0] as $mov) {
        preg_match('/id="(\\d+)"/i', $mov, $matches);
        $tmp_array['url'] = "http://www.shoutcast.com/sbin/tunein-tvstation.pls?id=" . $matches[1];
        preg_match('/name="(.*?)"/i', $mov, $matches);
        $tmp_array['title'] = reducehtml($matches[1]);
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function input($url)
{
    $t_html = cacheurl($url);
    preg_match_all('|<td class="summary">(.*?)</td>|si', $t_html, $row);
    foreach ($row[1] as $mov) {
        preg_match('|\\&videoid=(\\d+)">(.*?)</a>|is', $mov, $matches);
        preg_match('|\\>(\\d+):(\\d+)<|is', $mov, $time);
        $tmp_array['id'] = $matches[1];
        $tmp_array['time'] = $time[1] * 60 + $time[2];
        $tmp_array['title'] = reducehtml($matches[2]);
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function input($url)
{
    if (isset($url['function'])) {
        return call_user_func($url['function'], $url);
    }
    $html = cacheurl($url['url']);
    preg_match_all('^<h6 class="channel">(.*?)</h6>(?:.*?)</h6></div>(?:.*?)<h1><a href="/(.*?)/(.*?)/(\\d+)/(?:.*?)>(.*?)</a></h1>^si', $html, $matches);
    foreach ($matches[3] as $key => $row) {
        $tmp_array['url'] = "http://www.sat1.de/" . $matches[2][$key] . "/" . $matches[3][$key] . "/" . $matches[4][$key] . "/";
        $tmp_array['title'] = " " . reducehtml($matches[1][$key] . " - " . $matches[5][$key]);
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function trailer($url)
{
    $html = cacheurl($url);
    #         echo $html; exit;
    #	preg_match_all('|pfeilBlauAWeiss.gif"(?:.*?)mnr=(\d+)(?:.*?)">(.*?)</a>|is', $html, $matches);# $tmp_array['title'] = rep($matches[2]);
    preg_match_all('|<div class="srTrailerListItem dbtrefferdark">(.*?)</div>|is', $html, $matches);
    # $tmp_array['title'] = rep($matches[2]);
    foreach ($matches[1] as $key => $row) {
        $tmp_array['title'] = " " . reducehtml(strip_tags($matches[1][$key]));
        preg_match('|<a href="(.*?)">|is', $matches[1][$key], $urlMatch);
        $tmp_array['trailer'] = "http://www.kino.de" . $urlMatch[1];
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function input($url, $pos = "")
{
    $t_html = cacheurl($url, true, array("age_check" => "1"), "Blanko");
    preg_match_all('|<li>(.*?)</li>|si', $t_html, $row);
    foreach ($row[1] as $mov) {
        preg_match('|class="title">(?:.*?)>(.*?)</a>|i', $mov, $matches);
        $tmp_array['title'] = reducehtml($matches[1]);
        preg_match('|href="(.*?)"|i', $mov, $matches);
        $tmp_array['url'] = "http://www.youporn.com" . $matches[1];
        preg_match('|<p class="duration">(\\d+)(?:.*?)(\\d+)(?:.*?)</p>|i', $mov, $matches);
        $tmp_array['time'] = $matches[1] * 60 + $matches[2];
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function sub_navi2($url)
{
    $z = split(",", trim($url['keys'], "()"));
    $objekt = new Browser("Firefox");
    $objekt->url = $url['url'];
    $objekt->post = array("xajax" => "show_top_and_movies&xajaxr=1205505927158&xajaxargs[]=0&xajaxargs[]=" . trim($z[1], "'") . "&xajaxargs[]=" . trim($z[2], "'") . "&xajaxargs[]=0&xajaxargs[]=0&xajaxargs[]=0");
    $t_html = $objekt->read();
    #         preg_match_all('|div class="number">(.*?)</div><div class="time">(.*?)</div>(?:.*?)<div class="buy">(?:.*?)<a href=(.*?)>ansehen</a>(?:.*?)<div class="title" >(?:.*?)>(.*?)</a>|si',$t_html,$matches);
    preg_match_all('|href(?:.*?)>(?:.*?)</a>(?:.*?)</a>|si', $t_html, $matches);
    foreach ($matches[0] as $row) {
        $row = "<a " . $row;
        $row = str_replace(">.<", "", $row);
        $row = str_replace(">0.<", "", $row);
        $row = str_replace("kostenlos", "", $row);
        $row = trim($row);
        preg_match('|href="(.*?)">|si', $t_html, $link);
        $tmp_array['url'] = "http://rtl-now.rtl.de/" . str_replace("_produktdetail", "", $link[1]) . "&player=1";
        #                 $tmp_array['time']=strtotime($matches[2][$key]);
        $tmp_array['title'] = reducehtml(strip_tags($row));
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function showText($text, $killHtml = false)
{
    if ($killHtml == true) {
        $text = reducehtml($text);
    }
    $text = wordwrap($text, 38, "\n");
    $tarr = explode("\n", $text);
    foreach ($tarr as $txt) {
        if (strlen($txt) > 0) {
            $out[str_pad($i, 2, 0, STR_PAD_LEFT) . " " . $txt]['txt'] = $i . " " . $txt;
        }
        $i++;
    }
    return $out;
}
/**
 * peforms a search on myvideo and returns the videos as array
 *
 * @param string $string
 *   the searchstring
 * @param string $page
 *   the page of the results to display
 * @param string $orderby
 *   order the results: relevance=0,date=1,views=5
 * @return array
 *   returns videopages as array
 */
function myvideo_search_input($string, $page = 0, $orderby = 0)
{
    global $search;
    $url = str_replace("%string%", urlencode($string), $search);
    $url = str_replace("%orderby%", $orderby, $url);
    $url = str_replace("%page%", $page, $url);
    $t_html = cacheurl($url);
    $out = array();
    preg_match_all("|<span class='title'>(.*?)</span>|si", $t_html, $row);
    foreach ($row[0] as $mov) {
        preg_match("/title='(.*?)'/is", $mov, $matches);
        $tmp_array['title'] = reducehtml($matches[1]);
        preg_match("/href='(.*?)'/is", $mov, $matches);
        $tmp_array['url'] = "http://www.myvideo.de/" . $matches[1];
        $tmp_array['type'] = "file";
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
/**
 * Reads available shows on zdfmediathek on the given char url 
 * they only returns 50 items so use characterRangeEnd and characterRangeEnd
 *
 * @param $url
 *  complete url: http://www.zdf.de/ZDFmediathek/xmlservice/web/sendungenAbisZ?characterRangeStart=A&characterRangeEnd=C&detailLevel=2
 * @return array
 *  list of shows
 */
function get_alpa_show($url)
{
    $html = cacheurl($url);
    preg_match_all('/<information>(.*?)<\\/assetId>/si', $html, $shows);
    $out = array();
    foreach ($shows[0] as $show) {
        $tmp_array = array();
        preg_match('/<title>(.*?)<\\/title>/i', $show, $title);
        $tmp_array['title'] = reducehtml($title[1]);
        preg_match('/<detail>(.*?)<\\/detail>/i', $show, $detail);
        $tmp_array['detail'] = $detail[1];
        preg_match('/<assetId>(.*?)<\\/assetId>/i', $show, $assetId);
        $tmp_array['assetId'] = $assetId[1];
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}
function input($url, $sub = false, $function = '')
{
    if ($sub == true) {
        return call_user_func($function, $url);
    }
    # we extract the links
    $html = cacheurl($url, USE_BROWSER_REQUEST);
    preg_match_all('|<a class="resultlink" href="/iplayer/page/item/(.*?).shtml.*?">(.*?)</a>|i', $html, $matches);
    foreach ($matches[2] as $key => $row) {
        $tmp_array['title'] = reducehtml($row);
        $tmp_array['url'] = "http://" . $_SERVER['SERVER_ADDR'] . ":" . $_SERVER['SERVER_PORT'] . "/requests/scripts/inc/iplayer_stream.php?pid=" . $matches[1][$key];
        $tmp_array['type'] = 'file';
        $out[$tmp_array['title']] = $tmp_array;
    }
    return $out;
}