PageRenderTime 46ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/web/sfExtraWidgetsPlugin/js/tinymce/plugins/tinybrowser/upload.php

http://piwam.googlecode.com/
PHP | 160 lines | 149 code | 6 blank | 5 comment | 18 complexity | bfbae4e5d06552646471812900ba2937 MD5 | raw file
Possible License(s): ISC, LGPL-2.1, AGPL-3.0, BSD-3-Clause, LGPL-3.0, GPL-2.0
  1. <?php
  2. require_once("config_tinybrowser.php");
  3. // Set language
  4. if(isset($tinybrowser['language']) && file_exists('langs/'.$tinybrowser['language'].'.php'))
  5. {
  6. require_once('langs/'.$tinybrowser['language'].'.php');
  7. }
  8. else
  9. {
  10. require_once('langs/en.php'); // Falls back to English
  11. }
  12. require_once("fns_tinybrowser.php");
  13. // Check session, if it exists
  14. if(session_id() != '')
  15. {
  16. if(!isset($_SESSION[$tinybrowser['sessioncheck']]))
  17. {
  18. echo TB_DENIED;
  19. exit;
  20. }
  21. }
  22. if(!$tinybrowser['allowupload'])
  23. {
  24. echo TB_UPDENIED;
  25. exit;
  26. }
  27. // Assign get variables
  28. $typenow = (isset($_GET['type']) ? $_GET['type'] : 'image');
  29. $passfeid = (isset($_GET['feid']) && $_GET['feid']!='' ? '&feid='.$_GET['feid'] : '');
  30. // determine file dialog file types
  31. switch ($_GET['type'])
  32. {
  33. case 'image':
  34. $filestr = TB_TYPEIMG;
  35. break;
  36. case 'media':
  37. $filestr = TB_TYPEMEDIA;
  38. break;
  39. case 'file':
  40. $filestr = TB_TYPEFILE;
  41. break;
  42. }
  43. $fileexts = str_replace(",",";",$tinybrowser['filetype'][$_GET['type']]);
  44. $filelist = $filestr.' ('.$tinybrowser['filetype'][$_GET['type']].')';
  45. // Initalise alert array
  46. $notify = array(
  47. "type" => array(),
  48. "message" => array()
  49. );
  50. $goodqty = (isset($_GET['goodfiles']) ? $_GET['goodfiles'] : 0);
  51. $badqty = (isset($_GET['badfiles']) ? $_GET['badfiles'] : 0);
  52. $dupqty = (isset($_GET['dupfiles']) ? $_GET['dupfiles'] : 0);
  53. if($goodqty>0)
  54. {
  55. $notify['type'][]='success';
  56. $notify['message'][]=sprintf(TB_MSGUPGOOD, $goodqty);
  57. }
  58. if($badqty>0)
  59. {
  60. $notify['type'][]='failure';
  61. $notify['message'][]=sprintf(TB_MSGUPBAD, $badqty);
  62. }
  63. if($dupqty>0)
  64. {
  65. $notify['type'][]='failure';
  66. $notify['message'][]=sprintf(TB_MSGUPDUP, $dupqty);
  67. }
  68. if(isset($_GET['permerror']))
  69. {
  70. $notify['type'][]='failure';
  71. $notify['message'][]=sprintf(TB_MSGUPFAIL, $tinybrowser['docroot'].$tinybrowser['path'][$typenow]);
  72. }
  73. ?>
  74. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
  75. <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
  76. <head>
  77. <title>TinyBrowser :: <?php echo TB_UPLOAD; ?></title>
  78. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  79. <?php
  80. if($passfeid == '' && $tinybrowser['integration']=='tinymce')
  81. {
  82. ?>
  83. <link rel="stylesheet" type="text/css" media="all"
  84. href="<?php echo $tinybrowser['tinymcecss']; ?>" />
  85. <?php
  86. }
  87. else
  88. {
  89. ?>
  90. <link rel="stylesheet" type="text/css" media="all"
  91. href="css/stylefull_tinybrowser.css" />
  92. <?php
  93. }
  94. ?>
  95. <link rel="stylesheet" type="text/css" media="all"
  96. href="css/style_tinybrowser.css.php" />
  97. <script type="text/javascript" src="js/swfobject.js"></script>
  98. <script type="text/javascript">
  99. function uploadComplete(url) {
  100. document.location = url;
  101. }
  102. </script>
  103. </head>
  104. <body
  105. onload='
  106. var so = new SWFObject("flexupload.swf", "mymovie", "600", "340", "9", "#ffffff");
  107. so.addVariable("folder", "<?php echo urlencode($tinybrowser['path'][$typenow]); ?>");
  108. so.addVariable("uptype", "<?php echo $typenow; ?>");
  109. so.addVariable("destid", "<?php echo $passfeid; ?>");
  110. so.addVariable("maxsize", "<?php echo $tinybrowser['maxsize'][$_GET['type']]; ?>");
  111. so.addVariable("sessid", "<?php echo session_id(); ?>");
  112. so.addVariable("obfus", "<?php echo md5($_SERVER['DOCUMENT_ROOT'].$tinybrowser['obfuscate']); ?>");
  113. so.addVariable("filenames", "<?php echo $filelist; ?>");
  114. so.addVariable("extensions", "<?php echo $fileexts; ?>");
  115. so.addVariable("filenamelbl", "<?php echo TB_FILENAME; ?>");
  116. so.addVariable("sizelbl", "<?php echo TB_SIZE; ?>");
  117. so.addVariable("typelbl", "<?php echo TB_TYPE; ?>");
  118. so.addVariable("progresslbl", "<?php echo TB_PROGRESS; ?>");
  119. so.addVariable("browselbl", "<?php echo TB_BROWSE; ?>");
  120. so.addVariable("removelbl", "<?php echo TB_REMOVE; ?>");
  121. so.addVariable("uploadlbl", "<?php echo TB_UPLOAD; ?>");
  122. so.addVariable("uplimitmsg", "<?php echo TB_MSGMAXSIZE; ?>");
  123. so.addVariable("uplimitlbl", "<?php echo TB_TTLMAXSIZE; ?>");
  124. so.addVariable("uplimitbyte", "<?php echo TB_BYTES; ?>");
  125. so.addParam("allowScriptAccess", "always");
  126. so.addParam("type", "application/x-shockwave-flash");
  127. so.write("flashcontent");'>
  128. <?php
  129. if(count($notify['type'])>0) alert($notify);
  130. ?>
  131. <div class="tabs">
  132. <ul>
  133. <li id="browse_tab"><span><a
  134. href="tinybrowser.php?type=<?php echo $typenow.$passfeid ; ?>"><?php echo TB_BROWSE; ?></a></span></li>
  135. <li id="upload_tab" class="current"><span><a
  136. href="upload.php?type=<?php echo $typenow.$passfeid ; ?>"><?php echo TB_UPLOAD; ?></a></span></li>
  137. <?php
  138. if($tinybrowser['allowedit'] || $tinybrowser['allowdelete'])
  139. {
  140. ?>
  141. <li id="edit_tab"><span><a
  142. href="edit.php?type=<?php echo $typenow.$passfeid ; ?>"><?php echo TB_EDIT; ?></a></span></li>
  143. <?php } ?>
  144. </ul>
  145. </div>
  146. <div class="panel_wrapper">
  147. <div id="general_panel" class="panel currentmod">
  148. <fieldset><legend><?php echo TB_UPLOADFILES; ?></legend>
  149. <div id="flashcontent"></div>
  150. </fieldset>
  151. </div>
  152. </div>
  153. </body>
  154. </html>