PageRenderTime 45ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/e/admin/ecmseditor/infoeditor/epage/TranMedia.php

https://github.com/westeast/xwdede
PHP | 293 lines | 285 code | 4 blank | 4 comment | 21 complexity | e88a4648c86f5dc230148ccb5e5e4040 MD5 | raw file
  1. <?php
  2. define('EmpireCMSAdmin','1');
  3. require('../../../../class/connect.php');
  4. $showmod=(int)$_GET['showmod'];
  5. $type=(int)$_GET['type'];
  6. $classid=(int)$_GET['classid'];
  7. $filepass=(int)$_GET['filepass'];
  8. $InstanceName=$_GET['InstanceName'];
  9. $editor=3;
  10. ?>
  11. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  12. <html>
  13. <head>
  14. <title>上传视频</title>
  15. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  16. <meta content="noindex, nofollow" name="robots">
  17. <script src="../editor/dialog/common/fck_dialog_common.js" type="text/javascript"></script>
  18. <script src="../editor/dialog/tranmedia/media.js" type="text/javascript"></script>
  19. <script type="text/javascript">
  20. document.write( FCKTools.GetStyleHtml( GetCommonDialogCss() ) ) ;
  21. </script>
  22. <script type="text/javascript">
  23. function DoCheckTranFile(obj){
  24. var ctypes,actypes,cfiletype,ctypest,sfile,sfocus;
  25. ctypes="<?=$mediaplayertype?>";
  26. ctypest="<?=$realplayertype?>";
  27. actypes="<?=$public_r['filetype']?>";
  28. if(obj.tranurl.value==''&&obj.file.value=='')
  29. {
  30. alert('请选择要上传的视频');
  31. obj.file.focus();
  32. return false;
  33. }
  34. if(obj.file.value!='')
  35. {
  36. sfile=obj.file.value;
  37. sfocus=0;
  38. }
  39. else
  40. {
  41. sfile=obj.tranurl.value;
  42. sfocus=1;
  43. }
  44. cfiletype=','+ToGetFiletype(sfile)+',';
  45. if(ctypes.indexOf(cfiletype)==-1&&ctypest.indexOf(cfiletype)==-1&&cfiletype!=',.flv,')
  46. {
  47. alert('文件扩展名错误');
  48. if(sfocus==1)
  49. {
  50. obj.tranurl.focus();
  51. }
  52. else
  53. {
  54. obj.file.focus();
  55. }
  56. return false;
  57. }
  58. cfiletype='|'+ToGetFiletype(sfile)+'|';
  59. if(actypes.indexOf(cfiletype)==-1)
  60. {
  61. alert('文件扩展名不在允许的范围内');
  62. if(sfocus==1)
  63. {
  64. obj.tranurl.focus();
  65. }
  66. else
  67. {
  68. obj.file.focus();
  69. }
  70. return false;
  71. }
  72. ReturnFileNo(obj);
  73. // Show animation
  74. window.parent.Throbber.Show( 100 ) ;
  75. GetE( 'divUpload' ).style.display = 'none' ;
  76. return true;
  77. }
  78. function ToGetFiletype(sfile){
  79. var filetype,s;
  80. s=sfile.lastIndexOf(".");
  81. filetype=sfile.substring(s+1).toLowerCase();
  82. return '.'+filetype;
  83. }
  84. //返回编号
  85. function ExpStr(str,exp){
  86. var pos,len,ext;
  87. pos=str.lastIndexOf(exp)+1;
  88. len=str.length;
  89. ext=str.substring(pos,len);
  90. return ext;
  91. }
  92. function GetFname(str){
  93. var filename,exp;
  94. if(str.indexOf("\\")>=0)
  95. {
  96. exp="\\";
  97. }
  98. else
  99. {
  100. exp="/";
  101. }
  102. filename=ExpStr(str,exp);
  103. return filename;
  104. }
  105. function ReturnFileNo(obj){
  106. var filename,str,exp;
  107. if(obj.no.value!='')
  108. {
  109. return '';
  110. }
  111. if(obj.file.value!='')
  112. {
  113. str=obj.file.value;
  114. }
  115. else
  116. {
  117. str=obj.tranurl.value;
  118. }
  119. filename=GetFname(str);
  120. obj.no.value=filename;
  121. }
  122. //返回播放器代码
  123. function echoViewFileCode(toplay,width,height,autostart,furl){
  124. var fname=document.TranFlashFormT.no.value;
  125. if(toplay==1)//media
  126. {
  127. imgstr="<object align=middle classid=\"CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95\" class=\"OBJECT\" id=\"MediaPlayer\" width=\""+width+"\" height=\""+height+"\"><PARAM NAME=\"AUTOSTART\" VALUE=\""+autostart+"\"><param name=\"ShowStatusBar\" value=\"-1\"><param name=\"Filename\" value=\""+furl+"\"><embed type=\"application/x-oleobject codebase=http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701\" flename=\"mp\" src=\""+furl+"\" width=\""+width+"\" height=\""+height+"\"></embed></object>";
  128. }
  129. else if(toplay==3)//flv
  130. {
  131. imgstr="<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0\" width=\""+width+"\" height=\""+height+"\"><param name=\"movie\" value=\"<?=$public_r[newsurl]?>e/data/images/flvplayer.swf?vcastr_file="+furl+"&vcastr_title="+fname+"&BarColor=0xFF6600&BarPosition=1&IsAutoPlay="+autostart+"\"><param name=\"quality\" value=\"high\"><param name=\"allowFullScreen\" value=\"true\" /><embed src=\"<?=$public_r[newsurl]?>e/data/images/flvplayer.swf?vcastr_file="+furl+"&vcastr_title="+fname+"&BarColor=0xFF6600&BarPosition=1&IsAutoPlay="+autostart+"\" allowFullScreen=\"true\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\""+width+"\" height=\""+height+"\"></embed></object>";
  132. }
  133. else//reaplayer
  134. {
  135. imgstr="<object classid=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" HEIGHT=\""+height+"\" ID=\"Player\" WIDTH=\""+width+"\" VIEWASTEXT><param NAME=\"_ExtentX\" VALUE=\"12726\"><param NAME=\"_ExtentY\" VALUE=\"8520\"><param NAME=\"AUTOSTART\" VALUE=\""+autostart+"\"><param NAME=\"SHUFFLE\" VALUE=\"0\"><param NAME=\"PREFETCH\" VALUE=\"0\"><param NAME=\"NOLABELS\" VALUE=0><param NAME=CONTROLS VALUE=ImageWindow><param NAME=CONSOLE VALUE=_master><param NAME=LOOP VALUE=0><param NAME=NUMLOOP VALUE=0><param NAME=CENTER VALUE=0><param NAME=MAINTAINASPECT VALUE=\""+furl+"\"><param NAME=BACKGROUNDCOLOR VALUE=\"#000000\"></object><br><object CLASSID=\"clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA\" HEIGHT=32 ID=\"Player\" WIDTH=\""+width+"\" VIEWASTEXT><param NAME=_ExtentX VALUE=18256><param NAME=_ExtentY VALUE=794><param NAME=AUTOSTART VALUE=\""+autostart+"\"><param NAME=SHUFFLE VALUE=0><param NAME=PREFETCH VALUE=0><param NAME=NOLABELS VALUE=0><param NAME=CONTROLS VALUE=controlpanel><param NAME=CONSOLE VALUE=_master><param NAME=LOOP VALUE=0><param NAME=NUMLOOP VALUE=0><param NAME=CENTER VALUE=0><param NAME=MAINTAINASPECT VALUE=0><param NAME=BACKGROUNDCOLOR VALUE=\"#000000\"><param NAME=SRC VALUE=\""+furl+"\"></object>";
  136. }
  137. return imgstr;
  138. }
  139. //返回
  140. function echoViewFile(obj,ecms){
  141. var height=obj.height.value;
  142. var width=obj.width.value;
  143. var toplay=obj.toplay.value;
  144. var playmod=obj.playmod.value;
  145. var picsay=obj.picsay.value;
  146. var imgstr="";
  147. var autostart;
  148. var mediatypes="<?=$mediaplayertype?>";
  149. var realtypes="<?=$realplayertype?>";
  150. var furl,filetype;
  151. if(obj.inserturl.value=='')
  152. {
  153. return '';
  154. }
  155. if(height==""||height==0||width==""||width==0)
  156. {
  157. alert("请输入高度与宽度");
  158. return false;
  159. }
  160. furl=obj.inserturl.value;
  161. autostart="true";
  162. if(playmod==1)
  163. {
  164. autostart="false";
  165. }
  166. if(toplay==0)
  167. {
  168. filetype=ToGetFiletype(furl);
  169. if(filetype=='.flv')
  170. {
  171. toplay=3;
  172. }
  173. else if(mediatypes.indexOf(','+filetype+',')==-1)
  174. {
  175. toplay=2;
  176. }
  177. else
  178. {
  179. toplay=1;
  180. }
  181. }
  182. imgstr=echoViewFileCode(toplay,width,height,autostart,furl);
  183. if(picsay!="")
  184. {
  185. imgstr+="<br><span style='line-height=18pt'>"+picsay+"</span>";
  186. }
  187. imgstr='<center>'+imgstr+'</center>';
  188. if(ecms==0)
  189. {
  190. ePreview.innerHTML=imgstr;
  191. return '';
  192. }
  193. oEditor.FCK.InsertHtml(imgstr);
  194. window.parent.Cancel();
  195. }
  196. </script>
  197. </head>
  198. <body scroll="no" style="OVERFLOW: hidden">
  199. <div id="divInfo">
  200. <table cellSpacing="1" cellPadding="1" width="100%" border="0">
  201. <form action="" method="post" name="etranflashform" onsubmit="return false;">
  202. <input type="hidden" name="picsay" value="">
  203. <tr>
  204. <td> <table cellSpacing="0" cellPadding="0" width="100%" border="0">
  205. <tr>
  206. <td width="100%"><span fckLang="DlgImgURL">URL</span> </td>
  207. <td id="tdBrowse" style="DISPLAY: none" noWrap rowSpan="2">&nbsp;
  208. <input id="btnBrowse" onclick="window.open('<?="../../FileMain.php?filepass=$filepass&classid=$classid&type=3&InstanceName=$InstanceName&tranfrom=1&field=opener.document.etranflashform.inserturl";?>','','width=700,height=550,scrollbars=yes');" type="button" value="Browse Server" fckLang="DlgBtnBrowseServer">
  209. </td>
  210. </tr>
  211. <tr>
  212. <td vAlign="top"><input id="txtUrl" name="inserturl" onblur="echoViewFile(document.etranflashform,0);" style="WIDTH: 100%" type="text">
  213. </td>
  214. </tr>
  215. </table></td>
  216. </tr>
  217. <TR>
  218. <TD> <table cellSpacing="1" cellPadding="3" border="0">
  219. <TR>
  220. <TD nowrap> <span fckLang="DlgImgWidth">Width</span><br> <input type="text" id="txtWidth" name="width" value="480" size="3" onblur="echoViewFile(document.etranflashform,0);">
  221. </TD>
  222. <TD>&nbsp;</TD>
  223. <TD> <span fckLang="DlgImgHeight">Height</span><br> <input type="text" id="txtHeight" name="height" value="360" size="3" onblur="echoViewFile(document.etranflashform,0);">
  224. </TD>
  225. <TD>&nbsp;&nbsp;&nbsp;</TD>
  226. <TD>播放器<br> <select name="toplay" id="toplay" onchange="echoViewFile(document.etranflashform,0);">
  227. <option value="0">自动识别</option>
  228. <option value="1">Media Player</option>
  229. <option value="2">Real Player</option>
  230. <option value="3">Flv Player</option>
  231. </select> </TD>
  232. <TD>播放模式<br>
  233. <select name="playmod" id="playmod" onchange="echoViewFile(document.etranflashform,0);">
  234. <option value="0">自动播放</option>
  235. <option value="1">手动播放</option>
  236. </select></TD>
  237. </TR>
  238. </table></TD>
  239. </TR>
  240. <tr>
  241. <td vAlign="top"> <table cellSpacing="0" cellPadding="0" width="100%" border="0">
  242. <tr>
  243. <td valign="top" width="100%"> <table cellSpacing="0" cellPadding="0" width="100%">
  244. <tr>
  245. <td><span fckLang="DlgImgPreview">Preview</span></td>
  246. </tr>
  247. <tr>
  248. <td id="ePreviewCell" valign="top" class="FlashPreviewArea"><iframe src="../editor/dialog/fck_flash/fck_flash_preview.html" frameborder="0" marginheight="0" marginwidth="0"></iframe></td>
  249. </tr>
  250. </table></td>
  251. </tr>
  252. </table></td>
  253. </tr>
  254. </form>
  255. </table>
  256. </div>
  257. <div id="divUpload" style="DISPLAY: none">
  258. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" id="tranpictb">
  259. <form id="frmUpload" name="TranFlashFormT" method="post" target="UploadWindow" enctype="multipart/form-data" action="../../ecmseditor.php" onsubmit="return DoCheckTranFile(TranFlashFormT);">
  260. <input type=hidden name=classid value="<?=$classid?>">
  261. <input type=hidden name=filepass value="<?=$filepass?>">
  262. <input type=hidden name=enews value="TranFile">
  263. <input type=hidden name=type value="3">
  264. <input type=hidden name=doing value="0">
  265. <input type=hidden name=tranfrom value="1">
  266. <input type=hidden name=InstanceName value="<?=$InstanceName?>">
  267. <tr>
  268. <td>远程保存<br> <input name="tranurl" type="text" id="tranurl" size="32" style="width: 100%"></td>
  269. </tr>
  270. <tr>
  271. <td>本地上传<br> <input type="file" name="file" id="file" style="width: 100%">
  272. </td>
  273. </tr>
  274. <tr>
  275. <td>文件别名<br> <input name="no" type="text" id="no" value="<?=$_GET['fileno']?>" style="width: 100%">
  276. </td>
  277. </tr>
  278. <tr>
  279. <td height="30"> <input type="submit" name="Submit2" value="发送到服务器上">
  280. </td>
  281. </tr>
  282. </form>
  283. </table>
  284. <script type="text/javascript">
  285. document.write( '<iframe name="UploadWindow" style="DISPLAY: none" src="' + FCKTools.GetVoidUrl() + '"><\/iframe>' ) ;
  286. </script>
  287. </div>
  288. </body>
  289. </html>