⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 video.php

📁 Discuz功能源码(开源)
💻 PHP
📖 第 1 页 / 共 2 页
字号:

	function VideoClient_AccountService($appId, $handle = false, $passwd = false) {
		parent::VideoClient($appId);
		$this->handle = $handle;
		$this->passwd = $passwd;
	}

	function handleIsExists($handle) {
		if(!$handle) {
			$handle = $this->handle;
		}
		return $this->_doCall('account_check', array('handle' => $handle));
	}

	function register($handle, $passwd, $code, $email = '', $name = '', $qq = '', $msn = '', $tel= '', $mobile = '', $addr = '' , $postcode = '') {
		$result = $this->_doCall('account_register', array('handle' => $handle, 'passwd' => $passwd, 'code' => $code, 'email' => $email, 'name' => $name, 'qq' => $qq, 'msn' => $msn, 'tel' => $tel, 'mobile' => $mobile, 'addr' => $addr, 'postcode' => $postcode));
		if(!$result->isError()) {
			$this->handle = $handle;
			$this->passwd = $passwd;
		}
		return $result;
	}

	function bind($uniqKey, $siteName, $siteUrl, $logoUrl, $cateId) {
		return $this->_doCall('account_bind', array('handle' => $this->handle, 'passwd' => $this->passwd, 'uniqKey' => $uniqKey, 'siteName' => $siteName, 'siteUrl' => $siteUrl, 'logoUrl' => $logoUrl, 'cateId' => $cateId));
	}

	function getPmNum(){
		$secuKey = '1oidjoqfuikj3487vl8k3lsfdo399ckl4kvzp';
		$sk = md5($secuKey.$this->handle);
		return $this->_doCall('pm_number', array('handle' => $this->handle, 'sk' => $sk, 'appid' => $this->appId));
	}
}

class VideoClient_SiteService extends VideoClient {
	var $siteId = '';
	var $siteKey = '';

	function VideoClient_SiteService($appId, $siteId, $siteKey) {
		parent::VideoClient($appId);
		$this->siteId = $siteId;
		$this->siteKey = $siteKey;
		$this->key = $siteKey;
	}

	function edit($siteName, $siteUrl, $logoUrl, $cateId) {
		return $this->_doCall('site_edit', array('siteId' => $this->siteId, 'siteKey' => $this->siteKey, 'siteName' => $siteName, 'siteUrl' => $siteUrl, 'logoUrl' => $logoUrl, 'cateId' => $cateId));
	}

	function getInfo($uniqKey) {
		return $this->_doCall('site_info', array('siteId' => $this->siteId, 'siteKey' => $this->siteKey, 'uniqKey' => $uniqKey));
	}
}

class VideoClient_VideoService extends VideoClient {
	var $siteId = '';
	var $siteKey = '';

	function VideoClient_VideoService($appId, $siteId, $siteKey) {
		parent::VideoClient($appId);
		$this->siteId = $siteId;
		$this->siteKey = $siteKey;
		$this->key = $siteKey;
	}

	function upload($videoId, $tid, $isup = VIDEO_ISUP_UPLOAD, $subject, $tags, $description, $cateId, $autoplay = VIDEO_AUOT_PLAY_TRUE, $share = VIDEO_SHARE_FALSE) {
		$videoData[] = array( 'videoId' => $videoId, 'tid' => $tid,'isup' => $isup, 'subject' => $subject, 'tags' => $tags, 'description' => $description,
							'category' => $cateId, 'autoplay' => $autoplay, 'share' => $share);
		$results = $this->uploadMulti($videoData);
		return ($result = $results->get('results')) ? $result[0] : $results;
	}

	function getInfo($videoId) {
		return $this->_doCall('video_info', array('siteId' => $this->siteId, 'siteKey' => $this->siteKey, 'videoId' => $videoId));
	}

	function uploadMulti($videoArr = array()) {
		$data = array('siteId' => $this->siteId, 'siteKey' => $this->siteKey);
		foreach($videoArr as $index => $video) {
			foreach($video as $key => $item) {
				$data["videoData[$index][$key]"] = $item;
			}
		}
		return $this->_doCall('video_uploads', $data);
	}

