WordPress Download Manager - Version 2.1.3

Version Description

  • fixed tinymce button and editor issue
Download this release

Release Info

Developer codename065
Plugin Icon 128x128 WordPress Download Manager
Version 2.1.3
Comparing to
See all releases

Version 2.1.3

Files changed (102) hide show
  1. class.db.php +41 -0
  2. class.wpdmpagination.php +409 -0
  3. css/colorbox.css +41 -0
  4. css/front.css +166 -0
  5. css/icons.css +38 -0
  6. css/images/controls.png +0 -0
  7. css/images/loading.gif +0 -0
  8. css/jqueryFileTree.css +91 -0
  9. d16.png +0 -0
  10. d24.png +0 -0
  11. download-manager.php +646 -0
  12. download.php +92 -0
  13. download.png +0 -0
  14. editor_plugin.js +40 -0
  15. file-type-icons/avi.png +0 -0
  16. file-type-icons/doc.png +0 -0
  17. file-type-icons/docx.png +0 -0
  18. file-type-icons/file.png +0 -0
  19. file-type-icons/img.png +0 -0
  20. file-type-icons/mov.png +0 -0
  21. file-type-icons/mp3.png +0 -0
  22. file-type-icons/mp4.png +0 -0
  23. file-type-icons/pps.png +0 -0
  24. file-type-icons/ppt.png +0 -0
  25. file-type-icons/psd.png +0 -0
  26. file-type-icons/rar.png +0 -0
  27. file-type-icons/wav.png +0 -0
  28. file-type-icons/wma.png +0 -0
  29. file-type-icons/zip.png +0 -0
  30. files/.htaccess +5 -0
  31. fm-settings.php +70 -0
  32. functions.php +120 -0
  33. icon/download.png +0 -0
  34. images/Thumbs.db +0 -0
  35. images/add-file.png +0 -0
  36. images/add.png +0 -0
  37. images/application.png +0 -0
  38. images/bg_header.jpg +0 -0
  39. images/browse.png +0 -0
  40. images/bullet1.gif +0 -0
  41. images/bullet2.gif +0 -0
  42. images/category.png +0 -0
  43. images/code.png +0 -0
  44. images/css.png +0 -0
  45. images/db.png +0 -0
  46. images/directory.png +0 -0
  47. images/doc.png +0 -0
  48. images/down.png +0 -0
  49. images/download-16.png +0 -0
  50. images/download-manager-16.png +0 -0
  51. images/download-manager.png +0 -0
  52. images/error.png +0 -0
  53. images/file.png +0 -0
  54. images/film.png +0 -0
  55. images/flash.png +0 -0
  56. images/folder_open.png +0 -0
  57. images/help.png +0 -0
  58. images/help1.png +0 -0
  59. images/html.png +0 -0
  60. images/icons/download.png +0 -0
  61. images/import-files.png +0 -0
  62. images/information-balloon.png +0 -0
  63. images/information.png +0 -0
  64. images/java.png +0 -0
  65. images/linux.png +0 -0
  66. images/loading.gif +0 -0
  67. images/lock.png +0 -0
  68. images/music.png +0 -0
  69. images/pdf.png +0 -0
  70. images/php.png +0 -0
  71. images/picture.png +0 -0
  72. images/play.png +0 -0
  73. images/ppt.png +0 -0
  74. images/psd.png +0 -0
  75. images/remove.png +0 -0
  76. images/ruby.png +0 -0
  77. images/script.png +0 -0
  78. images/settings.png +0 -0
  79. images/spinner.gif +0 -0
  80. images/stats.png +0 -0
  81. images/templates.png +0 -0
  82. images/txt.png +0 -0
  83. images/xls.png +0 -0
  84. images/zip.png +0 -0
  85. img/donwloadmanager.png +0 -0
  86. js/jquery.colorbox-min.js +4 -0
  87. js/jqueryFileTree.js +95 -0
  88. l24.png +0 -0
  89. process.php +265 -0
  90. readme.txt +206 -0
  91. screenshot-1.png +0 -0
  92. screenshot-2.png +0 -0
  93. screenshot-3.png +0 -0
  94. wpdc.ppj +67 -0
  95. wpdc.ppx +1 -0
  96. wpdm-add-new-file.php +307 -0
  97. wpdm-categories.php +125 -0
  98. wpdm-free-mce-button.php +123 -0
  99. wpdm-list-files.php +189 -0
  100. wpdm-server-file-browser.php +71 -0
  101. wpdm-settings.php +70 -0
  102. wpdm-widgets.php +63 -0
