function liste($url)
{
    global $Comments;
    global $otherLinks;
    global $removeQ;
    $text = implode("", file($url));
    $text = eregi_replace("<!--([^-]|-[^-]|--[^>])*-->", "", $text);
    while (eregi("[:space:]*(href|src)[:space:]*=[:space:]*([^ >]+)", $text, $regs)) {
        $regs[2] = ereg_replace("\"", "", $regs[2]);
        $regs[2] = ereg_replace("'", "", $regs[2]);
        if ($removeQ) {
            $mylist[] = ereg_replace("\\?.*\$", "", $regs[2]);
        } else {
            $mylist[] = ereg_replace("#.*\$", "", $regs[2]);
        }
        $text = substr($text, strpos($text, $regs[1]) + strlen($regs[1]));
    }
    $mylist = sortarray($mylist);
    for ($i = 0; $i < count($mylist); $i++) {
        $temp = "";
        if (!eregi("^(mailto|news|javascript|ftp)+:(//)?", $mylist[$i])) {
            if (!eregi("^http://", $mylist[$i])) {
                $temp = specialconcat($url, $mylist[$i]);
            } else {
                $temp = $mylist[$i];
            }
        } else {
            if ($otherLinks) {
                $temp = $mylist[$i];
            }
        }
        if ($temp && $temp != $url) {
            $return[] = $temp;
        }
    }
    if (count($return) != 0) {
        return $return;
    } else {
        return false;
    }
}
Beispiel #2
0
function sortarray($classification, $pid = '0')
{
    $arr = array();
    foreach ($classification as $val) {
        if ($val['pid'] == $pid) {
            $drr = $val['id'];
            $arr[] = $val;
            $arr = array_merge($arr, sortarray($classification, $drr));
        }
    }
    return $arr;
}