1 | <?php |
---|
2 | # ***** BEGIN LICENSE BLOCK ***** |
---|
3 | # |
---|
4 | # This file is part of DL Manager. |
---|
5 | # Copyright 2008,2010 Moe (http://gniark.net/) and Tomtom (http://blog.zenstyle.fr) |
---|
6 | # |
---|
7 | # DL Manager is free software; you can redistribute it and/or modify |
---|
8 | # it under the terms of the GNU General Public License as published by |
---|
9 | # the Free Software Foundation; either version 3 of the License, or |
---|
10 | # (at your option) any later version. |
---|
11 | # |
---|
12 | # DL Manager is distributed in the hope that it will be useful, |
---|
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | # GNU General Public License for more details. |
---|
16 | # |
---|
17 | # You should have received a copy of the GNU General Public License |
---|
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | # |
---|
20 | # Images are from Silk Icons : http://www.famfamfam.com/lab/icons/silk/ |
---|
21 | # |
---|
22 | # ***** END LICENSE BLOCK ***** |
---|
23 | |
---|
24 | if (!defined('DC_CONTEXT_ADMIN')) { return; } |
---|
25 | |
---|
26 | $page_title = __('Download Manager'); |
---|
27 | |
---|
28 | $settings =& $core->blog->settings; |
---|
29 | |
---|
30 | try |
---|
31 | { |
---|
32 | if (!empty($_POST['saveconfig'])) |
---|
33 | { |
---|
34 | $settings->addNameSpace('dlManager'); |
---|
35 | $settings->dlManager->put('dlmanager_active',!empty($_POST['dlmanager_active']), |
---|
36 | 'boolean','Enable DL Manager'); |
---|
37 | $settings->dlManager->put('dlmanager_hide_urls',!empty($_POST['dlmanager_hide_urls']), |
---|
38 | 'boolean','Hide files URLs'); |
---|
39 | $settings->dlManager->put('dlmanager_counter',!empty($_POST['dlmanager_counter']), |
---|
40 | 'boolean','Enable download counter'); |
---|
41 | $settings->dlManager->put('dlmanager_attachment_url',!empty($_POST['dlmanager_attachment_url']), |
---|
42 | 'boolean','Redirect attachments links to DL Manager'); |
---|
43 | |
---|
44 | if ((isset($_POST['dlmanager_nb_per_page'])) |
---|
45 | && (abs((integer) $_POST['dlmanager_nb_per_page']) > 0)) |
---|
46 | { |
---|
47 | $nb_per_page = abs((integer) $_POST['dlmanager_nb_per_page']); |
---|
48 | } |
---|
49 | else |
---|
50 | { |
---|
51 | $nb_per_page = 20; |
---|
52 | } |
---|
53 | $settings->dlManager->put('dlmanager_nb_per_page',$nb_per_page, |
---|
54 | 'integer','Files per page'); |
---|
55 | $settings->dlManager->put('dlmanager_enable_sort',!empty($_POST['dlmanager_enable_sort']), |
---|
56 | 'boolean','Allow visitors to choose how to sort files'); |
---|
57 | $settings->dlManager->put('dlmanager_file_sort', |
---|
58 | (!empty($_POST['dlmanager_file_sort']) ? $_POST['dlmanager_file_sort'] : ''), |
---|
59 | 'string','file sort'); |
---|
60 | $settings->dlManager->put('dlmanager_root', |
---|
61 | (!empty($_POST['dlmanager_root']) ? $_POST['dlmanager_root'] : ''), |
---|
62 | 'string', 'root directory'); |
---|
63 | |
---|
64 | # empty the cache |
---|
65 | $core->blog->triggerBlog(); |
---|
66 | |
---|
67 | http::redirect($p_url.'&saveconfig=1'); |
---|
68 | } |
---|
69 | } |
---|
70 | catch (Exception $e) |
---|
71 | { |
---|
72 | $core->error->add($e->getMessage()); |
---|
73 | } |
---|
74 | |
---|
75 | if (isset($_GET['saveconfig'])) |
---|
76 | { |
---|
77 | $msg = __('Configuration successfully updated.'); |
---|
78 | } |
---|
79 | |
---|
80 | ?> |
---|
81 | <html> |
---|
82 | <head> |
---|
83 | <title><?php echo $page_title; ?></title> |
---|
84 | </head> |
---|
85 | <body> |
---|
86 | <?php |
---|
87 | echo dcPage::breadcrumb( |
---|
88 | array( |
---|
89 | html::escapeHTML($core->blog->name) => '', |
---|
90 | '<span class="page-title">'.$page_title.'</span>' => '' |
---|
91 | )); |
---|
92 | if (!empty($msg)) { |
---|
93 | dcPage::success($msg); |
---|
94 | } |
---|
95 | ?> |
---|
96 | <form method="post" action="<?php echo http::getSelfURI(); ?>"> |
---|
97 | <div class="fieldset"> |
---|
98 | |
---|
99 | <?php |
---|
100 | if ($core->blog->settings->dlManager->dlmanager_active) { |
---|
101 | echo '<p><a class="onblog_link outgoing" href="'.$core->blog->url.$core->url->getBase('media').'" title="'.__('View the Download Manager public page').'">'.__('View the Download Manager public page').' <img src="images/outgoing-blue.png" alt="" /></a></p>'; |
---|
102 | } |
---|
103 | ?> |
---|
104 | <h4><?php echo __('Plugin activation'); ?></h4> |
---|
105 | <p> |
---|
106 | <?php echo form::checkbox('dlmanager_active',1, |
---|
107 | $core->blog->settings->dlManager->dlmanager_active); ?> |
---|
108 | <label class="classic" for="dlmanager_active"> |
---|
109 | <?php printf(__('Enable the %s'),__('Download manager')); ?> |
---|
110 | </label> |
---|
111 | </p> |
---|
112 | <p class="form-note"> |
---|
113 | <?php printf(__('The %s display media on a public page.'), |
---|
114 | __('Download manager')); ?> |
---|
115 | </p> |
---|
116 | </div> |
---|
117 | <div class="fieldset"> |
---|
118 | <h4><?php echo __('Advanced options'); ?></h4> |
---|
119 | <p> |
---|
120 | <?php echo form::checkbox('dlmanager_hide_urls',1, |
---|
121 | $core->blog->settings->dlManager->dlmanager_hide_urls); ?> |
---|
122 | <label class="classic" for="dlmanager_hide_urls"> |
---|
123 | <?php echo __('Hide URLs of images, mp3, flv, mp4 and m4v files'); ?> |
---|
124 | </label> |
---|
125 | </p> |
---|
126 | <p class="form-note"> |
---|
127 | <?php printf(__('The images, mp3, flv, mp4 and m4v files will be served without revealing their URLs in %1$s and %2$s tags.'), |
---|
128 | '<code>'.'<img />'.'</code>','<code>'.'<object></object>'.'</code>'); |
---|
129 | echo ' '; |
---|
130 | printf(__('The public directory (or its subdirectories) can be in a restricted area or protected by a %1$s file containing %2$s.'), |
---|
131 | '<strong>.htaccess</strong>','<strong>Deny from all</strong>'); ?> |
---|
132 | </p> |
---|
133 | <p> |
---|
134 | <?php echo form::checkbox('dlmanager_counter',1, |
---|
135 | $core->blog->settings->dlManager->dlmanager_counter); ?> |
---|
136 | <label class="classic" for="dlmanager_counter"> |
---|
137 | <?php echo __('Enable the download counter'); ?> |
---|
138 | </label> |
---|
139 | </p> |
---|
140 | <p> |
---|
141 | <?php echo form::checkbox('dlmanager_attachment_url',1, |
---|
142 | $core->blog->settings->dlManager->dlmanager_attachment_url); ?> |
---|
143 | <label class="classic" for="dlmanager_attachment_url"> |
---|
144 | <?php printf(__('Redirect attachments links to %s'), |
---|
145 | __('Download manager')); ?> |
---|
146 | </label> |
---|
147 | </p> |
---|
148 | <p class="form-note"> |
---|
149 | <?php echo __('When downloading an attachment, the download counter will be increased.'); |
---|
150 | echo ' '; |
---|
151 | printf(__('This will redefine the %s tag.'), |
---|
152 | '<strong>{{tpl:AttachmentURL}}</strong>'); |
---|
153 | echo ' '; |
---|
154 | printf(__('The attachments must be located in the root of %s'), |
---|
155 | __('Download manager')); |
---|
156 | ?> |
---|
157 | </p> |
---|
158 | <p> |
---|
159 | <label class="classic" for="dlmanager_nb_per_page"> |
---|
160 | <?php echo __('Files per page:'); ?> |
---|
161 | </label> |
---|
162 | <?php echo form::field('dlmanager_nb_per_page',7,7, |
---|
163 | (($core->blog->settings->dlManager->dlmanager_nb_per_page) |
---|
164 | ? $core->blog->settings->dlManager->dlmanager_nb_per_page : 20)); ?> |
---|
165 | </p> |
---|
166 | <p> |
---|
167 | <?php echo form::checkbox('dlmanager_enable_sort',1, |
---|
168 | $core->blog->settings->dlManager->dlmanager_enable_sort); ?> |
---|
169 | <label class="classic" for="dlmanager_enable_sort"> |
---|
170 | <?php echo __('Allow visitors to choose how to sort files'); ?> |
---|
171 | </label> |
---|
172 | </p> |
---|
173 | <p> |
---|
174 | <label for="dlmanager_file_sort"> |
---|
175 | <?php echo __('Sort files:'). |
---|
176 | form::combo('dlmanager_file_sort',dlManager::getSortValues(true), |
---|
177 | $core->blog->settings->dlManager->dlmanager_file_sort); ?> |
---|
178 | </label> |
---|
179 | </p> |
---|
180 | <p class="form-note"> |
---|
181 | <?php echo __('Leave blank to disable this feature.'); ?> |
---|
182 | </p> |
---|
183 | <p> |
---|
184 | <label for="dlmanager_root"> |
---|
185 | <?php printf(__('Define root of %s:'),__('Download manager')); |
---|
186 | echo form::combo('dlmanager_root',dlManager::listDirs(false,true), |
---|
187 | $core->blog->settings->dlManager->dlmanager_root); ?> |
---|
188 | </label> |
---|
189 | </p> |
---|
190 | <p class="form-note"> |
---|
191 | <?php echo __('Leave blank to disable this feature.').' '; |
---|
192 | printf(__('This will change the root of the %s page and of the widget.'), |
---|
193 | __('Download manager')); |
---|
194 | echo ' '; |
---|
195 | printf(__('If you change this setting, reconfigure the %s widget.'), |
---|
196 | __('Download manager')); ?> |
---|
197 | </p> |
---|
198 | <p> |
---|
199 | <!-- filemanager->$exclude_list is protected --> |
---|
200 | <?php printf( |
---|
201 | __('Files can be excluded from %1$s by editing %2$s in %3$s.'), |
---|
202 | __('Download manager'),'<strong>media_exclusion</strong>','<strong>about:config (system)</strong>'); |
---|
203 | echo ' '; |
---|
204 | printf(__('For example, to exclude %1$s and %2$s files: %3$s'), |
---|
205 | 'PNG','JPG','<code>/\.(png|jpg)/i</code>'); ?> |
---|
206 | </p> |
---|
207 | <p> |
---|
208 | <?php printf(__('URL of the %s page:'),__('Download manager')); ?> |
---|
209 | <br /> |
---|
210 | <code><?php echo dlManager::pageURL(); ?></code> |
---|
211 | </p> |
---|
212 | </div> |
---|
213 | |
---|
214 | <p><?php echo $core->formNonce(); ?></p> |
---|
215 | <p><input type="submit" name="saveconfig" value="<?php echo __('Save configuration'); ?>" /></p> |
---|
216 | </form> |
---|
217 | |
---|
218 | <?php dcPage::helpBlock('dlManager');?> |
---|
219 | |
---|
220 | </body> |
---|
221 | </html> |
---|