TranMedia.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232
  1. <?php
  2. if(!defined('InEmpireCMS'))
  3. {
  4. exit();
  5. }
  6. ?>
  7. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
  8. <html>
  9. <head>
  10. <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  11. <title>上传视频</title>
  12. <link type="text/css" href="images/editorpage.css" rel=stylesheet>
  13. <script>
  14. function EcmsEditorReturnDoAction3(str){
  15. window.parent.EHEcmsEditorDoTranMedia(str);
  16. self.location.href=self.location.href;
  17. }
  18. </script>
  19. <script type="text/javascript">
  20. function DoCheckTranFile(obj){
  21. var ctypes,actypes,cfiletype,ctypest,sfile,sfocus,ctypesth;
  22. ctypes="<?=$ecms_config['sets']['mediaplayertype']?>";
  23. ctypest="<?=$ecms_config['sets']['realplayertype']?>";
  24. ctypesth="<?=$ecms_config['sets']['tranflashtype']?>";
  25. actypes="<?=$public_r['filetype']?>";
  26. if(obj.tranurl.value==''&&obj.file.value=='')
  27. {
  28. alert('请选择要上传的视频');
  29. obj.file.focus();
  30. return false;
  31. }
  32. if(obj.file.value!='')
  33. {
  34. sfile=obj.file.value;
  35. sfocus=0;
  36. }
  37. else
  38. {
  39. sfile=obj.tranurl.value;
  40. sfocus=1;
  41. }
  42. cfiletype=','+ToGetFiletype(sfile)+',';
  43. if(ctypes.indexOf(cfiletype)==-1&&ctypest.indexOf(cfiletype)==-1&&cfiletype!=',.flv,'&&ctypesth.indexOf(cfiletype)==-1)
  44. {
  45. alert('文件扩展名错误');
  46. if(sfocus==1)
  47. {
  48. obj.tranurl.focus();
  49. }
  50. else
  51. {
  52. obj.file.focus();
  53. }
  54. return false;
  55. }
  56. cfiletype='|'+ToGetFiletype(sfile)+'|';
  57. if(actypes.indexOf(cfiletype)==-1)
  58. {
  59. alert('文件扩展名不在允许的范围内');
  60. if(sfocus==1)
  61. {
  62. obj.tranurl.focus();
  63. }
  64. else
  65. {
  66. obj.file.focus();
  67. }
  68. return false;
  69. }
  70. ReturnFileNo(obj);
  71. return true;
  72. }
  73. function ToGetFiletype(sfile){
  74. var filetype,s;
  75. s=sfile.lastIndexOf(".");
  76. filetype=sfile.substring(s+1).toLowerCase();
  77. return '.'+filetype;
  78. }
  79. //返回编号
  80. function ExpStr(str,exp){
  81. var pos,len,ext;
  82. pos=str.lastIndexOf(exp)+1;
  83. len=str.length;
  84. ext=str.substring(pos,len);
  85. return ext;
  86. }
  87. function GetFname(str){
  88. var filename,exp;
  89. if(str.indexOf("\\")>=0)
  90. {
  91. exp="\\";
  92. }
  93. else
  94. {
  95. exp="/";
  96. }
  97. filename=ExpStr(str,exp);
  98. return filename;
  99. }
  100. function ReturnFileNo(obj){
  101. var filename,str,exp;
  102. if(obj.no.value!='')
  103. {
  104. return '';
  105. }
  106. if(obj.file.value!='')
  107. {
  108. str=obj.file.value;
  109. }
  110. else
  111. {
  112. str=obj.tranurl.value;
  113. }
  114. filename=GetFname(str);
  115. obj.no.value=filename;
  116. }
  117. //返回播放器代码
  118. function echoViewFileCode(toplay,width,height,autostart,furl){
  119. var fname=document.TranFlashFormT.no.value;
  120. if(toplay==1)//media
  121. {
  122. 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>";
  123. }
  124. else if(toplay==3)//flv
  125. {
  126. 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>";
  127. }
  128. else//reaplayer
  129. {
  130. 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>";
  131. }
  132. return imgstr;
  133. }
  134. //返回
  135. function echoViewFile(obj,ecms){
  136. var height=obj.height.value;
  137. var width=obj.width.value;
  138. var toplay=obj.toplay.value;
  139. var playmod=obj.playmod.value;
  140. var picsay=obj.picsay.value;
  141. var imgstr="";
  142. var autostart;
  143. var mediatypes="<?=$ecms_config['sets']['mediaplayertype']?>";
  144. var realtypes="<?=$ecms_config['sets']['realplayertype']?>";
  145. var furl,filetype;
  146. if(obj.inserturl.value=='')
  147. {
  148. return '';
  149. }
  150. if(height==""||height==0||width==""||width==0)
  151. {
  152. alert("请输入高度与宽度");
  153. return false;
  154. }
  155. furl=obj.inserturl.value;
  156. autostart="true";
  157. if(playmod==1)
  158. {
  159. autostart="false";
  160. }
  161. if(toplay==0)
  162. {
  163. filetype=ToGetFiletype(furl);
  164. if(filetype=='.flv')
  165. {
  166. toplay=3;
  167. }
  168. else if(mediatypes.indexOf(','+filetype+',')==-1)
  169. {
  170. toplay=2;
  171. }
  172. else
  173. {
  174. toplay=1;
  175. }
  176. }
  177. imgstr=echoViewFileCode(toplay,width,height,autostart,furl);
  178. if(picsay!="")
  179. {
  180. imgstr+="<br><span style='line-height=18pt'>"+picsay+"</span>";
  181. }
  182. imgstr='<center>'+imgstr+'</center>';
  183. if(ecms==0)
  184. {
  185. ePreview.innerHTML=imgstr;
  186. return '';
  187. }
  188. }
  189. </script>
  190. </head>
  191. <body scroll="no" style="OVERFLOW: hidden" topmargin="0">
  192. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" id="tranpictb">
  193. <form id="TranMediaFormT" name="TranMediaFormT" method="post" target="eeditoruploadmedia<?=$ecms_topager['InstanceId']?>" enctype="multipart/form-data" action="../ecmseditor.php" onsubmit="return DoCheckTranFile(TranMediaFormT);">
  194. <?=$ecms_hashur['form']?>
  195. <input type=hidden name=classid value="<?=$ecms_topager['classid']?>">
  196. <input type=hidden name=filepass value="<?=$ecms_topager['filepass']?>">
  197. <input type=hidden name=infoid value="<?=$ecms_topager['infoid']?>">
  198. <input type=hidden name=modtype value="<?=$ecms_topager['modtype']?>">
  199. <input type=hidden name=sinfo value="<?=$ecms_topager['sinfo']?>">
  200. <input type=hidden name=enews value="TranFile">
  201. <input type=hidden name=type value="3">
  202. <input type=hidden name=doing value="0">
  203. <input type=hidden name=tranfrom value="1">
  204. <input type=hidden name=InstanceName value="<?=$ecms_topager['InstanceName']?>">
  205. <input type=hidden name=InstanceId value="<?=$ecms_topager['InstanceId']?>">
  206. <input type=hidden name=doecmspage id=doecmspage value="<?=$doecmspage?>">
  207. <tr>
  208. <td><strong>远程保存</strong><br>
  209. <input name="tranurl" type="text" id="tranurl" size="32" style="width: 100%"></td>
  210. </tr>
  211. <tr>
  212. <td><strong>本地上传</strong><br>
  213. <input type="file" name="file" id="file" style="width: 100%">
  214. </td>
  215. </tr>
  216. <tr>
  217. <td><strong>文件别名</strong><br>
  218. <input name="no" type="text" id="no" value="<?=$ecms_topager['fileno']?>" style="width: 100%">
  219. </td>
  220. </tr>
  221. <tr>
  222. <td height="30"> <input type="submit" name="Submit2" value="发送到服务器上">
  223. </td>
  224. </tr>
  225. </form>
  226. </table>
  227. <iframe name="eeditoruploadmedia<?=$ecms_topager['InstanceId']?>" id="eeditoruploadmedia<?=$ecms_topager['InstanceId']?>" style="display:none" src="images/blank.html"></iframe>
  228. </body>
  229. </html>