Exemplo n.º 1
0
 function getdata($style, $parameter)
 {
     require_once libfile('function/discuzcode');
     $return = parseflv($parameter['url'], $parameter['width'], $parameter['height']);
     if ($return == false) {
         $return = $parameter['url'];
     }
     return array('html' => $return, 'data' => null);
 }
Exemplo n.º 2
0
function parsearticlemedia($params, $url)
{
    global $_G;
    $params = explode(',', $params);
    $width = intval($params[1]) > 800 ? 800 : intval($params[1]);
    $height = intval($params[2]) > 600 ? 600 : intval($params[2]);
    $url = addslashes($url);
    if ($flv = parseflv($url, 0, 0)) {
        if (!empty($flv) && preg_match("/\\.flv\$/i", $flv['flv'])) {
            $flv['flv'] = $_G['style']['imgdir'] . '/flvplayer.swf?&autostart=true&file=' . urlencode($flv['flv']);
        }
        $url = $flv['flv'];
        $params[0] = 'swf';
    }
    if (in_array(count($params), array(3, 4))) {
        $type = $params[0];
        $url = str_replace(array('<', '>'), '', str_replace('\\"', '\\"', $url));
        switch ($type) {
            case 'mp3':
            case 'wma':
            case 'ra':
            case 'ram':
            case 'wav':
            case 'mid':
                return '[flash=mp3]' . $url . '[/flash1]';
            case 'rm':
            case 'rmvb':
            case 'rtsp':
                return '[flash=real]' . $url . '[/flash1]';
            case 'swf':
                return '[flash]' . $url . '[/flash1]';
            case 'asf':
            case 'asx':
            case 'wmv':
            case 'mms':
            case 'avi':
            case 'mpg':
            case 'mpeg':
            case 'mov':
                return '[flash=media]' . $url . '[/flash1]';
            default:
                return '<a href="' . $url . '" target="_blank">' . $url . '</a>';
        }
    }
    return;
}
Exemplo n.º 3
0
function parsemedia($params, $url)
{
    $params = explode(',', $params);
    $width = intval($params[1]) > 800 ? 800 : intval($params[1]);
    $height = intval($params[2]) > 600 ? 600 : intval($params[2]);
    $url = addslashes($url);
    if (!in_array(strtolower(substr($url, 0, 6)), array('http:/', 'https:', 'ftp://', 'rtsp:/', 'mms://')) && !preg_match('/^static\\//', $url) && !preg_match('/^data\\//', $url)) {
        return dhtmlspecialchars($url);
    }
    if ($flv = parseflv($url, $width, $height)) {
        return $flv;
    }
    if (in_array(count($params), array(3, 4))) {
        $type = $params[0];
        $url = htmlspecialchars(str_replace(array('<', '>'), '', str_replace('\\"', '\\"', $url)));
        switch ($type) {
            case 'mp3':
            case 'wma':
            case 'ra':
            case 'ram':
            case 'wav':
            case 'mid':
                return parseaudio($url, $width);
            case 'rm':
            case 'rmvb':
            case 'rtsp':
                $mediaid = 'media_' . random(3);
                return '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="' . $width . '" height="' . $height . '"><param name="autostart" value="0" /><param name="src" value="' . $url . '" /><param name="controls" value="imagewindow" /><param name="console" value="' . $mediaid . '_" /><embed src="' . $url . '" autostart="0" type="audio/x-pn-realaudio-plugin" controls="imagewindow" console="' . $mediaid . '_" width="' . $width . '" height="' . $height . '"></embed></object><br /><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="' . $width . '" height="32"><param name="src" value="' . $url . '" /><param name="controls" value="controlpanel" /><param name="console" value="' . $mediaid . '_" /><embed src="' . $url . '" autostart="0" type="audio/x-pn-realaudio-plugin" controls="controlpanel" console="' . $mediaid . '_" width="' . $width . '" height="32"></embed></object>';
            case 'flv':
                $randomid = 'flv_' . random(3);
                return '<span id="' . $randomid . '"></span><script type="text/javascript" reload="1">$(\'' . $randomid . '\').innerHTML=AC_FL_RunContent(\'width\', \'' . $width . '\', \'height\', \'' . $height . '\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \'' . STATICURL . 'image/common/flvplayer.swf\', \'flashvars\', \'file=' . rawurlencode($url) . '\', \'quality\', \'high\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\');</script>';
            case 'swf':
                $randomid = 'swf_' . random(3);
                return '<span id="' . $randomid . '"></span><script type="text/javascript" reload="1">$(\'' . $randomid . '\').innerHTML=AC_FL_RunContent(\'width\', \'' . $width . '\', \'height\', \'' . $height . '\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', encodeURI(\'' . $url . '\'), \'quality\', \'high\', \'bgcolor\', \'#ffffff\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\');</script>';
            case 'asf':
            case 'asx':
            case 'wmv':
            case 'mms':
            case 'avi':
            case 'mpg':
            case 'mpeg':
                return '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="' . $width . '" height="' . $height . '"><param name="invokeURLs" value="0"><param name="autostart" value="0" /><param name="url" value="' . $url . '" /><embed src="' . $url . '" autostart="0" type="application/x-mplayer2" width="' . $width . '" height="' . $height . '"></embed></object>';
            case 'mov':
                return '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="' . $width . '" height="' . $height . '"><param name="autostart" value="false" /><param name="src" value="' . $url . '" /><embed src="' . $url . '" autostart="false" type="video/quicktime" controller="true" width="' . $width . '" height="' . $height . '"></embed></object>';
            default:
                return '<a href="' . $url . '" target="_blank">' . $url . '</a>';
        }
    }
    return;
}
Exemplo n.º 4
0
function fparsemedia($params, $url)
{
    $params = explode(',', $params);
    $url = addslashes($url);
    $html = '';
    if ($flv = parseflv($url, 0, 0)) {
        return fmakeflv($flv);
    }
    if (in_array(count($params), array(3, 4))) {
        $type = $params[0];
        $url = str_replace(array('<', '>'), '', str_replace('\\"', '\\"', $url));
        switch ($type) {
            case 'mp3':
                return fparseaudio($url);
                break;
            case 'flv':
                $url = STATICURL . 'image/common/flvplayer.swf?&autostart=true&file=' . urlencode($url);
                return fmakeflv($url);
                break;
            case 'swf':
                return fparseflash($url);
                break;
            default:
                $html = '<a href="' . $url . '" target="_blank">' . $url . '</a>';
                break;
        }
    }
    return fcodedisp($html, 'media');
}
Exemplo n.º 5
0
     if (!preg_match("/^(http|ftp|https|mms)\\:\\/\\/.{4,300}\$/i", $link)) {
         $link = '';
     }
 }
 if (empty($link)) {
     showmessage('url_incorrect_format');
 }
 $arr['itemid'] = '0';
 $arr['fromuid'] = '0';
 $arr['title_template'] = lang('spacecp', 'share_link');
 $arr['body_template'] = '{link}';
 $link_text = sub_url($link, 45);
 $arr['body_data'] = array('link' => "<a href=\"{$link}\" target=\"_blank\">{$link_text}</a>", 'data' => $link);
 $parseLink = parse_url($link);
 require_once libfile('function/discuzcode');
 $flashvar = parseflv($link);
 if (empty($flashvar) && preg_match("/\\.flv\$/i", $link)) {
     $flashvar = array('flv' => $_G['style']['imgdir'] . '/flvplayer.swf?&autostart=true&file=' . urlencode($link), 'imgurl' => '');
 }
 if (!empty($flashvar)) {
     $arr['title_template'] = lang('spacecp', 'share_video');
     $type = 'video';
     $arr['body_data']['flashvar'] = $flashvar['flv'];
     $arr['body_data']['host'] = 'flash';
     $arr['body_data']['imgurl'] = $flashvar['imgurl'];
 }
 if (preg_match("/\\.(mp3|wma)\$/i", $link)) {
     $arr['title_template'] = lang('spacecp', 'share_music');
     $arr['body_data']['musicvar'] = $link;
     $type = 'music';
 }
