public
Description: Git mirror of the CMS Made Simple 2.0 rewrite
Homepage: http://cmsmadesimple.org
Clone URL: git://github.com/tedkulp/cmsmadesimple-2-0.git
Search Repo:
Removed imagefiles.php

Signed-off-by: Ted Kulp <ted@cmsmadesimple.org>


git-svn-id: http://svn.cmsmadesimple.org/svn/cmsmadesimple/trunk@4459 
3d254a34-79dc-0310-9e5f-be208747d8a0
tedkulp (author)
Sun Apr 27 06:49:35 -0700 2008
commit  933f96dc6ea0ffe68cf5453b3ff0e0c56ba23dc2
tree    90f0e50646314abccbe28c6ec2c55869c87b174d
parent  7f2994736eebb73ec741543b244727f17e888a2b
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0
@@ -1,265 +1 @@
0
-<?php
0
-#CMS - CMS Made Simple
0
-#(c)2004-2008 by Ted Kulp (ted@cmsmadesimple.org)
0
-#This project's homepage is: http://cmsmadesimple.sf.net
0
-#
0
-#This program is free software; you can redistribute it and/or modify
0
-#it under the terms of the GNU General Public License as published by
0
-#the Free Software Foundation; either version 2 of the License, or
0
-#(at your option) any later version.
0
-#
0
-#This program is distributed in the hope that it will be useful,
0
-#but WITHOUT ANY WARRANTY; without even the implied warranty of
0
-#MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
0
-#GNU General Public License for more details.
0
-#You should have received a copy of the GNU General Public License
0
-#along with this program; if not, write to the Free Software
0
-#Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0
-#
0
-#$Id$
0
-
0
-$CMS_ADMIN_PAGE=1;
0
-
0
-// in filetypes.inc.php filetypes are defined
0
-require_once(dirname(dirname(__FILE__))."/lib/filemanager/filetypes.inc.php");
0
-require_once(dirname(dirname(__FILE__))."/lib/file.functions.php");
0
-require_once("../include.php");
0
-
0
-check_login();
0
-
0
-$action_done='';
0
-
0
-function deldir($dir)
0
-{
0
- $handle = opendir($dir);
0
- while (false!==($FolderOrFile = readdir($handle)))
0
- {
0
- if($FolderOrFile != "." && $FolderOrFile != "..")
0
- {
0
- if(@is_dir("$dir/$FolderOrFile"))
0
- {
0
- deldir("$dir/$FolderOrFile");
0
- } // recursive
0
- else
0
- {
0
- unlink("$dir/$FolderOrFile");
0
- }
0
- }
0
- }
0
- closedir($handle);
0
- if(rmdir($dir))
0
- {
0
- $success = true;
0
- }
0
- return $success;
0
-}
0
-
0
-$errors = "";
0
-
0
-$dir = $config["image_uploads_path"];
0
-$url = $config["image_uploads_url"];
0
-
0
-$reldir = "";
0
-
0
-if (!isset($IMConfig['thumbnail_dir'])) $IMConfig['thumbnail_dir'] = '';
0
-if (isset($_POST['reldir'])) $reldir = $_POST['reldir'];
0
-else if (isset($_GET['reldir'])) $reldir = $_GET['reldir'];
0
-
0
-if (strpos($reldir, '..') === false && strpos($reldir, '\\') === false)
0
-{
0
- $dir .= $reldir;
0
-}
0
-
0
-$userid = get_userid();
0
-$access = check_permission($userid, 'Modify Files');
0
-
0
-$username = $gCms->variables["username"];
0
-
0
-#Did we upload a file?
0
-if (isset($_FILES) && isset($_FILES['uploadfile']) && isset($_FILES['uploadfile']['name']) && $_FILES['uploadfile']['name'] != "")
0
-{
0
- if ($access)
0
- {
0
- if (!move_uploaded_file($_FILES['uploadfile']['tmp_name'], $dir."/".$_FILES['uploadfile']['name']))
0
- {
0
- $errors .= "<li>".lang('filenotuploaded')."</li>";
0
- }
0
- else
0
- {
0
- chmod($dir."/".$_FILES['uploadfile']['name'], octdec('0'.$config['default_upload_permission']));
0
- audit(-1, $_FILES['uploadfile']['name'], 'Uploaded File');
0
- }
0
- }
0
- else
0
- {
0
- $errors .= "<li>".lang('needpermissionto', array('Modify Files'))."</li>";
0
- }
0
-}
0
-
0
-#Did we create a new dir?
0
-if (isset($_POST['newdirsubmit']))
0
-{
0
- if ($access)
0
- {
0
- #Make sure it isn't an empty dir name
0
- if ($_POST['newdir'] == "")
0
- {
0
- $errors .= "<li>".lang('filecreatedirnoname')."</li>";
0
- }
0
- else if (ereg('\.\.',$_POST['newdir']))
0
- {
0
- $errors .= "<li>".lang('filecreatedirnodoubledot')."</li>";
0
- }
0
- else if (ereg('/', $_POST['newdir']) || strpos($_POST['newdir'], '\\') !== false)
0
- {
0
- $errors .= "<li>".lang('filecreatedirnoslash')."</li>";
0
- }
0
- else if (file_exists($dir."/".$_POST['newdir']))
0
- {
0
- $errors .= "<li>".lang('directoryexists')."</li>";
0
- }
0
- else
0
- {
0
- mkdir($dir."/".$_POST['newdir'], 0777);
0
- audit(-1, $_POST['newdir'], 'Created Directory');
0
- }
0
- }
0
- else
0
- {
0
- $errors .= "<li>".lang('needpermissionto', array('Modify Files'))."</li>";
0
- }
0
-}
0
-
0
-if (isset($_GET['action']) && $_GET['action'] == "deletefile")
0
-{
0
- if ($access)
0
- {
0
- if (is_file($dir . "/" . $_GET['file']))
0
- {
0
- if (!(unlink($dir . "/" . $_GET['file'])))
0
- {
0
- $errors .= "<li>".lang('errordeletingfile')."</li>";
0
- }
0
- else
0
- {
0
- audit(-1, $reldir . "/" . $_GET['file'], 'Deleted File');
0
- }
0
- }
0
- else
0
- {
0
- $errors .= "<li>".lang('norealfile')."</li>";
0
- }
0
- }
0
- else
0
- {
0
- $errors .= "<li>".lang('needpermissionto', array('Modify Files'))."</li>";
0
- }
0
-}
0
-else if (isset($_GET['action']) && $_GET['action'] == "deletedir")
0
-{
0
- if ($access)
0
- {
0
- if (@is_dir($dir . "/" . $_GET['file']))
0
- {
0
- if (!(deldir($dir . "/" . $_GET['file'])))
0
- {
0
- $errors .= "<li>".lang('errordeletingdirectory')."</li>";
0
- }
0
- else
0
- {
0
- audit(-1, $reldir . "/" . $_GET['file'], 'Deleted Directory');
0
- }
0
- }
0
- else
0
- {
0
- $errors .= "<li>".lang('norealdirectory')."</li>";
0
- }
0
- }
0
- else
0
- {
0
- $errors .= "<li>".lang('needpermissionto', array('Modify Files'))."</li>";
0
- }
0
-}
0
-
0
-include_once("header.php");
0
-?>
0
-
0
-
0
-
0
- <script type="text/javascript" src="../lib/filemanager/ImageManager/assets/dialog.js"></script>
0
- <script type="text/javascript" src="../lib/filemanager/ImageManager/IMEStandalone.js"></script>
0
-<?php echo " <script type=\"text/javascript\" src=\"../lib/filemanager/ImageManager/lang/{$nls['htmlarea'][$current_language]}.js\"></script>\n" ?>
0
- <script type="text/javascript">
0
- //<![CDATA[
0
-
0
- //Create a new Imanager Manager, needs the directory where the manager is
0
- //and which language translation to use.
0
-
0
- var manager = new ImageManager('../lib/filemanager/ImageManager','en');
0
-
0
- var thumbdir = "<?php echo $IMConfig['thumbnail_dir']; ?>";
0
- var base_url = "<?php echo $url; ?>";
0
- //Image Manager wrapper. Simply calls the ImageManager
0
-
0
-
0
- //]]>
0
- </script>
0
-
0
-<script type="text/javascript">
0
-/*<![CDATA[*/
0
-
0
-
0
-
0
-/*]]>*/
0
-</script>
0
-
0
-<?php
0
-
0
-
0
-$row = "row1";
0
-
0
-$dirtext = "";
0
-$filetext = "";
0
-$file = "";
0
-
0
-if ($errors != "")
0
-{
0
- // echo "<div class=\"pageerrorcontainer\"><ul class=\"error\">".$errors."</ul></div>";
0
- echo $themeObject->ShowErrors('<ul class="error">'.$errors.'</ul>');
0
-}
0
-
0
-echo '<div class="pagecontainer">';
0
-echo $themeObject->ShowHeader('imagemanagement');
0
-
0
-?>
0
-<iframe class="imageframe" src="../lib/filemanager/ImageManager/images.php?dir=<?php echo "$reldir" ?>" name="imgManager" title="Image Selection"></iframe>
0
-
0
-<?php
0
-
0
-if ($access)
0
-{
0
-?>
0
-
0
-<form enctype="multipart/form-data" action="imagefiles.php" method="post" name="uploader">
0
- <div class="row">
0
- <label><?php echo lang('uploadfile')?>:</label>
0
- <input type="hidden" name="MAX_FILE_SIZE" value="<?php echo $config["max_upload_size"]?>" />
0
- <input type="hidden" name="reldir" value="<?php echo $reldir?>" />
0
- <input name="uploadfile" type="file" style="margin-right:20px;" /> <input class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" type="submit" value="<?php echo lang('send')?>" />
0
- </div>
0
- <div class="row">
0
- <label><?php echo lang('createnewfolder')?>:</label>
0
- <input type="text" name="newdir" style="margin-right:20px;" /><input class="pagebutton" onmouseover="this.className='pagebuttonhover'" onmouseout="this.className='pagebutton'" type="submit" name="newdirsubmit" value="<?php echo lang('create')?>" />
0
- </div>
0
-</form>
0
-
0
-</div>
0
-
0
-<?php
0
-}
0
-
0
-include_once("footer.php");
0
-
0
-# vim:ts=4 sw=4 noet
0
-?>

Comments

    No one has commented yet.