TranMedia.php 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  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. if(obj.file.value=='')
  26. {
  27. alert('请选择要上传的视频');
  28. obj.file.focus();
  29. return false;
  30. }
  31. sfile=obj.file.value;
  32. sfocus=0;
  33. cfiletype=','+ToGetFiletype(sfile)+',';
  34. if(ctypes.indexOf(cfiletype)==-1&&ctypest.indexOf(cfiletype)==-1&&cfiletype!=',.flv,'&&ctypesth.indexOf(cfiletype)==-1)
  35. {
  36. alert('文件扩展名错误');
  37. obj.file.focus();
  38. return false;
  39. }
  40. return true;
  41. }
  42. function ToGetFiletype(sfile){
  43. var filetype,s;
  44. s=sfile.lastIndexOf(".");
  45. filetype=sfile.substring(s+1).toLowerCase();
  46. return '.'+filetype;
  47. }
  48. //返回编号
  49. function ExpStr(str,exp){
  50. var pos,len,ext;
  51. pos=str.lastIndexOf(exp)+1;
  52. len=str.length;
  53. ext=str.substring(pos,len);
  54. return ext;
  55. }
  56. function GetFname(str){
  57. var filename,exp;
  58. if(str.indexOf("\\")>=0)
  59. {
  60. exp="\\";
  61. }
  62. else
  63. {
  64. exp="/";
  65. }
  66. filename=ExpStr(str,exp);
  67. return filename;
  68. }
  69. function ReturnFileNo(obj){
  70. var filename,str,exp;
  71. if(obj.no.value!='')
  72. {
  73. return '';
  74. }
  75. str=obj.file.value;
  76. filename=GetFname(str);
  77. obj.no.value=filename;
  78. }
  79. //返回播放器代码
  80. function echoViewFileCode(toplay,width,height,autostart,furl){
  81. var fname=document.TranFlashFormT.no.value;
  82. if(toplay==1)//media
  83. {
  84. 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>";
  85. }
  86. else if(toplay==3)//flv
  87. {
  88. 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>";
  89. }
  90. else//reaplayer
  91. {
  92. 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>";
  93. }
  94. return imgstr;
  95. }
  96. //返回
  97. function echoViewFile(obj,ecms){
  98. var height=obj.height.value;
  99. var width=obj.width.value;
  100. var toplay=obj.toplay.value;
  101. var playmod=obj.playmod.value;
  102. var picsay=obj.picsay.value;
  103. var imgstr="";
  104. var autostart;
  105. var mediatypes="<?=$ecms_config['sets']['mediaplayertype']?>";
  106. var realtypes="<?=$ecms_config['sets']['realplayertype']?>";
  107. var furl,filetype;
  108. if(obj.inserturl.value=='')
  109. {
  110. return '';
  111. }
  112. if(height==""||height==0||width==""||width==0)
  113. {
  114. alert("请输入高度与宽度");
  115. return false;
  116. }
  117. furl=obj.inserturl.value;
  118. autostart="true";
  119. if(playmod==1)
  120. {
  121. autostart="false";
  122. }
  123. if(toplay==0)
  124. {
  125. filetype=ToGetFiletype(furl);
  126. if(filetype=='.flv')
  127. {
  128. toplay=3;
  129. }
  130. else if(mediatypes.indexOf(','+filetype+',')==-1)
  131. {
  132. toplay=2;
  133. }
  134. else
  135. {
  136. toplay=1;
  137. }
  138. }
  139. imgstr=echoViewFileCode(toplay,width,height,autostart,furl);
  140. if(picsay!="")
  141. {
  142. imgstr+="<br><span style='line-height=18pt'>"+picsay+"</span>";
  143. }
  144. imgstr='<center>'+imgstr+'</center>';
  145. if(ecms==0)
  146. {
  147. ePreview.innerHTML=imgstr;
  148. return '';
  149. }
  150. }
  151. </script>
  152. </head>
  153. <body scroll="no" style="OVERFLOW: hidden" topmargin="0">
  154. <table width="100%" border="0" align="center" cellpadding="3" cellspacing="1" id="tranpictb">
  155. <form id="TranMediaFormT" name="TranMediaFormT" method="post" target="eeditoruploadmedia<?=$ecms_topager['InstanceId']?>" enctype="multipart/form-data" action="../../../DoInfo/ecms.php" onsubmit="return DoCheckTranFile(TranMediaFormT);">
  156. <input type=hidden name=classid value="<?=$ecms_topager['classid']?>">
  157. <input type=hidden name=filepass value="<?=$ecms_topager['filepass']?>">
  158. <input type=hidden name=infoid value="<?=$ecms_topager['infoid']?>">
  159. <input type=hidden name=enews value="MEditorTranFile">
  160. <input type=hidden name=type value="3">
  161. <input type=hidden name=doing value="0">
  162. <input type=hidden name=tranfrom value="1">
  163. <input type=hidden name=InstanceName value="<?=$ecms_topager['InstanceName']?>">
  164. <input type=hidden name=InstanceId value="<?=$ecms_topager['InstanceId']?>">
  165. <input type=hidden name=doecmspage id=doecmspage value="<?=$doecmspage?>">
  166. <tr>
  167. <td><strong>本地上传</strong><br>
  168. <input type="file" name="file" id="file" style="width: 100%"> </td>
  169. </tr>
  170. <tr>
  171. <td height="30"> <input type="submit" name="Submit2" value="上传"> </td>
  172. </tr>
  173. </form>
  174. </table>
  175. <iframe name="eeditoruploadmedia<?=$ecms_topager['InstanceId']?>" id="eeditoruploadmedia<?=$ecms_topager['InstanceId']?>" style="display:none" src="images/blank.html"></iframe>
  176. </body>
  177. </html>