	function edit($videoId, $tid, $subject, $tags, $description, $cateId, $autoplay = VIDEO_AUOT_PLAY_TRUE, $share = VIDEO_SHARE_FALSE) {
		$videoData[] = array( 'videoId' => $videoId, 'tid' => $tid, 'subject' => $subject, 'tags' => $tags, 'description' => $description,
							'category' => $cateId, 'autoplay' => $autoplay, 'share' => $share);
		$results = $this->editMulti($videoData);
		return ($result = $results->get('results')) ? $result[0] : $results;
	}

	function editMulti($videoArr) {
		$data = array('siteId' => $this->siteId, 'siteKey' => $this->siteKey);
		foreach($videoArr as $index => $video) {
			foreach($video as $key => $item) {
				$data["videoData[$index][$key]"] = $item;
			}
		}
		return $this->_doCall('video_edit', $data);
	}

	function remove($videoId) {
		$videoData[] = array( 'videoId' => $videoId);
		$results = $this->removeMulti($videoData);
		return ($result = $results->get('results')) ? $result[0] : $results;
	}

	function removeMulti($videoArr) {
		$data = array('siteId' => $this->siteId, 'siteKey' => $this->siteKey);
		foreach($videoArr as $index => $video) {
			foreach($video as $key => $item) {
				$data["videoData[$index][$key]"] = $item;
			}
		}
		return $this->_doCall('video_remove', $data);
	}
}

class VideoClient_Util extends VideoClient {
	var $siteId = '';
	var $siteKey = '';
	var $flashKey ='87ed8f664329817c99bb02e08db9eeb9ade7981d44f2b50a5ac6461dfde3d95d';

	function VideoClient_Util($appId, $siteId = '', $siteKey = '') {
		parent::VideoClient($appId);
		$this->siteId  =  $siteId;
		$this->siteKey = $siteKey;
	}

	function createUploadFrom($options, $flashVars) {
		if(!$this->siteId || !$this->siteKey) {
			return FALSE;
		}
		$time = time();
		$flashVars['sid'] = $this->siteId;
		$flashVars['ts']  = $time;
		$flashVars['sk']  = md5($this->siteId . $this->siteKey . $this->flashKey . $time);
		$js = '';
		foreach($flashVars as $key => $value) {
			$js .= "\t\tso.addVariable('" . $key . "', '" . $value . "');\n";
			$varArr[] =  $key . '=' . $value;
		}
		$flashVarStr = join('&', $varArr);
		(!$options['width']) && $options['width'] = 480;
		(!$options['height']) && $options['height'] = 60;
		(!$options['id']) && $options['id'] = 'flashUpload';
		$SERVER_HOST = SERVER_HOST;
		$PIC_SERVER_HOST = PIC_SERVER_HOST;
$html = <<<EOF
<div id="video_uploader_wrap">
<div id="video_uploader_div"></div>
<script type="text/javascript" reload="1">
function video_uploader_show() {
	var so = new SWFObject('http://$SERVER_HOST/flash/video_uploader.swf','video_uploader','$options[width]','$options[height]','9.0.0', '#ffffff', 'high', 'http://www.macromedia.com/go/getflashplayer', 'http://www.macromedia.com/go/getflashplayer');
	so.addParam('allowfullscreen','true');
	so.addParam('allowscriptaccess','always');
	so.addParam('wmode','transparent');
	so.addParam('scale', 'noScale');
	$js
	if(!so.write('video_uploader_div'))document.getElementById("video_uploader_div").innerHTML='<span align="center" valign="middle"><a href="http://www.macromedia.com/go/getflashplayer" target=_blank><img src="http://$PIC_SERVER_HOST/flashdownload.jpg" width="468" height="370" border="0" /></a></span>';
	window.focus();
	if(document.getElementById('video_uploader')) {window.video_uploader = document.getElementById('video_uploader');}
}
</script>
</div>
EOF;
		return $html;
	}