Exemplo n.º 6
0
            }
            if (!empty($str) && preg_match("/\"img\":\"(.+?)\"/i", $str, $image)) {
                $imgurl = trim($image[1]);
                $img_w = substr($imgurl, 0, strrpos($imgurl, '.')) . '_b' . substr($imgurl, strrpos($imgurl, '.'));
            }
        }
    }
    if ($flv) {
        return array('flv' => $flv, 'imgurl' => $imgurl, 'img_w' => $img_w, 'title' => $title);
    } else {
        return FALSE;
    }
}
echo '解析到的视频 信息:<br />';
if (isset($_POST['url']) && $_POST['url']) {
    $flvdata = parseflv($_POST['url']);
    var_dump($flvdata);
    simple_show($flvdata);
}
echo '解析到的视频 信息[End]<br />';
function simple_show($flvdata)
{
    echo '<br />';
    echo '标题:<br />';
    echo $flvdata['title'];
    echo '<br />';
    echo 'flv地址:<br />';
    echo $flvdata['flv'];
    echo '<br />';
    echo '大图片:<br />';
    echo $flvdata['img_w'];
function parsemedia($params, $url) {
	$params = explode(',', $params);
	$width = intval($params[1]) > 800 ? 800 : intval($params[1]);
	$height = intval($params[2]) > 600 ? 600 : intval($params[2]);
	$autostart = !empty($params[3]) ? 1 : 0;
	if($flv = parseflv($url, $width, $height)) {
		return $flv;
	}
	if(in_array(count($params), array(3, 4))) {
		$type = $params[0];
		$url = str_replace(array('<', '>'), '', str_replace('\\"', '\"', $url));
		switch($type) {
			case 'mp3':
			case 'wma':
			case 'ra':
			case 'ram':
			case 'wav':
			case 'mid':
				return parseaudio($url, $width, $autostart);
			case 'rm':
			case 'rmvb':
			case 'rtsp':
				$mediaid = 'media_'.random(3);
				return '<object classid="clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA" width="'.$width.'" height="'.$height.'"><param name="autostart" value="'.$autostart.'" /><param name="src" value="'.$url.'" /><param name="controls" value="imagewindow" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" type="audio/x-pn-realaudio-plugin" controls="imagewindow" console="'.$mediaid.'_" width="'.$width.'" height="'.$height.'"></embed></object><br /><object classid="clsid:CFCDAA03-8BE4-11CF-B84B-0020AFBBCCFA" width="'.$width.'" height="32"><param name="src" value="'.$url.'" /><param name="controls" value="controlpanel" /><param name="console" value="'.$mediaid.'_" /><embed src="'.$url.'" type="audio/x-pn-realaudio-plugin" controls="controlpanel" console="'.$mediaid.'_" width="'.$width.'" height="32"'.($autostart ? ' autostart="true"' : '').'></embed></object>';
			case 'flv':
				return '<script type="text/javascript" reload="1">document.write(AC_FL_RunContent(\'width\', \''.$width.'\', \'height\', \''.$height.'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \'images/common/flvplayer.swf\', \'flashvars\', \'file='.rawurlencode($url).'\', \'quality\', \'high\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\'));</script>';
			case 'swf':
				return '<script type="text/javascript" reload="1">document.write(AC_FL_RunContent(\'width\', \''.$width.'\', \'height\', \''.$height.'\', \'allowNetworking\', \'internal\', \'allowScriptAccess\', \'never\', \'src\', \''.$url.'\', \'quality\', \'high\', \'bgcolor\', \'#ffffff\', \'wmode\', \'transparent\', \'allowfullscreen\', \'true\'));</script>';
			case 'asf':
			case 'asx':
			case 'wmv':
			case 'mms':
			case 'avi':
			case 'mpg':
			case 'mpeg':
				return '<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6" width="'.$width.'" height="'.$height.'"><param name="invokeURLs" value="0"><param name="autostart" value="'.$autostart.'" /><param name="url" value="'.$url.'" /><embed src="'.$url.'" autostart="'.$autostart.'" type="application/x-mplayer2" width="'.$width.'" height="'.$height.'"></embed></object>';
			case 'mov':
				return '<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" width="'.$width.'" height="'.$height.'"><param name="autostart" value="'.($autostart ? '' : 'false').'" /><param name="src" value="'.$url.'" /><embed src="'.$url.'" autostart="'.($autostart ? 'true' : 'false').'" type="video/quicktime" controller="true" width="'.$width.'" height="'.$height.'"></embed></object>';
			default:
				return '<a href="'.$url.'" target="_blank">'.$url.'</a>';
		}
	}
	return;
}
Exemplo n.º 8
0
<?php

/**
 *      (C)ÍÆÕ¾ÍøÌṩ  www.ituiz.com
 *      This is a freeware, But you have no right to modify or distribute
 *
 *      $Id: video.inc.php 2 2012-12-09 14:27:05Z except10n $
 */
require_once libfile('function/discuzcode');
$tid = intval($_GET['tid']);
$post = C::t('#singcere_waterfall#dx')->fetch_first_post_by_tid($tid);
$pos = intval($_GET['pos']);
if ($post) {
    $message = $post['message'];
    preg_match_all("/((\\[media=(swf|flv|x),\\d{1,4}[x|\\,]\\d{1,4}\\])\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/media\\])|((\\[flash\\])|(\\[flash=\\d{1,4}\\,\\d{1,4})\\]\\s*([^\\[\\<\r\n]+?)\\s*\\[\\/flash\\])/is", $message, $medialist, PREG_SET_ORDER);
    $pos = $pos < count($medialist) ? $pos : 0;
    $video['code'] = discuzcode($medialist[$pos][0], true, false, 0, 0, 1, 0, 0, 0, '0', '0', '1');
    $video['width'] = $medialist[$pos][3];
    $video['height'] = $medialist[$pos][4];
    // + 95;
    foreach ($medialist as $key => $media) {
        $flv = parseflv($medialist[$key][5], 0, 0);
        $video['img'][] = $flv['imgurl'];
    }
}
if (empty($video)) {
    showmessage(lang('plugin/singcere_waterfall', 'video_not_found'));
}
include template('singcere_waterfall:video');
Exemplo n.º 9
0
 public function linktovideo($link, $pfid)
 {
     global $_G;
     @set_time_limit(60);
     $videoext = array('swf', 'flv');
     $fid = $pfid;
     $gid = DB::result_first("select gid from %t where fid =%d", array('folder', $pfid));
     if (!($cvideo = DB::fetch_first("select * from " . DB::table('cai_video') . " where ourl='{$link}'"))) {
         $arr = array();
         require_once dzz_libfile('function/video');
         if (!($arr = parseflv($link))) {
             return false;
         }
         //采集标题和描述
         if (!$arr['title'] || !$arr['description']) {
             require_once dzz_libfile('class/caiji');
             $caiji = new caiji($link);
             $arr['title'] = $caiji->getTitle();
             $arr['description'] = $caiji->getDescription();
         }
         $cvideo = array('url' => $arr['url'], 'ourl' => $link, 'img' => $arr['img'], 'desc' => $arr['description'], 'title' => $arr['title'], 'copys' => 0, 'dateline' => $_G['timestamp']);
         $cvideo['cid'] = DB::insert('cai_video', $cvideo, 1);
     }
     //如果原先的标题和描述没采集到,重新采集
     if (!$cvideo['title'] || !$cvideo['desc']) {
         require_once dzz_libfile('class/caiji');
         $caiji = new caiji($link);
         $cvideo['title'] = $caiji->getTitle();
         $cvideo['description'] = $caiji->getDescription();
         C::t('cai_video')->update($cvideo['cid'], array('title' => $cvideo['title'], 'desc' => $cvideo['desc']));
     }
     $sourcedata = array('uid' => $_G['uid'], 'username' => $_G['username'], 'url' => $cvideo['url'], 'icon' => $cvideo['img'], 'desc' => $cvideo['desc'], 'title' => $cvideo['title'], 'cid' => $cvideo['cid'], 'dateline' => $_G['timestamp'], 'gid' => $gid);
     if ($sourcedata['vid'] = DB::insert('source_video', $sourcedata, 1)) {
         C::t('cai_video')->update($cvideo['cid'], array('copys' => $cvideo['copys'] + 1));
         $sourcedata['icon'] = $sourcedata['icon'] ? $sourcedata['icon'] : geticonfromext('', 'video');
         $icoarr = array('uid' => $_G['uid'], 'username' => $_G['username'], 'oid' => $sourcedata['vid'], 'name' => self::getFileName($sourcedata['title'], $fid), 'type' => 'video', 'dateline' => $_G['timestamp'], 'pfid' => $fid, 'opuid' => $_G['uid'], 'gid' => $gid, 'ext' => 'swf', 'flag' => '', 'size' => 0);
         if ($icoarr['icoid'] = DB::insert('icos', $icoarr, 1)) {
             $icoarr['url'] = $sourcedata['url'];
             $icoarr['img'] = $sourcedata['icon'];
             $icoarr['bz'] = '';
             $icoarr['path'] = $icoarr['icoid'];
             $icoarr['dpath'] = dzzencode($icoarr['icoid']);
             addtoconfig($icoarr);
             $icoarr['fsize'] = formatsize($icoarr['size']);
             $icoarr['ftype'] = getFileTypeName($icoarr['type'], $icoarr['ext']);
             $icoarr['fdateline'] = dgmdate($icoarr['dateline']);
             //if($gid) C::t('group_log')->setLog($gid,$_G['uid'],'addvideo',lang('message','xiezuo_log_addvideo',array('username'=>$_G['username'],'position'=>getPositionName($fid),'name'=>$icoarr['name'])));
         } else {
             C::t('source_video')->delete_by_vid($sourcedata['vid']);
         }
     }
     if ($icoarr['icoid']) {
         return $icoarr;
     } else {
         return array('error' => lang('message', 'linktovideo_error'));
     }
 }
Exemplo n.º 10
0
 public function video_fetch()
 {
     //$url = 'http://www.tudou.com/programs/view/Q_mSAYAvKp4/?resourceId=92873908_08_12_99&rpid=92873908';
     //$url="http://v.youku.com/v_show/id_XNDA2MTI1OTQ4.html?f=17651349";
     //$url="http://v.ku6.com/special/show_6578738/oUN9XYp8h2DFDh-6dKKyWg...html";
     //$url="http://video.sina.com.cn/v/b/78322036-1735047885.html";
     //$url="http://my.tv.sohu.com/u/pw/752681_1_1";
     //$url="http://www.ouou.com/starmv_mvview.jhtml?cont=1198";
     //$url="http://www.56.com/w79/play_album-aid-9915825_vid-Njg3NTU5NjQ.html";
     $this->ajax_check_login();
     $this->ajax_check_can_post();
     if (!$this->permission['other_permission']['allow_video']) {
         $this->ajax_failed_response("no-permission");
     }
     $act = $this->spArgs("act");
     if ($act == 'fetch') {
         $remote_url = $this->spArgs('remote_url');
         $data = parseflv($remote_url);
         if ($data['flv']) {
             $data['share_type'] = 'video';
             $data['type'] = 'video';
             $this->ajax_success_response($data, T('fetch_succeed'));
         } else {
             $this->ajax_failed_response(T('fetch_failed'));
         }
         return;
     } elseif ($act == 'save') {
         if ($this->settings['vcode_setting']['post'] && !$this->vcode_check()) {
             $this->ajax_failed_response(T('vcode_wrong'));
             return;
         }
         if ($this->save_share_fetch()) {
             $message = $this->settings['basic_setting']['site_need_verify'] && $this->permission['need_verify'] && !$this->is_editer() ? T('wait_admin_verify') : T('publish_succeed');
             $this->ajax_success_response($data, $message);
         } else {
             $this->ajax_failed_response(T('publish_failed'));
         }
     }
 }