nouveau style menu_top
[mtweb] / mw / libs / tiny_mce / plugins / tinybrowser / upload.php
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
14 // Check session, if it exists
15 if(session_id() != '')
16         {
17         if(!isset($_SESSION[$tinybrowser['sessioncheck']]))
18                 {
19                 echo TB_DENIED;
20                 exit;
21                 }
22         }
23
24 if(!$tinybrowser['allowupload'])
25         {
26         echo TB_UPDENIED;
27         exit;
28         }
29
30 // Assign get variables
31 $validtypes = array('image','media','file');
32 $typenow = ((isset($_GET['type']) && in_array($_GET['type'],$validtypes)) ? $_GET['type'] : 'image');
33 $foldernow = str_replace(array('../','..\\','./','.\\'),'',($tinybrowser['allowfolders'] && isset($_REQUEST['folder']) ? urldecode($_REQUEST['folder']) : ''));
34 $passfolder = '&folder='.urlencode($foldernow);
35 $passfeid = (isset($_GET['feid']) && $_GET['feid']!='' ? '&feid='.$_GET['feid'] : '');
36 $passupfeid = (isset($_GET['feid']) && $_GET['feid']!='' ? $_GET['feid'] : '');
37
38 // Assign upload path
39 $uploadpath = urlencode($tinybrowser['path'][$typenow].$foldernow);
40
41 // Assign directory structure to array
42 $uploaddirs=array();
43 dirtree($uploaddirs,$tinybrowser['filetype'][$typenow],$tinybrowser['docroot'],$tinybrowser['path'][$typenow]);
44
45 // determine file dialog file types
46 switch ($_GET['type'])
47         {
48         case 'image':
49                 $filestr = TB_TYPEIMG;
50                 break;
51         case 'media':
52                 $filestr = TB_TYPEMEDIA;
53                 break;
54         case 'file':
55                 $filestr = TB_TYPEFILE;
56                 break;
57         }
58 $fileexts = str_replace(",",";",$tinybrowser['filetype'][$_GET['type']]);
59 $filelist = $filestr.' ('.$tinybrowser['filetype'][$_GET['type']].')';
60
61 // Initalise alert array
62 $notify = array(
63         'type' => array(),
64         'message' => array()
65 );
66 $goodqty = (isset($_GET['goodfiles']) ? $_GET['goodfiles'] : 0);
67 $badqty = (isset($_GET['badfiles']) ? $_GET['badfiles'] : 0);
68 $dupqty = (isset($_GET['dupfiles']) ? $_GET['dupfiles'] : 0);
69
70 if($goodqty>0)
71         {
72         $notify['type'][]='success';
73         $notify['message'][]=sprintf(TB_MSGUPGOOD, $goodqty);
74         }
75 if($badqty>0)
76         {
77         $notify['type'][]='failure';
78         $notify['message'][]=sprintf(TB_MSGUPBAD, $badqty);
79         }
80 if($dupqty>0)
81         {
82         $notify['type'][]='failure';
83         $notify['message'][]=sprintf(TB_MSGUPDUP, $dupqty);
84         }
85 if(isset($_GET['permerror']))
86         {
87         $notify['type'][]='failure';
88         $notify['message'][]=sprintf(TB_MSGUPFAIL, $tinybrowser['docroot'].$tinybrowser['path'][$typenow]);
89         }
90 ?>
91 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
92 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
93 <head>
94 <title>TinyBrowser :: <?php echo TB_UPLOAD; ?></title>
95 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
96 <meta http-equiv="Pragma" content="no-cache" />
97 <?php
98 if($passfeid == '' && $tinybrowser['integration']=='tinymce')
99         {
100         ?><link rel="stylesheet" type="text/css" media="all" href="<?php echo $tinybrowser['tinymcecss']; ?>" /><?php 
101         }
102 else
103         {
104         ?><link rel="stylesheet" type="text/css" media="all" href="css/stylefull_tinybrowser.css" /><?php 
105         }
106 ?>
107 <link rel="stylesheet" type="text/css" media="all" href="css/style_tinybrowser.css.php" />
108 <script type="text/javascript" src="js/swfobject.js"></script>
109 <script type="text/javascript">
110 function uploadComplete(url) {
111 document.location = url;
112 }
113 </script>
114 </head>
115 <body onload='
116       var so = new SWFObject("flexupload.swf", "mymovie", "100%", "340", "9", "#ffffff");
117       so.addVariable("folder", "<?php echo $uploadpath; ?>");
118       so.addVariable("uptype", "<?php echo $typenow; ?>");
119       so.addVariable("destid", "<?php echo $passupfeid; ?>");
120       so.addVariable("maxsize", "<?php echo $tinybrowser['maxsize'][$_GET['type']]; ?>");
121       so.addVariable("sessid", "<?php echo session_id(); ?>");
122       so.addVariable("obfus", "<?php echo md5($_SERVER['DOCUMENT_ROOT'].$tinybrowser['obfuscate']); ?>");
123       so.addVariable("filenames", "<?php echo $filelist; ?>");
124       so.addVariable("extensions", "<?php echo $fileexts; ?>");
125       so.addVariable("filenamelbl", "<?php echo TB_FILENAME; ?>");
126       so.addVariable("sizelbl", "<?php echo TB_SIZE; ?>");
127       so.addVariable("typelbl", "<?php echo TB_TYPE; ?>");
128       so.addVariable("progresslbl", "<?php echo TB_PROGRESS; ?>");
129       so.addVariable("browselbl", "<?php echo TB_BROWSE; ?>");
130       so.addVariable("removelbl", "<?php echo TB_REMOVE; ?>");
131       so.addVariable("uploadlbl", "<?php echo TB_UPLOAD; ?>");
132       so.addVariable("uplimitmsg", "<?php echo TB_MSGMAXSIZE; ?>");
133       so.addVariable("uplimitlbl", "<?php echo TB_TTLMAXSIZE; ?>");
134       so.addVariable("uplimitbyte", "<?php echo TB_BYTES; ?>");
135       so.addParam("allowScriptAccess", "always");
136       so.addParam("type", "application/x-shockwave-flash");
137       so.write("flashcontent");'>
138 <?php
139 if(count($notify['type'])>0) alert($notify);
140 form_open('foldertab',false,'upload.php','?type='.$typenow.$passfeid);
141 ?>
142 <div class="tabs">
143 <ul>
144 <li id="browse_tab"><span><a href="tinybrowser.php?type=<?php echo $typenow.$passfolder.$passfeid ; ?>"><?php echo TB_BROWSE; ?></a></span></li>
145 <li id="upload_tab" class="current"><span><a href="upload.php?type=<?php echo $typenow.$passfolder.$passfeid ; ?>"><?php echo TB_UPLOAD; ?></a></span></li>
146 <?php
147 if($tinybrowser['allowedit'] || $tinybrowser['allowdelete'])
148         {
149         ?><li id="edit_tab"><span><a href="edit.php?type=<?php echo $typenow.$passfolder.$passfeid ; ?>"><?php echo TB_EDIT; ?></a></span></li>
150         <?php 
151         }
152 if($tinybrowser['allowfolders'])
153         {
154         ?><li id="folders_tab"><span><a href="folders.php?type=<?php echo $typenow.$passfolder.$passfeid; ?>"><?php echo TB_FOLDERS; ?></a></span></li><?php
155         }
156 // Display folder select, if multiple exist
157 if(count($uploaddirs)>1)
158         {
159         ?><li id="folder_tab" class="right"><span><?php
160         form_select($uploaddirs,'folder',TB_FOLDERCURR,urlencode($foldernow),true);
161         ?></span></li><?php
162         }
163 ?>
164 </ul>
165 </div>
166 </form>
167 <div class="panel_wrapper">
168 <div id="general_panel" class="panel currentmod">
169 <fieldset>
170 <legend><?php echo TB_UPLOADFILES; ?></legend>
171 <?php
172
173 ?>
174     <div id="flashcontent"></div>
175 </fieldset></div></div>
176 </body>
177 </html>