	function createPlayer($options, $flashVars) {
		if(!$this->siteId || !$this->siteKey || !$this->appId || !$flashVars['site']) {
			return FALSE;
		}

		$time = time();
		$flashVars['m'] = 'play';
		$flashVars['istyle'] = 'shallow_blue';
		$flashVars['sid'] = $this->siteId;
		$flashVars['ts'] = $time;
		$flashVars['sk'] = md5($this->siteId . $this->siteKey . $this->flashKey . $time);
		$flashVars['site'] = trim($flashVars['site'], '/') . '/';
		$js = '';
		foreach($flashVars as $key => $value) {
			$js .= "\t\tso.addVariable('" . $key . "', '" . $value . "');\n";
			$varArr[] =  $key . '=' .$value;
		}
		$flashVarStr = join('&', $varArr);
		(!$options['width']) && $options['width'] = 480;
		(!$options['height']) && $options['height'] = 410;
		(!$options['id']) && $options['id'] = 'flashPlayer';
		$SERVER_HOST = SERVER_HOST;
		$PIC_SERVER_HOST = PIC_SERVER_HOST;
$html = <<<EOF
<div id="video_Player_wrap">
<div id='video_player_div'></div>
<script type="text/javascript" reload="1">
	var so = new SWFObject('http://$SERVER_HOST/flash/FLVPlayer2.swf','video_player','$options[width]','$options[height]','8.0.0', '#ffffff', 'high', 'http://www.macromedia.com/go/getflashplayer', 'http://www.macromedia.com/go/getflashplayer');
	so.addParam('allowfullscreen','true');
	so.addParam('allowscriptaccess','always');
	so.addParam('scale', 'noScale');
	$js
	if(!so.write('video_player_div'))document.getElementById("video_player_div").innerHTML='<span align="center" valign="middle"><a href="http://www.macromedia.com/go/getflashplayer" target=_blank><img src="http://$PIC_SERVER_HOST/flashdownload.jpg" width="468" height="370" border="0" /></a></span>';
	window.focus();
	if(document.getElementById('video_player')) {window.video_uploader = document.getElementById('video_player');}
</script>
</div>
EOF;
	return $html;
	}

	function createReferPlayer($params = array()) {
		unset($params['ts']);
		unset($params['ks']);
		unset($params['sid']);
		$params['refer'] = 1;
		foreach($params as $key => $value) {
			$query[] = urlencode($key).'='.urlencode($value);
		}
		$time = time();
		$sk   = md5($this->siteId . $this->siteKey . $this->flashKey . $time);
		return 'http://'.SERVER_HOST.'/flash/FLVPlayer2.swf?'.join('&', $query).'&ts='.$time.'&sid='.$this->siteId.'&sk='.$sk;
	}

	function createCode() {
		$httpHeader = "GET /video_api.php?m=seccode HTTP/1.0\r\n";
		$httpHeader .= "Host: " . SERVER_HOST . " \r\n";
		$httpHeader .= "Connection: Close\r\n\r\n";
		$fp = fsockopen(SERVER_HOST, 80);
		if($fp) {
			if(fwrite($fp, $httpHeader)) {
				$resData = '';
				while(!feof($fp)) {
					$resData .= fread($fp, 8192);
				}
				fclose($fp);
				$sessionstr = strstr($resData, "insenz_session_id=");
				$sessionid = substr($sessionstr, 18, 32);
				setCookie('insenz_session_id', $sessionid, (time() + 600), '/');
				$resContent =  substr(strstr($resData, "\r\n\r\n"), 4);
				return $resContent;
			}
		}
	}

	function getThumbUrl($vid, $type = '') {
		$queryStr = 'id=' . $vid;
		if($type == 'small') {
			$queryStr .= '&type=small';
		}
		$url = 'http://' . PIC_SERVER_HOST . '/thumb?%s';
		return sprintf($url, $queryStr);
	}

}

?>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -