Esempio n. 1
0
File: tri.php Progetto: philum/cms
function auto_video($f, $o = '', $t = '', $op = '')
{
    if ($t) {
        $t = '§' . $t;
    }
    $fb = $f;
    if (strpos($f, '/') === false) {
        return '[' . $f . $t . ':' . $o . 'video]';
    }
    $f = str_replace(array("http://", "www."), '', $f);
    $fa = http_root($f);
    if (strpos($f, '#')) {
        $f = str_extract('#', $f, 0, 0);
    }
    if (strpos($f, '?')) {
        $f = str_extract('?', $f, 1, 1);
    }
    $r = array('', 'youtube', 'youtu', 'dailymotion', 'vimeo', 'vk', 'livestream', 'google');
    //,'ted'
    if (in_array($fa, $r)) {
        switch ($fa) {
            case 'youtube':
                if (strpos($f, 'channel') !== false) {
                    return http($f);
                }
                $p = strpos($f, 'v=');
                $f = substr($f, $p + 2);
                $pe = strpos($f, '&');
                if ($pe !== false) {
                    $ret = subtopos($f, 0, $pe);
                } else {
                    $ret = $f;
                }
                break;
            case 'youtu':
                $p = strpos($f, '/');
                $f = substr($f, $p + 1);
                $pe = strpos($f, '?');
                if ($pe !== false) {
                    $ret = subtopos($f, 0, $pe);
                } else {
                    $ret = $f;
                }
                break;
            case 'dailymotion':
                $ret = embed_detect($f, 'video/', '-');
                if (!$ret) {
                    $ret = substr($f, strpos($f, 'video/') + 6);
                }
                break;
            case 'vimeo':
                $ret = substr($f, strrpos($f, '/') + 1);
                break;
            case 'vk':
                $ret = embed_detect($f, '/video', '_');
                break;
            case 'livestream':
                $ret = embed_detect($f, 'com/', '/');
                break;
            case 'rutube':
                $ret = embed_detect($f, 'tracks/', '.');
                break;
        }
    } elseif (strpos($f, '.mp4')) {
        return $fb;
    }
    if ($ret) {
        if ($op == 1) {
            return $ret . $t . ':' . $o . 'video';
        } elseif ($op == 2) {
            return $ret;
        } else {
            return '[' . $ret . $t . ':' . $o . 'video]';
        }
    }
}
Esempio n. 2
0
File: tri.php Progetto: philum/cms
function treat_link($balise, $txa)
{
    if ($txa) {
        $tag = 'href=';
        $len = 6;
        if (substr($txa, 0, 1) == " ") {
            $sp = ' ';
        }
        $txt = clean_internaltag($txa);
        ///testing
        if (strpos($txt, '>')) {
            $txt = substr($txt, strpos($txt, '>') + 1);
        }
    } else {
        $tag = 'src=';
        $len = 5;
        $im = "ok";
    }
    $root = findroot($_GET['urlsrc'] ? $_GET['urlsrc'] : $_POST['urlsrc']);
    $imnb = strpos(strtolower($balise), $tag);
    if ($imnb !== false) {
        $imnc = substr($balise, $imnb + $len - 1, 1);
        if ($imnc == '"' or $imnc == "'") {
            $bend = strpos($balise, $imnc, $imnb + $len);
            $nb = $len;
        } else {
            $bend = strpos($balise, " ", $imnb + $len - 1);
            $nb = $len - 1;
        }
    }
    if ($bend === false) {
        $bend = strpos($balise, '>', $imnb + $nb);
    }
    $src = substr($balise, $imnb + $nb, $bend - $imnb - $nb);
    if (strpos($balise, 'popup_nbp')) {
        $mid = '[' . $txt . ':nh]';
    }
    //philum_anchor
    if (strpos($src, 'base64')) {
        $mid = '[' . b64img($src) . ']';
    } elseif ($src) {
        $src = utmsrc($src);
        $txt = utmsrc($txt);
        if ($tag == 'src=') {
            if ($pos = strpos($src, '?')) {
                $src = substr($src, 0, $pos);
            }
        }
        $src = str_replace(' ', "%20", $src);
        $src = mb_ereg_replace("(\n)|(\t)", '', $src);
        $txt = mb_ereg_replace("(\n)|(\t)", '', $txt);
        if (substr($src, 0, 2) == '//') {
            $src = 'http:' . $src;
        }
        if (strpos($src, 'http') === false) {
            $rot = partsoflink($root, $src);
        }
        if (substr($src, 0, 1) == '/') {
            $src = substr($src, 1);
        }
        if (substr($src, -1) == '/') {
            $src = substr($src, 0, -1);
        }
        if (substr($txt, 0, 1) == '/') {
            $txt = substr($txt, 0, -1);
        }
        $src = str_replace('../', '', $src);
        //if(!is_image($rot.$src,xt($src)) && $im)$ext=":img";
        if (strpos($src, "javascript") !== false) {
            $src = "";
        }
        //if(strpos($balise,'cs_glossaire')!==false)$mid='['.($txa).':pop]';//dico
        if (strpos($balise, 'cs_glossaire') !== false) {
            $mid = $src;
        } elseif ($txt && $txt != ' ') {
            $posdiez = strpos($src, '#');
            //if($tag=='src='){}
            $rt = array('youtube', 'youtu', 'dailymotion', 'vimeo', 'rutube');
            if ($posdiez !== false) {
                //$mid=$txt; //skip_anchors
                $id = prop_detect($balise, 'name');
                if (!$id) {
                    $id = prop_detect($balise, "name='", "'");
                }
                if (!$id) {
                    $id = prop_detect($balise, 'id');
                }
                if (!$id) {
                    $id = embed_detect($balise, "id='", "'");
                }
                if (substr($src, $posdiez + 1, 2) == "nb") {
                    $mid = '[' . $txt . ':nh]';
                } elseif (substr($src, $posdiez + 1, 2) == "nh") {
                    $mid = '[' . $txt . ':nb]';
                }
                if (substr($src, $posdiez + 1, 4) == "_ftn") {
                    $mid = '[' . $txt . ':nh]';
                } elseif (substr($src, $posdiez + 1, 7) == "_ftnref") {
                    $mid = '[' . $txt . ':nb]';
                }
                if (!$mid) {
                    if (!$txt) {
                        $mid = substr($src, $posdiez + 1);
                    } elseif (substr($txt, 0, 1) == '[' or substr($txt, 0, 1) == '(') {
                        $mid = $txt;
                    } else {
                        $mid = '[' . $txt . ']';
                    }
                }
            } elseif (in_array(http_root($src), $rt)) {
                if (!is_image($txt) && !ishttp($txt)) {
                    $txb = $txt;
                    $pop = 'pop';
                }
                $mid = auto_video($src, $pop, $txb);
            } elseif (strpos($src, "mailto:") !== false) {
                $mid = '[' . substr($src, 7) . '] ';
            } elseif (is_image($src) && is_image($txt)) {
                $mid = '[' . $rot . $src . '] ';
            } elseif ($txt && $src && strpos($txt, $src) !== false) {
                $mid = '[' . $rot . $src . '] ';
            } elseif ($rot . $src != $txt) {
                $txt = trim($txt);
                if (is_image($src)) {
                    if (!is_image($txt)) {
                        $mid = '[' . $rot . $src . ($txt ? '§' . $txt : '') . ']';
                    } else {
                        $mid = '[' . $rot . $src . ']';
                    }
                } elseif (strpos($txt, '...') !== false && strpos($src, str_replace('...', '', $txt)) !== false) {
                    $mid = '[' . $rot . $src . '] ';
                } else {
                    $mid = '[' . $rot . $src . '§' . $txt . '] ';
                }
            } else {
                $mid = '[' . $rot . $src . '] ' . $txb;
            }
        } else {
            $mid = '[' . $rot . $src . $ext . '] ' . $txb;
        }
    } elseif ($txt) {
        $mid = $txt . ' ';
    }
    return $sp . $mid;
}
Esempio n. 3
0
File: art.php Progetto: philum/cms
function pub_link($m)
{
    return lkt('', http($m), picto('url', 16)) . ' ' . lj('', 'popup_getcontent___source_' . ajx(http_root($m)), preplink($m));
}
Esempio n. 4
0
File: art.php Progetto: philum/cms
function pub_link($m)
{
    $f = ajx(http_root($m));
    return lkt('', http($m), picto('url', 16)) . ' ' . lj('', 'popup_api___source:' . $f, preplink($m));
}