class.db.php ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class DMDB{
4
+
5
+
6
+ function AddNew($table, $data){
7
+ mysql_query("insert into $table set ".self::MakeQuery($data));
8
+ }
9
+
10
+ function Update($table, $data, $cond){
11
+ mysql_query("update $table set ".self::MakeQuery($data)." where ".$cond);
12
+ }
13
+
14
+ function Delete($table, $cond){
15
+ $d = mysql_fetch_assoc(mysql_query("select * from $table where $cond"));
16
+ @unlink(UPLOAD_DIR.$d['file']);
17
+ mysql_query("delete from $table where ".$cond);
18
+ }
19
+
20
+ function getById($table, $id){
21
+ return mysql_fetch_assoc(mysql_query("select * from $table where id='$id'"));
22
+ }
23
+
24
+ function getData($table, $where = '', $limit=''){
25
+ $req = mysql_query("select * from $table $where $limit");
26
+ while($r = mysql_fetch_assoc($res)){
27
+ $rows[] = $r;
28
+ }
29
+ return $rows;
30
+ }
31
+
32
+ function MakeQuery($data){
33
+ foreach($data as $k=>$d){
34
+ $qry[] = "`$k`='$d'";
35
+ }
36
+ return implode(",", $qry);
37
+ }
38
+
39
+ }
40
+
41
+ ?>
class.wpdmpagination.php ADDED
@@ -0,0 +1,409 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class wpdmpagination{
4
+
5
+ /*
6
+
7
+ Script Name: *Digg Style Paginator Class
8
+
9
+ Script URI: http://www.mis-algoritmos.com/2007/05/27/digg-style-pagination-class/
10
+
11
+ Description: Class in PHP that allows to use a pagination like a digg or sabrosus style.
12
+
13
+ Script Version: 0.4
14
+
15
+ Author: Victor De la Rocha
16
+
17
+ Author URI: http://www.mis-algoritmos.com
18
+
19
+ */
20
+
21
+ /*Default values*/
22
+
23
+ var $total_pages = -1;//items
24
+
25
+ var $limit = null;
26
+
27
+ var $target = "";
28
+
29
+ var $page = 1;
30
+
31
+ var $adjacents = 2;
32
+
33
+ var $showCounter = false;
34
+
35
+ var $className = "pagination";
36
+
37
+ var $parameterName = "page";
38
+
39
+ var $urlF = false;//urlFriendly
40
+
41
+ var $uriTPL = '';
42
+
43
+
44
+
45
+ /*Buttons next and previous*/
46
+
47
+ var $nextT = "Next";
48
+
49
+ var $nextI = "&#187;"; //&#9658;
50
+
51
+ var $prevT = "Previous";
52
+
53
+ var $prevI = "&#171;"; //&#9668;
54
+
55
+
56
+
57
+ /*****/
58
+
59
+ var $calculate = false;
60
+
61
+
62
+
63
+ #Total items
64
+
65
+ function items($value){$this->total_pages = (int) $value;}
66
+
67
+
68
+
69
+ #how many items to show per page
70
+
71
+ function limit($value){$this->limit = (int) $value;}
72
+
73
+
74
+
75
+ #Page to sent the page value
76
+
77
+ function target($value){$this->target = $value;}
78
+
79
+
80
+
81
+ function urlTemplate($value){$this->uriTPL = $value;}
82
+
83
+
84
+
85
+ #Current page
86
+
87
+ function currentPage($value){$this->page = (int) $value;}
88
+
89
+
90
+
91
+ #How many adjacent pages should be shown on each side of the current page?
92
+
93
+ function adjacents($value){$this->adjacents = (int) $value;}
94
+
95
+
96
+
97
+ #show counter?
98
+
99
+ function showCounter($value=""){$this->showCounter=($value===true)?true:false;}
100
+
101
+
102
+
103
+ #to change the class name of the pagination div
104
+
105
+ function changeClass($value=""){$this->className=$value;}
106
+
107
+
108
+
109
+ function nextLabel($value){$this->nextT = $value;}
110
+
111
+ function nextIcon($value){$this->nextI = $value;}
112
+
113
+ function prevLabel($value){$this->prevT = $value;}
114
+
115
+ function prevIcon($value){$this->prevI = $value;}
116
+
117
+
118
+
119
+ #to change the class name of the pagination div
120
+
121
+ function parameterName($value=""){$this->parameterName=$value;}
122
+
123
+
124
+
125
+ #to change urlFriendly
126
+
127
+ function urlFriendly($value="%"){
128
+
129
+ if(eregi('^ *$',$value)){
130
+
131
+ $this->urlF=false;
132
+
133
+ return false;
134
+
135
+ }
136
+
137
+ $this->urlF=$value;
138
+
139
+ }
140
+
141
+
142
+
143
+ var $pagination;
144
+
145
+
146
+
147
+ function pagination(){}
148
+
149
+ function show(){
150
+
151
+ if(!$this->calculate)
152
+
153
+ if($this->calculate())
154
+
155
+ return "<div class=\"$this->className\">$this->pagination</div>\n";
156
+
157
+ }
158
+
159
+ function get_pagenum_link($id){
160
+
161
+ /*
162
+
163
+ if(strpos($this->target,'?')===false)
164
+
165
+ if($this->urlF)
166
+
167
+ return str_replace($this->urlF,$id,$this->target);
168
+
169
+ else
170
+
171
+ return "$this->target?$this->parameterName=$id";
172
+
173
+ else
174
+
175
+ return "$this->target&$this->parameterName=$id";
176
+
177
+ */
178
+
179
+ return str_replace('[%PAGENO%]',$id,$this->uriTPL);
180
+
181
+ }
182
+
183
+
184
+
185
+ function calculate(){
186
+
187
+ $this->pagination = "";
188
+
189
+ $this->calculate == true;
190
+
191
+ $error = false;
192
+
193
+ if($this->urlF and $this->urlF != '%' and strpos($this->target,$this->urlF)===false){
194
+
195
+ //Es necesario especificar el comodin para sustituir
196
+
197
+ echo "Especificaste un wildcard para sustituir, pero no existe en el target<br />";
198
+
199
+ $error = true;
200
+
201
+ }elseif($this->urlF and $this->urlF == '%' and strpos($this->target,$this->urlF)===false){
202
+
203
+ echo "Es necesario especificar en el target el comodin % para sustituir el n�mero de p�gina<br />";
204
+
205
+ $error = true;
206
+
207
+ }
208
+
209
+
210
+
211
+ if($this->total_pages < 0){
212
+
213
+ echo "It is necessary to specify the <strong>number of pages</strong> (\$class->items(1000))<br />";
214
+
215
+ $error = true;
216
+
217
+ }
218
+
219
+ if($this->limit == null){
220
+
221
+ echo "It is necessary to specify the <strong>limit of items</strong> to show per page (\$class->limit(10))<br />";
222
+
223
+ $error = true;
224
+
225
+ }
226
+
227
+ if($error)return false;
228
+
229
+
230
+
231
+ $n = trim($this->nextT.' '.$this->nextI);
232
+
233
+ $p = trim($this->prevI.' '.$this->prevT);
234
+
235
+
236
+
237
+ /* Setup vars for query. */
238
+
239
+ if($this->page)
240
+
241
+ $start = ($this->page - 1) * $this->limit; //first item to display on this page
242
+
243
+ else
244
+
245
+ $start = 0; //if no page var is given, set start to 0
246
+
247
+
248
+
249
+ /* Setup page vars for display. */
250
+
251
+ $prev = $this->page - 1; //previous page is page - 1
252
+
253
+ $next = $this->page + 1; //next page is page + 1
254
+
255
+ $lastpage = ceil($this->total_pages/$this->limit); //lastpage is = total pages / items per page, rounded up.
256
+
257
+ $lpm1 = $lastpage - 1; //last page minus 1
258
+
259
+
260
+
261
+ /*
262
+
263
+ Now we apply our rules and draw the pagination object.
264
+
265
+ We're actually saving the code to a variable in case we want to draw it more than once.
266
+
267
+ */
268
+
269
+
270
+
271
+ if($lastpage > 1){
272
+
273
+ if($this->page){
274
+
275
+ //anterior button
276
+
277
+ if($this->page > 1)
278
+
279
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($prev)."\" class=\"prev\" rel='Com'>$p</a>";
280
+
281
+ else
282
+
283
+ $this->pagination .= "<span class=\"disabled\">$p</span>";
284
+
285
+ }
286
+
287
+ //pages
288
+
289
+ if ($lastpage < 7 + ($this->adjacents * 2)){//not enough pages to bother breaking it up
290
+
291
+ for ($counter = 1; $counter <= $lastpage; $counter++){
292
+
293
+ if ($counter == $this->page)
294
+
295
+ $this->pagination .= "<span class=\"current\">$counter</span>";
296
+
297
+ else
298
+
299
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\" rel='Com'>$counter</a>";
300
+
301
+ }
302
+
303
+ }
304
+
305
+ elseif($lastpage > 5 + ($this->adjacents * 2)){//enough pages to hide some
306
+
307
+ //close to beginning; only hide later pages
308
+
309
+ if($this->page < 1 + ($this->adjacents * 2)){
310
+
311
+ for ($counter = 1; $counter < 4 + ($this->adjacents * 2); $counter++){
312
+
313
+ if ($counter == $this->page)
314
+
315
+ $this->pagination .= "<span class=\"current\">$counter</span>";
316
+
317
+ else
318
+
319
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\" rel='Com'>$counter</a>";
320
+
321
+ }
322
+
323
+ $this->pagination .= "...";
324
+
325
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\" rel='Com'>$lpm1</a>";
326
+
327
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\" rel='Com'>$lastpage</a>";
328
+
329
+ }
330
+
331
+ //in middle; hide some front and some back
332
+
333
+ elseif($lastpage - ($this->adjacents * 2) > $this->page && $this->page > ($this->adjacents * 2)){
334
+
335
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\" rel='Com'>1</a>";
336
+
337
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\" rel='Com'>2</a>";
338
+
339
+ $this->pagination .= "...";
340
+
341
+ for ($counter = $this->page - $this->adjacents; $counter <= $this->page + $this->adjacents; $counter++)
342
+
343
+ if ($counter == $this->page)
344
+
345
+ $this->pagination .= "<span class=\"current\">$counter</span>";
346
+
347
+ else
348
+
349
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\" rel='Com'>$counter</a>";
350
+
351
+ $this->pagination .= "...";
352
+
353
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lpm1)."\" rel='Com'>$lpm1</a>";
354
+
355
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($lastpage)."\" rel='Com'>$lastpage</a>";
356
+
357
+ }
358
+
359
+ //close to end; only hide early pages
360
+
361
+ else{
362
+
363
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(1)."\" rel='Com'>1</a>";
364
+
365
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link(2)."\" rel='Com'>2</a>";
366
+
367
+ $this->pagination .= "...";
368
+
369
+ for ($counter = $lastpage - (2 + ($this->adjacents * 2)); $counter <= $lastpage; $counter++)
370
+
371
+ if ($counter == $this->page)
372
+
373
+ $this->pagination .= "<span class=\"current\">$counter</span>";
374
+
375
+ else
376
+
377
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($counter)."\" rel='Com'>$counter</a>";
378
+
379
+ }
380
+
381
+ }
382
+
383
+ if($this->page){
384
+
385
+ //siguiente button
386
+
387
+ if ($this->page < $counter - 1)
388
+
389
+ $this->pagination .= "<a href=\"".$this->get_pagenum_link($next)."\" class=\"next\" rel='Com'>$n</a>";
390
+
391
+ else
392
+
393
+ $this->pagination .= "<span class=\"disabled\">$n</span>";
394
+
395
+ if($this->showCounter)$this->pagination .= "<div class=\"pagination_data\">($this->total_pages Pages)</div>";
396
+
397
+ }
398
+
399
+ }
400
+
401
+
402
+
403
+ return true;
404
+
405
+ }
406
+
407
+ }
408
+
409
+ ?>
css/colorbox.css ADDED
@@ -0,0 +1,41 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ /*
2
+ ColorBox Core Style:
3
+ The following CSS is consistent between example themes and should not be altered.
4
+ */
5
+ #colorbox, #cboxOverlay, #cboxWrapper{position:absolute; top:0; left:0; z-index:9999; overflow:hidden;}
6
+ #cboxOverlay{position:fixed; width:100%; height:100%;}
7
+ #cboxMiddleLeft, #cboxBottomLeft{clear:left;}
8
+ #cboxContent{position:relative;}
9
+ #cboxLoadedContent{overflow:auto;}
10
+ #cboxTitle{margin:0;}
11
+ #cboxLoadingOverlay, #cboxLoadingGraphic{position:absolute; top:0; left:0; width:100%;}
12
+ #cboxPrevious, #cboxNext, #cboxClose, #cboxSlideshow{cursor:pointer;}
13
+ .cboxPhoto{float:left; margin:auto; border:0; display:block;}
14
+ .cboxIframe{width:100%; height:100%; display:block; border:0;}
15
+
16
+ /*
17
+ User Style:
18
+ Change the following styles to modify the appearance of ColorBox. They are
19
+ ordered & tabbed in a way that represents the nesting of the generated HTML.
20
+ */
21
+ #cboxOverlay{background:#fff;}
22
+ #colorbox{}
23
+ #cboxContent{margin-top:32px; overflow:visible;}
24
+ #cboxError{padding:50px; border:1px solid #ccc;}
25
+ #cboxLoadedContent{background:#000; padding:1px;}
26
+ #cboxLoadingGraphic{background:url(images/loading.gif) no-repeat center center;}
27
+ #cboxLoadingOverlay{background:#000;}
28
+ #cboxTitle{position:absolute; top:-22px; left:0; color:#000;}
29
+ #cboxCurrent{position:absolute; top:-22px; right:205px; text-indent:-9999px;}
30
+ #cboxSlideshow, #cboxPrevious, #cboxNext, #cboxClose{text-indent:-9999px; width:20px; height:20px; position:absolute; top:-20px; background:url(images/controls.png) no-repeat 0 0;}
31
+ #cboxPrevious{background-position:0px 0px; right:44px;}
32
+ #cboxPrevious.hover{background-position:0px -25px;}
33
+ #cboxNext{background-position:-25px 0px; right:22px;}
34
+ #cboxNext.hover{background-position:-25px -25px;}
35
+ #cboxClose{background-position:-50px 0px; right:0;}
36
+ #cboxClose.hover{background-position:-50px -25px;}
37
+ .cboxSlideshow_on #cboxPrevious, .cboxSlideshow_off #cboxPrevious{right:66px;}
38
+ .cboxSlideshow_on #cboxSlideshow{background-position:-75px -25px; right:44px;}
39
+ .cboxSlideshow_on #cboxSlideshow.hover{background-position:-100px -25px;}
40
+ .cboxSlideshow_off #cboxSlideshow{background-position:-100px 0px; right:44px;}
41
+ .cboxSlideshow_off #cboxSlideshow.hover{background-position:-75px -25px;}
css/front.css ADDED
@@ -0,0 +1,166 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .download_link{
2
+
3
+ padding:10px 20px;
4
+ background: #6db3f2; /* old browsers */
5
+
6
+ background: -moz-linear-gradient(top, #6db3f2 0%, #1e69de 100%); /* firefox */
7
+
8
+ background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#6db3f2), color-stop(100%,#1e69de)); /* webkit */
9
+
10
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#6db3f2', endColorstr='#1e69de',GradientType=0 ); /* ie */
11
+ float: left;
12
+ -webkit-border-radius: 7px;
13
+ -moz-border-radius: 7px;
14
+ border-radius: 7px;
15
+ -moz-box-shadow: 0 0 5px #888;
16
+ -webkit-box-shadow: 0 0 5px#888;
17
+ box-shadow: 0 0 5px #888;
18
+ font-size:10pt;
19
+ font-family: Tahoma;
20
+ letter-spacing: 1px;
21
+ text-transform: uppercase;
22
+
23
+ }
24
+ .download_link a{
25
+ color: #FFF;
26
+ font-weight: bold;
27
+ }
28
+ .download_link input{
29
+ border:1px solid #7BBA60;
30
+ padding:4px;
31
+ font-size:10pt;
32
+ font-family: Tahoma;
33
+ letter-spacing: 1px;
34
+ }
35
+
36
+ .wpdm_submit{
37
+ background: #777 url('../images/play.png') 4px center no-repeat;
38
+ color: #FFF;
39
+ padding-left: 20px !important;
40
+ }
41
+ .wpdm_submit_wait{
42
+ background: #777 url('../images/loading.gif') 4px center no-repeat;
43
+ color: #FFF;
44
+ padding-left: 20px !important;
45
+ }
46
+ #wpdm_submit_error{
47
+ background: #FFF4F4;
48
+ border:1px solid #990000;
49
+ padding:10px;
50
+ float: left;
51
+ margin-top:10px;
52
+ display: none;
53
+ }
54
+
55
+ .wpdm_package{
56
+ float: left;
57
+ margin: 5px;
58
+ border:1px solid #ccc;
59
+ padding:5px;
60
+ text-align: center;
61
+ }
62
+ .download_link input{
63
+ margin:0px !important;
64
+ }
65
+
66
+ .myorder th{font-weight:bold;text-align: left;font-size:10pt;}
67
+ .myorder tr.items td{text-align: left;font-size:9pt;}
68
+ .myorder tr.item td{font-size: 8pt;}
69
+
70
+ .wpdm_category .thumb{
71
+
72
+ -moz-box-shadow: 0 0 5px #888;
73
+ -webkit-box-shadow: 0 0 5px#888;
74
+ box-shadow: 0 0 5px #888;
75
+
76
+ }
77
+ .wpdm_category .thumb{
78
+ float:left;
79
+ margin-right:25px;
80
+ }
81
+ .wpdm_category .desc{
82
+ float:left;
83
+ line-height: 1.5;
84
+ width: 70%;
85
+ }
86
+ .middle{
87
+ font-family:Tahoma;
88
+ font-size:10pt;
89
+ letter-spacing: 1px;
90
+ line-height: 1.5;
91
+ }
92
+ .middle .det{padding:15px;}
93
+
94
+
95
+ {
96
+ width: 700px;
97
+ padding: 0;
98
+ margin: 0;
99
+ }
100
+
101
+ #mytable caption {
102
+ padding: 0 0 5px 0;
103
+ width: 700px;
104
+ font: italic 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
105
+ text-align: right;
106
+ }
107
+
108
+ #mytable th {
109
+ font: bold 11px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
110
+ color: #4f6b72;
111
+ border-right: 1px solid #C1DAD7;
112
+ border-bottom: 1px solid #C1DAD7;
113
+ border-top: 1px solid #C1DAD7;
114
+ letter-spacing: 2px;
115
+ text-transform: uppercase;
116
+ text-align: left;
117
+ padding: 6px 6px 6px 12px;
118
+ background: #CAE8EA url(../images/bg_header.jpg) no-repeat;
119
+ }
120
+
121
+ #mytable th.nobg {
122
+ border-top: 0;
123
+ border-left: 0;
124
+ border-right: 1px solid #C1DAD7;
125
+ background: none;
126
+ }
127
+
128
+ #mytable td {
129
+ border-right: 1px solid #C1DAD7;
130
+ border-bottom: 1px solid #C1DAD7;
131
+ background: #fff;
132
+ padding: 6px 6px 6px 12px;
133
+ color: #4f6b72;
134
+ margin:0px !important;
135
+ }
136
+
137
+
138
+ #mytable tr.order td {
139
+ background: #F5FAFA;
140
+ color: #797268;
141
+ }
142
+
143
+ #mytable th.spec {
144
+ border-left: 1px solid #C1DAD7;
145
+ border-top: 0;
146
+ background: #fff url(../images/bullet1.gif) no-repeat;
147
+ font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
148
+ }
149
+
150
+ #mytable th.specalt {
151
+ border-left: 1px solid #C1DAD7;
152
+ border-top: 0;
153
+ background: #f5fafa url(../images/bullet2.gif) no-repeat;
154
+ font: bold 10px "Trebuchet MS", Verdana, Arial, Helvetica, sans-serif;
155
+ color: #797268;
156
+ }
157
+
158
+ .wpdm-filelist{
159
+ list-style:none;
160
+ }
161
+
162
+ .ind-download{
163
+ position:inline-block;
164
+ background: url(../images/download-16.png) left center no-repeat;
165
+ padding-left:20px;
166
+ }
css/icons.css ADDED
@@ -0,0 +1,38 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+ #icon-file-manager{
3
+ background: url('../images/download-manager.png') center center no-repeat;
4
+ }
5
+
6
+ #icon-add-new-file{
7
+ background: url('../images/add-file.png') center center no-repeat;
8
+ }
9
+ #icon-error{
10
+ background: url('../images/error.png') center center no-repeat;
11
+ }
12
+ #icon-import-file{
13
+ background: url('../images/import-files.png') center center no-repeat;
14
+ }
15
+ #icon-categories{
16
+ background: url('../images/category.png') center center no-repeat;
17
+ }
18
+ #icon-template{
19
+ background: url('../images/templates.png') center center no-repeat;
20
+ }
21
+ #icon-settings{
22
+ background: url('../images/settings.png') center center no-repeat;
23
+ }
24
+ #icon-stats{
25
+ background: url('../images/stats.png') center center no-repeat;
26
+ }
27
+
28
+ .infoicon{
29
+ background: url('../images/help1.png') center center no-repeat;
30
+ text-indent: -999999;
31
+ display: inline-block;
32
+ color:transparent;
33
+ width:16px;
34
+ height:16px;
35
+ border:0px !important;
36
+ }
37
+
38
+
css/images/controls.png ADDED
Binary file
css/images/loading.gif ADDED
Binary file
css/jqueryFileTree.css ADDED
@@ -0,0 +1,91 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ UL.jqueryFileTree {
2
+ font-family: Verdana, sans-serif;
3
+ font-size: 11px;
4
+ line-height: 18px;
5
+ padding: 0px;
6
+ margin: 0px;
7
+ }
8
+
9
+ UL.jqueryFileTree LI {
10
+ list-style: none;
11
+ padding: 0px;
12
+ padding-left: 20px;
13
+ margin: 0px;
14
+ white-space: nowrap;
15
+ }
16
+
17
+ UL.jqueryFileTree A {
18
+ color: #333;
19
+ text-decoration: none;
20
+ display: block;
21
+ padding: 0px 2px;
22
+ }
23
+
24
+ UL.jqueryFileTree A:hover {
25
+ background: #BDF;
26
+ }
27
+
28
+ /* Core Styles */
29
+ .jqueryFileTree LI.directory { background: url(../images/directory.png) left top no-repeat; }
30
+ .jqueryFileTree LI.expanded { background: url(../images/folder_open.png) left top no-repeat; }
31
+ .jqueryFileTree LI.file { background: url(../images/file.png) left top no-repeat; }
32
+ .jqueryFileTree LI.wait { background: url(../images/spinner.gif) left top no-repeat; }
33
+ /* File Extensions*/
34
+ .jqueryFileTree LI.ext_3gp { background: url(../images/film.png) left top no-repeat; }
35
+ .jqueryFileTree LI.ext_afp { background: url(../images/code.png) left top no-repeat; }
36
+ .jqueryFileTree LI.ext_afpa { background: url(../images/code.png) left top no-repeat; }
37
+ .jqueryFileTree LI.ext_asp { background: url(../images/code.png) left top no-repeat; }
38
+ .jqueryFileTree LI.ext_aspx { background: url(../images/code.png) left top no-repeat; }
39
+ .jqueryFileTree LI.ext_avi { background: url(../images/film.png) left top no-repeat; }
40
+ .jqueryFileTree LI.ext_bat { background: url(../images/application.png) left top no-repeat; }
41
+ .jqueryFileTree LI.ext_bmp { background: url(../images/picture.png) left top no-repeat; }
42
+ .jqueryFileTree LI.ext_c { background: url(../images/code.png) left top no-repeat; }
43
+ .jqueryFileTree LI.ext_cfm { background: url(../images/code.png) left top no-repeat; }
44
+ .jqueryFileTree LI.ext_cgi { background: url(../images/code.png) left top no-repeat; }
45
+ .jqueryFileTree LI.ext_com { background: url(../images/application.png) left top no-repeat; }
46
+ .jqueryFileTree LI.ext_cpp { background: url(../images/code.png) left top no-repeat; }
47
+ .jqueryFileTree LI.ext_css { background: url(../images/css.png) left top no-repeat; }
48
+ .jqueryFileTree LI.ext_doc { background: url(../images/doc.png) left top no-repeat; }
49
+ .jqueryFileTree LI.ext_exe { background: url(../images/application.png) left top no-repeat; }
50
+ .jqueryFileTree LI.ext_gif { background: url(../images/picture.png) left top no-repeat; }
51
+ .jqueryFileTree LI.ext_fla { background: url(../images/flash.png) left top no-repeat; }
52
+ .jqueryFileTree LI.ext_h { background: url(../images/code.png) left top no-repeat; }
53
+ .jqueryFileTree LI.ext_htm { background: url(../images/html.png) left top no-repeat; }
54
+ .jqueryFileTree LI.ext_html { background: url(../images/html.png) left top no-repeat; }
55
+ .jqueryFileTree LI.ext_jar { background: url(../images/java.png) left top no-repeat; }
56
+ .jqueryFileTree LI.ext_jpg { background: url(../images/picture.png) left top no-repeat; }
57
+ .jqueryFileTree LI.ext_jpeg { background: url(../images/picture.png) left top no-repeat; }
58
+ .jqueryFileTree LI.ext_js { background: url(../images/script.png) left top no-repeat; }
59
+ .jqueryFileTree LI.ext_lasso { background: url(../images/code.png) left top no-repeat; }
60
+ .jqueryFileTree LI.ext_log { background: url(../images/txt.png) left top no-repeat; }
61
+ .jqueryFileTree LI.ext_m4p { background: url(../images/music.png) left top no-repeat; }
62
+ .jqueryFileTree LI.ext_mov { background: url(../images/film.png) left top no-repeat; }
63
+ .jqueryFileTree LI.ext_mp3 { background: url(../images/music.png) left top no-repeat; }
64
+ .jqueryFileTree LI.ext_mp4 { background: url(../images/film.png) left top no-repeat; }
65
+ .jqueryFileTree LI.ext_mpg { background: url(../images/film.png) left top no-repeat; }
66
+ .jqueryFileTree LI.ext_mpeg { background: url(../images/film.png) left top no-repeat; }
67
+ .jqueryFileTree LI.ext_ogg { background: url(../images/music.png) left top no-repeat; }
68
+ .jqueryFileTree LI.ext_pcx { background: url(../images/picture.png) left top no-repeat; }
69
+ .jqueryFileTree LI.ext_pdf { background: url(../images/pdf.png) left top no-repeat; }
70
+ .jqueryFileTree LI.ext_php { background: url(../images/php.png) left top no-repeat; }
71
+ .jqueryFileTree LI.ext_png { background: url(../images/picture.png) left top no-repeat; }
72
+ .jqueryFileTree LI.ext_ppt { background: url(../images/ppt.png) left top no-repeat; }
73
+ .jqueryFileTree LI.ext_psd { background: url(../images/psd.png) left top no-repeat; }
74
+ .jqueryFileTree LI.ext_pl { background: url(../images/script.png) left top no-repeat; }
75
+ .jqueryFileTree LI.ext_py { background: url(../images/script.png) left top no-repeat; }
76
+ .jqueryFileTree LI.ext_rb { background: url(../images/ruby.png) left top no-repeat; }
77
+ .jqueryFileTree LI.ext_rbx { background: url(../images/ruby.png) left top no-repeat; }
78
+ .jqueryFileTree LI.ext_rhtml { background: url(../images/ruby.png) left top no-repeat; }
79
+ .jqueryFileTree LI.ext_rpm { background: url(../images/linux.png) left top no-repeat; }
80
+ .jqueryFileTree LI.ext_ruby { background: url(../images/ruby.png) left top no-repeat; }
81
+ .jqueryFileTree LI.ext_sql { background: url(../images/db.png) left top no-repeat; }
82
+ .jqueryFileTree LI.ext_swf { background: url(../images/flash.png) left top no-repeat; }
83
+ .jqueryFileTree LI.ext_tif { background: url(../images/picture.png) left top no-repeat; }
84
+ .jqueryFileTree LI.ext_tiff { background: url(../images/picture.png) left top no-repeat; }
85
+ .jqueryFileTree LI.ext_txt { background: url(../images/txt.png) left top no-repeat; }
86
+ .jqueryFileTree LI.ext_vb { background: url(../images/code.png) left top no-repeat; }
87
+ .jqueryFileTree LI.ext_wav { background: url(../images/music.png) left top no-repeat; }
88
+ .jqueryFileTree LI.ext_wmv { background: url(../images/film.png) left top no-repeat; }
89
+ .jqueryFileTree LI.ext_xls { background: url(../images/xls.png) left top no-repeat; }
90
+ .jqueryFileTree LI.ext_xml { background: url(../images/code.png) left top no-repeat; }
91
+ .jqueryFileTree LI.ext_zip { background: url(../images/zip.png) left top no-repeat; }
d16.png ADDED
Binary file
d24.png ADDED
Binary file
download-manager.php ADDED
@@ -0,0 +1,646 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * @package Download Manager
4
+ * @author Shaon
5
+ * @version 2.1.3
6
+ */
7
+ /*
8
+ Plugin Name: Download Manager
9
+ Plugin URI: http://www.wpdownloadmanager.com/
10
+ Description: Manage, track and controll file download from your wordpress site
11
+ Author: Shaon
12
+ Version: 2.1.3
13
+ Author URI: http://www.wpdownloadmanager.com/
14
+ */
15
+
16
+ $d = str_replace('\\','/',dirname(__FILE__));
17
+ $d = explode("/", $d);
18
+ array_pop($d);
19
+ array_pop($d);
20
+ $d = implode('/', $d);
21
+
22
+ define('UPLOAD_DIR',$d.'/uploads/download-manager-files/');
23
+ define('UPLOAD_BASE',$d.'/uploads/');
24
+
25
+ function wpdm_process(){
26
+ if($_GET['wpdmact']=='process')
27
+ include("process.php");
28
+ }
29
+
30
+ include("functions.php");
31
+ include("class.wpdmpagination.php");
32
+ include("wpdm-server-file-browser.php");
33
+
34
+ if(!$_POST) $_SESSION['download'] = 0;
35
+
36
+ function wpdm_download_info(){
37
+ include("download.php");
38
+ }
39
+
40
+ function wpdm_free_install(){
41
+ global $wpdb;
42
+
43
+ $sql = "CREATE TABLE IF NOT EXISTS `ahm_files` (
44
+ `id` int(11) NOT NULL AUTO_INCREMENT,
45
+ `title` varchar(255) NOT NULL,
46
+ `description` text NOT NULL,
47
+ `category` text NOT NULL,
48
+ `file` varchar(255) NOT NULL,
49
+ `password` varchar(40) NOT NULL,
50
+ `download_count` int(11) NOT NULL,
51
+ `access` enum('guest','member') CHARACTER SET utf8 COLLATE utf8_unicode_ci NOT NULL,
52
+ `show_counter` tinyint(1) NOT NULL,
53
+ `quota` INT NOT NULL,
54
+ `link_label` varchar(255) NOT NULL,
55
+ PRIMARY KEY (`id`)
56
+ ) ENGINE=MyISAM DEFAULT CHARSET=utf8";
57
+
58
+ require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
59
+
60
+ $wpdb->query($sql);
61
+ //$wpdb->query("ALTER TABLE `ahm_files` ADD `` varchar(255) NOT NULL");
62
+ $wpdb->query("ALTER TABLE `ahm_files` ADD `link_label` varchar(255) NOT NULL");
63
+ $wpdb->query("ALTER TABLE `ahm_files` ADD `show_counter` tinyint(1) NOT NULL");
64
+ $wpdb->query("ALTER TABLE `ahm_files` ADD `download_count` INT NOT NULL");
65
+ $wpdb->query("ALTER TABLE `ahm_files` ADD `quota` INT NOT NULL");
66
+ $wpdb->query("ALTER TABLE `ahm_files` ADD `category` TEXT NOT NULL");
67
+
68
+ update_option('wpdm_access_level','administrator');
69
+ wpdm_create_dir();
70
+
71
+ }
72
+
73
+ function wpdm_new_packages($show=5, $show_count=true){
74
+ global $wpdb;
75
+
76
+ $data = $wpdb->get_results("select * from ahm_files order by id desc limit 0, $show",ARRAY_A);
77
+ foreach($data as $d){
78
+
79
+ $key = $d['id'];
80
+ if($show_count) $sc = "<br/><i>$d[download_count] downloads</i>";
81
+ $url = home_url("/?download={$d[id]}");
82
+ echo "<li><a class='wpdm-popup' rel='colorbox' title='$d[title]' href='$url'>{$d[title]}</a> $sc</li>\r\n";
83
+ }
84
+ }
85
+
86
+ function wpdm_import_download_monitor(){
87
+ global $wpdb;
88
+ $data = $wpdb->get_results("select * from {$wpdb->prefix}download_monitor_files");
89
+ if($data){
90
+ foreach($data as $d){
91
+ $tdata = $wpdb->get_results("select t.name from {$wpdb->prefix}download_monitor_taxonomies t,{$wpdb->prefix}download_monitor_relationships r where t.taxonomy='category' and t.id=r.taxonomy_id and r.download_id={$d->id}");
92
+ $ct = array();
93
+ foreach($tdata as $c){
94
+ $ctu = strtolower(preg_replace("/([^a-zA-Z0-9\-]+)/","-", $c->name));
95
+ $ct[] = $ctu;
96
+ $allc["$ctu"] = array('title'=>$c->name);
97
+ }
98
+ $wpdm = array(
99
+ 'title'=>$d->title,
100
+ 'description'=>$d->file_description,
101
+ 'file'=>$d->filename,
102
+ 'password'=>'',
103
+ 'download_count'=>$d->hits,
104
+ 'access'=> ($d->member?'member':'guest'),
105
+ 'show_counter'=>'1',
106
+ 'quota'=>0,
107
+ 'category' => serialize($ct),
108
+ 'link_label'=>'Download'
109
+ );
110
+ $wpdb->insert('ahm_files', $wpdm);
111
+ }
112
+ $tpldata = maybe_unserialize(get_option('_fm_categories'));
113
+ if(!$tpldata) $tpldata = array();
114
+ $tpldata = $tpldata + $allc;
115
+ update_option('_fm_categories',@serialize($tpldata));
116
+ }
117
+ echo "
118
+ <script>
119
+ location.href='admin.php?page=file-manager';
120
+ </script>
121
+ ";
122
+ die();
123
+
124
+
125
+ }
126
+
127
+
128
+
129
+ function wpdm_downloadable($content){
130
+ global $wpdb;
131
+
132
+ preg_match_all("/\{filelink\=([^\}]+)\}/", $content, $matches);
133
+
134
+ $home = home_url('/');
135
+
136
+ $sap = count($_GET)>0?'&':'?';
137
+ for($i=0;$i<count($matches[1]);$i++){
138
+ $id = $matches[1][$i];
139
+ $data = $wpdb->get_row("select * from ahm_files where id='$id'",ARRAY_A);
140
+ $wpdm_login_msg = get_option('wpdm_login_msg')?get_option('wpdm_login_msg'):'Login Required';
141
+ $link_label = $data['link_label']?$data['link_label']:'Download';
142
+ if($data['access']=='member'&&!is_user_logged_in())
143
+ $matches[1][$i] = "<a href='".get_option('siteurl')."/wp-login.php?redirect_to=".$_SERVER['REQUEST_URI']."' style=\"background:url('".get_option('siteurl')."/wp-content/plugins/download-manager/l24.png') no-repeat;padding:3px 12px 12px 28px;font:bold 10pt verdana;\">".$wpdm_login_msg."</a>";
144
+ else {
145
+ if($data['password']=='') { $url = home_url('/?wpdmact=process&did='.base64_encode($id.'.hotlink')); $classrel = ""; }
146
+ else { $url = home_url('/?download='.$id); $classrel = " class='wpdm-popup' rel='colorbox' "; }
147
+ $matches[1][$i] = "<a $classrel title='{$data[title]}' href='$url' style=\"background:url('".get_option('siteurl')."/wp-content/plugins/download-manager/icon/download.png') no-repeat;padding:3px 12px 12px 28px;font:bold 10pt verdana;\">$link_label</a>";
148
+ if($data['show_counter']!=0)
149
+ $matches[1][$i] .= "<br><small style='margin-left:30px;'>Downloaded $data[download_count] times</small>";
150
+ }
151
+ }
152
+
153
+ preg_match_all("/\{wpdm_category\=([^\}]+)\}/", $content, $cmatches);
154
+ for($i=0;$i<count($cmatches[1]);$i++){
155
+ $cmatches[1][$i] = wpdm_embed_category($cmatches[1][$i]);
156
+ }
157
+ $content = str_replace($cmatches[0],$cmatches[1], $content);
158
+ return str_replace($matches[0],$matches[1], $content);
159
+
160
+ }
161
+
162
+ function wpdm_cblist_categories($parent="", $level = 0, $sel = array()){
163
+ $cats = maybe_unserialize(get_option('_fm_categories'));
164
+ if(is_array($cats)){
165
+ if($parent!='') echo "<ul>";
166
+ foreach($cats as $id=>$cat){
167
+ $pres = str_repeat("&mdash;", $level);
168
+ if($cat['parent']==$parent){
169
+ if(in_array($id,$sel))
170
+ $checked = 'checked=checked';
171
+ else
172
+ $checked = '';
173
+ echo "<li><input type='checkbox' name='file[category][]' value='$id' $checked /> $cat[title]</li>\n";
174
+ wpdm_cblist_categories($id,$level+1, $sel);}
175
+ }
176
+ if($parent!='') echo "</ul>";
177
+ }
178
+ }
179
+
180
+ function wpdm_dropdown_categories($parent="", $level = 0, $sel='',$cid='',$class=array()){
181
+ $cats = maybe_unserialize(get_option('_fm_categories'));
182
+ if(!is_array($cats)) $cats = array();
183
+ foreach($cats as $id=>$cat){
184
+ $pres = str_repeat("&mdash;", $level);
185
+ array_push($class,$parent);
186
+ if($parent=='') $class = array();
187
+ $class = array_unique($class);
188
+ $cssclass = implode(" ",$class);
189
+ if($cat['parent']==$parent){
190
+ if($sel==$id)
191
+ echo "<option class='level_{$level} $id $cssclass' selected=selected value='$id'>{$pres} $cat[title]</option>\n";
192
+ else
193
+ echo "<option class='level_{$level} $id $cssclass' value='$id'>{$pres} $cat[title]</option>\n";
194
+ wpdm_dropdown_categories($id,$level+1, $sel, $cid, $class);}
195
+ }
196
+
197
+ }
198
+
199
+ function wpdm_admin_options(){
200
+
201
+ if(!file_exists(UPLOAD_DIR)&&$_GET[task]!='wpdm_create_dir'){
202
+
203
+ echo "
204
+ <div id=\"warning\" class=\"error fade\"><p>
205
+ Automatic dir creation failed! [ <a href='admin.php?page=file-manager&task=CreateDir&re=1'>Try again to create dir automatically</a> ]<br><br>
206
+ Please create dir <strong>" . UPLOAD_DIR . "</strong> manualy and set permision to <strong>777</strong><br><br>
207
+ Otherwise you will not be able to upload files.</p></div>";
208
+ }
209
+
210
+ if($_GET[success]==1){
211
+ echo "
212
+ <div id=\"message\" class=\"updated fade\"><p>
213
+ Congratulation! Plugin is ready to use now.
214
+ </div>
215
+ ";
216
+ }
217
+
218
+
219
+ if(!file_exists(UPLOAD_DIR.'.htaccess'))
220
+ setHtaccess();
221
+
222
+ if($_GET[task]!='')
223
+ return call_user_func($_GET['task']);
224
+ else
225
+ include('wpdm-list-files.php');
226
+ }
227
+
228
+ function wpdm_delete_file(){
229
+ global $wpdb;
230
+ if(is_array($_GET[id])){
231
+ foreach($_GET[id] as $id){
232
+ $qry[] = "id='".(int)$id."'";
233
+ }
234
+ $cond = implode(" and ", $qry);
235
+ } else
236
+ $cond = "id='".(int)$_GET[id]."'";
237
+ $wpdb->query("delete from ahm_files where ". $cond);
238
+ echo "<script>
239
+ location.href='admin.php?page=file-manager';
240
+ </script>";
241
+ die();
242
+ }
243
+
244
+ function wpdm_create_dir(){
245
+ if(!file_exists(UPLOAD_BASE)){
246
+ @mkdir(UPLOAD_BASE,0777);
247
+ }
248
+ @chmod(UPLOAD_BASE,0777);
249
+ @mkdir(UPLOAD_DIR,0777);
250
+ @chmod(UPLOAD_DIR,0777);
251
+ @chmod(dir(__FILE__).'/cache/',0777);
252
+ wpdm_set_htaccess();
253
+ if($_GET[re]==1) {
254
+ if(file_exists(UPLOAD_DIR)) $s=1;
255
+ else $s = 0;
256
+ echo "<script>
257
+ location.href='{$_SERVER[HTTP_REFERER]}&success={$s}';
258
+ </script>";
259
+ die();
260
+ }
261
+ }
262
+
263
+ function wpdm_settings(){
264
+ if($_POST){
265
+ update_option('wpdm_access_level',$_POST[access]);
266
+ update_option('wpdm_login_msg',$_POST[wpdm_login_msg]);
267
+ }
268
+ if(is_uploaded_file($_FILES['icon']['tmp_name'])){
269
+ ///print_r(dirname(__FILE__).'/icon/download.png');
270
+ move_uploaded_file($_FILES['icon']['tmp_name'],dirname(__FILE__).'/icon/download.png');
271
+ }
272
+ $access = get_option('wpdm_access_level');
273
+ include('wpdm-settings.php');
274
+ }
275
+
276
+ function wpdm_add_new_file(){
277
+ global $wpdb;
278
+ if(!file_exists(UPLOAD_DIR)){
279
+
280
+ echo "
281
+ <div id=\"warning\" class=\"error fade\"><p>
282
+ Automatic dir creation failed! [ <a href='admin.php?page=file-manager&task=wpdm_create_dir&re=1'>Try again to create dir automatically</a> ]<br><br>
283
+ Please create dir <strong>" . UPLOAD_DIR . "</strong> manualy and set permision to <strong>777</strong><br><br>
284
+ Otherwise you will not be able to upload files.
285
+ </p></div>";
286
+ }
287
+
288
+ if($_GET[success]==1){
289
+ echo "
290
+ <div id=\"message\" class=\"updated fade\"><p>
291
+ Congratulation! Plugin is ready to use now.
292
+ </div>
293
+ ";
294
+ }
295
+
296
+ if($_POST){
297
+ extract($_POST);
298
+ if(is_uploaded_file($_FILES['media']['tmp_name'])){
299
+ $info = pathinfo($_FILES['media']['name']);
300
+ //echo dirname(__FILE__).'/files/'.$_FILES['media']['name'];
301
+
302
+ $name = file_exists(dirname(__FILE__).'/files/'.$_FILES['media']['name'])?str_replace('.'.$info['extension'],'_'.uniqid().'.'.$info['extension'],$info['basename']):$_FILES['media']['name'];
303
+ move_uploaded_file($_FILES['media']['tmp_name'], UPLOAD_DIR . $name);
304
+ $file['file'] = $name;
305
+
306
+ }
307
+
308
+ $file['show_counter'] = 0;
309
+ $file['category'] = serialize($file['category']);
310
+ $wpdb->insert("ahm_files", $file);
311
+ if(!$wpdb->insert_id){
312